Skip to content

Commit

Permalink
Tooltips fixes post bh (#47)
Browse files Browse the repository at this point in the history
* Feat: Adding inputs from all pages (not just LA) so that bookmarking works

* Feat: Alphabetically ordering indicators for when all topics is selected

* Feat: Using the global covid method to find what years should be treated as covid

* Feat: Using a join instead of filter so that each measure uses its right year for the covid NA years (mainly for Create Your Own plots)

* Feat: Adding new covid years method to all relevant scripts

* Feat: Tooltip for LA input to explain can scroll or type, also doing this in placeholders

* Feat: Adding bslib tooltip to reactable cell instead of tippy

* Chore: Roxygen comments for new tooltip fns

* Feat: Applying new tooltip with direction to each reactable tooltip

* Feat: Setting tooltip class with arrow gov colour and changing icon to information

* Feat: Adding tooltip to Year Range and making tooltip text html

* Feat: Adding tooltips to Create Your Own tables and Charts (instead of brackets)

* Feat: Adding placeholder to multi-chart selections and improving Create Your Own placeholder to suggest multiple selections

* Feat: Making year range tooltip bulletpoints

* Feat: Adding tooltip to ui Create Your Own charts, removing fullstops

* Tests: Fixing tests for new default indicator and using .data to specify Measure in filter by topic
  • Loading branch information
JT-39 authored Nov 28, 2024
1 parent 0cdcdf2 commit 73e8d43
Show file tree
Hide file tree
Showing 28 changed files with 2,887 additions and 2,701 deletions.
309 changes: 156 additions & 153 deletions 02_dev/create_your_own_page/create_own_table_dev_mod_app.R
Original file line number Diff line number Diff line change
@@ -1,153 +1,156 @@
# Load global
source(here::here("global.R"))

# Load functions
list.files("R/", full.names = TRUE) |>
(\(x) {
x[grepl("fn_", x)]
})() |>
purrr::walk(source)

# Load modules
list.files("R/lait_modules/", full.names = TRUE) |>
purrr::walk(source)

# Main App UI
ui <- bslib::page_fillable(
## Other language dependencies ===============================================
shiny::includeCSS(here::here("www/dfe_shiny_gov_style.css")),
tags$head(htmltools::includeScript("www/custom_js.js")),
# Makes the remove button work
reactable.extras::reactable_extras_dependency(),

# Start of app ===============================================================

# Main selections ============================================================
h1("Create your own"),
# Full dataset notification banner
full_data_on_github_noti(),
div(
class = "well",
style = "overflow-y: visible; padding: 1rem;",
bslib::layout_column_wrap(
Create_MainInputsUI("create_inputs")["Main choices"],
),
bslib::layout_column_wrap(
Create_MainInputsUI("create_inputs")["LA grouping"],
Create_MainInputsUI("create_inputs")["Other grouping"],
YearRangeUI("year_range"),
Create_MainInputsUI("create_inputs")["Clear all current selections"]
)
),
# Staging table and Add selections button
StagingTableUI("staging_table"),
QueryTableUI("query_table"),
CreateOwnTableUI("create_own_table"),
# Charts =====================================================================
div(
class = "well",
style = "overflow-y: visible;",
h3("Output Charts (Charts showing data from saved selections)"),
p("Note a maximum of 4 geographies and 3 indicators can be shown."),

# Line chart ---------------------------------------------------------------
bslib::navset_tab(
CreateOwnLineChartUI("create_own_line"),
CreateOwnBarChartUI("create_own_bar")
)
)
)

# Main App Server
server <- function(input, output, session) {
# Call the main inputs module
create_inputs <- Create_MainInputsServer(
"create_inputs",
topic_indicator_full
)

# Year range
year_input <- YearRangeServer(
"year_range",
bds_metrics,
create_inputs$indicator,
create_inputs$clear_selections
)

# Geog Groupings
geog_groups <- GroupingInputServer(
"geog_groups",
create_inputs,
la_names_bds,
region_names_bds,
stat_n_geog,
stat_n_la
)

# Filtering BDS for staging data
staging_bds <- StagingBDSServer(
"staging_bds",
create_inputs,
geog_groups,
year_input,
bds_metrics
)

# Build staging data
staging_data <- StagingDataServer(
"staging_data",
create_inputs,
staging_bds,
region_names_bds,
la_names_bds,
stat_n_la
)

# Output staging table
StagingTableServer(
"staging_table",
create_inputs,
region_names_bds,
la_names_bds,
stat_n_la,
geog_groups,
year_input,
bds_metrics
)

query_data <- QueryDataServer(
"query_data",
create_inputs,
geog_groups,
year_input,
staging_data
)

query_table <- QueryTableServer(
"query_table",
query_data
)

CreateOwnTableServer(
"create_own_table",
query_table,
bds_metrics
)

CreateOwnLineChartServer(
"create_own_line",
query_table,
bds_metrics,
covid_affected_indicators
)

CreateOwnBarChartServer(
"create_own_bar",
query_table,
bds_metrics,
covid_affected_indicators
)
}

# Run the application
shinyApp(ui = ui, server = server)
# Load global
source(here::here("global.R"))

# Load functions
list.files("R/", full.names = TRUE) |>
(\(x) {
x[grepl("fn_", x)]
})() |>
purrr::walk(source)

# Load modules
list.files("R/lait_modules/", full.names = TRUE) |>
purrr::walk(source)

# Main App UI
ui <- bslib::page_fillable(
## Other language dependencies ===============================================
shiny::includeCSS(here::here("www/dfe_shiny_gov_style.css")),
tags$head(htmltools::includeScript("www/custom_js.js")),
# Makes the remove button work
reactable.extras::reactable_extras_dependency(),

# Start of app ===============================================================

# Main selections ============================================================
h1("Create your own"),
# Full dataset notification banner
full_data_on_github_noti(),
div(
class = "well",
style = "overflow-y: visible; padding: 1rem;",
bslib::layout_column_wrap(
Create_MainInputsUI("create_inputs")["Main choices"],
),
bslib::layout_column_wrap(
Create_MainInputsUI("create_inputs")["LA grouping"],
Create_MainInputsUI("create_inputs")["Other grouping"],
YearRangeUI("year_range"),
Create_MainInputsUI("create_inputs")["Clear all current selections"]
)
),
# Staging table and Add selections button
StagingTableUI("staging_table"),
QueryTableUI("query_table"),
CreateOwnTableUI("create_own_table"),
# Charts =====================================================================
div(
class = "well",
style = "overflow-y: visible;",
h3(
"Output Charts",
create_tooltip_icon("Charts showing data from all the saved selections")
),
p("Note a maximum of 4 geographies and 3 indicators can be shown."),

# Line chart ---------------------------------------------------------------
bslib::navset_tab(
CreateOwnLineChartUI("create_own_line"),
CreateOwnBarChartUI("create_own_bar")
)
)
)

# Main App Server
server <- function(input, output, session) {
# Call the main inputs module
create_inputs <- Create_MainInputsServer(
"create_inputs",
topic_indicator_full
)

# Year range
year_input <- YearRangeServer(
"year_range",
bds_metrics,
create_inputs$indicator,
create_inputs$clear_selections
)

# Geog Groupings
geog_groups <- GroupingInputServer(
"geog_groups",
create_inputs,
la_names_bds,
region_names_bds,
stat_n_geog,
stat_n_la
)

# Filtering BDS for staging data
staging_bds <- StagingBDSServer(
"staging_bds",
create_inputs,
geog_groups,
year_input,
bds_metrics
)

# Build staging data
staging_data <- StagingDataServer(
"staging_data",
create_inputs,
staging_bds,
region_names_bds,
la_names_bds,
stat_n_la
)

# Output staging table
StagingTableServer(
"staging_table",
create_inputs,
region_names_bds,
la_names_bds,
stat_n_la,
geog_groups,
year_input,
bds_metrics
)

query_data <- QueryDataServer(
"query_data",
create_inputs,
geog_groups,
year_input,
staging_data
)

query_table <- QueryTableServer(
"query_table",
query_data
)

CreateOwnTableServer(
"create_own_table",
query_table,
bds_metrics
)

CreateOwnLineChartServer(
"create_own_line",
query_table,
bds_metrics,
covid_affected_data
)

CreateOwnBarChartServer(
"create_own_bar",
query_table,
bds_metrics,
covid_affected_data
)
}

# Run the application
shinyApp(ui = ui, server = server)
Loading

0 comments on commit 73e8d43

Please sign in to comment.