Skip to main content Skip to footer

How to format X axis to display time as seconds

When you have date-time type data with interval difference in seconds than you can set Axis' Major unit property as follows:

//sets the difference between the X-axis labels to 4 seconds
flexchart.AxisX.MajorUnit = initDate.AddSeconds(4).ToOADate() - initDate.ToOADate(); 

In addition to this if you want to set the labels to 'mm/dd/yyyy hh:mm:ss am/pm' format, you can set Axis' Format property as shown below:

flexchart.AxisX.Format = "MM/dd/yyyy HH:mm:ss tt";