开发者

Line Chart with date and time on X axis

开发者 https://www.devze.com 2023-04-12 14:56 出处:网络
I am working with line chart using ZedGraph and C# in Visual Studio 2010. The values ​​are coming from serial port.

I am working with line chart using ZedGraph and C# in Visual Studio 2010. The values ​​are coming from serial port. T开发者_Python百科he 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?

This video shows the problem.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号