brush_select {g6R} | R Documentation |
Configure Brush Selection Interaction
Description
Creates a configuration object for brush selection interaction in graph visualizations. This function configures how elements are selected when using a brush selection tool.
Usage
brush_select(
key = "brush-select",
animation = FALSE,
enable = JS("(e) => {\n return true\n }"),
enableElements = "node",
immediately = FALSE,
mode = c("default", "union", "intersect", "diff"),
onSelect = NULL,
state = c("selected", "active", "inactive", "disabled", "highlight"),
style = NULL,
trigger = "shift",
...
)
Arguments
key |
Behavior unique identifier. Useful to modify this behavior from JS side. |
animation |
Whether to enable animation (boolean, default: FALSE). |
enable |
Whether to enable brush select functionality (boolean or function, default: TRUE). |
enableElements |
Types of elements that can be selected (character vector, default: "node").
Can be |
immediately |
Whether to select immediately in default mode (boolean, default: FALSE). |
mode |
Selection mode: "union", "intersect", "diff", or "default" (string, default: "default"). |
onSelect |
Callback for selected element state (JS function). |
state |
State to switch to when selected (string, default: "selected"). |
style |
Style specification for the selection box (list). See https://g6.antv.antgroup.com/en/manual/behavior/brush-select#style. |
trigger |
Shortcut keys for selection (character vector). |
... |
Extra parameters. See https://g6.antv.antgroup.com/en/manual/behavior/brush-select. |
Value
A list with the configuration settings for the brush select behavior.
Examples
# Basic configuration
config <- brush_select()
# Custom configuration
config <- brush_select(
animation = TRUE,
enableElements = c("node", "edge"),
mode = "union",
state = "highlight",
style = list(
fill = "rgba(0, 0, 255, 0.1)",
stroke = "blue",
lineWidth = 2
),
trigger = c("Shift")
)