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 labels = {
0 : 'low',
1 : 'medium',
1 : 'high'
};
var chart = new CanvasJS.Chart("chartContainer",
{
axisY: {
/*
Is something like this possible???
*/
content : function(y) {
return labels[y];
}
},
data: [
{
type: "stepLine",
dataPoints: [
{ x: 10, y: 1 },
{ x: 20, y: 0},
{ x: 30, y: 1 },
{ x: 40, y: 2 },
{ x: 50, y: 0 },
{ x: 60, y: 1 }
]
}
]
});
chart.render();