Search code examples
canvasjs

CanvasJS force order of x-axis


I have a canvasjs-line-chart, which is filled automatically by PHP (http://jsfiddle.net/9geLc/3). What I want is the following:

23:00 (11pm) - yValue

0:00 (12pm) - yValue

1:00 (1am) - yValue

But canvasjs sorts like this(although I give the x & y values in the right order):

0:00

1:00

23:00

That makes sense (because 11 pm is after 1am). But 23:00 is from the first day and 0:00 and 1:00 from the second day. So 0:00 and 1:00 have to appear (in the chart) after 23:00. Are there any methods to force the order? Or to set the auto-order to off (maybe auto-order: false or something else)?

Thanks for advice, Max


Solution

  • Assign the values (23:00 0:00 & 1:00) along with their date and it should automatically work fine. What you are probably doing is setting these hours to the same date