always visible tooltip on google chart on page load?
Asked Answered
E

3

7

Is there any way to make google charts tooltip always visible, no matter where the mouse pointer is? it should be constantly on after page load

Etra answered 25/3, 2014 at 13:7 Comment(0)
E
8

The best I could come up with is:

http://jsfiddle.net/xDfLd/

But if you interact with the chart (ie, click on different pie segments, or different line segments), the tooltip will disappear. Setting enableInteractivity:false I'll file a bug that tooltips and selections should still display when interactivity is off anyway.

Excitation answered 25/3, 2014 at 14:19 Comment(1)
I added other rows to selection and it seems to work: chart.setSelection([{row:4,column:null}, {row:3,column:null}, {row:2,column:null} , {row:1,column:null} , {row:0,column:null}]);Lusatia
P
3

I combined what Jeremy posted with Yasen's comment and came to this solution:

var options = {
  enableInteractivity: false,
  selectionMode: 'multiple',
  tooltip: {
    trigger: 'selection'
  }
};

google.visualization.events.addListener(chart, 'ready', function(e) {
  var selected_rows = [];
  for (var i = 0; i < your_total_number_of_rows - 1; i++) {
    selected_rows.push({row: i, column: null});
  }
  chart.setSelection(selected_rows);
});

chart.draw(data, options);

This shows all the tooltips on load and prevents the user from messing around with them. Works great with the Pie Chart.

Parfleche answered 16/3, 2017 at 15:47 Comment(0)
R
2

Use tooltip: { trigger: 'selection' } when defining options for the chart.

Reversal answered 21/5, 2014 at 7:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.