Chartjs-Chart.JS Chart Not Being Generated

1👍

There seems to be an issue with the plugin. TRY using the following one :

plugins: [{
   beforeDraw: function(chart) {
      var labels = chart.data.labels;
      labels.forEach(function(e, i) {
         var meta = chart.data.datasets[0]._meta;
         var bar = meta[Object.keys(meta)[0]].data[i]._model;
         var dataPoint = e.split(/\s/)[1];
         if (dataPoint === '12') bar.backgroundColor = 'blue';
         else if (dataPoint === '13') bar.backgroundColor = 'green';
      });
   }
}]

Leave a comment