JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://npmcdn.com/chart.js@4.5.1/dist/chart.umd.js"></script>
<button id="clear">Clear</button>
<div class="myChartDiv">
  <canvas id="myChart" width="600" height="400"></canvas>
</div>

CSS

.myChartDiv {
  max-width: 600px;
  max-height: 400px;
}

JavaScript

var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
    type: 'line',
    data: {
        labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
        datasets: [{
            label: '# of Votes',
            data: [12, 19, 3, 5, 2, 3]
        }]
    },
});
document.querySelector("#clear").addEventListener("click", function(event) {
  myChart.data.datasets[0].data.splice(0);
  myChart.update();
});