Description Usage Arguments Details See Also Examples
Creates module server for tabset panel containing two tabs - with plot and an elegant table with data.
1 2 3 4 5 6 7 8 9 | beam_plot_panel_SERVER(
id,
plot_out,
table_out,
plot_type = "geom_point",
tt_content = NULL,
tt_range = 5,
helpfiles = "helpfiles"
)
|
id |
unique Id of tabset panel. The same ID as in the corresponding UI for a module |
plot_out |
Plot to display in tab. There will be provided an automatically generated tooltip compatible with the plot. The items from first mapping will be connected with tooltip. |
table_out |
Table to display in tab. |
plot_type |
Type of plot corresponding to the data from first mapping.
Accepts either |
tt_content |
Optional. If |
tt_range |
A number denoting maximum distance between hoover and objects on the plot.
The row, whose distance to the hoover is less than |
helpfiles |
A character string denoting directory to save empty help files.
Default |
Module's server involves a panel with two tabs. The first tab consists of
displayed plot and three download buttons (png, svg and jpeg). There is also a
compatible with plot tooltip obtained via beam_tooltip
.
The second tab consists of a table with two download buttons (Excel and CSV).
The table table_out
before displaying is formatted using
dt_format
. For both table and plot there are provided
helpers.
To build Shiny module within a Shiny app using beam_plot_panel_SERVER
see beam_plot_panel_UI
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ## Not run:
ui <- fluidPage(title = "Example app",
beam_plot_panel_UI("airquality_basic"),
beam_plot_panel_UI("airquality_advanced",
tab_plot = "An advanced plot",
tab_table = "An elegant table for an advanced plot",
helpfiles = "custom_helpfiles"))
server <- function(input, output, session) {
airquality_basic_plot <- reactive({
ggplot(airquality, aes(x = Wind, y = Temp, col = as.character(Month))) +
geom_point()
})
airquality_basic_data <- reactive({
airquality
})
beam_plot_panel_SERVER("airquality_basic",
plot_out = airquality_basic_plot(),
table_out = airquality_basic_data())
airquality_advanced_data <- reactive({
df <- data.frame(aggregate(. ~ Month, airquality, function(x) c(mean = mean(x), sd = sd(x)))[, c(1, 5)])
df[["Month"]] <- month.name[df[["Month"]]]
data.frame(Month = df[["Month"]],
Temp_mean = df$Temp[, 1],
Error = df$Temp[, 2],
Year = 1973)})
airquality_advanced_plot <- reactive({
ggplot(airquality_advanced_data(), aes(y = 0, yend = Temp_mean, x = Month, xend = Month)) +
geom_segment() +
geom_point(mapping = aes(x = Month, y = Temp_mean), size = 3) +
geom_point() +
ylab("average temperature")
})
beam_plot_panel_SERVER("airquality_advanced",
plot_out = airquality_advanced_plot(),
table_out = airquality_advanced_data(),
plot_type = "geom_segment",
tt_content = list(row_text = c("Date: %s %i",
"Average temperature: %f °F",
"Error: %f",
"Place: La Guardia Airport"),
chosen_cols = c("Month",
"Year",
"Temp_mean",
"Error"))
)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.