Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No labels or titles for relationships #378

Open
nielsjansendk opened this issue Jan 17, 2024 · 2 comments
Open

No labels or titles for relationships #378

nielsjansendk opened this issue Jan 17, 2024 · 2 comments

Comments

@nielsjansendk
Copy link

nielsjansendk commented Jan 17, 2024

Expected Behavior (Mandatory)

When I have a config file with this:

MY_CONNECTION: {
        label: 'MY_CONNECTION',
        value: 'weight',
        [NeoVis.NEOVIS_ADVANCED_CONFIG]: {
          function: {
            title: NeoVis.objectToTitleHtml
          },
          static: {
            color: '#8DCC93'
          }
        }
      },

I expect to see a label on the relationship and to see a title when I hover over it.

Actual Behavior (Mandatory)

Neither title or label shows up. I have tried this:

     MY_CONNECTION: {
        label: 'MY_CONNECTION',
        [NeoVis.NEOVIS_ADVANCED_CONFIG]: {
          function: {
            title: function (edge) {
              console.log(edge);
            },
          }
        }
      },

And it logs edge to be undefined. When I try the same with a node title it returns information about the node.

How to Reproduce the Problem

Set a label or a title on a relationship and check if it shows up.

Specifications (Mandatory)

I am using neovis.js version 2.10 and I am using datafunctions to connect to an api. The relationships are drawn, they are just not labelled.

Currently used versions

Versions

  • OS: The api that is called by the datafunctions have been tested both on Linux and Mac
  • Library: 2.10
  • Neo4j: 5.14 but neovis does not connect directly to the database.
@thebestnom
Copy link
Collaborator

I have to debug it and I need sample data if you can send it
But I guess I would not have any time to test it in the following months

I suggest to try to debug it yourself for the time being shouldn't be too hard...

Sorry that I can't help...

@exoup
Copy link

exoup commented Jan 19, 2024

@nielsjansendk
It seems like the label property for relationships expect to be a property that relationship has.
So if MY_CONNECTION has a property called databus with a value of 100BIT then the configuration would look like:

MY_CONNECTION: {
        label: 'databus',
        value: 'weight',
        ...otherProps
      }

and you'd see relationship labels that say 100BIT

I would expect to just be able to set a string for this, or have a property to use the relationship type from Neo4j, but I couldn't find it.

Instead you can set the label using an advanced config like so:

     MY_CONNECTION: {
        label: 'MY_CONNECTION',
        [NeoVis.NEOVIS_ADVANCED_CONFIG]: {
          function: {
            label: (edge) => edge.type
          }
        }
      }

I expect your title function isn't working because it's malformed.
objectToTitleHtml expects a neo4jObject (the edge), and an array of properties.

You should be able to get all of your relationship properties in a title like so:

     MY_CONNECTION: {
        label: 'MY_CONNECTION',
        [NeoVis.NEOVIS_ADVANCED_CONFIG]: {
          function: {
            title: (edge) => objectToTitleHtml(edge, Object.keys(edge.properties)),
//OR        title: (edge) => objectToTitleHtml(edge, ["databus", ...])
            label: (edge) => edge.type
          }
        }
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants