Skip to content

Commit

Permalink
update graph to show last save plot
Browse files Browse the repository at this point in the history
  • Loading branch information
stephpenn1 committed Dec 18, 2023
1 parent 662a896 commit bb0b6b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions h2/components/functions/func_graph_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ graph_plots <- function(r6) {
if (r6$save == TRUE) {
#browser()

{ggplot(r6$no_save_output) +
geom_line(aes(x = year, y = value, color = ssp)) +
{ggplot(last(r6$output)) +
geom_line(aes(x = year, y = value, color = Scenario)) +
labs(x = "Year", y = last(r6$output)$variable[1],
title = paste0("Run Name: ", last(r6$output)$run[1], "\n", "Variable: ", last(r6$output)$variable[1])) +
theme(legend.position = "bottom")} %>%
Expand Down
12 changes: 6 additions & 6 deletions h2/components/modules/mod_run.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ run_ui <- function(id) {
),
fluidRow(
actionBttn(ns("run"),"Run", color = "primary"),

),
fluidRow(
withSpinner(plotlyOutput(ns("graph")))
Expand All @@ -88,13 +87,9 @@ run_server <- function(id, r6) {
observe({

if (input$savetoggle == TRUE) {

r6$save <- TRUE

} else {

r6$save <- FALSE

}

r6$selected_var <- reactive({input$variable})
Expand All @@ -116,7 +111,6 @@ run_server <- function(id, r6) {
reset(core())
run(core())

#browser()
if (r6$save == TRUE) {

r6$output[[r6$run_name()]] <- fetchvars(core(), r6$time()[1]:r6$time()[2], vars = list(r6$selected_var())) %>%
Expand Down Expand Up @@ -149,6 +143,12 @@ run_server <- function(id, r6) {
}) %>%
bindEvent(input$savetoggle == FALSE)


save_table <- reactive(as.data.frame(names(r6$output)))
output$savetable <- renderDataTable({
save_table()
})

})
}

Expand Down

0 comments on commit bb0b6b5

Please sign in to comment.