0

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.

Haedrian
  • 4,240
  • 2
  • 32
  • 53
Thomas Mann
  • 99
  • 3
  • 19

2 Answers2

0

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

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

bretddog
  • 5,411
  • 11
  • 63
  • 111
  • Hi,but i dont have HH mm or ss. My scaling is in mucroseconds from 0 to 0.3072s How to define this? Thx – Thomas Mann Aug 28 '13 at 08:12
  • I think it uses the same format as DateTime.ToString(), so it can show milliseconds; `"HH:mm:ss.fff"`, for you then `"ff"` or `"fff"` is probably ok. This of course assumes your X value is in fact a DateTime. If you need the 4th digit I think you need to handle it manually in the `OnXScaleFormatEvent`. – bretddog Aug 28 '13 at 08:43
0

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

SanVEE
  • 2,009
  • 5
  • 34
  • 55