R Shiny:调用 google 图表的 renderGvis() 不会生成图表
R Shiny: call to renderGvis() for google charts doesn't produce a chart
(更新:已解决 div 问题的 height/width;更改了问题)。
我在做:
output$mainplot <- renderGvis({gvisBubbleChart()}, chartid="foo")
结果:空白图。我单独尝试了 gvisBubbleChart() 调用,据我所知,它确实创建了 gvis 对象。
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] googleVis_0.5.7 data.table_1.9.4 shiny_0.11
loaded via a namespace (and not attached):
[1] chron_2.3-45 digest_0.6.7 htmltools_0.2.6 httpuv_1.3.2 mime_0.2 plyr_1.8.1
[7] R6_2.0.1 Rcpp_0.11.3 reshape2_1.4.1 RJSONIO_1.3-0 stringr_0.6.2 tools_3.1.2
[13] xtable_1.7-4
>
chartid="foo"
需要进入 gvisBubbleChart()
作为示例 here
rm(list = ls())
library(googleVis)
library(shiny)
times <- seq(c(ISOdate(2014,01,06)), by = "day", length.out = 100)
data1 <- round(runif(100, min = 100, max = 1000))
test <- round(runif(100, min = -10, max = 10))
my_data <- as.data.frame(cbind(as.character(times),data1,test))
colnames(my_data) <- c("time","data1","test")
ui =fluidPage(mainPanel(htmlOutput("view")))
server = function(input, output, session){
datasetInput <- reactive({
gvisBubbleChart(my_data,idvar="test",
xvar="time", yvar="data1", chartid="foo")})
output$view <- renderGvis({datasetInput()})
}
runApp(list(ui = ui, server = server))
(更新:已解决 div 问题的 height/width;更改了问题)。 我在做:
output$mainplot <- renderGvis({gvisBubbleChart()}, chartid="foo")
结果:空白图。我单独尝试了 gvisBubbleChart() 调用,据我所知,它确实创建了 gvis 对象。
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] googleVis_0.5.7 data.table_1.9.4 shiny_0.11
loaded via a namespace (and not attached):
[1] chron_2.3-45 digest_0.6.7 htmltools_0.2.6 httpuv_1.3.2 mime_0.2 plyr_1.8.1
[7] R6_2.0.1 Rcpp_0.11.3 reshape2_1.4.1 RJSONIO_1.3-0 stringr_0.6.2 tools_3.1.2
[13] xtable_1.7-4
>
chartid="foo"
需要进入 gvisBubbleChart()
作为示例 here
rm(list = ls())
library(googleVis)
library(shiny)
times <- seq(c(ISOdate(2014,01,06)), by = "day", length.out = 100)
data1 <- round(runif(100, min = 100, max = 1000))
test <- round(runif(100, min = -10, max = 10))
my_data <- as.data.frame(cbind(as.character(times),data1,test))
colnames(my_data) <- c("time","data1","test")
ui =fluidPage(mainPanel(htmlOutput("view")))
server = function(input, output, session){
datasetInput <- reactive({
gvisBubbleChart(my_data,idvar="test",
xvar="time", yvar="data1", chartid="foo")})
output$view <- renderGvis({datasetInput()})
}
runApp(list(ui = ui, server = server))