im trying to figure out how I can add a tooltip when I hover/mouseover the vertical line annotation I've drawn:
annotation: {
annotations: [{
"drawTime": "afterDatasetsDraw",
"type": "line",
"mode": "vertical",
"scaleID": "x-axis-0",
"value": "2020-04-01 12:20:27.709523",
"borderWidth": 2,
"borderColor": "red",
"label": {
"content": "Example Content",
"enabled": true,
"position": "top"
},
onMouseover: function(e) {
console.log("I AM GETTING CALLED!");
},
},
Can anybody explain how this can be done?
You can use a label for the annotation whose display is changed when the mouse enters and leaves (see Events configuration).
See the Label visibility example in the chartjs-plugin-annotation documentation.