Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-28-2022 09:18 AM
I have created the following representation:
MATCH (p:Producer)-[r:HAS_NAME_VARIANT]->(n:Name)-[r2:FOUND_IN]->(s:Source)
WHERE n.text = $neodash_name_text
MATCH (p)-[r3:HAS_NAME_VARIANT]->(n2)-[r4:FOUND_IN]->(s2:Source)
MATCH path=(p)-[r]-(n)-[r2]-(s)
RETURN s2.title, p, n, r, r2, n2, s, s2, r3, r4
I want the node n to have a different colour when the relationship property r.qualification has the value "preferred".
Currently nodes can only be coloured in function of node properties.
Is there a workaround? Thanks!
Solved! Go to Solution.
07-29-2022 12:57 AM - edited 07-29-2022 01:01 AM
Indeed, you can only apply rules to nodes.
The only way right now is to set a new property on your nodes to be able to change the color.
The workaround is to set a property on relationships with HTML color values then use the property name in the settings for the parameter: Relationship Color Property.
Regards,
Cobra
07-28-2022 01:39 PM
07-28-2022 10:30 PM
Hi @Cobra ,
Thanks for the reply.
Only properties of the node and related nodes are listed in the rule-based styling window, but not relationship properties...
The manual states that also "simple fields (text, number)" can do the job. Does that mean that I can create such a field in the code (e.g. 1 if node property = "preferred")? If so, can you please show me because this transcends my limited knowledge of Cypher (30+ years of experience in relational databases but only 6 months in graphs 😉).
07-29-2022 12:57 AM - edited 07-29-2022 01:01 AM
Indeed, you can only apply rules to nodes.
The only way right now is to set a new property on your nodes to be able to change the color.
The workaround is to set a property on relationships with HTML color values then use the property name in the settings for the parameter: Relationship Color Property.
Regards,
Cobra
07-29-2022 01:21 AM
Thanks.
Adding a property to the node only works for 1:1 relationships, but not for 1:n...
I'll try and figure out how to set up the workaround.
08-01-2022 07:53 AM - edited 08-01-2022 07:53 AM
Hi @guido !
I'm interested on your use case and I would like to understand it better (so I can help providing a fix if needed). How does your query results look? Are you planning to change the color of a node based on what condition on the subset of relationshipS? If there's always one relationship, why isn't that property part of the node?
Regards
08-01-2022 08:10 AM
Hi @bennu_neo
Thanks for you reply.
I have solved the issue in the meantime (see Cobra ).
To answer your questions: I want to change the color of lines in a table, based on a property of the relationship. It is a 1:n relationship, so the content of the same node n2 in (p)-[r3:HAS_NAME_VARIANT]->(n2) can be "preferred" for one p and "alternative" for another.
But, as I said, problem fixed. Thanks for your interest!
(could you maybe have a look at my recent question: https://community.neo4j.com/t5/neo4j-graph-platform/data-importer-how-to-import-null-values/m-p/5847...)
09-12-2022 10:12 PM
Hi Guido,
Can you please tell me how can I show the different path having different color from node A to node B in map. See there are more than one path form node A to node B, So I want to show that paths in different color in map. How can I do that? Can you please tell me?
Thank you!
Thanks and Regards
Rohit Kumar
09-14-2022 11:14 AM
@rohit_kumar01
Hi Rohit,
i am using NeoDash to represent the data. It has pre-formatted field settings in which I can indicate conditional colours. So I wouldn't know how to do it in code.... sorry!
All the sessions of the conference are now available online