Reputation: 83
I am working with line chart using ZedGraph and C# in Visual Studio 2010. The values are coming from serial port. The date and time are entering the X axis, but each interval the number of seconds to change and it seems that this weak and lacking harmony. How to solve this?
Upvotes: 2
Views: 4604
Reputation: 41
Maybe try using:
myPane.XAxis.Type = AxisType.Date;
myPane.XAxis.Scale.Format = "HH:mm";
myPane.XAxis.Scale.MajorStepAuto = false;
myPane.XAxis.Scale.MinorStepAuto = false;
myPane.XAxis.Scale.MajorUnit = DateUnit.Minute;
myPane.XAxis.Scale.MinorUnit = DateUnit.Minute;
myPane.XAxis.Scale.MinorStep = minor;
myPane.XAxis.Scale.MajorStep = major;
myPane.XAxis.Scale.Min = Min;
myPane.XAxis.Scale.Max = Max;
myPane.XAxis.Scale.MaxAuto = false;
myPane.XAxis.Scale.MinAuto = false;
myPane.YAxis.Scale.Min = min_rr;
myPane.YAxis.Scale.Max = max_rr;
For MinorStep
and MajorStep
you must use some value like 3, 5, 30 etc.
For Max
and Min
use eg:
XDate Min = new XDate(1999, 1, 1, 0, 0, 0, 0);
XDate Max = new XDate(1999, 1, 1, 0, 30, 0, 0);
In Changing axis type in ZedGraph you have example with DateAsOrdinal X Axis.
I hope it helps. Cheers.
Upvotes: 3