开发者

Controlling hover label of data point in Google Chart [duplicate]

开发者 https://www.devze.com 2023-04-11 00:50 出处:网络
This question already has answers here: Closed 10 years ago. Possible Duplicate: How to change tooltip text for google chart api?
This question already has answers here: Closed 10 years ago.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消