I'm plotting a ScatterPlot showing the last one month's data using OxyPlot. But the X axis labels are overlapping. X axis is a date time axis.
Here's the function that I use to get X Axis.
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;
}
How can I prevent them from overlapping? Do I need manually skip labels? or is there a setting in oxyplot which automatically does this? Also, Is it possible to adjust the labels automatically when zooming in and out?