Skip to content
  1. Tutorials
  2. Getting started

Filters

Filters can be defined globally to filter nodes and edges out of the visualisation. They use a function selector that returns a boolean indicating whether the node or the edge should be visible (true) or filtered out (false). Filters are automatically applied to new nodes and edges or when their data is updated.

The following example only shows nodes having a data.properties.funding_total property greater than 300 million.

js
// Create a filter on nodes.
const filter1 = ogma.transformations.addNodeFilter(node => {
  return node.getData('properties.funding_total') > 300000000;
});

// Removed the node filter.
ogma.removeNodeFilter(filter1);

// Remove all node filters.
ogma.clearNodeFilters();