How to show tooltip on a Google Pie Chart on legend hover? -


i want show tooltip of slices on mouse hover in legend. default shows tooltip when mouse on slice of pie.

currently nearest thing have show tooltip when click on legend, with:

tooltip: { trigger: 'selection' } 

as option when draw chart.

i tried find reference no result.

jsfiddle: http://jsfiddle.net/ohavpo17/2/

you close. keep tooltip: { trigger: 'selection' } , add event listener onmouseover :

google.visualization.events.addlistener(chart, 'onmouseover', function(entry) {    chart.setselection([{row: entry.row}]); }); 

this show tooltip when mouse hover legend. docs says onmouseover:

fired when user mouses on visual entity. passes row , column indices of corresponding data table element. slice or legend entry correlates row in data table (column index null).

so above code simulates selection row corresponding legend being hovered. add onmouseout listener, tooltip not hangs when mouse leaves chart :

google.visualization.events.addlistener(chart, 'onmouseout', function(entry) {    chart.setselection([]); });    

see demo -> http://jsfiddle.net/a095qq8e/


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -