rte-antares-rpackage / leaflet.minicharts

Compare f0ee296 ... +21 ... ce29abf

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 2 of 19 files from the diff.

@@ -61,6 +61,8 @@
Loading
61 61
#' @param onChange (For power users who know javascript) A character string
62 62
#'   containing javascript code that is executed each time a chart is updated.
63 63
#'   See the details section to understand why and how to use this parameter.
64 +
#' @param popupOptions Change default popupOptions (ex : autoClose, maxHeight, closeButton ...)
65 +
#' See \code{\link[leaflet]{popupOptions}} for more informations.
64 66
#'
65 67
#' @details
66 68
#' Since version 0.5, the parameter \code{onChange} can be used to execute
@@ -122,6 +124,13 @@
Loading
122 124
#' mymap %>% updateMinicharts("c1", maxValues = 6)
123 125
#' mymap %>% updateMinicharts("c1", type="pie")
124 126
#'
127 +
#' # popupOptions
128 +
#' mymap <- leaflet() %>% addTiles() %>%
129 +
#'   addMinicharts(0, 0, chartdata = 1:3, layerId = "c1", popupOptions = list(closeButton = FALSE))
130 +
#'
131 +
#' mymap
132 +
#' mymap %>% updateMinicharts("c1", maxValues = 6, popupOptions = list(closeButton = TRUE))
133 +
#'
125 134
#' @export
126 135
#'
127 136
addMinicharts <- function(map, lng, lat, chartdata = 1, time = NULL, maxValues = NULL, type = "auto",
@@ -132,7 +141,8 @@
Loading
132 141
                          transitionTime = 750,
133 142
                          popup = popupArgs(),
134 143
                          layerId = NULL, legend = TRUE, legendPosition = "topright",
135 -
                          timeFormat = NULL, initialTime = NULL, onChange = NULL) {
144 +
                          timeFormat = NULL, initialTime = NULL, onChange = NULL,
145 +
                          popupOptions = NULL) {
136 146
  # Prepare options
137 147
  type <- match.arg(type, c("auto", "bar", "pie", "polar-area", "polar-radius"))
138 148
  if (is.null(layerId)) layerId <- sprintf("_minichart (%s,%s)", lng, lat)
@@ -176,7 +186,8 @@
Loading
176 186
177 187
  map <- invokeMethod(map, data = leaflet::getMapData(map), "addMinicharts",
178 188
                      args$options, args$chartdata, maxValues, colorPalette,
179 -
                      args$timeLabels, args$initialTime, args$popupArgs, args$onChange)
189 +
                      args$timeLabels, args$initialTime, args$popupArgs, args$onChange,
190 +
                      popupOptions)
180 191
181 192
  if (legend && length(args$legendLab) > 0 && args$ncol > 1) {
182 193
    legendCol <- colorPalette[(seq_len(args$ncols)-1) %% args$ncols + 1]
@@ -196,7 +207,8 @@
Loading
196 207
                             labelMaxSize = NULL, labelStyle = NULL,
197 208
                             transitionTime = NULL, popup = NULL,
198 209
                             legend = TRUE, legendPosition = NULL,
199 -
                             timeFormat = NULL, initialTime = NULL, onChange = NULL) {
210 +
                             timeFormat = NULL, initialTime = NULL, onChange = NULL,
211 +
                             popupOptions = NULL) {
200 212
201 213
  if (!is.null(type)) {
202 214
    type <- match.arg(type, c("auto", "bar", "pie", "polar-area", "polar-radius"))
@@ -258,7 +270,8 @@
Loading
258 270
  map %>%
259 271
    invokeMethod(leaflet::getMapData(map), "updateMinicharts",
260 272
                 args$options, args$chartdata, maxValues, colorPalette,
261 -
                 args$timeLabels, args$initialTime, args$popupArgs, args$legendLab, args$onChange)
273 +
                 args$timeLabels, args$initialTime, args$popupArgs,
274 +
                 args$legendLab, args$onChange, popupOptions)
262 275
}
263 276
264 277
#' @rdname addMinicharts

@@ -43,13 +43,23 @@
Loading
43 43
#'     time = bal$month
44 44
#'   )
45 45
#'
46 +
#' # popupOptions
47 +
#' data("eco2mixBalance")
48 +
#' bal <- eco2mixBalance
49 +
#' leaflet() %>% addTiles() %>%
50 +
#'   addFlows(
51 +
#'     bal$lng0, bal$lat0, bal$lng1, bal$lat1,
52 +
#'     flow = bal$balance,
53 +
#'     time = bal$month,
54 +
#'     popupOptions = list(closeOnClick = FALSE, autoClose = FALSE)
55 +
#'   )
46 56
#'
47 57
#' @export
48 58
addFlows <- function(map, lng0, lat0, lng1, lat1, color = "blue", flow = 1,
49 59
                     opacity = 1, dir = NULL, time = NULL, popup = popupArgs(labels = "Flow"),
50 60
                     layerId = NULL,
51 61
                     timeFormat = NULL, initialTime = NULL, maxFlow = max(abs(flow)),
52 -
                     minThickness = 1, maxThickness = 20) {
62 +
                     minThickness = 1, maxThickness = 20, popupOptions = NULL) {
53 63
  if (is.null(time)) time <- 1
54 64
  if (is.null(layerId)) layerId <- sprintf("_flow (%s,%s) -> (%s,%s)", lng0, lat0, lng1, lat1)
55 65
@@ -67,7 +77,7 @@
Loading
67 77
  map$dependencies <- c(map$dependencies, minichartDeps())
68 78
69 79
  invokeMethod(map, data = leaflet::getMapData(map), "addFlows", args$options,
70 -
               args$timeLabels, args$initialTime, args$popupArgs) %>%
80 +
               args$timeLabels, args$initialTime, args$popupArgs, popupOptions) %>%
71 81
    expandLimits(c(lat0, lat1), c(lng0, lng1))
72 82
}
73 83
@@ -76,7 +86,7 @@
Loading
76 86
updateFlows <- function(map, layerId, color = NULL, flow = NULL, opacity = NULL,
77 87
                        dir = NULL, time = NULL, popup = NULL,
78 88
                        timeFormat = NULL, initialTime = NULL, maxFlow = NULL,
79 -
                        minThickness = 1, maxThickness = 20) {
89 +
                        minThickness = 1, maxThickness = 20, popupOptions = NULL) {
80 90
  if (is.null(time)) time <- 1
81 91
82 92
  options <- .preprocessArgs(
@@ -94,7 +104,7 @@
Loading
94 104
  }
95 105
96 106
  invokeMethod(map, data = leaflet::getMapData(map), "updateFlows", args$options,
97 -
               args$timeLabels, args$initialTime, args$popupArgs)
107 +
               args$timeLabels, args$initialTime, args$popupArgs, popupOptions)
98 108
}
99 109
100 110
#' @rdname addFlows

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.

23 Commits

Hiding 21 contexual commits
+2
+2
Files Coverage
Project Totals (8 files) 93.46%
Loading