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

The relationship between points is not shown on the edge #369

Closed SeXyTeA-x closed 10 months ago

SeXyTeA-x commented 10 months ago

Expected Behavior (Mandatory)

Show the relationship between points on the edge,like this : image

Actual Behavior (Mandatory)

there is no relationship on the edge,like this: image I want to know how to let the relationship show

How to Reproduce the Problem

this is my config:
var config = {
                containerId: "viz",
                neo4j: {
                    serverUrl: "bolt://localhost:7687",
                    serverUser: "neo4j",
                    serverPassword: "csu123"
                },
                labels: {
                    Project: {
                        label: "name",
                        value: "pagerank",
                        group: "community"
                    },
                    Person:{
                        label: "name",
                        value: "pagerank",
                        group: "community"
                    },
                    Bidder:{
                        label: "name",
                        value: "pagerank",
                        group: "community"
                    },
                    Agent:{
                        label: "name",
                        value: "pagerank",
                        group: "community"
                    }
                },
                relationships: {
                    AGENT_OF: {
                        value: 'weight',
                        label: "AGENT_OF",
                    },
                    WINS: {
                        value: 'weight',
                        label: 'wiWINSns',
                    },
                    BIDS:{
                        value: 'weight',
                        label: 'BIDS',
                    },
                    BIDS_FOR:{
                        value: 'weight',
                        label: 'BIDS_FOR',
                    }
                },
                visConfig: {
                    nodes: {
                        shape: 'square'
                    },
                    edges: {   
                        arrows: {
                            to: {
                                enabled: true,
                                type: "arrow",
                            },
                        },
                    },
                },
                initialCypher: `MATCH (n{name:"项目21479"})-[r1]-(m)-[r2]-(o),(a)-[r3]-(n)RETURN *`
            };

Simple Example

Screenshots (where it's possibile)

image

Specifications (Mandatory)

Currently used versions

Versions

thebestnom commented 10 months ago

https://visjs.github.io/vis-network/examples/network/labels/labelAlignment.html This is all I could find in the vis.js docs, It should be possible, but it will bot look the same as neo4j desktop

thebestnom commented 10 months ago

Also if you want the label to have the exact text you wrote in the config and not get it from the relationship you'll need to use NEOVIS_ADVANCED_CONFIG

SeXyTeA-x commented 10 months ago

No, I just want to get the relationship returned from neo4j, and in neovis.js, is there an option to set the display relationship?

thebestnom commented 10 months ago

in advanced config

{
// Advanced
label: rel => rel.type
}
SeXyTeA-x commented 10 months ago

emmm, I don't understand what you mean, is this what you mean:

var config = {
                containerId: "viz",
                neo4j: {
                    serverUrl: "bolt://localhost:7687",
                    serverUser: "neo4j",
                    serverPassword: "csu123"
                },
               ...
                relationships: {
                    AGENT_OF: {
                        value: 'weight',
                       label: rel => rel.type
                    },
                    WINS: {
                        value: 'weight',
                       label: rel => rel.type
                    },
                    BIDS:{
                        value: 'weight',
                        label: rel => rel.type

                    },
                    BIDS_FOR:{
                        value: 'weight',
                        label: rel => rel.type
                    }
                },
                ...
            };

It doesn't seem to have any effect.

SeXyTeA-x commented 10 months ago

Oh, I know how to configure, thank you for your answer