dateTime axis with intervalType minute - CanvasJS
dateTime axis with intervalType minute - CanvasJS
by canvasjs
HTML
<script src="https://www.canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 400px; width: 100%;"></div>
JavaScript
var chart = new CanvasJS.Chart("chartContainer",
{
title:{
text: "Temperature Change"
},
axisX:{
interval: 30,
intervalType: "minute",
valueFormatString: "hh:mm TT",
},
data: [
{
type: "line",
dataPoints: [
{ x: new Date(2012, 01, 1, 12, 00), y: 31},
{ x: new Date(2012, 01, 1, 12, 30), y: 32},
{ x: new Date(2012, 01, 1, 13, 00), y: 43},
{ x: new Date(2012, 01, 1, 13, 30), y: 32},
{ x: new Date(2012, 01, 1, 14, 00), y: 28},
{ x: new Date(2012, 01, 1, 14, 30), y: 23},
{ x: new Date(2012, 01, 1, 15, 00), y: 33},
{ x: new Date(2012, 01, 1, 15, 30), y: 32},
]
}
]
});
chart.render();