Configuring DateTimeAxis question

Oystein Bjorke 6 years ago 0
This discussion was imported from CodePlex

DShawNitec wrote at 2012-06-27 18:12:

I have been using the DateTimeAxis for some dynamically created plots. But I have yet to figure out what combination of options I need to get an axis the way the users want.

I'm using the following now:

hAxisDate.Minimum = OxyPlot.DateTimeAxis.ToDouble(minDate);
hAxisDate.Maximum = OxyPlot.DateTimeAxis.ToDouble(maxDate);
hAxisDate.IntervalType = DateTimeIntervalType.Years;
hAxisDate.MajorTickSize = 10;
hAxisDate.MinorIntervalType = DateTimeIntervalType.Months;
hAxisDate.ShowMinorTicks = true;
hAxisDate.MinorStep = 1;
hAxisDate.MinorTickSize = 5;
With minDate of 6/22/2013 and maxDate of 1/1/2017 I only get MajorTicks and Dates.
the dates are 2015,2017,2019,2021,2023,2025,2027 no MajorTick's in between or dates. 
Also no month ticks.
Users would like to see major ticks at each year, date every other or whatever would show without overlap.
Along with month ticks if they would not get to crowded.

objo wrote at 2012-06-28 06:48:

(use HTML edit mode to get rid of too many <pre> tags in the posts)

I think the DateTimeAxis implementation needs some refactoring, but I have not figured out how to solve this yet. It should be possible to use the 'automatic' mode and get 'nice' tick values. It should also be possible to zoom in/out and see it change from years, to dates and finally to time, automatically...

The issue is already in the issue tracker, 6 votes so far!

The actual source code for this issue is in DateTimeAxis.CalculateActualInterval. this is the best place to look to figure out how to current code works...