I have a shiny application consisting of three files. server.R, ui.R and the file to launch the application with
require(shiny)
require(rCharts)
runApp(\"shi
There are two ways to get this working. The first way is to add h1$set(dom = "myChart") in your server.R. This is required so that both server.R and ui.R are communicating about the correct chart. The alternative is to use renderChart2, which is in the dev branch of rCharts, that is a upgraded version of renderChart and will eventually replace it. I am attaching the entire code for everyone's benefit.
require(rCharts)
require(shiny)
runApp(list(
ui = pageWithSidebar(
headerPanel("rCharts: Highcharts"),
sidebarPanel(selectInput(
inputId = "x",
label = "Choose X",
choices = c('SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth'),
selected = "SepalLength"
)),
mainPanel(showOutput("myChart", "Highcharts"))
),
server = function(input, output){
output$myChart <- renderChart2({
h1 <- Highcharts$new()
h1$chart(type = "spline")
h1$series(data = c(1, 3, 2, 4, 5), dashStyle = "longdash")
h1$series(data = c(NA, 4, 1, 3, 4), dashStyle = "shortdot")
h1$legend(symbolWidth = 80)
return(h1)
})
}
))