neo4j-contrib / neovis.js

Neo4j + vis.js = neovis.js. Graph visualizations in the browser with data from Neo4j.
Apache License 2.0
1.59k stars 324 forks source link

Dynamic edge name #353

Closed NudistBeaaach closed 1 year ago

NudistBeaaach commented 1 year ago

Hello after the 2.0 it is possible to use

[NeoVis.NEOVIS_ADVANCED_CONFIG]: {
                "static": {
                        "label": "lives with",
                }
            }

to specify a static edge name, but how can you get neovis.js in this new version to use the label set during the relationship declaration plz ?

thebestnom commented 1 year ago

I don't understand the question 😅 if you mean getting the relationship type you can use function instead of static like so


{
//... Advance config
 function: {
   label: rel => rel.type // if Im correct on the raw rel from neo4j that how we get the rel type
  }
}
NudistBeaaach commented 1 year ago

Yeah I mean, actually my relationships fields looks like this:

    "relationships": {
        "works_with": {
            [NeoVis.NEOVIS_ADVANCED_CONFIG]: {
                "static": {
                    "label": "works with",
                }
            }
        },

And I'm forced to define a new static label for each relationship (i.e works_with) but I would know how to get each relationship has the label I set during the query. In your response you mean ? :

{
relationships:{
[ NeoVis.NEOVIS_ADVANCED_CONFIG]: {
   function: {
     label: rel => rel.type
    }
}
}
}
thebestnom commented 1 year ago

Nope, I mean

{
   relationships: {
      [NeoVis.NEOVIS_DEFAULT_CONFIG]: {
          [NeoVis.NEOVIS_ADVANCED_CONFIG]: {
              function: {
                  label: rel => rel.type
              }
         }
     }
}
NudistBeaaach commented 1 year ago

Thx you very much!