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 –