As an independent code the hide/unhide is working, but not in shiny
I have a data frame df as below
Date Category Number
2014-01-01 AA 2
2014-01-01 BB 4
2014-01-01 CC 3
2014-01-01 DD 11
2014-01-02 AA 21
2014-01-02 BB 14
2014-01-02 CC 12
2014-01-02 DD 14
2014-01-03 AA 11
2014-01-03 BB 13
2014-01-03 CC 9
2014-01-03 DD 11
I am trying to plot stacked bar plot with hide/unhide option. I tried to use the below example hide/unhide is not working. If I hide the data that is in the middle, it is not rescaling. http://glimmer.rstudio.com/reinholdsson/rHighcharts/
I also tried below example, but it is confusing and not showing any plot at all. http://rcharts.io/viewer/?5842467#.UuuYLKX-aQw
My code is
b <- rCharts:::Highcharts$new()
b$chart(type = "column")
b$plotOptions(column = list(stacking = "normal"))
b$xAxis(categories = unique(as.character(df$Date)))
tt = sapply(unique(as.character(df$Category)), function(name){
d <- df[df$Category == name, ]
b$series(name = name, data = d$Number, stack = d$Category[[1]])
})
b
with the above code the stacking option is gone.
I changed
b$series(name = name, data = d$Number, stack = d$Category[[1]])
to
b$series(name = name, data = d$Number, stack = d$Date[[1]])
Took little time to understand. I want to stack by Date so have to choose date here.
But the hide/unhide is not rescaling, instead disappearing the bar corresponding to the category.