Shiny - googlevis: Tooltips for gvisPieChart

血红的双手。 提交于 2019-12-12 14:16:32

问题


I am trying to create custom tooltips for a googlevis pie chart.

I have found Using Roles via googleVis but I cannot replicate a similar concept to a pie chart. See below for one of my attempts to achive this:

df <- data.frame(year=c("a","b","g"),pop=1:3, pop.html.tooltip=c("alpha","beta","gamma"))

  plot(
    gvisPieChart(df,options=list(tooltip="{isHtml:'true'}"))
  )

Moreover, I found out that the first column chart example in Using Roles via googleVis is not working properly. Although the certainty concept is working fine, the tooltips are not displayed as defined in Sales.html.tooltip column of dat dataframe.

Apparently, I am having a problem with tooltips in every other chart apart from gvisScatterChart.


回答1:


This is currently not possible via the google visualisation api

https://code.google.com/p/google-visualization-api-issues/issues/detail?id=507

The way it would work with for example the column chart is:

g <- gvisColumnChart(df, xvar = "year", yvar = c("pop", "pop.html.tooltip")
                     , options=list(tooltip="{isHtml:'true'}"))
plot(g)



来源:https://stackoverflow.com/questions/26376379/shiny-googlevis-tooltips-for-gvispiechart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!