cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Same color for same Relationship nodes/same Origination nodes

sucheta
Graph Buddy

Hi,

We have a concern. As showed in the example diagram , all the same originated nodes or probably same relationship nodes here have same color

but in my neovis.js we get a different output of colors of the nodes belonging to the same relationship/ origination from the same node-

Can this issue of different colors be resolved and that the color of the node be made the same as its relationship parameter.

5 REPLIES 5

Neovis colors the nodes by default after the community property.
You can choose other properties (or label) as coloring source in the config.

I tried to change the config in Neovis.js in both labels and well as relationships, but to no avail. Only the lines became thin and the font - size reduced (that is desired). But the concern of all for example - parameter arrows as well as parameter nodes becoming same color did not happen . My code is -

      
         var cypherQuery = "MATCH (n)-[r]->(m) RETURN n,r,m;";

         var config = {
             container_id: "viz",
             server_url: "bolt://localhost:11001/",
             server_user: "neo4j",
             server_password: "ib1",
             labels: {
              
                 "Banking": {
                     "caption": "name",
                     "size": "pagerank",
                     "community": "community",
                  
                     
                 },
                 "Parameter": {
                    "thickness": "weight",
                    "caption": true,
                    "color": "green"
                },
                "Method": {
                   "thickness": "weight",
                   "caption": true,
                   "color": "Blue"
               },
               "Request": {
                   "thickness": "weight",
                   "caption": true,
                   "color": "Red"
               },
               "Response": {
                   "thickness": "weight",
                   "caption": true,
                   "color": "Black"
               },
               "Paths": {
                   "thickness": "weight",
                   "caption": true,
                   "color": "Yellow"
               },
               "API": {
                   "thickness": "weight",
                   "caption": true,
                   "color": "Purple"
               },
               "Department": {
                   "thickness": "weight",
                   "caption": true,
                   "color": "Pink"
               },
               "System": {
                   "thickness": "weight",
                   "caption": true,
                   "color": "Gray"
               },
                 
             },
             relationships: {
                 "Parameter": {
                     "thickness": "weight",
                     "caption": true,
                     "color": "green"
                 },
                 "Method": {
                    "thickness": "weight",
                    "caption": true,
                    "color": "Blue"
                },
                "Request": {
                    "thickness": "weight",
                    "caption": true,
                    "color": "Red"
                },
                "Response": {
                    "thickness": "weight",
                    "caption": true,
                    "color": "Black"
                },
                "Paths": {
                    "thickness": "weight",
                    "caption": true,
                    "color": "Yellow"
                },
                "API": {
                    "thickness": "weight",
                    "caption": true,
                    "color": "Purple"
                },
                "Department": {
                    "thickness": "weight",
                    "caption": true,
                    "color": "Pink"
                },
                "System": {
                    "thickness": "weight",
                    "caption": true,
                    "color": "Gray"
                },
             },
          RETURN cc",
         
           initial_cypher:cypherQuery ,        
            arrows: true,
            hierarchical_layout:true,
            hierarchical_sort_method:"directed",
            
         };                 
         this.viz = new NeoVis.default(config);
         this.viz.render();
         console.log(this.viz);

And the output result is -

Please help to segregate the nodes according to the colors.

The color comes from: "community": "propertyName"

Here i tried, but it doesn't work. I tried in labels as well as relationships also.

 var cypherQuery = "MATCH (n)-[r]->(m) RETURN n,r,m;";
var config = {
             container_id: "viz",
             server_url: "bolt://localhost:11001/",
             server_user: "neo4j",
             server_password: "Virtuallib1",
             labels: {
                 //"Character": "name",
                 "Banking": {
                     "caption": "name",
                     "size": "pagerank",
                     "community": "community",
                  
                     //"sizeCypher": "MATCH (n) WHERE id(n) = {id} MATCH (n)-[r]-() RETURN sum(r.weight) AS c"
                 },
                 "Parameter": {
                    "thickness": "weight",
                    "caption": true,
                    "community": "Green",
                },
                "Method": {
                   "thickness": "weight",
                   "caption": true,
                   "community": "Blue",
               },
               "Request": {
                   "thickness": "weight",
                   "caption": true,
                   "community": "Red"
               },
               "Response": {
                   "thickness": "weight",
                   "caption": true,
                   "community": "Pink"
               },
               "Paths": {
                   "thickness": "weight",
                   "caption": true,
                   "community": "Purple"
               },
               "API": {
                   "thickness": "weight",
                   "caption": true,
                   "community": "Black"
               },
               "Department": {
                   "thickness": "weight",
                   "caption": true,
                   "community": "Yellow"
               },
               "System": {
                   "thickness": "weight",
                   "caption": true,
                   "community": "Red"
               },
                 
             },
             relationships: {
                 "Parameter": {
                     "thickness": "weight",
                     "caption": true,
                     "community": "green"
                 },
                 "Method": {
                    "thickness": "weight",
                    "caption": true,
                    "community": "Blue"
                },
                "Request": {
                    "thickness": "weight",
                    "caption": true,
                    "community": "Red"
                },
                "Response": {
                    "thickness": "weight",
                    "caption": true,
                    "community": "Red"
                },
                "Paths": {
                    "thickness": "weight",
                    "caption": true,
                    "community": "Red"
                },
                "API": {
                    "thickness": "weight",
                    "caption": true,
                    "community": "Red"
                },
                "Department": {
                    "thickness": "weight",
                    "caption": true,
                    "community": "Red"
                },
                "System": {
                    "thickness": "weight",
                    "caption": true,
                    "community": "Red"
                },
             },
           
             initial_cypher:cypherQuery ,        
            arrows: true,
            hierarchical_layout:true,
            hierarchical_sort_method:"directed",
            
         };                 
         this.viz = new NeoVis.default(config);  
      
         this.viz.render();
         console.log(this.viz);

output nodes are still multi-color.

I am sorry, but you will have to spoon-feed.

pborah88
Node Clone

This is because your "output" nodes belong to a different community than the source node. Go back to your data/database and check if the source and target nodes belong to the same community. The color of the arrows will depend on the source node. E.g. If your source node is blue, the arrow will also be colored blue. You might want to use an external clustering algorithm or assign clusters manually in your data and load that as a node property to neo4j first. Then go and set the "community" in config to that specific node property. Note that for neovis, "community" has to be a numerical value.