I have written a custom plugin for ChartJS v4 in my application, and I am instantiating it in my chart instance like this:
new Chart(myCanvas, {
plugins: [
new MyPlugin(...)
],
//rest of the configuration
});
This works, however I have a problem: my plugin draws on the chart's canvas, and since I also have Tooltips enabled (which in ChartJS is itself a plugin) what happens is:
- The chart area is drawn
- The
Tooltip
plugin draws the tooltip - My plugin draws on the canvase Result: my plugin is drawing on top of the tooltips.
How can I avoid this? Is there a way to specify the order of execution of plugins?
NOTES:
1 - My plugin needs to be instantiated inline like in the example above, because its constructor needs some parameters that are not known beforehand, so I cannot register it globally
2 - I tried doing this instead (define the Tooltip plugin inline instead of globally) but in this way the Tooltip plugin doesn't seem to work:
new Chart(myCanvas, {
plugins: [
new MyPlugin(...),
Tooltip
],
//rest of the configuration
});