Basic HTML5 Chart Example - CanvasJS
Basic HTML5 Chart Example
HTML
<script src="http://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 360px; width: 100%;"></div>
JavaScript
var data = [
{
"type": "line",
"xValueType": "dateTime",
"name": "pmPagS1Received",
"showInLegend": true,
"markerSize": 5,
xValueFormatString: "DD: MMM HH:mm:ss",
"dataPoints": [
{
"x": 1408320000000,
"y": 6933666
},
{
"x": 1408406400000,
"y": 7253286
},
{
"x": 1408492800000,
"y": 7521119
}
]
}
];
var chart = new CanvasJS.Chart("chartContainer" ,
{
animationEnabled: false,
title:{
//text: "teste",
fontSize: 14,
fontFamily: "verdana",
},
toolTip: {
shared: true, //disable here.
},
axisX:{
//valueFormatString: "DD-MMM" ,
valueFormatString: "DD-MMM" ,
labelAngle: -45,
labelFontSize: 12,
interval: 1,
intervalType: "day",
},
axisY:{
labelFontSize: 12,
titleFontFamily: "verdana",
titleFontSize: 14,
titleFontWeight: "lighter",
includeZero: false,
},
axisY2:{
labelFontSize: 12,
titleFontFamily: "verdana",
titleFontSize: 14,
titleFontWeight: "lighter",
gridThickness : 0,
tickLength : 0,
includeZero: false,
},
legend:{
fontFamily: "verdana",
cursor: "pointer",
itemclick: function (e) {
//console.log("legend click: " + e.dataPointIndex);
//console.log(e);
if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
e.dataSeries.visible = false;
} else {
e.dataSeries.visible = true;
...