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
Properties
rawEmitter
rawEmitter:
EventEmitter
<DefaultEventMap
>
Inherited from
TypedEventEmitter.rawEmitter
Defined in
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
clear()
clear():
this
Method used to clear all the canvases.
Returns
this
Defined in
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
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
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
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
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
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
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
getBBox()
getBBox():
object
Method returning the graph's bounding box.
Returns
object
x
x:
Extent
y
y:
Extent
Defined in
getCamera()
getCamera():
Camera
Method returning the renderer's camera.
Returns
Defined in
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
getContainer()
getContainer():
HTMLElement
Method returning the container DOM element.
Returns
HTMLElement
Defined in
getCustomBBox()
getCustomBBox():
null
|object
Method returning the graph's custom bounding box, if any.
Returns
null
| object
Defined in
getDimensions()
getDimensions():
Dimensions
Method returning the current renderer's dimensions.
Returns
Dimensions
Defined in
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
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
getGraph()
getGraph():
AbstractGraph
<N
,E
,G
>
Method returning the renderer's graph.
Returns
AbstractGraph
<N
, E
, G
>
Defined in
getGraphDimensions()
getGraphDimensions():
Dimensions
Method returning the current graph's dimensions.
Returns
Dimensions
Defined in
getGraphToViewportRatio()
getGraphToViewportRatio():
number
Method returning the distance multiplier between the graph system and the viewport system.
Returns
number
Defined in
getMaxListeners()
getMaxListeners():
number
Returns
number
Inherited from
TypedEventEmitter.getMaxListeners
Defined in
getMouseCaptor()
getMouseCaptor():
MouseCaptor
<N
,E
,G
>
Method returning the mouse captor.
Returns
MouseCaptor
<N
, E
, G
>
Defined in
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
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
getRenderParams()
getRenderParams():
RenderParams
Function used to get the render params.
Returns
RenderParams
Defined in
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
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
getStagePadding()
getStagePadding():
number
Function used to retrieve the actual stage padding value.
Returns
number
Defined in
getTouchCaptor()
getTouchCaptor():
TouchCaptor
<N
,E
,G
>
Method returning the touch captor.
Returns
TouchCaptor
<N
, E
, G
>
Defined in
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
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
kill()
kill():
void
Method used to shut the container & release event listeners.
Returns
void
Defined in
killLayer()
killLayer(
id
):this
Function used to properly kill a layer.
Parameters
• id: string
Layer id.
Returns
this
Defined in
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
setCamera()
setCamera(
camera
):void
Method setting the renderer's camera.
Parameters
• camera: Camera
New camera.
Returns
void
Defined in
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
setGraph()
setGraph(
graph
):void
Method used to set the renderer's graph.
Parameters
• graph: AbstractGraph
<N
, E
, G
>
Returns
void
Defined in
setMaxListeners()
setMaxListeners(
n
):this
Parameters
• n: number
Returns
this
Inherited from
TypedEventEmitter.setMaxListeners
Defined in
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
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
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
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
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