Ich zeichne einen ScatterPlot, der die Daten des letzten Monats mit OxyPlot anzeigt. Aber die X-Achsenbeschriftungen überlappen sich. Die X-Achse ist eine Datumszeitachse.Oxyplot: Verhindern, dass X-Achsen-Label überlappt
Hier ist die Funktion, die ich verwende X-Achse zu erhalten.
DateTimeAxis GetXAxis()
{
var axis = new DateTimeAxis {
Position = AxisPosition.Bottom,
MinorIntervalType = DateTimeIntervalType.Days,
MinorTickSize = 0,
MajorTickSize = 0,
MajorGridlineStyle = LineStyle.None,
MinorGridlineStyle = LineStyle.None,
FontSize = 8,
TextColor = OxyColor.Parse (ColorHex.DarkGray),
Maximum = DateTimeAxis.ToDouble (DateTime.Now),
MajorStep = 1,
};
if (type == Constants.QUESTION_ANSWER_TYPE_WEEK) {
axis.Minimum = DateTimeAxis.ToDouble (DateTime.Now.AddDays (-7));
axis.StringFormat = "ddd";
} else if (type == Constants.QUESTION_ANSWER_TYPE_MONTH) {
axis.Minimum = DateTimeAxis.ToDouble (DateTime.Now.AddDays (-30));
axis.StringFormat = "MMM dd";
} else {
axis.StringFormat = "MMM dd";
}
return axis;
}
Wie kann ich verhindern, dass sie sich überschneiden? Muss ich Etiketten manuell überspringen? oder gibt es eine Einstellung in oxyplot, die das automatisch macht? Ist es außerdem möglich, die Beschriftungen beim Ein- und Auszoomen automatisch anzupassen?