简体   繁体   中英

ZedGraph: How to add time (usecs) in X-Axis (not date)

Currently my graph only shows the index in the x-axis and current in y-axis. Now I added additional parameters (NumberOfPoints =1024, TimeImtervall = 0.0003s) to the graph-function.

What I finally want is that the x-axis show time-values and not the index.

But I the only examples I found where how to add a date.

It has something to do with the "XAxis.Type" and "XAxis.Scale.Format" but I haven't found out how to do this.

If you want date/time I think you need to use XAxis.Type Date or DateAsOrdinal . In this case XAxis.Scale.Format should work, eg set to "HH:mm".

http://zedgraph.sourceforge.net/documentation/default.html

Try this:

private void Form1_Load(object sender, EventArgs e)
    {
        GraphPane myPane = zedGraphControl1.GraphPane;

        myPane.XAxis.Title.Text = "Time(sec)";

        myPane.XAxis.Scale.Format ="f4";
        myPane.XAxis.Type = AxisType.Linear;

        myPane.XAxis.Scale.Min = 0;
        myPane.XAxis.Scale.Max = 0.3072;

        myPane.AxisChange();

        zedGraphControl1.Invalidate();
    }

You need to zoom in to see the graph in milli & micro seconds.

Edit:

Customize the zedgraph scale format

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM