I'm using ChartJs and datalabels plugin.
I would like to add the css "cursor:pointer" when a user is hovering on a datalabel.
How could I do that ?
I had to add this in the datalabels section
It selects the chart when hovering on a specific label and changes the cursor to pointer. It resets when stopping from hovering the label:
listeners: {
enter: function(context) {
context.hovered = true;
var el = document.getElementById("myLineChart");
el.style.cursor = "pointer";
return true;
},
leave: function(context) {
context.hovered = false;
var el = document.getElementById("myLineChart");
el.style.cursor = "default";
return true;
},
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.