0👍
The plugin you have registered has overridden two methods, beforeRender
and afterDraw
, both of which will do absolutely nothing if chart.config.options.showAllTooltips
is false
. So, to disable the functionality of your plugin, you can manually manipulate your chart object and set chart.config.options.showAllTooltips
to false
.
Caveat 1: You will probably have to update
the chart afterwards, in order to apply the changes.
Caveat 2: You may have to slightly change the code of your plugin, because the current code messes with chart.options.tooltips.enabled
. You could have an else
part to your if
, which would reinstate the value of chart.options.tooltips.enabled
. Or you could leave the plugin code as is and manually set the desired value of chart.options.tooltips.enabled
, together with the value of chart.config.options.showAllTooltips
.
0👍
After investigating the chart.js source code, I found a solution to unregister afterDraw callback.
To make the solution simplify, I’ll assume you register only afterDraw callback.
First you have to update register part like below.
const afterDrawPlugin = {
id: 'afterDraw',
afterDraw: function(chart, easing) {
...your callback code...
}
};
Chart.plugins.register(afterDrawPlugin);
And unregister the plugin in the section you want to remove afterDraw callback.
Chart.plugins.unregister([afterDrawPlugin]);