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

External control : forward Sigma ref #30

Closed
sim51 opened this issue Sep 27, 2022 · 1 comment
Closed

External control : forward Sigma ref #30

sim51 opened this issue Sep 27, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@sim51
Copy link
Owner

sim51 commented Sep 27, 2022

It can be cool to be able to forward the Sigma ref when using the SigmaContainer.
This will allow user to control the graph & Sigma outside SigmaContainer tree.

Example :

export const ExternalView: FC = () => {
  const [sigma, setSigma] = useState<Sigma | null>(null);

  useEffect(() => {
    if (sigma) {
      const graph = sigma.getGraph();
      graph.addNode("A", { x: 0, y: 0, label: "Node A", size: 10 });
      graph.addNode("B", { x: 1, y: 1, label: "Node B", size: 10 });
      graph.addEdgeWithKey("rel1", "A", "B", { label: "REL_1" });
    }
  }, [sigma]);

  return <SigmaContainer ref={setSigma} />;
};
@sim51 sim51 added the enhancement New feature or request label Sep 27, 2022
@sim51 sim51 self-assigned this Sep 27, 2022
sim51 added a commit that referenced this issue Sep 27, 2022
@sim51 sim51 modified the milestone: v2.0 Sep 27, 2022
@sim51
Copy link
Owner Author

sim51 commented Sep 27, 2022

Should add an example on the website

@sim51 sim51 closed this as completed Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant