rCharts突出显示闪亮的图表不起作用

时间:2015-05-19 20:34:13

标签: r highcharts shiny rcharts

使用现有问题的答案作为可重现代码的基础here

我收到以下错误,并且不确定为什么它不起作用...当渲染hPlot类型图表时,它似乎是一个普遍的问题,因为我不断地得到相同的错误

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)
                                                                                                                                           })
                                                                                                                                         }))

下面是我在rCharts升级后的sessionInfo ...导致同样的错误...还要注意,在RStudio的查看器中查看时,高亮图表在本地工作,但在使用{{{ 1}}功能

showOutput

1 个答案:

答案 0 :(得分:1)

"Highcharts"内将"highcharts"更改为showOutput()会为我修复此问题(使用rCharts版本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)
    })
  }
))