简体   繁体   English

在鼠标悬停时显示折线图注释

[英]Show linechart annotations on mouseover

I'm working on some google charts that show scores of apps, the issue that I'm having is that I want to add the vote count somewhere in the linechart as well, so I did some googling and thought it would be best to use annotations within my charts. 我正在处理一些显示应用程序得分的Google图表,而我遇到的问题是我也想在线路图中添加投票计数,因此我进行了一些谷歌搜索,认为最好使用我的图表中的注释。 So I tried that but it looks really messy. 所以我尝试了一下,但是看起来真的很乱。

在此输入图像描述

Is there a way to make annotations show on mouseover? 有没有办法在鼠标悬停时显示注释? Or is there maybe a way to add the vote amount in the mouseover popup labels? 还是有办法在鼠标悬停弹出标签中添加投票额?

Code is kinda irrelevant as my code is working fine, I'm using the standard data annotation used in this documentation: https://developers.google.com/chart/interactive/docs/customizing_tooltip_content#annotating-data 代码有点无关紧要,因为我的代码工作正常,我使用的是本文档中使用的标准数据注释: https : //developers.google.com/chart/interactive/docs/customizing_tooltip_content#annotating-data

After looking more into the documentation I found that 在深入研究文档之后,我发现

dataTable.addColumn({type: 'string', role: 'domain'});

instead of 代替

dataTable.addColumn({type: 'string', role: 'annotation'});

Gave the result that I wanted, role: domain changes the popup title when hovering over the points which was exactly what I needed! 悬停在要点上时,给了我想要的结果,角色:域更改了弹出标题,这正是我所需要的!

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM