dateTime axis with intervalType hour - CanvasJS
dateTime axis with intervalType hour - 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: 1,
intervalType: "hour",
valueFormatString: "hh:mm TT",
},
data: [
{
type: "line",
dataPoints: [
{ x: new Date(2012, 01, 1, 12, 00), y: 31},
{ x: new Date(2012, 01, 1, 13, 00), y: 32},
{ x: new Date(2012, 01, 1, 14, 00), y: 33},
{ x: new Date(2012, 01, 1, 15, 00), y: 34},
{ x: new Date(2012, 01, 1, 16, 00), y: 34},
{ x: new Date(2012, 01, 1, 17, 00), y: 34},
{ x: new Date(2012, 01, 1, 18, 00), y: 33},
{ x: new Date(2012, 01, 1, 19, 00), y: 32},
{ x: new Date(2012, 01, 1, 20, 00), y: 29}
]
}
]
});
chart.render();