[EDITED]
I have been coding up a simple Shiny-based implementation of a multibar chart using the rcharts wrapper for nvd3. When I produce the graphic locally from the R console, I am able to interact with it and the transitions work as expected. However, when wrapped in the shiny interface, it does not redraw, nor does it allow for interactions with the plot itself.
I have pasted in the code that I am using below along with a sample data set. When run with the sample data, it works great. However, my actual data set is significantly larger (over 5k records in the trips dataset and over 100 entries in the stations dataset). Not sure why this would matter, but it seems to break the interface.
Here is the global.r file:
#global.r
preppedTrips <- read.csv("trips.csv")
stations <- read.csv("stations.csv")
stationnames <- as.character(stations$Name)
Here is the server.r file:
#ui.r
require(rCharts)
shinyServer(function(input, output) {
trips <- reactive({
preppedTrips[preppedTrips$station == stationID(),]
})
stationID <- reactive({
a <- as.character(stations[stations$Name == input$station,]$ID)
})
output$caption <- renderText({
paste("Station ID is: ", stationID(), sep="")
})
output$plot <- renderChart({
n1 <- nPlot(value ~ time, group="group", data = trips(), type="multiBarChart")
n1$set(dom = "plot")
return(n1)
})
})
Here is the ur.r file:
require(rCharts)
shinyUI(pageWithSidebar(
headerPanel("nvd3 test"),
sidebarPanel(
selectInput(inputId = 'station',
label = "Stations",
choices = stationnames,
selected = 's1'),
submitButton("Update View")
),
mainPanel(
h3(textOutput("caption")),
showOutput("plot","nvd3")
)
))
Here is a sample of the trips.csv file:
"","time","variable","value","group","station"
"8","07:00","V1",73,"Start","s1"
"9","08:00","V1",145,"Start","s1"
"10","09:00","V1",146,"Start","s1"
"11","10:00","V1",85,"Start","s1"
"12","11:00","V1",84,"Start","s1"
"13","12:00","V1",102,"Start","s1"
"14","13:00","V1",126,"Start","s1"
"32","07:00","V1",27,"End","s1"
"33","08:00","V1",97,"End","s1"
"34","09:00","V1",148,"End","s1"
"35","10:00","V1",70,"End","s1"
"36","11:00","V1",106,"End","s1"
"37","12:00","V1",84,"End","s1"
"38","13:00","V1",124,"End","s1"
"55","07:00","V1",24,"Start","s2"
"56","08:00","V1",107,"Start","s2"
"57","09:00","V1",127,"Start","s2"
"58","10:00","V1",54,"Start","s2"
"59","11:00","V1",50,"Start","s2"
"60","12:00","V1",59,"Start","s2"
"61","13:00","V1",45,"Start","s2"
"78","07:00","V1",34,"End","s2"
"79","08:00","V1",101,"End","s2"
"80","09:00","V1",95,"End","s2"
"81","10:00","V1",54,"End","s2"
"82","11:00","V1",44,"End","s2"
"83","12:00","V1",60,"End","s2"
"84","13:00","V1",56,"End","s2"
And here is a sample of the stations.csv file:
"","Name","ID"
"1","Station 1","s1"
"2","Station 2","s2"
trips.csv
andstations.csv
so that your example is reproducible. – Ramnath