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("shinyApp")
The application starts, but the plot is not visible. It works with a normal r-plot and with polycharts, but after trying a lot, I still have no success with rCharts (which includes rHighcharts).
This is the files of the last try:
server.R:
library(rCharts)
shinyServer(function(input, output) {
output$myChart <- renderChart({
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)
})
})
ui.R:
require(rCharts)
shinyUI(pageWithSidebar(
headerPanel("rCharts: Highcharts"),
sidebarPanel(
selectInput(inputId = "x",
label = "Choose X",
choices = c('SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth'),
selected = "SepalLength")
),
mainPanel(showOutput("myChart", "Highcharts")
)
))
My assumption is that the second argument of "showOutput" might be wrong, but I didn't find anything.