Skip to main content

Class: Sigma<N, E, G>

Main class.

Param

Graph to render.

Param

DOM container in which to render.

Param

Optional settings.

Extends

  • TypedEventEmitter<SigmaEvents>

Type Parameters

N extends Attributes = Attributes

E extends Attributes = Attributes

G extends Attributes = Attributes

Constructors

new Sigma()

new Sigma<N, E, G>(graph, container, settings): Sigma<N, E, G>

Parameters

graph: AbstractGraph<N, E, G>

container: HTMLElement

settings: Partial<Settings<N, E, G>> = {}

Returns

Sigma<N, E, G>

Overrides

TypedEventEmitter<SigmaEvents>.constructor

Defined in

sigma/src/sigma.ts:192

Properties

rawEmitter

rawEmitter: EventEmitter<DefaultEventMap>

Inherited from

TypedEventEmitter.rawEmitter

Defined in

sigma/src/types.ts:109

Methods

addListener()

addListener<Event>(type, listener): this

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

listener: SigmaEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.addListener

Defined in

sigma/src/types.ts:115


clear()

clear(): this

Method used to clear all the canvases.

Returns

this

Defined in

sigma/src/sigma.ts:1948


createCanvas()

createCanvas(id, options): HTMLCanvasElement

Function used to create a canvas element.

Parameters

id: string

Context's id.

options: object & object | object = {}

Returns

HTMLCanvasElement

Defined in

sigma/src/sigma.ts:1567


createCanvasContext()

createCanvasContext(id, options): this

Function used to create a canvas context and add the relevant DOM elements.

Parameters

id: string

Context's id.

options = {}

options.style?: Partial<CSSStyleDeclaration>

Returns

this

Defined in

sigma/src/sigma.ts:1580


createLayer()

createLayer<T>(id, tag, options): T

Function used to create a layer element.

Type Parameters

T extends HTMLElement

Parameters

id: string

Context's id.

tag: string

The HTML tag to use.

options: object & object | object = {}

Returns

T

Defined in

sigma/src/sigma.ts:1528


createWebGLContext()

createWebGLContext(id, options): WebGLRenderingContext

Function used to create a WebGL context and add the relevant DOM elements.

Parameters

id: string

Context's id.

options: object & object | object = {}

#getContext params to override (optional)

Returns

WebGLRenderingContext

Defined in

sigma/src/sigma.ts:1601


emit()

emit<Event>(type, ...args): boolean

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

• ...args: Parameters<SigmaEvents[Event]>

Returns

boolean

Inherited from

TypedEventEmitter.emit

Defined in

sigma/src/types.ts:114


eventNames()

eventNames<Event>(): Event[]

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Returns

Event[]

Inherited from

TypedEventEmitter.eventNames

Defined in

sigma/src/types.ts:111


framedGraphToViewport()

framedGraphToViewport(coordinates, override): Coordinates

Method returning the coordinates of a point from the framed graph system to the viewport system. It allows overriding anything that is used to get the translation matrix, or even the matrix itself.

Be careful if overriding dimensions, padding or cameraState, as the computation of the matrix is not the lightest of computations.

Parameters

coordinates: Coordinates

override: CoordinateConversionOverride = {}

Returns

Coordinates

Defined in

sigma/src/sigma.ts:2121


getBBox()

getBBox(): object

Method returning the graph's bounding box.

Returns

object

x

x: Extent

y

y: Extent

Defined in

sigma/src/sigma.ts:2223


getCamera()

getCamera(): Camera

Method returning the renderer's camera.

Returns

Camera

Defined in

sigma/src/sigma.ts:1678


getCanvases()

getCanvases(): PlainObject<HTMLCanvasElement>

Method that returns the collection of all used canvases. At the moment, the instantiated canvases are the following, and in the following order in the DOM:

  • edges
  • nodes
  • edgeLabels
  • labels
  • hovers
  • hoverNodes
  • mouse

Returns

PlainObject<HTMLCanvasElement>

  • The collection of canvases.

Defined in

sigma/src/sigma.ts:2349


getContainer()

getContainer(): HTMLElement

Method returning the container DOM element.

Returns

HTMLElement

Defined in

sigma/src/sigma.ts:1699


getCustomBBox()

getCustomBBox(): null | object

Method returning the graph's custom bounding box, if any.

Returns

null | object

Defined in

sigma/src/sigma.ts:2232


getDimensions()

getDimensions(): Dimensions

Method returning the current renderer's dimensions.

Returns

Dimensions

Defined in

sigma/src/sigma.ts:1761


getEdgeDisplayData()

getEdgeDisplayData(key): undefined | DisplayData

Method used to get all the sigma edge attributes. It's useful for example to get values that are set by the edgeReducer.

Parameters

key: unknown

The edge's key.

Returns

undefined | DisplayData

A copy of the desired edge's attribute or undefined if not found

Defined in

sigma/src/sigma.ts:1799


getEdgeDisplayedLabels()

getEdgeDisplayedLabels(): Set<string>

Method used to get the set of currently displayed edge labels.

Returns

Set<string>

A set of edge keys whose label is displayed.

Defined in

sigma/src/sigma.ts:1818


getGraph()

getGraph(): AbstractGraph<N, E, G>

Method returning the renderer's graph.

Returns

AbstractGraph<N, E, G>

Defined in

sigma/src/sigma.ts:1708


getGraphDimensions()

getGraphDimensions(): Dimensions

Method returning the current graph's dimensions.

Returns

Dimensions

Defined in

sigma/src/sigma.ts:1770


getGraphToViewportRatio()

getGraphToViewportRatio(): number

Method returning the distance multiplier between the graph system and the viewport system.

Returns

number

Defined in

sigma/src/sigma.ts:2206


getMaxListeners()

getMaxListeners(): number

Returns

number

Inherited from

TypedEventEmitter.getMaxListeners

Defined in

sigma/src/types.ts:113


getMouseCaptor()

getMouseCaptor(): MouseCaptor<N, E, G>

Method returning the mouse captor.

Returns

MouseCaptor<N, E, G>

Defined in

sigma/src/sigma.ts:1743


getNodeDisplayData()

getNodeDisplayData(key): undefined | NodeDisplayData

Method used to get all the sigma node attributes. It's useful for example to get the position of a node and to get values that are set by the nodeReducer

Parameters

key: unknown

The node's key.

Returns

undefined | NodeDisplayData

A copy of the desired node's attribute or undefined if not found

Defined in

sigma/src/sigma.ts:1787


getNodeDisplayedLabels()

getNodeDisplayedLabels(): Set<string>

Method used to get the set of currently displayed node labels.

Returns

Set<string>

A set of node keys whose label is displayed.

Defined in

sigma/src/sigma.ts:1809


getRenderParams()

getRenderParams(): RenderParams

Function used to get the render params.

Returns

RenderParams

Defined in

sigma/src/sigma.ts:1493


getSetting()

getSetting<K>(key): Settings<N, E, G>[K]

Method returning the current value for a given setting key.

Type Parameters

K extends keyof Settings<N, E, G>

Parameters

key: K

The setting key to get.

Returns

Settings<N, E, G>[K]

The value attached to this setting key or undefined if not found

Defined in

sigma/src/sigma.ts:1837


getSettings()

getSettings(): Settings<N, E, G>

Method returning a copy of the settings collection.

Returns

Settings<N, E, G>

A copy of the settings collection.

Defined in

sigma/src/sigma.ts:1827


getStagePadding()

getStagePadding(): number

Function used to retrieve the actual stage padding value.

Returns

number

Defined in

sigma/src/sigma.ts:1515


getTouchCaptor()

getTouchCaptor(): TouchCaptor<N, E, G>

Method returning the touch captor.

Returns

TouchCaptor<N, E, G>

Defined in

sigma/src/sigma.ts:1752


getViewportZoomedState()

getViewportZoomedState(viewportTarget, newRatio): CameraState

Method used to (un)zoom, while preserving the position of a viewport point. Used for instance to zoom "on the mouse cursor".

Parameters

viewportTarget: Coordinates

newRatio: number

Returns

CameraState

Defined in

sigma/src/sigma.ts:2064


graphToViewport()

graphToViewport(graphPoint, override): Coordinates

Method used to translate a point's coordinates from the graph system (the reference system of data as they are in the given graph instance) to the viewport system (pixel distance from the top-left of the stage).

This method accepts an optional camera which can be useful if you need to translate coordinates based on a different view than the one being currently being displayed on screen.

Parameters

graphPoint: Coordinates

override: CoordinateConversionOverride = {}

Returns

Coordinates

Defined in

sigma/src/sigma.ts:2198


kill()

kill(): void

Method used to shut the container & release event listeners.

Returns

void

Defined in

sigma/src/sigma.ts:2252


killLayer()

killLayer(id): this

Function used to properly kill a layer.

Parameters

id: string

Layer id.

Returns

this

Defined in

sigma/src/sigma.ts:1653


listenerCount()

listenerCount<Event>(type): number

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

Returns

number

Inherited from

TypedEventEmitter.listenerCount

Defined in

sigma/src/types.ts:124


listeners()

listeners<Event>(type): SigmaEvents[Event][]

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

Returns

SigmaEvents[Event][]

Inherited from

TypedEventEmitter.listeners

Defined in

sigma/src/types.ts:123


off()

off<Event>(type, listener): this

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

listener: SigmaEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.off

Defined in

sigma/src/types.ts:121


on()

on<Event>(type, listener): this

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

listener: SigmaEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.on

Defined in

sigma/src/types.ts:116


once()

once<Event>(type, listener): this

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

listener: SigmaEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.once

Defined in

sigma/src/types.ts:117


prependListener()

prependListener<Event>(type, listener): this

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

listener: SigmaEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.prependListener

Defined in

sigma/src/types.ts:118


prependOnceListener()

prependOnceListener<Event>(type, listener): this

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

listener: SigmaEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.prependOnceListener

Defined in

sigma/src/types.ts:119


rawListeners()

rawListeners<Event>(type): SigmaEvents[Event][]

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

Returns

SigmaEvents[Event][]

Inherited from

TypedEventEmitter.rawListeners

Defined in

sigma/src/types.ts:125


refresh()

refresh(opts?): this

Method used to refresh, i.e. force the renderer to reprocess graph data and render, but keep the state.

  • if a partialGraph is provided, we only reprocess those nodes & edges.
  • if schedule is TRUE, we schedule a render instead of sync render
  • if skipIndexation is TRUE, then labelGrid & program indexation are skipped (can be used if you haven't modify x, y, zIndex & size)

Parameters

opts?

opts.partialGraph?

opts.partialGraph.edges?: string[]

opts.partialGraph.nodes?: string[]

opts.schedule?: boolean

opts.skipIndexation?: boolean

Returns

this

Defined in

sigma/src/sigma.ts:1973


removeAllListeners()

removeAllListeners<Event>(type?): this

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type?: Event

Returns

this

Inherited from

TypedEventEmitter.removeAllListeners

Defined in

sigma/src/types.ts:122


removeListener()

removeListener<Event>(type, listener): this

Type Parameters

Event extends "clickStage" | "rightClickStage" | "doubleClickStage" | "wheelStage" | "downStage" | "upStage" | "leaveStage" | "enterStage" | "clickNode" | "rightClickNode" | "doubleClickNode" | "wheelNode" | "downNode" | "upNode" | "leaveNode" | "enterNode" | "clickEdge" | "rightClickEdge" | "doubleClickEdge" | "wheelEdge" | "downEdge" | "upEdge" | "leaveEdge" | "enterEdge" | keyof SigmaAdditionalEvents

Parameters

type: Event

listener: SigmaEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.removeListener

Defined in

sigma/src/types.ts:120


resize()

resize(force?): this

Method used to resize the renderer.

Parameters

force?: boolean

If true, then resize is processed even if size is unchanged (optional).

Returns

this

Defined in

sigma/src/sigma.ts:1880


scaleSize()

scaleSize(size, cameraRatio): number

Method used to scale the given size according to the camera's ratio, i.e. zooming state.

Parameters

size: number = 1

The size to scale (node size, edge thickness etc.).

cameraRatio: number = ...

A camera ratio (defaults to the actual camera ratio).

Returns

number

  • The scaled size.

Defined in

sigma/src/sigma.ts:2328


scheduleRefresh()

scheduleRefresh(opts?): this

Method used to schedule a refresh (i.e. fully reprocess graph data and render) at the next available frame. This method can be safely called on a same frame because it basically debounces refresh to the next frame.

Parameters

opts?

opts.layoutUnchange?: boolean

opts.partialGraph?

opts.partialGraph.edges?: string[]

opts.partialGraph.nodes?: string[]

Returns

this

Defined in

sigma/src/sigma.ts:2052


scheduleRender()

scheduleRender(): this

Method used to schedule a render at the next available frame. This method can be safely called on a same frame because it basically debounces refresh to the next frame.

Returns

this

Defined in

sigma/src/sigma.ts:2034


setCamera()

setCamera(camera): void

Method setting the renderer's camera.

Parameters

camera: Camera

New camera.

Returns

void

Defined in

sigma/src/sigma.ts:1688


setCustomBBox()

setCustomBBox(customBBox): this

Method used to override the graph's bounding box with a custom one. Give null as the argument to stop overriding.

Parameters

customBBox: null | object

Returns

this

Defined in

sigma/src/sigma.ts:2241


setGraph()

setGraph(graph): void

Method used to set the renderer's graph.

Parameters

graph: AbstractGraph<N, E, G>

Returns

void

Defined in

sigma/src/sigma.ts:1717


setMaxListeners()

setMaxListeners(n): this

Parameters

n: number

Returns

this

Inherited from

TypedEventEmitter.setMaxListeners

Defined in

sigma/src/types.ts:112


setSetting()

setSetting<K>(key, value): this

Method setting the value of a given setting key. Note that this will schedule a new render next frame.

Type Parameters

K extends keyof Settings<N, E, G>

Parameters

key: K

The setting key to set.

value: Settings<N, E, G>[K]

The value to set.

Returns

this

Defined in

sigma/src/sigma.ts:1849


updateSetting()

updateSetting<K>(key, updater): this

Method updating the value of a given setting key using the provided function. Note that this will schedule a new render next frame.

Type Parameters

K extends keyof Settings<N, E, G>

Parameters

key: K

The setting key to set.

updater

The update function.

Returns

this

Defined in

sigma/src/sigma.ts:1866


viewportToFramedGraph()

viewportToFramedGraph(coordinates, override): Coordinates

Method returning the coordinates of a point from the viewport system to the framed graph system. It allows overriding anything that is used to get the translation matrix, or even the matrix itself.

Be careful if overriding dimensions, padding or cameraState, as the computation of the matrix is not the lightest of computations.

Parameters

coordinates: Coordinates

override: CoordinateConversionOverride = {}

Returns

Coordinates

Defined in

sigma/src/sigma.ts:2149


viewportToGraph()

viewportToGraph(viewportPoint, override): Coordinates

Method used to translate a point's coordinates from the viewport system (pixel distance from the top-left of the stage) to the graph system (the reference system of data as they are in the given graph instance).

This method accepts an optional camera which can be useful if you need to translate coordinates based on a different view than the one being currently being displayed on screen.

Parameters

viewportPoint: Coordinates

override: CoordinateConversionOverride = {}

Returns

Coordinates

Defined in

sigma/src/sigma.ts:2184


viewRectangle()

viewRectangle(): object

Method returning the abstract rectangle containing the graph according to the camera's state.

Returns

object

  • The view's rectangle.
height

height: number

x1

x1: number

x2

x2: number

y1

y1: number

y2

y2: number

Defined in

sigma/src/sigma.ts:2094