generated from The-Strategy-Unit/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod_plot_rates_box.R
More file actions
30 lines (29 loc) · 964 Bytes
/
mod_plot_rates_box.R
File metadata and controls
30 lines (29 loc) · 964 Bytes
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
#' Plot Rates Box UI
#' @param id,input,output,session Internal parameters for `shiny`.
#' @noRd
mod_plot_rates_box_ui <- function(id) {
ns <- shiny::NS(id)
bslib::card(
bslib::card_header("Rates Box"),
bslib::card_body(shiny::plotOutput(ns("rates_box_plot"))),
full_screen = TRUE
)
}
#' Plot Rates Box Server
#' @param id Internal parameter for `shiny`.
#' @param rates A data.frame. Annual rate values for combinations of provider
#' and strategy.
#' @param y_axis_limits Numeric vector. Min and max values for the y axis.
#' @noRd
mod_plot_rates_box_server <- function(id, rates, y_axis_limits) {
shiny::moduleServer(id, function(input, output, session) {
output$rates_box_plot <- shiny::renderPlot({
rates <- rates()
shiny::validate(shiny::need(
nrow(rates) > 0,
"No data available for these selections."
))
plot_rates_box(rates, y_axis_limits())
})
})
}