0👍
✅
That is because, you are creating a new chart instance each time the submit button is clicked.
To get it working properly, you need to destroy the previous chart instance, before creating a new one, like so :
...
createData = () => {
// destroy previous chart instance, if exists
if (this.myChart) this.myChart.destroy();
/** create new chart instance **/
const ctx = document.getElementById("myChart");
// store chart instance to a class property
this.myChart = new Chart(ctx, {
...
here is the working example.
Source:stackexchange.com