1๐
As of Chart.js release 3.x
global
namespace was removed fromdefaults
. SoChart.defaults.global
is nowChart.defaults
.legend
,title
andtooltip
namespaces were moved fromChart.defaults
toChart.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.
Source:stackexchange.com