[Chartjs]-Chart.JS: How to add Data to a specific dataset

4👍

This works for me (you probably just need to add update):

function addData() {
  myBarChart.data.labels[12] ="2017";
  myBarChart.data.labels[13] ="2018";
  myBarChart.data.datasets[0].data[12] = 500;
  myBarChart.data.datasets[0].data[13] = 600;
  myBarChart.update();
}

CodePen: Add/Remove adjust data Chart.js

Leave a comment