如何在谷歌Vizualization条形图自定义工具提示(文本和格式)? [英] How to customize tooltips(text and Format) in Google Vizualization Bar Charts?
本文介绍了如何在谷歌Vizualization条形图自定义工具提示(文本和格式)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用谷歌可视化条形图我想为自定义或更改提示文本和一个栏,单击时,显示格式为:。
我经历过的文档,但我没有找到一个方法来实现 本。你知道吗:
- 它甚至有可能?
- 如果是这样,你能提供一些code的例子吗?
解决方案
您可以更改号码由使用 google.visualization.NumberFormat
类格式化的方式。
VAR格式化=新google.visualization.NumberFormat({
参数fractionDigits:0,
preFIX:$
});
formatter.format(数据,1); //应用格式化过第二栏。
如果您需要更多的灵活性,有一个看 PatternFormat
类。
这里是参考。
I am using Google Visualization Bar Chart and I would like to customize or change the tooltip text and format that appears when clicking on a bar.
I have been through documentation but I didn't find a way to implement this. Do you know:
- Is it even possible?
- If so, could you provide some code examples ?
解决方案
You can change the way the number is formatted by using the google.visualization.NumberFormat
class.
var formatter = new google.visualization.NumberFormat({
fractionDigits: 0,
prefix: '$'
});
formatter.format(data, 1); // Apply formatter to second column.
If you need more flexibility, have a look at the PatternFormat
class.
Here's the API reference.
这篇关于如何在谷歌Vizualization条形图自定义工具提示(文本和格式)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文