Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace axes checkbox #129

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
### Breaking Changes
* Converted the `hline` parameter of `tm_g_gh_lineplot` to three parameters: `hline_arb`, `hline_arb_color` and `hline_arb_label`.

### Enhancements
* Added checkbox UI to replace the y and / or x axes with new break points derived from horizontal and or vertical lines.

### Miscellaneous
* Added basic logging to the modules.
* Rewrote modules to use `moduleServer` and updated calls to `teal.devel` modules which have also been written to use `moduleServer`.
Expand Down
2 changes: 2 additions & 0 deletions R/tm_g_gh_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ srv_g_boxplot <- function(id,
hline_arb <- horizontal_line()$line_arb
hline_arb_label <- horizontal_line()$line_arb_label
hline_arb_color <- horizontal_line()$line_arb_color
replace_y_axis <- horizontal_line()$replace_axis

hline_vars <- input$hline_vars
trt_group <- input$trt_group
Expand Down Expand Up @@ -473,6 +474,7 @@ srv_g_boxplot <- function(id,
alpha = .(alpha),
dot_size = .(dot_size),
font_size = .(font_size),
replace_y_axis = .(replace_y_axis),
unit = .("AVALU")
)
})
Expand Down
24 changes: 14 additions & 10 deletions R/tm_g_gh_correlationplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@
#' AVISIT == "SCREENING" ~ "SCR",
#' AVISIT == "BASELINE" ~ "BL",
#' grepl("WEEK", AVISIT) ~
#' paste(
#' "W",
#' trimws(
#' substr(
#' AVISIT,
#' start = 6,
#' stop = stringr::str_locate(AVISIT, "DAY") - 1
#' paste(
#' "W",
#' trimws(
#' substr(
#' AVISIT,
#' start = 6,
#' stop = stringr::str_locate(AVISIT, "DAY") - 1
#' )
#' )
#' )
#' ),
#' ),
#' TRUE ~ NA_character_
#' )) %>%
#' mutate(AVISITCDN = case_when(
Expand Down Expand Up @@ -772,6 +772,7 @@ srv_g_correlationplot <- function(id,
hline_arb <- horizontal_line()$line_arb
hline_arb_label <- horizontal_line()$line_arb_label
hline_arb_color <- horizontal_line()$line_arb_color
replace_y_axis <- horizontal_line()$replace_axis
hline_vars <- if (length(input$hline_vars) == 0) {
NULL
} else {
Expand All @@ -780,6 +781,7 @@ srv_g_correlationplot <- function(id,
vline_arb <- vertical_line()$line_arb
vline_arb_label <- vertical_line()$line_arb_label
vline_arb_color <- vertical_line()$line_arb_color
replace_x_axis <- vertical_line()$replace_axis
vline_vars <- if (length(input$vline_vars) == 0) {
NULL
} else {
Expand Down Expand Up @@ -845,7 +847,9 @@ srv_g_correlationplot <- function(id,
vline_arb_color = .(vline_arb_color),
vline_vars = .(vline_vars),
vline_vars_colors = .(vline_vars_colors[seq_along(vline_vars)]),
vline_vars_labels = .(paste(vline_vars_labels[seq_along(vline_vars)], "-", xaxis_param))
vline_vars_labels = .(paste(vline_vars_labels[seq_along(vline_vars)], "-", xaxis_param)),
replace_x_axis = .(replace_x_axis),
replace_y_axis = .(replace_y_axis)
)
print(p)
})
Expand Down
4 changes: 3 additions & 1 deletion R/tm_g_gh_density_distribution_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ srv_g_density_distribution_plot <- function(id, # nolint
hline_arb <- horizontal_line()$line_arb
hline_arb_label <- horizontal_line()$line_arb_label
hline_arb_color <- horizontal_line()$line_arb_color
replace_y_axis <- horizontal_line()$replace_axis
facet_ncol <- input$facet_ncol
validate(need(
is.na(facet_ncol) || (as.numeric(facet_ncol) > 0 && as.numeric(facet_ncol) %% 1 == 0),
Expand Down Expand Up @@ -356,7 +357,8 @@ srv_g_density_distribution_plot <- function(id, # nolint
hline_arb = .(hline_arb),
hline_arb_label = .(hline_arb_label),
hline_arb_color = .(hline_arb_color),
rug_plot = .(rug_plot)
rug_plot = .(rug_plot),
replace_y_axis = .(replace_y_axis)
)
})
)
Expand Down
4 changes: 3 additions & 1 deletion R/tm_g_gh_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ srv_lineplot <- function(id,
hline_arb <- horizontal_line()$line_arb
hline_arb_label <- horizontal_line()$line_arb_label
hline_arb_color <- horizontal_line()$line_arb_color
replace_y_axis <- horizontal_line()$replace_axis

chunks_push(
chunks = private_chunks,
Expand Down Expand Up @@ -728,7 +729,8 @@ srv_lineplot <- function(id,
dodge = .(dodge),
count_threshold = .(count_threshold),
table_font_size = .(table_font_size),
display_center_tbl = .(include_stat)
display_center_tbl = .(include_stat),
replace_y_axis = .(replace_y_axis)
)
print(p)
})
Expand Down
4 changes: 3 additions & 1 deletion R/tm_g_gh_spaghettiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ srv_g_spaghettiplot <- function(id,
hline_arb <- horizontal_line()$line_arb
hline_arb_label <- horizontal_line()$line_arb_label
hline_arb_color <- horizontal_line()$line_arb_color
replace_y_axis <- horizontal_line()$replace_axis
group_stats <- input$group_stats
font_size <- input$font_size
alpha <- input$alpha
Expand Down Expand Up @@ -438,7 +439,8 @@ srv_g_spaghettiplot <- function(id,
group_stats = .(group_stats),
hline_vars = .(hline_vars),
hline_vars_colors = .(hline_vars_colors[seq_along(hline_vars)]),
hline_vars_labels = .(hline_vars_labels[seq_along(hline_vars)])
hline_vars_labels = .(hline_vars_labels[seq_along(hline_vars)]),
replace_y_axis = .(replace_y_axis)
)
print(p)
})
Expand Down
10 changes: 8 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ ui_arbitrary_lines <- function(id, line_arb, line_arb_label, line_arb_color, tit
tags$b(title),
textInput(ns("line_arb"), label = "Value:", value = paste(line_arb, collapse = ", ")),
textInput(ns("line_arb_label"), label = "Label:", value = paste(line_arb_label, collapse = ", ")),
textInput(ns("line_arb_color"), label = "Color:", value = paste(line_arb_color, collapse = ", "))
textInput(ns("line_arb_color"), label = "Color:", value = paste(line_arb_color, collapse = ", ")),
checkboxInput(ns("replace_axis"), label = "Replace axis break points", value = FALSE)
)
}
#' Server module to arbitrary lines
Expand Down Expand Up @@ -460,7 +461,12 @@ srv_arbitrary_lines <- function(id) {
)
}
}
list(line_arb = line_arb, line_arb_label = line_arb_label, line_arb_color = line_arb_color)
list(
line_arb = line_arb,
line_arb_label = line_arb_label,
line_arb_color = line_arb_color,
replace_axis = input$replace_axis
)
})
})
}
Expand Down
18 changes: 9 additions & 9 deletions man/tm_g_gh_correlationplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.