JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 300px; width: 100%;">
</div>
<button id="removeDp">Remove Datapoint</button>
JavaScript
var chart = new CanvasJS.Chart("chartContainer",
{
title:{
text: "Remove dataPoint from the Chart"
},
data: [
{
type: "line",
dataPoints: [
{ y: 450 },
{ y: 414 },
{ y: 520 },
{ y: 460 },
{ y: 450 },
{ y: 500 },
{ y: 480 },
{ y: 480 },
{ y: 410 },
{ y: 500 },
{ y: 480 },
{ y: 510 }
]
}
]
});
chart.render();
document.getElementById("removeDp").addEventListener("click", function(){
chart.options.data[0].dataPoints.shift();
chart.render();
});