Possible Duplicate:
How to change tooltip text for google chart api?
I am using 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 hovers over a datapoint. Currently the hover only shows the dataset name and 开发者_如何学编程value (same a Y-axis). I would like to display additional meta-data. Is this possible? Does someone have an example?
You could use "tooltip" in the dataTable roles:
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']);
Refers to:DataTable roles
Yes you do this by using the following code -
<code>
data.setFormattedValue(<your custom hover lable>);
</code>
Refer here:
http://code.google.com/apis/chart/interactive/docs/reference.html#DataTable_setFormattedValue
精彩评论