Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to setup Neovis in Reactjs #366

Open
Roushan-Raj-au9 opened this issue Oct 17, 2023 · 5 comments
Open

How to setup Neovis in Reactjs #366

Roushan-Raj-au9 opened this issue Oct 17, 2023 · 5 comments

Comments

@Roushan-Raj-au9
Copy link

Roushan-Raj-au9 commented Oct 17, 2023

import NeoVis, { NEOVIS_ADVANCED_CONFIG } from 'neovis.js';
import { useEffect } from "react";


function App() {

  useEffect(() => {
    let neoViz;

    function draw() {
      const config = {
        containerId: "viz",
        neo4j: {
          serverUrl: "bolt://localhost:7687",
          serverUser: "neo4j",
          serverPassword: "neo4j",
        },
        labels: {
          Character: {
            label: "name",
            value: "pagerank",
            group: "community",
            [NEOVIS_ADVANCED_CONFIG]: {
              static: {
                font: '18px',
                shape: 'box',
                color: '#00ff00'
              }
            }
          }
        },
        relationships: {
          INTERACTS: {
            value: "weight"
          }
        },
         initialCypher: "MATCH (n) RETURN n limit 20"   // here I'm trying to use default Movie DBMS 
      };

      neoViz = new NeoVis.default(config);
      neoViz.render();
      console.log("neoViz >> ", neoViz);
    }

    draw();
  }, [])

  return (
    <div className="App">
      Hello
      <div id="viz"></div>
    </div>
  );
}

export default App;

After running this I'm getting an error as -> Uncaught TypeError: neovis_js__WEBPACK_IMPORTED_MODULE_0___default(...).default is not a constructor at draw

Can you help me to correctly setup neovis in Reactjs

@thebestnom
Copy link
Collaborator

thebestnom commented Oct 17, 2023

Change new NeoVis.default( to new NeoVis(
You are already imporint NeoVis as default, the examples written like it was imported as import * as NeoVis

@Roushan-Raj-au9
Copy link
Author

Thank you that resolved the particular problem
But now I cannot see the arrows, labels ,name , how to bring that attaching below the image how currently it is looking for reference

image

@Roushan-Raj-au9
Copy link
Author

I want to display something like below image
image

@NeoZ666
Copy link

NeoZ666 commented Dec 26, 2023

Put the correct query

@NeoZ666
Copy link

NeoZ666 commented Jan 2, 2024

initialCypher: MATCH (n) RETURN n limit 20

This is incorrect.
Use something like:

initialCypher: MATCH p=()-[:ACTED_IN]->() RETURN p to get all nodes which have 'to' and 'from' relationship of 'ACTED_IN'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants