Skip to contents

Configures interaction behaviors for a G6 graph visualization. This function collects and combines multiple behavior configurations into a list that can be passed to graph initialization functions.

Usage

g6_behaviors(graph, ...)

Arguments

graph

A g6 graph instance.

...

Behavior configuration objects created by behavior-specific functions. These can include any of the following behaviors:

Navigation behaviors:

Selection behaviors:

Editing behaviors:

Data Exploration behaviors:

Visual Optimization behaviors:

Value

A list of behavior configuration objects that can be passed to G6 graph initialization

Note

You can create custom behaviors from JavaScript and use them on the R side. See more at https://g6.antv.antgroup.com/en/manual/behavior/custom-behavior.

Examples

# Create a basic set of behaviors
behaviors <- g6_behaviors(
  drag_canvas(),
  zoom_canvas(),
  click_select()
)

# Create a more customized set of behaviors
behaviors <- g6_behaviors(
  drag_canvas(),
  zoom_canvas(sensitivity = 1.5),
  hover_activate(state = "highlight"),
  fix_element_size(
    node = list(
      list(shape = "circle", fields = c("r", "lineWidth"))
    )
  )
)