Chartjs-Creating datapoints on mouseclick Chart.js

0👍

Every new point in the chart is data, so you need to add that point in the data (chartData.data.dataset[]) array. Instead of adding to the, myLineChart.points which i’m not sure why you have used you should add the data-point in the data array and the UI decorations such as colors are supposed to be specified in the chartOptions.scales.yAxes[] array. Therefore in order to add the point in the chart use:

// here i is the corresponding parameter for which you want to add the new point
chartInstance.data.datasets[i].push(value); 
chartInstance.update();

Leave a comment