4
votes

I am new to neo4j and I am trying to edit the GraSS file so that I can display nodes and relationship in different colors. Basically what I want is, nodes to have different colors based on certain properties of the node.

For example there is a Person node and it has an attribute 'Gender' then I want all the nodes with value of 'Gender' as male to be red and all the nodes with value of 'Gender' as female to be green. Can I achieve this by editing GraSS (Graph Style Sheets)

1
That question talks about the procedure to edit a style sheet. My question is different. My question is about styling the nodes based on a property in the node. - Ganesh

1 Answers

0
votes

Use the stylesheet to edit the styles of a property. Lets say you have two types of relationships, negative and positive. You would like a green color for the positive relationship and a red color for the negative relationship. Here are basic styles to achieve the desired outcome.

relationship {
  color: #D4D6D7;
  shaft-width: 1px;
  font-size: 8px;
  padding: 3px;
  text-color-external: #000000;
  text-color-internal: #FFFFFF;
}
relationship.Negative {
  color: #FF0000; //Bright Red
  shaft-width: 1px;
  font-size: 8px;
  padding: 3px;
  text-color-external: #000000;
  text-color-internal: #FFFFFF;
}
relationship.Positive {
  color: #15FF00; //Bright Green
  shaft-width: 1px;
  font-size: 8px;
  padding: 3px;
  text-color-external: #000000;
  text-color-internal: #FFFFFF;
}