
DateTimeAxis minimum value incorrect?
Denisio wrote at 2011-04-19 08:26:
I'm open SilverlightDemo project and modify filling:
var tmp = new PlotModel("Test"); tmp.Axes.Add(new LinearAxis(AxisPosition.Left) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, TickStyle = TickStyle.Outside}); DateTime dt = new DateTime(2010, 1, 1); tmp.Axes.Add(new DateTimeAxis(dt, dt.AddDays(1), AxisPosition.Bottom, null, null, DateTimeIntervalType.Hours) { MajorGridlineStyle = LineStyle.Solid, Angle = 90, StringFormat = "HH:mm", MajorStep = 0.041666/2, // 1/24 = 1 hour, 1/24/2 = 30 minutes IsZoomEnabled = true, MaximumPadding = 0, MinimumPadding = 0, TickStyle = TickStyle.None }); var ls = new LineSeries("Line1") {DataFieldX = "X", DataFieldY = "Y" }; List<Item> ii = new List<Item>(); for (int i = 0; i < 24; i++) ii.Add(new Item() {X = dt.AddHours(i), Y = i*i}); ls.ItemsSource = ii; tmp.Series.Add(ls); tmp.PlotMargins = new OxyThickness(40, 0, 0, 40); plot1.Model = tmp;
As you see, series contain 24 points, one point per each hour:
But, how I can set minimum value to 00:00 and points 00:30, 01:00, 01:30 and so on?
I playing with some Minimum / ActualMinimum and other properties of DateTimeAxis axis, but I can't found solution for my task.
objo wrote at 2011-04-19 10:58:
hi Denisio, your 'step' size is inaccurate - replace with "MajorStep = 1.0/24/2" and it should work.
I see the AxisBase.CreateTickValues might need some improvements to handle floating point precision issues better.
Also note that the DateTimeAxis and TimeSpanAxis are not quite finished yet, I will do some refactoring soon.
Denisio wrote at 2011-04-19 11:11:
Excellent! Thank you very much!
Customer support service by UserEcho