On further investigation, I realized that this is a bug in rCharts
, which has been fixed on the dev
branch. You can install it using devtools::install_github('ramnathv/rCharts@dev')
.
So running the code below will produce this chart with controls
library(rCharts)
Sp = c("a", "b", "c", "d")
A = c(10, 4, 3, 0)
B = c(3, 5, 22, 4)
C = c(1, 0 ,10, 8)
df = data.frame(Sp, A, B, C)
p1 <- nPlot(x = "Sp", y ="A" , data = df,
group = 'Sp', type = 'pieChart'
)
p1$addControls('y', 'A', values=c('A','B','C'))
p1