You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/legends.R
+19-5Lines changed: 19 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -186,6 +186,7 @@
186
186
#' @param filter_values For interactive legends, the actual data values to filter on. For categorical legends, use this when your display labels differ from the data values (e.g., values = c("Music", "Bar") for display, filter_values = c("music", "bar") for filtering). For continuous legends, provide numeric break values when using formatted display labels (e.g., values = get_legend_labels(scale), filter_values = get_breaks(scale)). If NULL (default), uses values.
187
187
#' @param classification A mapgl_classification object (from step_quantile, step_equal_interval, etc.) to use for the legend. When provided, values and colors will be automatically extracted. For interactive legends, range-based filtering will be used based on the classification breaks.
188
188
#' @param breaks Numeric vector of break points for filtering with classification-based legends. Typically extracted automatically from the classification object. Only needed if you want to override the default breaks.
189
+
#' @param draggable Logical, whether the legend can be dragged to a new position by the user. Default is FALSE.
189
190
#' @export
190
191
add_legend<-function(
191
192
map,
@@ -211,7 +212,8 @@ add_legend <- function(
211
212
filter_column=NULL,
212
213
filter_values=NULL,
213
214
classification=NULL,
214
-
breaks=NULL
215
+
breaks=NULL,
216
+
draggable=FALSE
215
217
) {
216
218
type<- match.arg(type)
217
219
if (is.null(unique_id)) {
@@ -263,7 +265,8 @@ if (is.null(values) || is.null(colors)) {
263
265
style,
264
266
interactive,
265
267
filter_column,
266
-
filter_values
268
+
filter_values,
269
+
draggable
267
270
)
268
271
} else {
269
272
add_categorical_legend(
@@ -287,7 +290,8 @@ if (is.null(values) || is.null(colors)) {
0 commit comments