Manage Data Point Hover Label in Google Chart

Possible duplicate:
How to change tooltip text for google chart api?

I use Google Charts to create a line chart: http://code.google.com/apis/chart/interactive/docs/gallery/linechart.html

I would like to control the text displayed when the user clicks or hover over a datapoint. Currently, guidance only displays the name and value of the dataset (the same as the Y axis). I would like to display additional metadata. Is it possible? Does anyone have an example?

+7
source share
2 answers

Yes, you do this using the following code -

<code> data.setFormattedValue(<your custom hover lable>); </code> 

See here:

http://code.google.com/apis/chart/interactive/docs/reference.html#DataTable_setFormattedValue

+2
source

You can use the "hint" in the roles of dataTable:

  data.addColumn('number', 'Abscisses'); data.addColumn('number', 'Warior'); data.addColumn({type:'number', role:'tooltip'}); data.addColumn({type:'string', role:'tooltip'}); data.addRow([2,3,4,'a']); data.addRow([3,4,2,'b']); 

Applies to: DataTable Roles

+4
source

All Articles