Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

zedgraph

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;
like image 856
Brad Avatar asked Feb 04 '09 18:02

Brad


1 Answers

Having had the same problem recently, I discovered that the above answer isn't actually correct. The sample code simple casts an XDate() to a double.

However, the sample does highlight what you need to do. I still use DateTime.ToOADate(), but with the addition of the following code, I get to see times (in HH:MM:SS format):

pane.XAxis.Type = AxisType.Date;
pane.XAxis.Scale.MajorUnit = DateUnit.Hour;
pane.XAxis.Scale.Format = "T";
like image 119
cmroanirgo Avatar answered Oct 21 '22 15:10

cmroanirgo