I'm trying to implement a hover
callback in the chart I made using Chartjs. Here's the part below I'm confused:
var chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
// Am I supposed to put onHover callback inside of hover property of options?
//hover: {
// onHover: (e, elements): void => {}
//}
// OR
// Am I supposed to put onHover callback just as a property of options?
// onHover: (e, elements): void => {}
}
});
The tricky part is that I've tried the both approach and it works in either way. I've been sniffing around their docs but I seem to not get the right approach. According to their docs, onHover
: Called when any of the events fire. Called in the context of the chart and passed the event and an array of active elements (bars, points, etc).
Shouldn't it be called when only hover
event fires? Any insight would be appreciated!