JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 300px; width: 100%;"></div>
<button id="selectButton">
Select 1st Datapoint
</button>
<button id="deSelectButton">
De Select 1st Datapoint
</button>
JavaScript
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
title:{
text: "My First Chart in CanvasJS"
},
data: [
{
// Change type to "doughnut", "line", "splineArea", etc.
type: "line",
dataPoints: [
{ label: "apple", y: 10 },
{ label: "orange", y: 15 },
{ label: "banana", y: 25 },
{ label: "mango", y: 30 },
{ label: "grape", y: 28 }
]
}
]
});
chart.render();
document.getElementById("selectButton").addEventListener("click", function(){
chart.options.data[0].dataPoints[0].markerSize = (chart.data[0].markerSize * 1.5);
chart.render();
});
document.getElementById("deSelectButton").addEventListener("click", function(){
chart.options.data[0].dataPoints[0].markerSize = null;
chart.render();
});
}