Appearance
Ogma.export
Export API: functions to export graphs to various formats.
ogma.export.csv(parameters)
Arguments
- parameters
object|"nodes"|"edges"- dataProperties(optional)
Array<PropertyPath>Data properties to export. If not specified, exports all data properties. - download(optional)
boolean[=true]If true, the user will be prompted a modal window so he can download the exported graph. - edgeData(optional)
function (data: any): anyGiven an edge data in input, must return the object to export as data. By default export the whole edge data untouched. - edges(optional)
EdgeCollectionEdges to export. By default export all the edges (ifwhatis"edges"). - filename(optional)
string[="graph.csv"]Ifdownloadis true, the default name for the downloaded file. - filter(optional)
Filter[="visible"]Indicates what elements to export. - nodeData(optional)
function (data: any): anyGiven a node data in input, must return the object to export as data. By default export the whole node data untouched. - nodes(optional)
NodeCollectionNodes to export. By default export all the nodes (ifwhatis"nodes"). - separator(optional)
string[=","]Column separator - textSeparator(optional)
'"'|"'"[='"']String used to surround strings. Can only be"or'. - what
"nodes"|"edges"Indicates if nodes or edges should be exported.
- dataProperties(optional)
Returns
-
Promise<string>
ogma.export.gexf([parameters])
Arguments
- parameters(optional)
object- creator(optional)
stringName of the creator, that will be specified in the output file - description(optional)
stringDescription of the graph, that will be specified in the output file - download(optional)
boolean[=true]If true, the user will be prompted a modal window so he can download the exported graph. - edgeData(optional)
function (data: any): anyGiven an edge data in input, must return the object to export as data. By default export the whole edge data untouched. - edges(optional)
EdgeCollectionEdges to export. By default export all the edges. - filename(optional)
string[="graph.gexf"]Ifdownloadis true, the default name for the downloaded file. - filter(optional)
Filter[="visible"]Indicates what elements to export. - nodeData(optional)
function (data: any): anyGiven a node data in input, must return the object to export as data. By default export the whole node data untouched. - nodes(optional)
NodeCollectionNodes to export. By default export all the nodes. - styles(optional)
"all"|"none"|"original"[="all"]Indicates what styles (color, shape, size, text) should be exported:'all'for what is visually displayed,'none'for no style and'original'for the values provided at initialization.
- creator(optional)
Returns
-
Promise<string>
ogma.export.gif([options])
Arguments
- options(optional)
ImageExportOptions
Returns
-
Promise<string>The argument of the Promise is the data url of the output image
ogma.export.graphml([parameters])
Arguments
- parameters(optional)
object- directedEdges(optional)
boolean[=true]Indicates in the output file if the edges are directed or not - download(optional)
boolean[=true]If true, the user will be prompted a modal window so he can download the exported graph. - edgeData(optional)
function (data: any): anyGiven an edge data in input, must return the object to export as data. By default export the whole edge data untouched. - edges(optional)
EdgeCollectionEdges to export. By default export all the edges. - filename(optional)
string[="graph.graphml"]Ifdownloadis true, the default name for the downloaded file. - filter(optional)
Filter[="visible"]Indicates what elements to export. - graphId(optional)
string[="G"]Id of the graph to write in the output file - nodeData(optional)
function (data: any): anyGiven a node data in input, must return the object to export as data. By default export the whole node data untouched. - nodes(optional)
NodeCollectionNodes to export. By default export all the nodes. - styles(optional)
"all"|"none"|"original"[="all"]Indicates what styles (color, shape, size, text) should be exported:'all'for what is visually displayed,'none'for no style and'original'for the values provided at initialization.
- directedEdges(optional)
Returns
-
Promise<string>
ogma.export.jpg([options])
Arguments
- options(optional)
ImageExportOptions
Returns
-
Promise<string>The argument of the Promise is the data url of the output image
ogma.export.json([parameters])
Arguments
- parameters(optional)
object- anonymize(optional)
boolean[=false]If true, the exported graph will be anonimized (i.e. all the nodes and edges will be exported without data). All the node and edge attributes will be exported as well. Equivalent toogma.export.json({ nodeAttributes: 'all', edgeAttributes: 'all', filter: 'all', nodeData: () => null, edgeData => null });. - download(optional)
boolean[=true]If true, the user will be prompted a modal window so he can download the exported graph. - edgeAttributes(optional)
Array<PropertyPath>|"all"[=['color', 'width', 'text']]List of edge attributes to export. By default, export color, text and width. - edgeData(optional)
function (data: any): anyGiven an edge data in input, must return the object to export as data. By default export the whole edge data untouched. - filename(optional)
string[="graph.json"]Ifdownloadis true, the default name for the downloaded file. - filter(optional)
Filter|{nodes: NodeCollection, edges: EdgeCollection}[="visible"]Indicates what elements to export. - nodeAttributes=['x',
Array<PropertyPath>|"all"'y', 'color', 'radius', 'shape', 'text']] List of node attributes to export. By default, export position, color, shape, text and radius. - nodeData(optional)
function (data: any): anyGiven a node data in input, must return the object to export as data. By default export the whole node data untouched. - pretty(optional)
boolean[=false]Indicates if the output should be properly indented.
- anonymize(optional)
Returns
-
Promise<RawGraph>
ogma.export.png([options])
Arguments
- options(optional)
ImageExportOptions
Returns
-
Promise<string>The argument of the Promise is the data url of the output image
ogma.export.svg([parameters])
Arguments
- parameters(optional)
object- background(optional)
ColorColor of the background - badges(optional)
boolean[=true]Whether or not to export badges - clip(optional)
boolean[=false]Whether to clip the exported image to the current Ogma viewport. - download(optional)
boolean[=true]If true, the user will be prompted a modal window so he can download the exported graph. - embedFonts(optional)
boolean[=false]Whether or not to embed custom fonts as base64 (works in viewers and browsers, but in order to edit you will have to install the fonts on your machine anyway). Otherwise the custom fonts will be just linked in the file. - filename(optional)
string[="graph.svg"]Ifdownloadis true, the default name for the downloaded file. - groupSemantically(optional)
boolean[=true]Whether or not group the elements by type (nodes and edges). If true expect the z-index of the texts to be different than in the visualization. - height(optional)
numberIf not specified, the height of the canvas will be used. - images(optional)
boolean[=true]Indicates if images should be exported. - margin(optional)
number[=10]Additional margin. - prefix(optional)
string[='ogma']Prefix for the entity class names. For example, elements belonging to a node are grouped into an SVG group with the classogma-nodeand an attributedata-node-idwith the (escaped) node id. The wordogmain these class names can be replaced by a custom string. - texts(optional)
boolean[=true]Whether or not to export texts - width(optional)
numberIf not specified, the width of the canvas will be used.
- background(optional)
Returns
-
Promise<string>The argument is the SVG string
ogma.export.tiff([options])
Arguments
- options(optional)
ImageExportOptions
Returns
-
Promise<string>The argument of the Promise is the data url of the output image
ogma.export.xlsx([parameters])
Requires the xlsx library to be included (if browser) or to be available through 'require' (if Node.js)
Arguments
- parameters(optional)
XLSXExportOptions|"nodes"|"edges"dataProperties(optional)
Array<PropertyPath>Data properties to export. If not specified, exports all data properties. Deprecated : usenodeDataandedgeDatainstead.download(optional)
boolean[=true]If true, the user will be prompted a modal window so he can download the exported graph. Browser only.edgeData(optional)
function(data: any, allTabs: Array<string>): object|Array<object>|undefinedIndicates how to format the edge data for the tab: each key of the returnedobjectis used ascolumnNameand its value ascolumnValue. In case of multiple tabs for the edge, an array of objects will be expected. TheallTabsarray is passed to give some context to the formatting. The default is use the data object "flatten" all his properties. When set it overwritesdataPropertiesconfiguration.edges(optional)
EdgeCollectionEdges to export. By default export all the edges. When set it overwrites "filter" configuration.filename(optional)
string[="graph.xlsx"]Ifdownloadis true, the default name for the downloaded file.filter(optional)
Filter[="visible"]Indicates what elements to export.nodeData(optional)
function(data: any, allTabs: Array<string>): object|Array<object>|undefinedIndicates how to format the node data for the tab: each key of the returnedobjectis used ascolumnNameand its value ascolumnValue. In case of multiple tabs for the node, an array of objects will be expected. TheallTabsarray is passed to give some context to the formatting. The default is use the data object "flatten" all his properties. When set it overwritesdataPropertiesconfiguration.nodes(optional)
NodeCollectionNodes to export. By default export all the nodes. When set it overwrites "filter" configuration.tab(optional)
objectIndicates how to name the tabs in the XSLX tabs. When not defined it will exports a "nodes" and a "edges" tab. Note: tab names cannot contain some characters in Excel, for more information please see: naming conventions for worksheets .- edges (optional)
function(edge: Edge): string|Array<string>|undefined[=(edge: Edge) => "edges"]The returned string indicates the name of the tab (or tabs) to use for the edge. Whenundefinedis returned it defaults to "edges". - nodes (optional)
function(node: Node): string|Array<string>|undefined[=(node: Node) => "nodes"]The returned string indicates the name of the tab (or tabs) to use for the node. Whenundefinedis returned it defaults to "nodes".
- edges (optional)
what(optional)
"nodes"|"edges"If a value is specified, only nodes or edges will be exported, not both.
Returns
-
Promise<Blob>