Reputation: 118
I need to pass data from Sunburst plot to R (server side). The following code creates a sunburst plot and gives alert on the level that you select (curtesy of Kerry and his great work with HTMLWidgets and SunburstR). I would like to be able to pass that information on so that I can create a download list.
library(sunburstR)
# read in sample visit-sequences.csv data provided in source
# https://gist.github.com/kerryrodden/7090426#file-visit-sequences-csv
sequences <- read.csv(
system.file("examples/visit-sequences.csv",package="sunburstR")
,header = FALSE
,stringsAsFactors = FALSE
)
sb <- sunburst(sequences)
sb$x$tasks <- list(
htmlwidgets::JS(
"
function(){
//debugger;
this.instance.chart.on('click',function(d){
alert(d);
});
}
"
)
)
sb
Upvotes: 1
Views: 133
Reputation: 17719
use:
this.instance.chart.on('click',function(d){
Shiny.onInputChange("val", d);
});
then you can use
input$val
on server side which gives you the value d.
Upvotes: 4