1.1.6 • Published 3 years ago

react-neo4j-paths v1.1.6

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

react-neo4j-paths

Graph visualization component for Neo4j.

NPM JavaScript Style Guide

Install

npm install react-neo4j-paths

Example

https://turbo-disco-6030766d.pages.github.io/

Usage

To use react-neo4j-paths you must pass the component an array of Neo4j paths. All other props are optional. Below is an example Cypher query showcasing how paths can be queried in Neo4j.

import React from 'react'
import { Neo4jPaths } from 'react-neo4j-paths'

const App = () => {
  return (
    <div
      style={{
        width: '100%',
        height: '100vh'
      }}
    >
      <Neo4jPaths paths={data} />
    </div>
  )
}

export default App

Data Management Props

NameDescriptionTypeDefault
setNodeGroupFunction to set node groups (groups influence color, icon etc...).Functionnode.labels0
setRelGroupSet function for relationship groups.Functionrelationship.type

Event Based Props

NameDescriptionTypeDefault
onNodesChangedFunction that is called each time the nodes in the graph change.Function() => {}
onRelsChangedFunction that is called each time the relationships in the graph change.Function() => {}

Stylistic Props

NameDescriptionTypeDefault
showRelTypesShow or hide relationship type text.Booleantrue
enableForceLayoutOnDragContinue to apply force layout to nodes on drag.Booleanfalse
defaultColorDefines default color for zoom buttons, rels, legend text etc.String#c9c9c9
defaultFontFamilyDefault font family applied to all text.StringArial
nodeRadiusRadius of nodes.Integer30
nodeFontSizeFont size of node text.StringnodeRadius / 4
nodeFontFamilyFont family of node text.StringdefaultFontFamily
relOpacityOpacity applied to relationships.Float0.5
displayLegendBoolean to define whether the legend is displayed.Booleantrue
legendStyleStyle for the legend text. Whatever is defined here will overwrite defaults.Object{}
displayZoomControlsBoolean to define whether the zoom controlls are displayed.Booleantrue
nodeTextMapMap to define node text based on its group (i.e. { Movie: "title" }).Objectnode.identity
nodeColorMapMap to define node color based on its group (i.e. { Movie: "#fff" }).Objectrandom color
nodeIconMapMap to define node icon based on its group (i.e. { Movie: "f008" }). Icon codes can be found at https://fontawesome.com/cheatsheet.Objectno icon
relColorMapMap to define relationship colors.ObjectdefaultColor

Example Cypher Query

MATCH path=(:Person)-[:ACTED_IN]->(:Movie)-[:HAS_GENRE]->(:Genre)
RETURN collect(path) AS paths

License

MIT © HenryBall

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago