dagre-d3-react
Dagre D3 Graph Renderer built on DagreD3
Browsers
- support IE11+, Chrome, Firefox, Safari
Screenshots

Install
Usage
Update
rankdir prop has been updated in version 0.2.0
It has now been replaced with config
and the new options can be found here
import DagreGraph from 'dagre-d3-react' ReactDOM
Example CSS Styles
API
props
name | type | default | description |
---|---|---|---|
nodes | array | undefined | List of node objects {label:'', id:'', class: ''} |
links | array | undefined | List of link objects {source: '', target: '', class: '', label: ''} |
zoomable | boolean | false | Allows scroll to zoom on graph |
fitBoundaries | boolean | false | Autosizes graph to fit container |
height | string | 500 | Default height of svg |
width | string | 500 | Default width of svg |
config | object | See configuration options here | |
animate | number | 1000 | Enables animation with duration in milliseconds |
shape | string | circle | SVG node shape: 'rect' | 'circle' | 'ellipse' |
className | string | Assign custom class to svg element | |
onNodeClick | Function | Callback on node click | |
onRelationshipClick | Function | Callback relationship click (specifically the label) |
Node Object
Link Object
Neo4j Example
let data = await axios let dagreData = nodes: links: datadataresults0data return <DagreGraph nodes=dagreDatanodes links=dagreDatalinks>
Node Render HTML
let data = nodes: id: "1" label: "<h3>Node 1</h3>" labelType: "html" id: "2" label: "<h3>Node 2</h3>" labelType: "html" config: style: 'fill: #afa' links: source: '1' target: '2' label: 'TO' config: arrowheadStyle: 'display: none' curve: d3curveBasis <DagreGraph nodes=dagreDatanodes links=dagreDatalinks>
License
dagre-d3-react is released under the MIT license.