Search code examples
c#zedgraph

ZedGraph - I am looking for an example of using a DateTime


I am looking for an example of using a datetime field on a zedgraph linechart X-Axis.

Edit - And how do I set the XAxis max scale

myPane.XAxis.Type = AxisType.Date;
myPane.XAxis.Scale.Min = 0;
myPane.XAxis.Scale.Max = 12;

Solution

  • You will have to convert the DateTime variables to XDate structs. You can create a method like this:

    public XDate ConvertDateToXdate(DateTime date)
    {
      return new XDate(date.ToOADate);
    }
    

    Here is an example of a chart using the XDate structs