hafen / trelliscopejs

@@ -30,16 +30,16 @@
Loading
30 30
make_png <- function(p, file, width, height, orig_width = width, res = 72,
31 31
  base_point_size = 12, pixelratio = 2) {
32 32
33 -
  if (capabilities("aqua")) {
34 -
    pngfun <- grDevices::png
35 -
  } else {
36 -
    pkg <- "Cairo" # nolint
37 -
    if (suppressWarnings(suppressMessages(require(pkg, character.only = TRUE)))) {
38 -
      pngfun <- Cairo::CairoPNG
39 -
    } else {
40 -
      pngfun <- grDevices::png
41 -
    }
42 -
  }
33 +
  pngfun <- grDevices::png
34 +
  # if (capabilities("aqua")) {
35 +
  # } else {
36 +
  #   pkg <- "Cairo" # nolint
37 +
  #   if (suppressWarnings(suppressMessages(require(pkg, character.only = TRUE)))) {
38 +
  #     pngfun <- Cairo::CairoPNG
39 +
  #   } else {
40 +
  #     pngfun <- grDevices::png
41 +
  #   }
42 +
  # }
43 43
44 44
  units <- get_png_units(width, height, orig_width, res,
45 45
    base_point_size, pixelratio)

@@ -134,7 +134,6 @@
Loading
134 134
#' @param val A string indicating the value of the filter.
135 135
#' @param desc a description for this cognostic value
136 136
#' @param group optional categorization of the cognostic for organizational purposes in the viewer (currently not implemented in the viewer)
137 -
#' @param type the desired type of cognostic you would like to compute (see details)
138 137
#' @param default_label should this cognostic be used as a panel label in the viewer by default?
139 138
#' @param default_active should this cognostic be active (available for sort / filter / sample) by default?
140 139
#' @param filterable should this cognostic be filterable?  Default is \code{TRUE}.  It can be useful to set this to \code{FALSE} if the cognostic is categorical with many unique values and is only desired to be used as a panel label.

@@ -82,28 +82,40 @@
Loading
82 82
  ret
83 83
}
84 84
85 -
#' Add method for gg / facet_trelliscope
86 -
#' @param e1 a object with class gg
87 -
#' @param e2 if object is of class 'facet_trelliscope', then 'facet_trelliscope' will be appended to the class of e1
88 85
#' @export
89 -
#' @importFrom ggplot2 %+%
90 -
`+.gg` <- function (e1, e2) {
91 -
  if (inherits(e2, "facet_trelliscope")) {
92 -
93 -
    # e1 <- e1 %+% (e2$facet_wrap)
94 -
    attr(e1, "trelliscope") <- e2[c("facets", "facet_cols", "name", "group",
86 +
ggplot_add.facet_trelliscope <- function(object, plot, object_name) {
87 +
  attr(plot, "trelliscope") <- object[
88 +
    c("facets", "facet_cols", "name", "group",
95 89
      "desc", "md_desc", "height", "width", "state", "jsonp", "self_contained",
96 90
      "path", "state", "nrow", "ncol", "scales", "thumb", "as_plotly",
97 91
      "split_sig", "plotly_args", "plotly_cfg", "auto_cog", "split_layout",
98 92
      "data")]
99 -
    class(e1) <- c("facet_trelliscope", class(e1))
100 -
    return(e1)
101 -
    # return(print(e1))
102 -
  }
103 -
104 -
  e1 %+% e2
93 +
  class(plot) <- c("facet_trelliscope", class(plot))
94 +
  return(plot)
105 95
}
106 96
97 +
# #' Add method for gg / facet_trelliscope
98 +
# #' @param e1 a object with class gg
99 +
# #' @param e2 if object is of class 'facet_trelliscope', then 'facet_trelliscope' will be appended to the class of e1
100 +
# #' @export
101 +
# #' @importFrom ggplot2 %+%
102 +
# `+.gg` <- function (e1, e2) {
103 +
#   if (inherits(e2, "facet_trelliscope")) {
104 +
105 +
#     # e1 <- e1 %+% (e2$facet_wrap)
106 +
#     attr(e1, "trelliscope") <- e2[c("facets", "facet_cols", "name", "group",
107 +
#       "desc", "md_desc", "height", "width", "state", "jsonp", "self_contained",
108 +
#       "path", "state", "nrow", "ncol", "scales", "thumb", "as_plotly",
109 +
#       "split_sig", "plotly_args", "plotly_cfg", "auto_cog", "split_layout",
110 +
#       "data")]
111 +
#     class(e1) <- c("facet_trelliscope", class(e1))
112 +
#     return(e1)
113 +
#     # return(print(e1))
114 +
#   }
115 +
116 +
#   e1 %+% e2
117 +
# }
118 +
107 119
108 120
#' Print facet trelliscope object
109 121
#'
@@ -185,7 +197,18 @@
Loading
185 197
  # wrapper function that swaps out the data with a subset and removes the facet
186 198
  make_plot_obj <- function(dt, pos = -1) {
187 199
    q <- p
188 -
    q$data <- tidyr::unnest(dt, data)
200 +
    # dt$data <- lapply(dt$data, function(x) {
201 +
    #   idx <- which(unlist(lapply(x, function(a) inherits(a, "cog"))))
202 +
    #   for (ii in idx) {
203 +
    #     class(x[[ii]]) <- setdiff(class(x[[ii]]), "cog")
204 +
    #   }
205 +
    #   x
206 +
    # })
207 +
    # q$data <- tidyr::unnest(dt, data)
208 +
    nms <- setdiff(names(dt), "data")
209 +
    tmp <- dt$data[[1]]
210 +
    for (nm in nms) tmp[[nm]] <- dt[[nm]]
211 +
    q$data <- tmp[, c(nms, setdiff(names(tmp), nms))]
189 212
    q <- add_trelliscope_scales(q, scales_info, show_warnings = (pos == 1))
190 213
    q
191 214
  }

@@ -10,3 +10,23 @@
Loading
10 10
sort_spec <- function(name, dir = "asc") {
11 11
  list(name = name, dir = dir)
12 12
}
13 +
14 +
# #' Specify how a display should be filtered
15 +
# #'
16 +
# #' @param name variable name to sort on
17 +
# #' @param type either "select" or "regex"
18 +
# #' @param value If \code{type} is "select", a vector of values to select. If \code{type} is "regex", a string indicating a regular expression
19 +
# filter_cat_spec <- function(name, type = c("select", "regex"), value) {
20 +
#   if (type == "regex" && length(value) > 1)
21 +
#     stop_nice("If specifying a filter of type 'regex', the value must be a string.")
22 +
#   list(name = name, type = type, value = value)
23 +
# }
24 +
25 +
# #' Specify how a display should be filtered
26 +
# #'
27 +
# #' @param name variable name to sort on
28 +
# #' @param type either "select" or "regex"
29 +
# #' @param value If \code{type} is "select", a vector of values to select. If \code{type} is "regex", a string indicating a regular expression
30 +
# filter_num_spec <- function(name, from = NA, to = NA) {
31 +
#   list(name = name, from = from, to = to)
32 +
# }
Files Coverage
R 75.82%
Project Totals (11 files) 75.82%
1
comment: false
2

3
coverage:
4
  range: "70...95"
5
  status:
6
    patch:
7
      default:
8
        branches:
9
        - master
10
        - dev
11
        target: '80'
12
    project:
13
      default:
14
        branches:
15
        - master
16
        - dev
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading