xValueType: String

This defines the data type of x values. Data Type is normally figured out by default based on the object type that is assigned to x. But if you are providing time stamp (which is integer) values instead of Date objects, you’ll have to explicitly set the xValueType to “dateTime”.


Default: Automatically Calculated
Options: “number”, “dateTime”

Notes

var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
 data: [{
   xValueType: "dateTime",

  },
 ]
 .
 .
});
chart.render();


Try it Yourself by Editing the Code below.



If you have any questions, please feel free to ask in our forums.Ask Question

Comments 8

  1. How do I make the xValueType a string? For example, I am trying to refer to academic school years such as 11-12 and 12-13, but the chart keeps trying to do subtractions for each year. I want the string “11-12” to show up as the first x data point. Thanks.

  2. I want to show my axis in HH:MM format and zooming the same it should show HH:mm:ss format.how I could do this. Kindly advice asap?

  3. This behaviour is not possible as of now. But we will provide a way to do this from next version.

  4. how can i use time instead of years?
    i need to show time like 07:11:35 07:11:37 on X-axis.
    Please help

If you have any questions, please feel free to ask in our forums. Ask Question