How to draw the item before the datasetsDraw on an event? #11142
-
I have an onHover option and I want to draw a shape behind the datasets when I mouseover the I have been reading the plugin for event handling, https://www.chartjs.org/docs/latest/developers/plugins.html, but I struggle understand it. I also tried with a beforeEvent, and afterEvent but it does not work as the shape will be draw always on top. Probably because the chart has rendered already. I tried 2 options but both failed.
I also tried it with a
I hope someone can help out. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@Udemology in my opinion, the shape should be drawn in |
Beta Was this translation helpful? Give feedback.
@Udemology in my opinion, the shape should be drawn in
beforeDatasetsDraw
. All data you need to draw should be created and managed inafterEvent
. To force a draw fromafterEvent
you should setargs.changed
property to true before return. Setting that property chart.js redraws the chart.