Bubble size in Neo4j

2019-03-22 04:17发布

问题:

Is there a way to adjust the bubble size (or colour) of nodes in Neo4j in relation to a node property value? For example, if each node has a size: "xxx" property, how would I make each node scale to this size?

Is there a similar way to adjust relation lines? I know both nodes and relations can be adjusted to different colours or sizes all at once, but I can't figure out how to do this based on their properties.

I tried creating a custom GRASS file, but weird things happened. This is what I used:

node
{
    diameter: 50px;
    color: #A5ABB6;
    border-color: #9AA1AC;
    border-width: 2px;
    text-color-internal: #FFFFFF;
    font-size: 10px;
}

relationship
{
    color: #A5ABB6;
    shaft-width: 1px;
    font-size: 8px;
    padding: 3px;
    text-color-external: #000000;
    text-color-internal: #FFFFFF;
}

node.person
{
    /* Node diameter is based on value. */
    diameter: {value};
}

And this is what appears when I drag and drop it into the browser:

node {
  diameter: 50px;
  color: #A5ABB6;
  border-color: #9AA1AC;
  border-width: 2px;
  text-color-internal: #FFFFFF;
  font-size: 10px;
}

relationship {
  color: #A5ABB6;
  shaft-width: 1px;
  font-size: 8px;
  padding: 3px;
  text-color-external: #000000;
  text-color-internal: #FFFFFF;
}

node.person {
  /* Node diameter is based on value. */
    diameter: value;
  color: #68BDF6;
  border-color: #5CA8DB;
  text-color-internal: #FFFFFF;
  caption: '{person_name}';
}

; {
}

Not only does it add the caption can colours, and ignore the {value} variable, but it also adds the extra ;{} at the end. Nothing shows up in the graph window. Am I screwing up the syntax, or is this a bug?

回答1:

The neo4j browser can be configured to customize a node by one of its labels, and to customize a relationship by its type. See here and here for the 2 ways to do that.

However, the browser has no support for dynamic customization by property value.