x-values corresponding to dataPoints - CanvasJS
x-values corresponding to dataPoints - CanvasJS
by canvasjs
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer1" style="height: 500px; width: 100%; margin-left:auto; margin-right:auto;"></div>
JavaScript
var chart_1= new CanvasJS.Chart("chartContainer1", {
title:{
text: "x-values corresponding to dataPoints"
},
axisX:{
labelWrap: false,
labelMaxWidth: 180,
labelAngle: -60
},
data: [
{
type: "line",
dataPoints: [
{ label: new Date(1415016180000), y : 2.0 },
{ label: new Date(1420093800000), y : 1.0 },
{ label: new Date(1420790940000), y : 1.0 },
{ label: new Date(1420877280000), y : 2.0 },
{ label: new Date(1421815440000), y : 1.0 },
{ label: new Date(1421818740000), y : 2.0 }
]
},
{
type: "line",
dataPoints: [
{ label: new Date(1415016180000) , y : 120.0 },
{ label: new Date(1420093800000) , y : 142.0 },
{ label: new Date(1420790940000) , y : 300.0 },
{ label: new Date(1420877280000) , y : 100.0 },
{ label: new Date(1421815440000) , y : 120.0 },
{ label: new Date(1421818740000) , y : 142.0 }
]
}
]
});
chart_1.render();