5๐
I needed the cursor to change only when over a bar or point on a line chart so came up with this simple solution. Place your function outside the chart declaration.
var chart = new Chart(ctx, {
data: {...},
options: {
onHover: graphHover
}
});
function graphHover(e, array) {
if(array.length > 0) {
e.target.style.cursor = 'pointer';
}else {
e.target.style.cursor = '';
}
}
- [Chartjs]-How to fix chart Legends width-height with overflow scroll in ChartJS
- [Chartjs]-Chart.js Custom Image for Each Point
1๐
there is a cursor property in css that you can set.
for example :
span.crosshair {
cursor: crosshair;
}
span.help {
cursor: help;
}
span.wait {
cursor: wait;
}
Please refer to this link for more information
Source:stackexchange.com