neo4jd3 icon indicating copy to clipboard operation
neo4jd3 copied to clipboard

Usage with React App

Open ghost opened this issue 7 years ago • 4 comments

Is there a way to use neo4jd3 with React app ?

ghost avatar Jul 14 '17 06:07 ghost

I got this working in my react app in the following way:

General:

  • npm i neo4jd3
  • add a reference to d3 from a cdn in your index page

In the component:

import React from 'react'
import Neo4JD3 from 'neo4jd3'

class Graph extends React.Component {

  componentDidMount() {
    this.props.getGraph() // this sets a state property in my app with the neo4j data
  }

  componentDidUpdate(prevProps, prevState) {

    const { data } = this.props; // the data retreived from getGraph() is passed to the component through props

    if(data) {
      new Neo4JD3('#graph', {
        neo4jData: data,
        minCollision: 75,
        nodeRadius: 20
      })
    }
  }

  render() {
    return <GraphGrid>
      <TableTitle>Graph visualisation</TableTitle>
      <Panel>
        <GraphContainer id="graph"></GraphContainer>
      </Panel>
    </GraphGrid>
  }

}

export default Graph

dougajmcdonald avatar Jun 01 '18 13:06 dougajmcdonald

not working.. getting lots of error. GraphGrid, TableTitle, Panel, GraphContainer not defined

chandra155 avatar Aug 19 '19 09:08 chandra155

not working.. getting lots of error. GraphGrid, TableTitle, Panel, GraphContainer not defined

how to fix this

MoMoWongHK avatar Jan 06 '20 10:01 MoMoWongHK

not working.. getting lots of error. GraphGrid, TableTitle, Panel, GraphContainer not defined

how to fix this

It was an example. You can remove those Components and create your own

nitinreddy3 avatar Jul 22 '20 09:07 nitinreddy3