Neo4j Grass能否通过属性设置节点尺寸?设置后节点消失
First off, yes—you absolutely can use a custom property to define node dimensions in .grass. The reason your node is disappearing is because of a mismatch between the property value format and what the .diameter parameter expects.
The Root Cause
Your diameter property is set to "50px" (a string with a unit), but the .diameter configuration option in .grass expects a raw numeric value (it assumes pixels by default). When you pass a string with px, the renderer can't parse it correctly, so the node fails to render entirely.
Solution 1: Use Numeric Property Value (Simplest Fix)
- Update your
diameterproperty to be a pure number instead of a string with units: set it to50(not"50px"). - Keep your existing configuration code—it will work correctly now:
"node.User": { "color": "#FB95AF", "border-color": "#E0849B", "text-color-internal": "#FFFFFF", "caption": "{name}", "diameter": "{diameter}" }
This tells the renderer to create a node with a 50px diameter, which is the default unit for the .diameter field.
Solution 2: Custom Units (If You Need Them)
If you need to use units other than pixels (like em, %, or rem), you can leverage the style property to set explicit width and height instead of using .diameter:
- Keep your
diameterproperty as"50px"(or any unit you need). - Modify your configuration to use inline styles:
"node.User": { "color": "#FB95AF", "border-color": "#E0849B", "text-color-internal": "#FFFFFF", "caption": "{name}", "style": "width: {diameter}; height: {diameter}; border-radius: 50%;" }
The border-radius: 50% ensures the node stays circular, matching the behavior of the .diameter parameter.
Either approach should bring your node back and let you control its size via the custom property.
内容的提问来源于stack exchange,提问作者JamEnergy

