facets column fixed: fixed bug complete data x order
This commit is contained in:
parent
552675f0a2
commit
63db3566fb
|
@ -1,5 +1,5 @@
|
|||
Package: apexcharter
|
||||
Version: 0.1.8.900
|
||||
Version: 0.1.8.910
|
||||
Title: Create Interactive Chart with the JavaScript 'ApexCharts' Library
|
||||
Description: Provides an 'htmlwidgets' interface to 'apexcharts.js'.
|
||||
'Apexcharts' is a modern JavaScript charting library to build interactive charts and visualizations with simple API.
|
||||
|
|
11
R/facets.R
11
R/facets.R
|
@ -511,14 +511,21 @@ knit_print.apex_facet <- function(x, ..., options = NULL) { # nocov start
|
|||
|
||||
complete_mapdata <- function(mapdata, mapall) {
|
||||
data <- as.data.frame(mapdata)
|
||||
full_data <- data.frame(x = unique(mapall$x), stringsAsFactors = FALSE)
|
||||
full_x <- unique(mapall$x)
|
||||
full_data <- data.frame(
|
||||
xorder = seq_along(full_x),
|
||||
x = full_x,
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
full_data <- merge(
|
||||
x = full_data,
|
||||
y = data,
|
||||
by = "x",
|
||||
all.x = TRUE,
|
||||
sort = TRUE
|
||||
sort = FALSE
|
||||
)
|
||||
full_data <- full_data[order(full_data$xorder), ]
|
||||
full_data$xorder <- NULL
|
||||
full_data$y[is.na(full_data$y)] <- 0
|
||||
return(as.list(full_data))
|
||||
}
|
||||
|
|
|
@ -221,6 +221,7 @@ test_that("complete_mapdata works", {
|
|||
|
||||
expect_is(cmd, "list")
|
||||
expect_length(cmd$x, 12)
|
||||
expect_identical(cmd$x, month.name)
|
||||
})
|
||||
|
||||
test_that("complete_data works", {
|
||||
|
|
Loading…
Reference in New Issue