将自定义文本添加到Google可视化工具提示 [英] Add custom text to Google Visualization tooltip

查看:89
本文介绍了将自定义文本添加到Google可视化工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在显示的每个工具提示(面积图)上添加另一行文本。我已经添加了一张截图来说明我希望做什么。



我目前的图表:

添加了附加文字的图表。 (这是我想要做的):



我希望能够在不使用第三方JS的情况下自定义工具提示。有什么方法可以添加另一行基于文本的内容以显示在默认的工具提示中?



任何帮助都非常感谢。 角色#whatrolesavailablerel =nofollow> https://developers.google.com/chart/interactive/docs/roles#whatrolesavailable



其他工具提示行是你正在寻找!



示例:

 
标签:'Year','Sales', null,'Expenses',null
角色:域名,数据,工具提示,数据,工具提示
'2004',1000,'1M $ sales,400''2004年$ 0.4M
' 2004年'b $ b''2005',1170,'1.17M $销售额,460''2005年'$ 0.46M开支
'2006'
'''660,'.66 $销售额,2006年1120美元,2006年'112万美元,2006年'b $ b'b',2007年1030美元,103万美元销售额540美元,'2007年'54.4亿美元,b $ b美元


I need to add in another row of text on each of the tooltips I'm displaying (on an area chart). I've included a screenshot to illustrate what I'm hoping to do.

My current chart: The chart with the additional text added. (This is what I'm trying to do):

I'm hoping to do this without having to use a third party JS for custom tooltips. Is there any way to just add another row of text-based content to be displayed in the default tooltips?

Any help is greatly appreciated.

解决方案

Have a look at https://developers.google.com/chart/interactive/docs/roles#whatrolesavailable:

Additional tooltip rows are what you are looking for!

The example:

label: 'Year',   'Sales',    null,   'Expenses',    null
 role: domain,     data,    tooltip,    data,      tooltip    
        '2004',    1000, '1M$ sales,     400,    '$0.4M expenses
                           in 2004'                  in 2004'
        '2005',    1170, '1.17M$ sales,  460,    '$0.46M expenses
                            in 2005'                  in 2005'
        '2006',     660, '.66$ sales,   1120,     '$1.12M expenses
                            in 2006'                 in 2006'
        '2007',    1030, '1.03M$ sales,  540,    '$0.54M expenses
                            in 2007'                  in 2007'

这篇关于将自定义文本添加到Google可视化工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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