Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
34
rated 0 times [  40] [ 6]  / answers: 1 / hits: 37434  / 9 Years ago, thu, march 26, 2015, 12:00:00

I've made a pie chart using Chart.js, and I'd like to detect when a segment is hovered over. I've found plenty of documentation regarding manipulating the tooltips that appear when hovering over segments, but nothing regarding doing something else when a tooltip would appear. Is this possible?


More From » chart.js

 Answers
5

No...



There's nothing in the ChartJS API to override or extend the tooltip,



But, a workaround...



You can modify the draw method of the Chart.Tooltip class. This would allow you to do something else when the tooltip would normally be rendered by ChartJS.



The draw method you want to tie into starts at line 1351 of the source here:



https://github.com/nnnick/Chart.js/blob/master/src/Chart.Core.js


[#67301] Tuesday, March 24, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
phoebea

Total Points: 607
Total Questions: 100
Total Answers: 78

Location: Netherlands
Member since Thu, Jul 1, 2021
3 Years ago
;