Custom Attribute to the dataPoint - CanvasJS
Custom Attribute to the dataPoint - CanvasJS
by canvasjs
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 500px; width: 100%; margin-left:auto; margin-right:auto;"></div>
JavaScript
var chart = new CanvasJS.Chart("chartContainer", {
title: {
text: "Custom Attribute to the dataPoint"
},
axisY: {
title: "Views"
},
axisX: {
title: "Pages"
},
data: [
{
type: "column",
toolTipContent: "{page}<hr/>Views: {y}",
indexLabel: "{page}",
indexLabelFontColor: "black",
dataPoints: [
{ x: 10, y: 84, page: "Home"},
{ x: 20, y: 36, page: "Download"},
{ x: 30, y: 19, page: "Blog"},
{ x: 40, y: 45, page: "Gallery"}
]
}
]
});
chart.render();