Reputation: 13465
Using the answer to an existing question as a base for reproducible code here
I get the following error, and am unsure why it does not work...It seems to be a generic problem when rendering hPlot
type charts in shiny, as I constantly keep getting the same error
Listening on http://127.0.0.1:7537
Error in normalizePath(directoryPath, mustWork = TRUE) :
path[1]="": No such file or directory
Error in normalizePath(directoryPath, mustWork = TRUE) :
path[1]="": No such file or directory
> traceback()
21: normalizePath(directoryPath, mustWork = TRUE)
20: addResourcePath(LIB$name, LIB$url)
19: singleton(addResourcePath(LIB$name, LIB$url))
18: withCallingHandlers(expr, message = function(c) invokeRestart("muffleMessage"))
17: suppressMessages(singleton(addResourcePath(LIB$name, LIB$url)))
16: showOutput("myChart", "Highcharts")
15: tag("div", list(...))
14: tags$div(...)
13: div(class = paste0("col-sm-", width), ...)
12: mainPanel(showOutput("myChart", "Highcharts"))
11: tag("div", list(...))
10: tags$div(...)
9: div(class = "row", sidebarPanel, mainPanel)
8: tag("div", list(...))
7: tags$div(...)
6: div(class = "container-fluid", div(class = "row", headerPanel),
div(class = "row", sidebarPanel, mainPanel))
5: tagList(if (!is.null(title)) tags$head(tags$title(title)), if (!is.null(theme)) {
tags$head(tags$link(rel = "stylesheet", type = "text/css",
href = theme))
}, list(...))
4: attachDependencies(tagList(if (!is.null(title)) tags$head(tags$title(title)),
if (!is.null(theme)) {
tags$head(tags$link(rel = "stylesheet", type = "text/css",
href = theme))
}, list(...)), importBootstrap())
3: bootstrapPage(div(class = "container-fluid", div(class = "row",
headerPanel), div(class = "row", sidebarPanel, mainPanel)))
2: pageWithSidebar(headerPanel("rCharts: Highcharts"), sidebarPanel(selectInput(inputId = "x",
label = "Choose X", choices = c("SepalLength", "SepalWidth",
"PetalLength", "PetalWidth"), selected = "SepalLength")),
mainPanel(showOutput("myChart", "Highcharts")))
1: 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)
})
}))
below is my sessionInfo after an upgrade in rCharts...which resulted in the same error...also note that highlight charts work locally when viewing in RStudio's viewer, but not in shiny when using the showOutput
function
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: powerpc64le-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_0.11.1 rCharts_0.4.5
loaded via a namespace (and not attached):
[1] codetools_0.2-8 digest_0.6.8 grid_3.1.1 htmltools_0.2.6
[5] httpuv_1.3.2 lattice_0.20-29 mime_0.3 nabor_0.4.4
[9] plyr_1.8.1 R6_2.0.1 Rcpp_0.11.5 RJSONIO_1.3-0
[13] tools_3.1.1 whisker_0.3-2 xtable_1.7-4 yaml_2.1.13
Upvotes: 3
Views: 648
Reputation: 8510
Changing "Highcharts"
to "highcharts"
inside showOutput()
fixes it for me (using rCharts version 0.4.5):
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)
})
}
))
Upvotes: 1