如何在Google Vizualization Bar Charts中自定义工具提示(文本和格式)? [英] How to customize tooltips(text and Format) in Google Vizualization Bar Charts?

查看:160
本文介绍了如何在Google Vizualization Bar Charts中自定义工具提示(文本和格式)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Google可视化条形图和我想要自定义或更改单击栏上显示的工具提示文本和格式

我已经通过文档,但我没有找到一种方法来实现
。您知道吗:

I have been through documentation but I didn't find a way to implement this. Do you know:


  1. 是否可能

  2. 所以,你能提供一些代码示例吗?


推荐答案

您可以使用 google.visualization.NumberFormat class。

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.

如果您需要更多的灵活性,请查看 PatternFormat class。

If you need more flexibility, have a look at the PatternFormat class.

这是 API参考

这篇关于如何在Google Vizualization Bar Charts中自定义工具提示(文本和格式)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆