Skip to content
  1. Tutorials
  2. Getting started


With Ogma's export module, you can export the graph, its data, and create images in various formats.

Full graph exports

It is possible to export the full contents of the graph, including data and styles. Using the JSON and GEXF formats allow to load the file later with ogma.parse module.

Here, we export the graph to the JSON format.

ogma.export.json({ pretty: true })
  .then(() => console.log('Graph exported.'));

Live examples:

Data exports

Ogma's graph data can be exported to various formats.

For example, this line of code exports all nodes and their properties to the csv format.

  what: 'nodes' // use 'edges' to export the edges and their properties

The exports function can take several parameters into account in order to customize what should be exported.

In this example, we export the nodes and only some of their properties to the csv format. We also choose not to download the file but instead add a callback that displays the csv result into the console.

    what: 'nodes',
    dataProperties: ['name', 'address'],
    download: true
  .then(csv => console.log(csv));

Live examples:

Image exports

The graph can also be exported as an image in various formats.

Let's export the graph on the screen as a PNG file named 'screenshot.png'.

  filename: 'screenshot.png'

Live examples: