问题
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