X axis time limited to 5 minutes
X axis time limited to 5 minutes
by canvasjs
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<br/><!-- Just so that JSFiddle's Result label doesn't overlap the Chart -->
<div id="chartContainer" style="height: 360px; width: 100%;"></div>
JavaScript
var chart = new CanvasJS.Chart("chartContainer",
{
title:{
text: "Chart With Date-Time Stamps Inputs"
},
axisX:{
labelAngle: -70,
},
data: [
{
type: "area",
xValueType: "dateTime",
dataPoints: [
{ x: 1449043020000, y : 65 },
{ x: 1449043080000, y : 95 },
{ x: 1449043140000, y : 68 },
{ x: 1449043200000, y : 28 },
{ x: 1449043260000, y : 34 },
{ x: 1449043320000, y : 14 },
{ x: 1449043380000, y : 34 },
{ x: 1449043440000, y : 44 },
{ x: 1449043500000, y : 84 },
{ x: 1449043560000, y : 4 },
{ x: 1449043620000, y : 44 },
{ x: 1449043680000, y : 11 }
]
}
]
});
chart.options.axisX.viewportMaximum = chart.options.data[0].dataPoints[ chart.options.data[0].dataPoints.length - 1].x;
chart.options.axisX.viewportMinimum = chart.options.axisX.viewportMaximum - (5 * 60 * 1000);
chart.render();