1.0.2 • Published 4 months ago

d3neo4j.js v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

d3neo4j.js

Neo4j graph visualization using D3.js.

neo3jd3.js

Running

> git clone https://github.com/zeus1999/neo4jd3.git
> npm install

Documentation

Options

ParameterTypeDescription
highlightarrayHighlight several nodes of the graph. Selection with Node Id.Example:[    {        id: 'Pet-001'    }]
infoPanelbooleanShow the information panel: true, false. Default: true.
minCollisionintMinimum distance between nodes. Default: 2 * nodeRadius.
neo4jDataobjectGraph data in Neo4j data format.
neo4jDataUrlstringURL of the endpoint that serves the graph data in Neo4j data format.
nodeRadiusintRadius of nodes. Default: 25.
onNodeClickfunctionCallback function to be executed when the user clicks a node.
onNodeDoubleClickfunctionCallback function to be executed when the user double clicks a node.
onNodeDragEndfunctionCallback function to be executed when the user finishes dragging a node.
onNodeDragStartfunctionCallback function to be executed when the user starts dragging a node.
onNodeMouseEnterfunctionCallback function to be executed when the mouse enters a node.
onNodeMouseLeavefunctionCallback function to be executed when the mouse leaves a node.
onRelationshipDoubleClickfunctionCallback function to be executed when the user double clicks a relationship.
zoomFitbooleanAdjust the graph to the container once it has been loaded: true, false. Default: false.
showNodeLabelbooleanShow the node labels: true, false. Default: false.
nodeLabelFunctionfunctionShow the node labels: true, false. Default: false. Examples:node => node.namenode => node.idnode => node.id + " " + node.name

Documentation

Example Data

{
    "results": [
        {
            "columns": [
                "user",
                "entity"
            ],
            "data": [
                {
                    "graph": {
                        "nodes": [
                            {
                                "id": "1001",
                                "name": "Anna Schmidt",
                                "labels": ["Person"],
                                "properties": {}
                            },
                            {
                                "id": "1002",
                                "name": "Ben Müller",
                                "labels": ["Person"],
                                "properties": {}
                            },
                            {
                                "id": "1003",
                                "name": "Clara Weber",
                                "labels": ["Person"],
                                "properties": {}
                            },
                            {
                                "id": "1004",
                                "name": "David Fischer",
                                "labels": ["Person"],
                                "properties": {}
                            },
                            {
                                "id": "2001",
                                "name": "TechCorp GmbH",
                                "labels": ["Unternehmen"],
                                "properties": {}
                            }
                        ],
                        "relationships": [
                            {
                                "id": "R100",
                                "type": "Freund",
                                "startNode": "1001",
                                "endNode": "1002",
                                "properties": {}
                            },
                            {
                                "id": "R101",
                                "type": "Arbeitskollege",
                                "startNode": "1002",
                                "endNode": "1003",
                                "properties": {}
                            },
                            {
                                "id": "R102",
                                "type": "Angestellter",
                                "startNode": "1003",
                                "endNode": "2001",
                                "properties": {}
                            },
                            {
                                "id": "R103",
                                "type": "Chef",
                                "startNode": "1004",
                                "endNode": "2001",
                                "properties": {}
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "errors": []
}

Example

new d3Neo4J('#neo4jd3', {
    highlight: [
        {
            id: "1004"
        }
    ],
    neo4jData: graphData,
    infoPanel: false,
    minCollision: 100,
    nodeRadius: 25,
    showNodeLabel: true,
    nodeLabelFunction: node => node.name
});

Versions

Tested in D3 Version 7.9.0

License

Code released under the MIT license.

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago