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

Sigma with VueJs #1420

Open
evrenonur opened this issue Apr 3, 2024 · 2 comments
Open

Sigma with VueJs #1420

evrenonur opened this issue Apr 3, 2024 · 2 comments

Comments

@evrenonur
Copy link

Is there any documentation for use with VueJs?

@jacomyal
Copy link
Owner

jacomyal commented Apr 4, 2024

Hello,

There is none yet. However, I've plugged sigma.js in a Vue application once, and the process is quite the same as with React and Angular:

  1. Create a component, with a DOM element that will be the root of the sigma instance:
<div id="graph-container" ref="sigmaRoot" class="absolute inset-0" />
  1. The component must have sigmaInstance and sigmaRoot in its state:
setup() {
  return {
    // ...
    sigmaRoot: ref<HTMLDivElement | null>(null),
    sigmaInstance: shallowRef<Sigma | null>(null),
  };
}
  1. Instantiate sigma when the component becomes mounted:
mounted() {
  this.sigmaInstance = new Sigma(
    someGraph,
    this.sigmaRoot
  );
  // Bind events, etc...
}
  1. Kill sigma before the component becomes unmounted:
beforeUnmount() {
  // Unbind events, etc...
  this.sigmaInstance.kill();
  this.sigmaInstance = null;
}

And that's basically it.

I'll leave this ticket opened so that we release a working example at some point, similar to what we did with Angular (which is probably outdated...).

@evrenonur
Copy link
Author

Thank you. I am patiently waiting for the sample you will publish. @jacomyal

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

No branches or pull requests

2 participants