I have a shiny app with embedded google line charts using the googlevis package. I need to be able to hide a line when clicking on it's legend key. I found this code on how to do it in google charts:
$http://jsfiddle.net/xDUPF/4/light/$
How can I introduce this behavior to a graph created using shiny? can I use the "jscode" parameter for it?
You can achieve this by inserting some extra javascript code. The technique is shown here. When you call
gvisLineChartand assign it toxit returns a list. You can inspect the followingit will return something like
You can adjust this piece of javascript code to achieve your aims. As an example here is a
ui.Randserver.R. The result can be viewed http://spark.rstudio.com/johnharrison/gvisTest