1
我跟随this example绘制多个图,具体取决于不同的参数(如数据框列)。所以情况是每天要做的地块数量会有所不同。高坐标图的动态数
我修改了使用Highcharter获取javascript图表而不是基本图的代码,但它不起作用。
另外我想知道我必须添加到此代码来绘制2,3或4列的图表?
感谢
ui.R
fluidPage(
# Application title
titlePanel("Hello World!"),
# Show a plot
fluidRow(
column(width = 6,
highchartOutput("hcontainer", height = "400px")
)
)
)
server.R
get_plot_output_list <- function() {
plot_output_list <- lapply(1:NCOL(df), FUN = function(i) {
plot_output_object <- highchartOutput("hcontainer")
plot_output_object <- renderHighchart({
hc <- highchart() %>%
hc_add_serie(name = "df name", data = df)
return(hc)
})
})
do.call(tagList, plot_output_list) # needed to display properly.
return(plot_output_list)
}
observe({
output$hcontainer <- renderUI({ get_plot_output_list() })
#output$hcontainer <- renderHighchart({ get_plot_output_list() })
})
这工作。谢谢 –
在我的情况下,我有两个文件ui.R和server.R。在这种情况下,我已经使用global.R在两个部分共享相同的数据集。 http://shiny.rstudio.com/articles/scoping.html –