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

Main text update #56

Merged
merged 5 commits into from
Jul 18, 2023
Merged
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
6 changes: 6 additions & 0 deletions R/html.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,9 @@ insert_table_toggle <- function(output_name) {

return(html)
}

accessible_tabs <- function() {
"<script>
$('.nav-link').attr('tab-index', '0');
</script>"
}
14 changes: 10 additions & 4 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ plot_stacked <- function(data, n, break_q_names_col, type = c("bar", "line"), ma

data[[break_q_names_col]] <- break_q_names(data[[break_q_names_col]], max_lines = max_lines)

data[[break_q_names_col]] <- factor(data[[break_q_names_col]], levels = data[[break_q_names_col]])
data[[break_q_names_col]] <- factor(data[[break_q_names_col]], levels = unique(data[[break_q_names_col]]))
}

colour_scale <- match.arg(colour_scale)
Expand Down Expand Up @@ -433,21 +433,26 @@ plot_grouped <- function(data, n, break_q_names_col, max_lines = 2, xlab = "", y
data[[break_q_names_col]] <- factor(data[[break_q_names_col]], levels = data[[break_q_names_col]])
}

data[[1]] <- factor(x[[1]], levels = x[[1]])
data[[2]] <- factor(x[[2]], levels = unique(x[[2]]))
data[[1]] <- factor(data[[1]], levels = unique(data[[1]]))
data[[2]] <- factor(data[[2]], levels = unique(data[[2]]))

orientation <- match.arg(orientation)

axes <- axis_settings(xlab, ylab, font_size)

if (orientation == "v") {
data[[1]] <- factor(data[[1]], levels = unique(data[[1]]))
data[[2]] <- factor(data[[2]], levels = unique(data[[2]]))
x_vals <- data[[1]]
y_vals <- data[[3]]
x_axis <- axes$cat_axis
y_axis <- axes$scale_axis
legend = list(traceorder = 'normal')
} else if (orientation == "h") {
x_vals <- data[[3]]
data[[1]] <- factor(rev(data[[1]]), levels = rev(unique(data[[1]])))
data[[2]] <- factor(rev(data[[2]]), levels = rev(unique(data[[2]])))
colours <- rev(colours)
x_vals <- rev(data[[3]])
y_vals <- data[[1]]
x_axis <- axes$scale_axis
y_axis <- axes$cat_axis
Expand Down Expand Up @@ -475,6 +480,7 @@ plot_grouped <- function(data, n, break_q_names_col, max_lines = 2, xlab = "", y
fig <- plotly::layout(fig,
xaxis = x_axis,
yaxis = y_axis,
legend = legend,
margin = list(b = 100, t = font_size * 2),
hoverlabel = list(bgcolor = "white", font = list(size = font_size)),
annotations = list(x = 1, y = 0, text = sample,
Expand Down
13 changes: 1 addition & 12 deletions R/render.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,13 @@
#'
#' @description render CARS publication from quarto
#'
#' @param data full pre-processed CARS dataset
#' @param path quarto input
#' @param path execute directory
#' @param output_path output path (will overwrite existing outputs). Should match the path set in the quarto site yaml
#'
#' @export

render_site <- function(data, path = "quarto/main", output_path = "docs/") {
unlink(output_path, recursive = TRUE)

dir.create("../temp")
save(data, file = "../temp/data.rda")

# executes in higher directory level to avoid issues with .quarto stopping package from building

render_site <- function(path = "quarto/main", output_path = "docs/") {
quarto::quarto_render(input = path, as_job = FALSE)

unlink("../temp", recursive = TRUE)
}

#' @title create filtered pages
Expand Down
2 changes: 1 addition & 1 deletion main.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ data <- CARS::get_tidy_data_file("2022_data.csv") %>%

CARS::create_filtered_pages(data, type = "departments")
CARS::create_filtered_pages(type = "professions")
CARS::render_site(data)
CARS::render_site()
6 changes: 3 additions & 3 deletions man/display_prof_langs.Rd

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

4 changes: 2 additions & 2 deletions man/plot_likert.Rd

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

6 changes: 2 additions & 4 deletions man/render_site.Rd

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

2 changes: 1 addition & 1 deletion quarto/main/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project:
output-dir: ../../docs/

website:
title: "DRAFT: Coding in Analysis and Research Survey 2022"
title: Coding in Analysis and Research Survey 2022"
shilohd marked this conversation as resolved.
Show resolved Hide resolved
navbar:
background: primary
left:
Expand Down
8 changes: 0 additions & 8 deletions quarto/main/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
title: "Home"
---

## Draft notice

Please note that all outputs are provisional. All findings have been thoroughly quality assured. However, the outputs presented here may change.

While any changes to the data are not likely to be substantial, we are planning to carry out more in-depth analysis and the commentary may change. As such, we recommend linking to these pages rather than sharing this analysis any other way at this stage.



## How do analysts use programming and software engineering in the UK Public Sector?

Please note it is possible that the figures presented here will change in future.
shilohd marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
3 changes: 1 addition & 2 deletions quarto/main/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@
color: black;
}


.toggle-button {
text-decoration: underline;
}

.toggle-button:focus {
.toggle-button:hover {
background-color: #ffdd00;
border-bottom: 4px solid black;
color: black;
Expand Down
Loading