【发布时间】:2015-12-09 01:40:55
【问题描述】:
我在我的 Rshiny 仪表板中多次需要相同的 googlevis 图表,但是当我尝试执行此操作时,图表无法正确加载。
例如,在下面的代码中,如果我只绘制一次图表,它就可以正常运行。否则,两个图表都不会加载。有什么想法吗?
## app.R ##
library(shiny)
library(shinydashboard)
suppressPackageStartupMessages(library(googleVis))
ui <- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(),
dashboardBody(
fluidRow(box(htmlOutput("plot", height = 350))),
fluidRow(box(htmlOutput("plot", height = 350)))
)
)
server <- function(input, output) {
set.seed(122)
histdata <- rnorm(500)
output$plot <- renderGvis({ gvisBubbleChart(Fruits, idvar="Fruit",
xvar="Sales", yvar="Expenses",
colorvar="Year", sizevar="Profit",
options=list(
hAxis='{minValue:75, maxValue:125}')) })
}
shinyApp(ui, server)
【问题讨论】: