[Chartjs]-Chart.js Plugin Not Recognized as Options Property in Angular

1๐Ÿ‘

2 things, plugin options have to be defined in the plugins section of the options object like so:

new Chart(ctx, {
  type: 'line',
  data: data,
  options: {
    plugins: {
      dragData: {
        onDragStart: function () {},
        onDragEnd: function () {},
      }
    }
  }
});

Second part is that since you use chart.js version 2 you might need to downgrade your drag plugin since the latest version is for V3, the latest drag version you can use is version: 1.1.13, you can get this version by changing it directly in your package.json and running npm install again

Leave a comment