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?
Not directly answering your question, but you can modify the chart and annotations in any way you prefer (in ChartJS v3) by accessing the context
chartandelement(docs)I used this to change style of annotation on hover (in TypeScript):