简体   繁体   English

ZedGraph:如何在X轴(而非日期)中添加时间(微秒)

[英]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. 目前,我的图形仅在x轴上显示索引,而在y轴上显示电流。 Now I added additional parameters (NumberOfPoints =1024, TimeImtervall = 0.0003s) to the graph-function. 现在,我向图形函数添加了其他参数(NumberOfPoints = 1024,TimeImtervall = 0.0003s)。

What I finally want is that the x-axis show time-values and not the index. 我最后想要的是x轴显示时间值而不是索引。

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. 它与“ XAxis.Type”和“ XAxis.Scale.Format”有关,但是我还没有发现如何做到这一点。

If you want date/time I think you need to use XAxis.Type Date or DateAsOrdinal . 如果您想要日期/时间,我想您需要使用XAxis.Type DateDateAsOrdinal In this case XAxis.Scale.Format should work, eg set to "HH:mm". 在这种情况下, XAxis.Scale.Format应该可以工作,例如,设置为“ HH:mm”。

http://zedgraph.sourceforge.net/documentation/default.html 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. 您需要放大才能看到图中的millimicro秒。

Edit:

Customize the zedgraph scale format 自定义zedgraph比例尺格式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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