Basic line chart with dateTime values - CanvasJS
Basic line chart with dateTime values - CanvasJS
by canvasjs
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 300px; width: 100%; margin-left:auto; margin-right:auto;"></div>
JavaScript
var chart = new CanvasJS.Chart("chartContainer", {
title:{
text: "Basic line chart with dateTime values"
},
data: [
{
type: "line",
xValueType: "dateTime",
dataPoints: [
{ x: Date.parse("2/1/2015 10:00:05"), y: 90 },
{ x: Date.parse("2/1/2015 20:09:10"), y: 92 },
{ x: Date.parse("2/1/2015 20:20:35"), y: 90 },
{ x: Date.parse("2/3/2015 03:34:50"), y: 67 }
]
}
]
});
chart.render();