From 956729f77461c4bdf272c9bd2641ee0c65bf1a7e Mon Sep 17 00:00:00 2001 From: dylanbenzi Date: Mon, 14 Jul 2025 17:46:29 -0400 Subject: [PATCH] update select landfalls input for chart --- dashboard.Rmd | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/dashboard.Rmd b/dashboard.Rmd index 857f9e0..d5d17fb 100644 --- a/dashboard.Rmd +++ b/dashboard.Rmd @@ -291,10 +291,17 @@ observe({ unique_lfs <- get_unique_lf_ids(storm_selection) - updateSelectInput( - session, - "storm_overview_cost_index_lf", - choices = unique_lfs$full_lf_id, + #updateSelectInput( + # session, + # "storm_overview_cost_index_lf", + # choices = unique_lfs$full_lf_id, + # selected = unique_lfs$full_lf_id[1] + #) + + updateVirtualSelect( + session = session, + "storm_overview_cost_index_lf_select", + choices = prepare_choices(unique_lfs, full_lf_id, full_lf_id, lf_type), selected = unique_lfs$full_lf_id[1] ) @@ -392,7 +399,7 @@ DTOutput("track_data") Col {data-width=500} ------------------------------------ -### Normalization Cost Index {data-height=500} +### Normalization Cost Index {data-height=700} ```{r} output$cost_index_chart <- renderDygraph({ @@ -411,14 +418,25 @@ output$cost_index_chart <- renderDygraph({ dyRangeSelector(height = 30) }) -#observeEvent(input$storm_overview_select_base, { - # TODO: add button to select normalized costs -#}) +df <- data.frame(lf_type = c("LF", "LF", "LF", "DIL", "DIL", "DIL", "DIL", "ID", "ID", "ID", "ID"), lf_id = c("1", "2", "3", "1", "2", "3", "4", "1", "2", "3", "4")) + +df_tree <- create_tree(df, levels = names(df)) fluidRow( style = "height: 100%", column(3, - selectInput("storm_overview_cost_index_lf", "Landfall", choices = NULL), + #selectInput("storm_overview_cost_index_lf", "Landfall", choices = NULL), + #treeInput("storm_overview_cost_index_lf_tree", "Landfalls", choices = df_tree, returnValue = "text") + virtualSelectInput("storm_overview_cost_index_lf_select", "Landfalls", + #choices = list( + # "LF" = c("LF1", "LF2", "LF3"), + # "DIL" = c("DIL1", "DIL2", "DIL3", "DIL4"), + # "ID" = c("ID1", "ID2", "ID3", "ID4") + #), + choices = NULL, + showValueAsTags = T, + multiple = T, + autoSelectFirstOption = T), radioGroupButtons("storm_overview_cost_index_value", label = "Value", choices = c("Index", "Loss"), status = "outline-primary rounded-0", justified = T) ), column(9, @@ -427,7 +445,7 @@ fluidRow( ) ``` -### Landfalls {data-height=500 .no-padding} +### Landfalls {data-height=300 .no-padding} ```{r} output$landfalls_table <- renderDT({ req(storm_selection$is_selected)