You must be logged in to post your query.
Home › Forums › Chart Support › Time axis with valueFormatString not working
Tagged: time axis
Hi I want to render a time axis chart,
var chart = new CanvasJS.Chart("rssi",{ exportEnabled: true, zoomEnabled: true, title:{ text:"RSSI signal / Date time" }, axisX: { intervalType: "hour", valueFormatString: "YYYY-MM-DD HH:mm:ss", labelMaxWidth: 100, // change label width accordingly }, axisY: { title: "Downloads" }, data: [{ type: "area", name:" RSSI value", showInLegend: true, xValueType: "dateTime", markerType: "square", color: "#F08080", dataPoints : dataPoint }] }); chart.render();
Here is my datapoints:
0: Object { x: Date 2018-01-07T20:51:41.000Z, y: -67 } 1: Object { x: Date 2018-01-07T20:51:05.000Z, y: -6 } 2: Object { x: Date 2018-01-07T20:51:05.000Z, y: -21 } 3: Object { x: Date 2018-01-07T20:51:05.000Z, y: -29 } 4: Object { x: Date 2018-01-07T20:51:06.000Z, y: -44 }
https://screenshots.firefox.com/2QL0FQlVN0walVDx/null
@ahmedcharef,
Passing the Date to dataPoints in the standard JavaScript DateTime format new Date("2018-01-07T20:51:05.000Z") will work fine in your case. Please take a look at this jsfiddle.
new Date("2018-01-07T20:51:05.000Z")
___________ Indranil Deo, Team CanvasJS
You must be logged in to reply to this topic. Login/Register