闪亮和rCharts:我没有得到它的工作

时间:2015-03-31 13:54:34

标签: r shiny nvd3.js rcharts

我不知道怎么做不起作用。没有显示任何内容,但未显示任何错误。这是来自我的UI,因此所有库都被加载:

tags$head(
                        tags$link(rel = "stylesheet", type = "text/css", href = "style_mozilla_win.css"),
                        tags$link(rel = "stylesheet", type = "text/css", href="nv.d3.css")
                      ),

                      HTML('
                           <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
                           '),

...

mainPanel( 
                                              showOutput("SectorCharting", "nvd3")
                                            )

从我的服务器.R

output$SectorCharting<-renderChart({
      hair_eye_male <- subset(as.data.frame(HairEyeColor), Sex == "Male")
      n1 <- nPlot(Freq ~ Hair, group = "Eye", data = hair_eye_male, 
                  type = 'multiBarChart')

      return(n1)
  })

1 个答案:

答案 0 :(得分:2)

这与昨天here的问题相同,在此之前很多,请使用renderChart2代替renderChart

rm(list = ls())
library(shiny)
library(rCharts)

ui =pageWithSidebar(
  headerPanel("Test"),

  sidebarPanel(),
  mainPanel(
    showOutput("SectorCharting", "nvd3")
  )
)


server = function(input, output) {

  output$SectorCharting <-renderChart2({
    hair_eye_male <- subset(as.data.frame(HairEyeColor), Sex == "Male")
    n1 <- nPlot(Freq ~ Hair, group = "Eye", data = hair_eye_male, 
                type = 'multiBarChart')
    return(n1)
  })
}


runApp(list(ui = ui, server = server))