Skip to content
This is the alpha v4 version website. Looking for the v3 documentation?

Settings

Settings control camera behavior, interaction, and rendering performance. They are separate from styles, which handle visual appearance.

Pass settings when creating a sigma instance:

const renderer = new Sigma(graph, container, {
settings: {
renderEdgeLabels: true,
enableEdgeEvents: true,
hideEdgesOnMove: true,
},
});

Update settings at runtime with renderer.setSettings():

renderer.setSettings({ hideEdgesOnMove: true });

Rendering

SettingTypeDefaultDescription
renderLabelsbooleantrueWhether to render node labels
renderEdgeLabelsbooleanfalseWhether to render edge labels
enableEdgeEventsbooleanfalseEnable mouse events on edges (has a performance cost)
nodeLabelEventsfalse | "extend" | "separate"falseEnable node label events. "extend" routes hits to the parent node event; "separate" makes labels standalone targets.
edgeLabelEventsfalse | "extend" | "separate"falseEnable edge label events. "extend" routes hits to the parent edge event; "separate" makes labels standalone targets.
stagePaddingnumber30Padding around the graph in pixels
minEdgeThicknessnumber1.7Minimum edge thickness in pixels
antiAliasingFeathernumber1Anti-aliasing feather amount for WebGL rendering
pickingDownSizingRationumber2Down-sizing ratio for the picking framebuffer
nodePickingPaddingnumber0Extra pixel padding added around nodes when picking under the cursor
edgePickingPaddingnumber4Extra pixel padding added around edges when picking under the cursor
labelPickingPaddingnumber10Extra pixel padding added around labels when picking under the cursor
maxDepthLevelsnumber20Maximum number of depth levels for z-ordering

Camera

SettingTypeDefaultDescription
enableCameraZoomingbooleantrueAllow zooming with the mouse wheel
enableCameraPanningbooleantrueAllow panning by dragging the background
enableCameraRotationbooleantrueAllow camera rotation
enableCameraMouseRotationbooleantrueAllow mouse-based camera rotation
minCameraRationumber | nullnullMinimum zoom level (smaller = more zoomed in). null means no limit
maxCameraRationumber | nullnullMaximum zoom level (larger = more zoomed out). null means no limit
cameraPanBoundariessee belownullConstrain the camera panning area
enableScrollBlockingbooleantrueWhen zoom hits a min/max bound, block page scroll so wheel events keep targeting sigma
scrollBlockingReleaseThresholdnumber5Number of consecutive wheel events at a zoom boundary still blocked before page scroll is released. Infinity never releases.

Camera pan boundaries

The cameraPanBoundaries setting accepts:

  • null: no boundaries (default)
  • true: automatically constrain to the graph extent
  • An object with tolerance and/or boundaries:
{
tolerance: 0.1,
boundaries: { x: [-100, 100], y: [-100, 100] }
}

Sizing and scaling

SettingTypeDefaultDescription
itemSizesReference"screen" | "positions""positions"Reference space for node/edge sizes. "positions": sizes live in graph space and scale with zoom. "screen": sizes stay constant in screen pixels regardless of zoom. In both modes zoomToSizeRatioFunction still applies
zoomToSizeRatioFunction(ratio: number) => numberMath.sqrtMaps camera zoom ratio to a size scaling factor. Applied in both "screen" and "positions" modes
autoRescaleboolean | "once"trueAutomatically rescale the graph to fit the viewport. "once" captures the initial extent and freezes it, useful for drag-and-drop scenarios

Label optimization

SettingTypeDefaultDescription
labelRenderedSizeThresholdnumber6Minimum rendered node size (in pixels) for its label to be displayed
labelDensitynumber1Controls how many labels are shown. Higher values show more labels (must be positive)
labelGridCellSizenumber100Size of the label grid cells used for density-based culling
labelPixelSnappingbooleantrueSnap label positions to whole pixels for sharper text rendering

Node drag

SettingTypeDefaultDescription
enableNodeDragbooleanfalseAllow users to drag nodes. See the drag and drop guide
getDraggedNodes(node: string) => string[][node]Returns the list of nodes to move when a drag starts. Override to implement multi-node drag
dragPositionToAttributes((pos, node) => Record<string, unknown>) | nullnullTransforms the drag position before writing it to the graph. Use for snapping or mapping to non-x/y attributes. null = no-op

Performance

SettingTypeDefaultDescription
hideEdgesOnMovebooleanfalseHide edges while the camera is moving (panning, zooming)
hideLabelsOnMovebooleanfalseHide labels while the camera is moving

Mouse and touch interaction

SettingTypeDefaultDescription
zoomingRationumber1.7Zoom factor per mouse wheel step
zoomDurationnumber250Zoom animation duration in milliseconds
doubleClickZoomingRationumber2.2Zoom factor on double click
doubleClickZoomingDurationnumber200Double-click zoom animation duration in milliseconds
doubleClickTimeoutnumber300Maximum delay between two clicks to register as a double click (ms)
inertiaDurationnumber200Inertia duration after a pan gesture (ms)
inertiaRationumber3Inertia strength multiplier
dragTimeoutnumber100Delay before a mouse-down is considered a drag (ms)
draggedEventsTolerancenumber3Pixel tolerance before a click becomes a drag
tapMoveTolerancenumber10Pixel tolerance for touch tap detection

Lifecycle

SettingTypeDefaultDescription
allowInvalidContainerbooleanfalseAllow creating a sigma instance with an invalid (e.g. zero-size) container

Debug

SettingTypeDefaultDescription
DEBUG_displayPickingLayerbooleanfalseDisplay the picking layer for debugging node/edge hit detection