You must be logged in to post your query.
Home › Forums › Report Bugs › DateTime is shown incorrect when year rolls over
Tagged: incorrect date on plot
I have asked his question on stackoverflow with graphs. Basically I am plotting data from Dec 12, 2018 to Jan 11, 2019. It looks in the following format
dataPoints.push({ x: new Date(2018,12,13,06,09,38), y: 384 }); dataPoints.push({ x: new Date(2018,12,13,06,12,46), y: 386 }); dataPoints.push({ x: new Date(2018,12,13,06,15,53), y: 379 }); dataPoints.push({ x: new Date(2018,12,13,06,19,02), y: 377 }); …. …. dataPoints.push({ x: new Date(2019,01,11,17,11,12), y: 632 }); dataPoints.push({ x: new Date(2019,01,11,17,13,35), y: 616 }); dataPoints.push({ x: new Date(2019,01,11,17,15,49), y: 614 });
As you can see, dates on y-axis are completely wrong (off by a month).
Is this a bug. What am I doing wrong
var options = { zoomEnabled: true, animationEnabled: true, title: { text: selectedText }, axisX:{ title: “Timeline”, gridThickness: 1
}, axisY: { title: “KVA”, includeZero: false, lineThickness: 1 }, data: [{ type: “column”, dataPoints:dataPoints }] // random data };
My mistake, I had to subtract 1 from month, which I didn’t. Now fixed.
@hammad1001,
Glad you figured it out :)
— Vishwas R Team CanvasJS
You must be logged in to reply to this topic. Login/Register