Shiny 和 rCharts:我无法正常工作
Shiny and rCharts: I don't get it to work
我不知道怎么让它工作。什么都没有显示,但没有显示错误。这是来自我的 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")
)
还有我的 server.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)
})
这与昨天 和之前的许多问题相同,请使用 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))
我不知道怎么让它工作。什么都没有显示,但没有显示错误。这是来自我的 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")
)
还有我的 server.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)
})
这与昨天 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))