Skip to content

Commit

Permalink
Merge branch '195-colour-code-the-categories-and-sentiment-columns' i…
Browse files Browse the repository at this point in the history
…nto public-view
  • Loading branch information
asegun-cod committed Nov 8, 2023
2 parents 475a8de + e9b5e28 commit 0c14746
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 27 deletions.
6 changes: 4 additions & 2 deletions R/mod_click_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
mod_click_tables_ui <- function(id) {
ns <- NS(id)
tagList(
uiOutput(ns("dynamic_click_tableUI"))
uiOutput(ns("dynamic_click_tableUI")) |>
shinycssloaders::withSpinner()
)
}

Expand Down Expand Up @@ -39,7 +40,8 @@ mod_click_tables_server <- function(id, filter_data, data_exists, comment_type =
shinycssloaders::withSpinner(),
hr(),
h5("Please select a Sub-category from the table above in other to drill down the table below"),
uiOutput(ns("comment_table"))
uiOutput(ns("comment_table")) |>
shinycssloaders::withSpinner()
)
})

Expand Down
58 changes: 42 additions & 16 deletions R/mod_demographics.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
mod_demographics_ui <- function(id) {
ns <- NS(id)

uiOutput(ns("dynamic_demo_UI"))
uiOutput(ns("dynamic_demo_UI")) |>
shinycssloaders::withSpinner()
}

#' demographics Server Functions
Expand Down Expand Up @@ -48,28 +49,53 @@ mod_demographics_server <- function(id, filter_data, data_exists) {
br(),
fluidRow(
if (has_demography_1) {
column(width, plotly::plotlyOutput(ns("demography_1_graph")))
column(
width,
plotly::plotlyOutput(ns("demography_1_graph")) |>
shinycssloaders::withSpinner()
)
},
if (has_demography_2) {
column(width, plotly::plotlyOutput(ns("demography_2_graph")))
column(
width,
plotly::plotlyOutput(ns("demography_2_graph")) |>
shinycssloaders::withSpinner()
)
},
if (has_demography_3) {
column(width, plotly::plotlyOutput(ns("demography_3_graph")))
column(
width,
plotly::plotlyOutput(ns("demography_3_graph")) |>
shinycssloaders::withSpinner()
)
}
),
hr(),
pre("The below chart shows the average percentage of FFT score for each group in the demographic feature.",
"Note: Categories with fewer than 10 individuals are excluded",
style = "background-color:#005EB8; color:#fff"),
"Note: Categories with fewer than 10 individuals are excluded",
style = "background-color:#005EB8; color:#fff"
),
fluidRow(
if (has_demography_1) {
column(width, plotly::plotlyOutput(ns("compare_demography_1")))
column(
width,
plotly::plotlyOutput(ns("compare_demography_1")) |>
shinycssloaders::withSpinner()
)
},
if (has_demography_2) {
column(width, plotly::plotlyOutput(ns("compare_demography_2")))
column(
width,
plotly::plotlyOutput(ns("compare_demography_2")) |>
shinycssloaders::withSpinner()
)
},
if (has_demography_3) {
column(width, plotly::plotlyOutput(ns("compare_demography_3")))
column(
width,
plotly::plotlyOutput(ns("compare_demography_3")) |>
shinycssloaders::withSpinner()
)
}
)
)
Expand All @@ -78,23 +104,23 @@ mod_demographics_server <- function(id, filter_data, data_exists) {
# distribution----

output$demography_1_graph <- plotly::renderPlotly({
demo_data <- filter_data()$unique_data %>%
demo_data <- filter_data()$unique_data |>
dplyr::arrange(get_golem_config("demography_1"))
demo_data[, get_golem_config("demography_1")] <- demo_data[, get_golem_config("demography_1")] %>%
unlist(use.names = F) %>%
demo_data[, get_golem_config("demography_1")] <- demo_data[, get_golem_config("demography_1")] |>
unlist(use.names = F) |>
factor()
demo_data %>%

demo_data |>
demographic_distribution(variable = get_golem_config("demography_1"))
})

output$demography_2_graph <- plotly::renderPlotly({
filter_data()$unique_data %>%
filter_data()$unique_data |>
demographic_distribution(variable = get_golem_config("demography_2"))
})

output$demography_3_graph <- plotly::renderPlotly({
filter_data()$unique_data %>%
filter_data()$unique_data |>
demographic_distribution(variable = get_golem_config("demography_3"))
})

Expand Down
11 changes: 2 additions & 9 deletions R/mod_trend.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ mod_trend_ui <- function(id) {

tagList(
br(),
uiOutput(ns("dynamic_trendUI"))
uiOutput(ns("dynamic_trendUI")) |>
shinycssloaders::withSpinner()
)
}

Expand Down Expand Up @@ -55,9 +56,6 @@ mod_trend_server <- function(id, filter_data, data_exists) {
plotly::plotlyOutput(ns("super_category_trend_plot")) %>%
shinycssloaders::withSpinner(),
hr(),
# downloadButton(ns("super_category_download_data"), "Download data",
# icon = icon("download")
# ),
uiOutput(ns("dynamic_super_category_table"))
),

Expand All @@ -70,16 +68,11 @@ mod_trend_server <- function(id, filter_data, data_exists) {
plotly::plotlyOutput(ns("sub_category_trend_plot")) %>%
shinycssloaders::withSpinner(),
hr(),
# downloadButton(ns("sub_category_download_data"), "Download data",
# icon = icon("download")
# ),
uiOutput(ns("dynamic_sub_category_table"))
)
)
)
)
# hr(),
# DT::DTOutput(ns("dynamic_super_category_table"))
)
})

Expand Down

0 comments on commit 0c14746

Please sign in to comment.