Graph
Neo4j dashboard graphs render returned nodes, relationships and paths. Configure the graph layout and nodes, relationships, labels and colors to your liking.
You can drag and drop nodes in the displayed graph.
Cypher example
MATCH (p:Product)-[o:PART_OF]->(c:Category)
WHERE c.categoryName = "Produce"
RETURN p, o, c
Rule-based styling for graphs
Use rule-based styling to change the appearance of nodes and relationships.
Style all matching nodes or relationships by selecting a label or relationship type. Or, use a property and condition to style only a matching subset.
To add a rule, open the graph visualization’s Styling settings:
-
Select the Nodes or Relationships tab.
-
Select Add.
-
For nodes choose the label, and for relationships choose the type, then configure the rules.
-
(Optional) Select a property and condition to apply the rule only to matching nodes or relationships.
-
The first time you create a rule, Apply is selected by default.
-
Select Add to add the rule.
-
If you change the rule later, select Apply before selecting Add to apply the updated rule. To add the updated rule without applying it, select Add only.
-
Select Save on the card to save your changes.
When multiple rules match the same node or relationship, the rules are evaluated from top to bottom. Drag rules to change their order.
The available conditions depend on the property type that is selected:
- Numeric properties
-
-
equals
-
does not equal
-
greater than
-
less than
-
greater than or equal to
-
less than or equal to
-
between
-
not between
-
is null
-
is not null
-
- Text properties
-
-
contains
-
equals
-
does not equal
-
starts with
-
ends with
-
is null
-
is not null
-
- Boolean properties
-
-
is true
-
is false
-
is null
-
is not null
-
- Temporal properties
-
-
equals
-
does not equal
-
between
-
not between
-
before
-
after
-
is null
-
is not null
-
Most examples on this page use the Northwind dataset. The arc examples use virtual nodes and relationships generated by the query. They do not use Northwind data.
Highlight products by stock level
Set a base color
The following query returns suppliers and the products they supply:
MATCH (s:Supplier)-[r:SUPPLIES]->(p:Product)
RETURN s, r, p
Create a base style for all Product nodes.
Select the label Product and leave Property and Condition empty, select Color, and choose a single red color.
Group suppliers by country
Color nodes by unique value
Use Unique value to assign a different color to each distinct value of a property. Nodes with the same value use the same automatically assigned color. The 33 colors in the palette repeat across nodes with unique values.
The following query returns suppliers in the USA, Germany, and UK, together with the products they supply:
MATCH (s:Supplier)-[r:SUPPLIES]->(p:Product)
WHERE s.country IN ['USA', 'Germany', 'UK']
RETURN s, r, p
In this example, the rule uses the country property on Supplier nodes:
-
Suppliers in the USA are dark purple.
-
Suppliers in Germany are orange.
-
Suppliers in the UK are yellow.
Use unique values when you want to distinguish categories, rather than show a value from low to high.
Show values with range
Color nodes by range
This Cypher example generates virtual nodes and relationships with a range of property types. It does not use Northwind data.
UNWIND range(10, 1, -1) AS i
WITH
i,
apoc.create.vNode(
['SampleNode'],
{
id: i,
label: 'test' + i,
intProp: i * 10,
floatProp: i * 1.5,
stringProp: 'Node_' + toString(i),
boolProp: i % 2 = 0,
point2dProp: point({x: i * 1.0, y: i * 2.0})
}
) AS n
WITH collect({i: i, node: n}) AS nodes
UNWIND range(0, size(nodes) - 2) AS idx
WITH
nodes,
idx,
nodes[idx].node AS startNode,
nodes[idx + 1].node AS endNode,
idx + 1 AS relIndex
RETURN
endNode AS from,
apoc.create.vRelationship(
endNode,
'CONNECTS_TO',
{
id: relIndex,
weight: relIndex * 0.5,
label: 'Edge_' + toString(relIndex),
active: relIndex % 2 = 0,
locationProp: point({x: relIndex * 1.0, y: relIndex * 2.0})
},
startNode
) AS rel,
startNode AS to
ORDER BY relIndex;
For numeric properties, use Range to show values on a continuous scale.
In this example, nodes with IDs from 1 to 10 use a color range: green for the minimum value and red for the maximum value.
The minimum and maximum values are automatically set from the query results. You could also add a midpoint color to create a three-color range.
Size nodes by range
You can also use a size range to make nodes with higher numeric values appear larger. For example,
on the Size tab, select Range.
The minimum and maximum values are automatically set from the id values 1 and 10.
Set their sizes to 0.25x and 5x. Nodes with IDs between these values are sized proportionally.
Highlight discounted orders
Color relationships by condition
MATCH (o:Order)-[ordered:ORDERS]->(p:Product)
RETURN o, ordered, p
LIMIT 10
On the Relationships tab, create a rule for ORDERS relationships.
Select the discount property, set the condition to does not equal with a value of 0, then set the relationship color to red.
Show order quantities
Add relationship captions
Set a relationship caption to display a property value on the arrow.
The following query returns orders and the products they contain:
MATCH (o:Order)-[ordered:ORDERS]->(p:Product)
RETURN o, ordered, p
LIMIT 10
Add a rule for the ORDERS relationship type and set a relationship color.
On the Caption tab, select quantity to show the number of units ordered on each arrow.