Here is my chart creation
createChart = function (name, contributions, idArray) {
globalIdArray = idArray;
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: "bar",
data: {
labels: name,
datasets: [{
label: "Contributions",
data: contributions,
backgroundColor: [
'rgba(0, 255, 0, 0.2)',
'rgba(0, 255, 0, 0.2)',
'rgba(0, 255, 0, 0.2)',
'rgba(0, 255, 0, 0.2)',
'rgba(0, 255, 0, 0.2)'
]
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
},
onClick: handleClick,
onHover: handleHover
}
});
This is the HTML, everything is JavaScript and resides inside the canvas element.
<canvas chart-hover="onHover" id="myChart" width="200" height="200"></canvas>
I made it so when I click on a bar they act as a "drill in" and take my a page with more details. To do that I used this code:
function handleClick(e) {
debugger;
var activeElement = myChart.getElementAtEvent(e);
var designerId = _idArray[activeElement[0]._index];
window.location.href = "/Display/search/index?designerId=" + designerId;
}
I'd like to make it so my cursor changes to a pointer to let the user know they can click the bar (as it would normally change with a link). I saw some examples of this on Stack Overflow but they were from the last year or two, the posts included comments asking for an updated version but no solutions.
Here is another post I saw which I believe is the same thing I am trying to accomplish but it didn't work for me.
How to change cursor style to pointer on hovering over points of the chart?
Does anyone know of how I can implement this, using the most recent live version of ChartJS?