admin管理员组文章数量:1355608
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
});
本文标签: chartjsHow can I make my custom plugin execute before the Tooltip pluginStack Overflow
版权声明:本文标题:chart.js - How can I make my custom plugin execute before the Tooltip plugin? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743939160a2565239.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论