The main issue is that showOutput
, renderChart
and the Shiny call, all need to refer to the same plot id. I modified your code based on this and it works. Here is the code for everyone's reference
UPDATE. Please make sure that you have the latest version of rCharts installed from github.
## server.R
library(shiny)
library(rCharts)
library(rattle)
data(weather)
w = weather
dateToSeconds = function (date) {
date = as.POSIXct(as.Date(date), origin = "1970-01-01")
as.numeric(date)
}
w$Date = dateToSeconds(w$Date)
shinyServer(function(input, output) {
output$plot = renderChart({
rs = Rickshaw$new()
rs$layer(MinTemp ~ Date, data = w, type = "line")
rs$set(dom = "plot")
return(rs)
})
})
## ui.R
library(shiny)
library(rCharts)
library(rattle)
shinyUI(pageWithSidebar(
headerPanel("Rickshaw test"),
sidebarPanel(
selectInput("variable", "Choice is arbitrary:",
c("Choice 1", "Choice 2")
)
),
mainPanel(
showOutput("plot", "Rickshaw")
)
))