Appearance
Ogma.layers 
Layers API: functions to add custom annotation layers to your graph visualization.
ogma.layers.addCanvasLayer(draw[, index][, options]) 
Add a canvas layer. Useful to perform drawings in sync with the view. In the drawing function you are given the CanvasRenderingContext2D, that is automatically scaled and translated to be in sync with the graph. So you can simply use graph coordinates to draw shapes and text in it. See our "Layers" examples for the code snippets.
Arguments
- draw 
DrawingFunctionThe function drawing on the canvas in the graph space. - index(optional) 
numberThe optional index of the layer. - options(optional) 
CanvasLayerOptionsThe optional layer options 
Returns
-  
CanvasLayerReturns the canvas layer object. 
ogma.layers.addLayer(element[, index]) 
Add an HTML element as an overlay to Ogma at the specifided index (if provided). This is the most basic way of adding your custom HTML elements to the Ogma canvas, they will be positioned at a coordinate (in graph space) and kept in sync with the camera movement, but not scaled.
Arguments
- element 
HTMLElement | stringThe HTML element attached to the layer. Can be an HTML string. - index(optional) 
numberThe optional index of the layer. 
Returns
-  
LayerReturns the layer object. 
ogma.layers.addOverlay(options[, index]) 
Adds an overlay layer to Ogma, that will update its position and scale in sync with the graph. Ideal for images or complex annotations of the nodes.
Arguments
- options 
OverlayOptionsHTML element provided with its affine transformation in the graph space. - index(optional) 
numberThe optional index of the layer. 
Returns
-  
OverlayReturns the layer object. 
ogma.layers.addSVGLayer([options][, index]) 
Add a SVG layer. Useful to perform drawings in sync with the view. In the drawing function, the svg is automatically scaled and translated to be in sync with the graph. So you can simply use graph coordinates to draw shapes and text in it. See our "Layers" examples for the code snippets.
Arguments
- options(optional) 
SVGLayerOptionsThe optional layer options - index(optional) 
numberThe optional index of the layer. 
Returns
-  
SVGLayerReturns the canvas layer object.