Chartjs-Has Chart.defaults.global.legend.onClick been moved in v4.2.0?

1๐Ÿ‘

As of Chart.js release 3.x

  • global namespace was removed from defaults. So Chart.defaults.global is now Chart.defaults.
  • legend, title and tooltip namespaces were moved from Chart.defaults to Chart.defaults.plugins.

For further information, please consult section Defaults in 3.x Migration Guide at https://www.chartjs.org/docs/latest/migration/v3-migration.html.

0๐Ÿ‘

I finally found the answer to my problem in the Legend documentation:
"The doughnut, pie, and polar area charts override the legend defaults. To change the overrides for those chart types, the options are defined in Chart.overrides[type].plugins.legend."

As I am working on doughnut chart, I changed the code to:
var original = Chart.overrides.doughnut.plugins.legend.onClick;

and it works.

Leave a comment