auto_fit_config {g6R} | R Documentation |
Create Auto-Fit Configuration for G6 Graphs
Description
Configures the auto-fit behavior for a G6 graph. Auto-fit automatically adjusts the view to fit all elements or centers them within the canvas.
Usage
auto_fit_config(
type = c("view", "center"),
when = c("overflow", "always"),
direction = c("x", "y", "both"),
duration = 1000,
easing = c("ease-in-out", "ease", "ease-in", "ease-out", "linear", "cubic-bezier",
"step-start", "step-end")
)
Arguments
type |
The auto-fit mode to use. Options:
|
when |
When the auto-fit should be triggered. Options:
|
direction |
The direction for auto-fit adjustment. Options:
|
duration |
The duration of the auto-fit animation in milliseconds (default: 1000) |
easing |
The animation easing function to use. Options:
|
Details
The auto-fit feature helps ensure that graph elements remain visible within the canvas. It can be configured to either fit all elements to view or center them, and can be triggered under different conditions.
Value
A list containing the auto-fit configuration that can be passed to g6_options()
.
Examples
# Basic auto-fit configuration with default settings
config <- auto_fit_config()
# Auto-fit with only centering (no scaling)
config <- auto_fit_config(type = "center")
# Auto-fit that always triggers when graph data changes
config <- auto_fit_config(when = "always")
# Auto-fit only in the x direction
config <- auto_fit_config(direction = "x")
# Auto-fit with a fast animation
config <- auto_fit_config(duration = 300, easing = "ease-out")