'Chartjs tooltip and draw line separatly
Chartjs 3.6.1; typescript 4.3.5
I would like to draw a vertical line on chartJs, where the user clicked (once). I can draw a line in the chart.options.onClick() function, it's no problem, but:
- by default, it's removed when I move my mouse
- I can add
chart.options.events: ['click'],, but in this case the tooltip's behaviour changes as well: on click, the tooltip appears, then I have to click again to draw my line as well. Also, the line is go through the tooltip which is ugly - If I disable the tooltip, my line will never be rendered
This question is a good base: Moving vertical line when hovering over the chart using chart.js With that fiddle included: http://jsfiddle.net/dbyze2ga/658/ (It uses older chartJs version, but it's okay I think)
Is there a solution to leave that line after I move the mouse? Best could be to just extend with a line on click, and displays tooltips on mouse hover; worst case is draw the line and tooltip on click, but not by overlapping each other
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
