2014-10-09 71 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