0👍
✅
Yes you can update both things
- New label with new data point
-
update exisiting datapoint
document.getElementById('addData').addEventListener('click', function() { if (config.data.datasets.length > 0) { var month = MONTHS[config.data.labels.length % MONTHS.length]; config.data.labels.push(month); config.data.datasets.forEach(function(dataset) { dataset.data.push(randomScalingFactor()); }); window.myLine.update(); } }); document.getElementById('updateOnlyPoint').addEventListener('click', function() { if (config.data.datasets.length > 0) { var month = config.data.labels.indexOf("March");//change point var olddata=config.data.datasets[0].data olddata[month]=randomScalingFactor(); //new data window.myLine.update(); } });
here is working example
Source:stackexchange.com