Sigma.js dragging graph leaves old graph on canvas

24 Views Asked by At

Tried using the sigma.js to render a rather simple force graph.

export const GraphView = () => {

  useEffect(() => {
    const container = document.getElementById('sigma-container') as HTMLElement;
    const graph = new Graph();

    graph.addNode('John', { x: 0, y: 10, size: 5, label: 'John', color: 'blue' });
    graph.addNode('Mary', { x: 10, y: 0, size: 3, label: 'Mary', color: 'red' });

    graph.addEdge('John', 'Mary');

    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const renderer = new Sigma(graph, container);
  }, []);

  return <div id="sigma-container"></div>;
};

It renders fine, but dragging graph causes the previous graph to remain on the canvas. Any reason why this might be happening?

enter image description here

0

There are 0 best solutions below