79303721

Date: 2024-12-23 16:59:05
Score: 1
Natty:
Report link

Thank you for pointing out the direction, @thekangaroofactory! I have fixed part of the original issue. Initially, I have to click on all tabs until I reached the last tab for the plots to be rendered in each tab. I changed the selectedData() reactive expression and broke down the reactive expression to multiple reactive corresponding to each plot in each tab. It solved the delaying of rendering plots across tabs. However, the ERROR message of attempt to select less than one element in get1index, still persists for the first time I clicked on each tab. The ERROR message will flash for less than half second before plots render. After the initial rendering of the plots, the error message does not show up anymore when I make selections on the study level or KPI level. My revised code which solved the first part of the issue is following. Of course, I also have to revise all corresponding part in renderPlot() accordingly.

## Debug plot render issue: Unwrap data selection from a list of reactive expression
  cumulative_data <- reactive({
    data_list <- get(input$cumulative_comparison_type)
    study_data <- data_list[[input$select_cumulative_study]]
    kpi_data <- study_data[[input$select_cumulative_metric]]
    })
  
  monthly_data <- reactive({
    data_list <- get(input$monthly_comparison_type)
    study_data <- data_list[[input$select_monthly_study]]
    kpi_data <- study_data[[input$select_monthly_metric]]
    })
        
  overall_data <- reactive({
    data_list <- get(input$overall_comparison_type)
    study_data <- data_list[[input$select_overall_study]]
    kpi_data <- study_data[[input$select_overall_metric]]
    })
Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @thekangaroofactory
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Jane Lu