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 Calculatedvar chart = new CanvasJS.Chart("container", { . . data: [{ xValueType: "dateTime", }, ] . . }); chart.render();
8 Comments
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.
You need to use labels in that case…
How to hide labels? Thank you.
ant,
You can do so by setting valueFormatString to a single space. Please refer this example.
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?
This behaviour is not possible as of now. But we will provide a way to do this from next version.
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
You can set axisX (interval and) intervalType as second, or for more specific format use valueFormatString