Basic Column Chart - CanvasJS JavaScript Charts
Basic Column Chart - CanvasJS JavaScript Charts
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: "A Stacked Area Chart"
},
toolTip: {
enabled: true,
reversed: true
},
data: [{
type: "stackedArea",
fillOpacity:0,
color: "red",
mouseover: onMouseover,
dataPoints: [
{ x: 10, y: 19000},
{ x: 20, y: null}
]
},{
type: "stackedArea",
fillOpacity: 0,
mouseover: onMouseover,
dataPoints: [
{ x: 10, y: null},
{ x: 20, y: 1}
]
},{
type: "stackedArea",
fillOpacity: 0,
color: 'black',
mouseover: onMouseover,
dataPoints: [
{ x: 10, y: 500},
{ x: 20, y: 6}
]
}
]
});
function onMouseover(e){
console.log( "dataPoint { x:" + e.dataPoint.x + ", y: "+ e.dataPoint.y + " }" );
}
chart.render();