diff --git a/NAMESPACE b/NAMESPACE index faad3008..a8cbfffa 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -20,6 +20,7 @@ S3method(is_initialized,block) S3method(is_initialized,field) S3method(server_code,block) S3method(server_output,block) +S3method(server_output,plot_block) S3method(ui_code,block) S3method(ui_input,field) S3method(ui_input,select_field) diff --git a/R/server.R b/R/server.R index bfda6586..cb2edaa2 100644 --- a/R/server.R +++ b/R/server.R @@ -139,6 +139,13 @@ server_output.block <- function(x, result, output) { output } +#' @rdname generate_ui +#' @export +server_output.plot_block <- function(x, result, output) { + output$plot <- shiny::renderPlot(result()) + output +} + #' @param state Block state #' @rdname generate_ui #' @export diff --git a/man/generate_ui.Rd b/man/generate_ui.Rd index 223f931c..3b770ed2 100644 --- a/man/generate_ui.Rd +++ b/man/generate_ui.Rd @@ -3,6 +3,7 @@ \name{server_output} \alias{server_output} \alias{server_output.block} +\alias{server_output.plot_block} \alias{server_code} \alias{server_code.block} \alias{generate_ui} @@ -12,13 +13,13 @@ \alias{ui_input.field} \alias{ui_input.string_field} \alias{ui_input.select_field} -\alias{ui_output} -\alias{ui_output.plot_block} \alias{ui_update} \alias{ui_update.field} \alias{ui_update.string_field} \alias{ui_update.select_field} +\alias{ui_output} \alias{ui_output.block} +\alias{ui_output.plot_block} \alias{ui_code} \alias{ui_code.block} \title{UI} @@ -27,6 +28,8 @@ server_output(x, result, output) \method{server_output}{block}(x, result, output) +\method{server_output}{plot_block}(x, result, output) + server_code(x, state, output) \method{server_code}{block}(x, state, output) @@ -45,10 +48,6 @@ ui_input(x, id, name) \method{ui_input}{select_field}(x, id, name) -ui_output(x, ns) - -\method{ui_output}{plot_block}(x, id) - ui_update(x, session, id, name) \method{ui_update}{field}(x, session, id, name) @@ -61,6 +60,8 @@ ui_output(x, ns) \method{ui_output}{block}(x, ns) +\method{ui_output}{plot_block}(x, ns) + ui_code(x, ns) \method{ui_code}{block}(x, ns) @@ -80,9 +81,9 @@ ui_code(x, ns) \item{name}{Field name} -\item{ns}{Output namespace} - \item{session}{Shiny session} + +\item{ns}{Output namespace} } \description{ Generic for UI generation