Appearance
Ogma.transformations
Transformations allow to change the structure of the graph based on rules.
ogma.transformations.addDrillDown([options])
Add the ability to replace a node by a group of nodes and edges. For instance, when double click on a node, you can can call drilldown.drill(clickedNode) to replace the clickedNode by its children.
Arguments
- options(optional)
DrillDownOptions
Returns
-
DrillDown
The drilldown
ogma.transformations.addEdgeFilter(options)
Hide all edges for which the specified function evaluate to false. The filter is applied as long as it's not removed and is updated when edges are added/removed/their data is updated. Also hides the edges adjacent to the hidden edges.
Arguments
- options
EdgeFilterOptions|function(edge: Edge): boolean
Returns
ogma.transformations.addEdgeGrouping([options])
Group the edges that are parallel and match the same group id together. The groups are automatically updated when the original edges are added, removed or when their data is updated.
Arguments
- options(optional)
EdgeGroupingOptions
Returns
-
Transformation
The added transformation
ogma.transformations.addGeoClustering([options])
Group nodes in geo mode. Works in a similar way as addNodeGrouping but only in geo mode. The nodes get grouped depending on the distance between each other in Mercator projection. Warning: you should have only one GeoClustering object in your vizualisation to prevent from conflicts.
Arguments
- options(optional)
GeoClusteringOptions
Returns
-
Transformation
The added transformation
ogma.transformations.addNeighborGeneration(options)
For each node that match the selector, create one or more neighbor nodes, each identified by a string. If multiple nodes give the same string identifier, they will all share the same neighbor.
Arguments
- options
NeighborGenerationOptions
Returns
ogma.transformations.addNeighborMerging(options)
Hide the nodes that match the selector, and add the data properties specified by dataFunction
to their neighbors. When the transformation is destroyed or disabled, the data of the affected nodes is restored.
Arguments
- options
NeighborMergingOptions
Returns
ogma.transformations.addNodeClustering([options])
Middleware on addNode
addEdge
which allows to cluster the graph without adding the subNodes and subEdges to it. This is much faster than Grouping as the graph remains small. Switching between clustered/unclustered state is though slower than with the Grouping (as Ogma has to recreate all the missing nodes and edges).
Arguments
- options(optional)
NodeClusteringOptions
Returns
-
Transformation
The added transformation
ogma.transformations.addNodeCollapsing(options)
Hide the nodes that match the specified selector. For each of the hidden nodes, create an edge between each pair of adjacent nodes of this node. In essence, it's transforming the graph such as (A -> B -> C) becomes (A -> C), with B being a node that matches the selector. Note that this will throw in the case of multiple collapsed nodes, for instance a daisy chain of nodes like (A -> B -> C -> D) where B and C are collapsed.
Arguments
- options
NodeCollapsingOptions
Returns
ogma.transformations.addNodeFilter(options)
Hide all nodes for which the specified function evaluate to false. The filter is applied as long as it's not removed and is updated when nodes are added/removed/their data is updated. Also hides the edges adjacent to the hidden nodes.
Arguments
- options
NodeFilterOptions|function(node: Node): boolean
Returns
ogma.transformations.addNodeGrouping([options])
Group the nodes that match the same group id together. The groups are automatically updated when original nodes are added, removed or when their data is updated.
Arguments
- options(optional)
NodeGroupingOptions
Returns
-
Transformation
The added transformation
ogma.transformations.addVirtualProperties(options)
Add (or overwrite) some data properties to the specified nodes and edges. When the transformation is disabled/destroyed, the old data is restored.
Arguments
- options
VirtualPropertiesOptions
Returns
ogma.transformations.afterNextUpdate()
Returns a Promise that resolves after the next time the transformations are updated
Returns
-
Promise<void>
ogma.transformations.clear()
Clear all transformations.
Returns
-
Promise<void>
ogma.transformations.getById(id)
Arguments
- id
Number
Returns
-
Transformation | undefined
ogma.transformations.getList()
Returns the list of transformations applied to the graph.
Returns
-
Array<Transformation>
ogma.transformations.layoutGroups(toRelayout, options, propagate)
Run layouts on the groups that are specified in the arguments.
Arguments
- toRelayout
GroupLayout
Array of objects containing the groupId, the layout name and the params of the layout to run - options
AttributeAnimationOptions
Animation options (the ones passed into toRelayout are ignored) - propagate
boolean
If true, re-layout the parent nodes of the groups, if false, simply recompute the radius and position of the parents.
Returns
-
Promise<void>
The promise resolves when the layouts are done.
ogma.transformations.onGroupsUpdated()
Defines the callback to be called when the node groups are updated. Usually a layout.
Returns
-
Promise<void| unknown>