sigma.js
sigma.js copied to clipboard
Sigma with VueJs
Is there any documentation for use with VueJs?
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:
- 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" />
- The component must have
sigmaInstanceandsigmaRootin its state:
setup() {
return {
// ...
sigmaRoot: ref<HTMLDivElement | null>(null),
sigmaInstance: shallowRef<Sigma | null>(null),
};
}
- Instantiate sigma when the component becomes
mounted:
mounted() {
this.sigmaInstance = new Sigma(
someGraph,
this.sigmaRoot
);
// Bind events, etc...
}
- 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...).
Thank you. I am patiently waiting for the sample you will publish. @jacomyal