View source: R/djpr_shiny_plot.R
djpr_plot_server | R Documentation |
Server-side companion to djpr_plot_ui()
.
djpr_plot_server(
id,
plot_function,
data,
plt_change,
date_slider = TRUE,
date_slider_value_min = NULL,
check_box_options = NULL,
check_box_selected = check_box_options,
check_box_var = series,
download_button = TRUE,
width_percent = 100,
height_percent = 100,
interactive = TRUE,
convert_lazy = TRUE,
...
)
id |
a Shiny |
plot_function |
A function (without |
data |
data frame containing data to visualise |
plt_change |
This should be: |
date_slider |
Logical; |
date_slider_value_min |
|
check_box_options |
A character vector containing values to include
in a check box. |
check_box_selected |
A character vector containing values of the check box that should be selected by default. |
check_box_var |
name of column in |
download_button |
logical; |
width_percent |
Width of plot object, as a percentage of the standard |
height_percent |
Height of plot object, as a percentage of the standard |
interactive |
logical; |
convert_lazy |
logical; |
... |
arguments passed to |
## Not run:
library(shiny)
library(ggplot2)
ui <- djpr_page(
title = "My dashboard",
djpr_tab_panel(
title = "First tab",
djpr_plot_ui("plot")
)
)
plot_function <- function(data = economics,
title = "This is a title",
subtitle = "This is a subtitle",
caption = "This data comes from the ggplot2 package") {
data %>%
ggplot(aes(x = date, y = unemploy)) +
geom_line() +
labs(
title = title,
subtitle = subtitle,
caption = caption
) +
theme_minimal(base_size = 14)
}
server <- function(input, output, session) {
djpr_plot_server("plot",
plot_function,
date_slider = TRUE,
data = ggplot2::economics,
plt_change = reactive(input$plt_change)
)
}
shinyApp(ui, server)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.