Change colours of nodes based on the labels
Saif Rehman Nasir
When I try to visualize the graph in Neo4j Workspace Explore, I see all the nodes with the same color.
This could also be because all of my nodes are of entity type __Entity__. I have the various subtypes of this __Entity__ type in "type" attribute of each node.
Additionally, I added these subtypes as labels to the nodes. Here is my cypher statement for creating one node:
MERGE (e: __Entity__ {{id:"{entity_id}"}})
SET e.name={name}, e.type="{type}", e.description="{description}"
WITH e
CALL apoc.create.addLabels(e, case when coalesce("{type}","") = "" then [] else [apoc.text.upperCamelCase(replace("{type}",'"',''))] end) yield node
RETURN node
Can I somehow visualize the whole graph to show the label colours for the nodes?
Jeff Gagnon
Hi, Explore will colour the nodes based on the Category, for which there should be one for each distinct label in the database. In cases where nodes have more than one label, you can prioritize the label used for colouring in Explore by dragging the Category names up & down in the left side Perspective Designer drawer (this drawer is accessed using the icon to the left of the Search bar).