How can I get `vis.js` `vis-network` to run on React.js?
Asked Answered
L

2

6

I'm trying to use vis.js to render a Network Visualization using React. For that, I've been following the guide from James Tharpe: https://www.jamestharpe.com/react-visjs/. However, the follwing errors are raised...

Console Errors

Please check out my code on this repo:

https://github.com/murilobellatini/try-vis-network

Can you guys help me get this code working?

Thanks!

Lessee answered 12/5, 2021 at 23:4 Comment(0)
C
7

I've been facing the same issue. Add options in the Network constructor.

  useEffect(() => {
    const network =
      container.current &&
      new Network(container.current, { nodes, edges }, options);
  }, [container, nodes, edges]);

full working stack: https://stackblitz.com/edit/react-e1pbxf?file=src/Graph.js

Try remove options. And it'll say Cannot read the property 'solve' of undefined.

Comical answered 21/6, 2021 at 10:7 Comment(0)
S
-1

I used the react version of Vis js.

npm install --save react-visjs-timeline

and it is working properly

npm

Sarong answered 27/12, 2021 at 13:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.