2014-10-09 76 views
1

在此示例中,我想要一个只显示百分比的工具提示,省略绝对值。gvisPieChart工具提示 - 仅限百分比

a<-c('option1','option2','option3') 
b<-c(35,80,10) 
data<-data.frame(a,b) 

myplot<-gvisPieChart(data,options=list(title='Example',width=1000, height=500)) 

plot(myplot) 

https://google-developers.appspot.com/chart/interactive/docs/gallery/piechart 我发现这一点:

enter image description here

但我不知道如何以及是否it's能够适应googleVis。

在此先感谢。

路易斯

回答

2

您可以添加一个选项tooltip = "{text:'percentage'}"

library(googleVis) 
a<-c('option1','option2','option3') 
b<-c(35,80,10) 
data<-data.frame(a,b) 

myplot<-gvisPieChart(data,options=list(title='Example',width=1000, height=500 
             , tooltip = "{text:'percentage'}")) 

plot(myplot) 

enter image description here