有光泽的rNVD3在rstutio中运行良好,但只显示了铬的一半图表

时间:2014-11-12 08:41:41

标签: r shiny nvd3.js rcharts

我使用闪亮的rNVD3来制作图表,它在rstudio中工作得很好,但它会给出错误信息:

  

错误:[on_request_read]连接由peer重置

我不知道是什么问题

但是当我在Chrome或Firefox中打开此应用时,图表仅显示上半部分(我没有足够的声誉来发布图片,抱歉)

代码是:

#ui.r
require(rNVD3)
library(shiny)
shinyUI(pageWithSidebar(
    headerPanel("rNVD3: Interactive Charts from R using NVD3.js"),

    sidebarPanel(
       selectInput(inputId = "gender",
            label = "Choose Gender",
            choices = c("Male", "Female"),
            selected = "Male"),
       selectInput(inputId = "type",
            label = "Choose Chart Type",
            choices = c("multiBarChart", "multiBarHorizontalChart"),
            selected = "multiBarChart"),
       checkboxInput(inputId = "stack",
              label = strong("Stack Bars?"),
              value = FALSE)
  ),
 mainPanel(
    showOutput("myChart")
   )
  ))

#server.r
require(rNVD3)
shinyServer(function(input, output) {
      output$myChart <- renderChart({
        hair_eye = as.data.frame(HairEyeColor)
        p6 <- nvd3Plot(Freq ~ Hair | Eye, data = subset(hair_eye, Sex == input$gender), 
               type = input$type, id = 'myChart')
    p6$chart(color = c('brown', 'blue', '#594c26', 'green'), stacked = input$stack)
    return(p6)
  })
})

0 个答案:

没有答案