Skip to content

Commit

Permalink
CanvasXpress Version 51.0
Browse files Browse the repository at this point in the history
  • Loading branch information
neuhausi committed Jul 8, 2024
1 parent 3edb1bc commit a12266e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
24 changes: 19 additions & 5 deletions R/ggplot_as_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,12 @@ gg_order <- function(o, b) {
o <- ggplot2::last_plot()
}
r <- Filter(Negate(is.null), sapply(o$data, levels))
r$xLabels <- as.character(b$layout$panel_params[[1]]$x$get_labels())
r$yLabels <- as.character(b$layout$panel_params[[1]]$y$get_labels())
if (!is.null(b$layout$panel_params[[1]]$x)) {
r$xLabels <- as.character(b$layout$panel_params[[1]]$x$get_labels())
}
if (!is.null(b$layout$panel_params[[1]]$y)) {
r$yLabels <- as.character(b$layout$panel_params[[1]]$y$get_labels())
}
r
}

Expand Down Expand Up @@ -412,6 +416,12 @@ gg_coordinates <- function(o) {
r$setMinY <- o$coordinates$limits$y[1]
r$setMaxY <- o$coordinates$limits$y[2]
}
l <- c("r", "theta", "start", "end", "direction", "inner_radius", "arc")
for (i in l) {
if (!is.null(o$coordinates[[i]])) {
r[[i]] <- o$coordinates[[i]]
}
}
r
}

Expand Down Expand Up @@ -666,22 +676,26 @@ data_to_matrix <- function(o, b) {
m <- c("x", "y", "z")
d <- o$data
nd <- data.frame(lapply(d, as.character), stringsAsFactors = FALSE, check.names = FALSE)
k <- length(row.names(nd))
for (i in m) {
if (!is.null(o$mapping[[i]])) {
q <- rlang::as_label(o$mapping[[i]])
if (q %in% colnames(o$data) || q == "1") {
## Nothing to do
} else if (i == "label") {
u <- as.character(b$data[[1]][[i]])
nd[i] <- u
if (length(u) == k) {
nd[i] <- u
}
} else {
u <- as.numeric(b$data[[1]][[i]])
nd[q] <- u
if (length(u) == k) {
nd[q] <- u
}
}
}
}
for (i in 1:length(layers)) {
l <- layers[i]
q <- class(o$layers[[i]]$geom)[1]
if (q != "GeomBlank") {
for (j in m) {
Expand Down
6 changes: 3 additions & 3 deletions inst/htmlwidgets/lib/canvasXpress/canvasXpress.min.js

Large diffs are not rendered by default.

0 comments on commit a12266e

Please sign in to comment.