Fix Sigma

This commit is contained in:
Yûki VACHOT 2024-05-12 02:41:43 +02:00
parent 1e37577b17
commit 4f4fabce54
2 changed files with 9 additions and 9 deletions

View file

@ -1,5 +1,5 @@
import graphology from 'https://cdn.jsdelivr.net/npm/graphology/+esm'; import graphology from 'https://cdn.jsdelivr.net/npm/graphology/+esm';
import sigma from 'https://cdn.jsdelivr.net/npm/sigma/+esm'; import Sigma from 'https://cdn.jsdelivr.net/npm/sigma/+esm';
import forceAtlas2 from 'https://cdn.jsdelivr.net/npm/graphology-layout-forceatlas2/+esm'; import forceAtlas2 from 'https://cdn.jsdelivr.net/npm/graphology-layout-forceatlas2/+esm';
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
@ -13,10 +13,7 @@ async function main(){
graph = addLayout(graph); graph = addLayout(graph);
console.log("Graph data:", network_graph_json); console.log("Graph data:", network_graph_json);
console.log("Graph object:", graph); console.log("Graph object:", graph);
let sigmaInstance = new sigma.Sigma( new Sigma(graph, document.getElementById('container'));
graph,
document.getElementById('container')
);
} catch (error) { } catch (error) {
console.error('Failed to load or create the graph:', error); console.error('Failed to load or create the graph:', error);
} }
@ -58,7 +55,7 @@ function addLayout(graph){
iterations: 100, iterations: 100,
settings: { settings: {
gravity: 0.5, gravity: 0.5,
scalingRatio: 2.0 scalingRatio: 1.0
} }
}); });

View file

@ -1,9 +1,12 @@
body { html, body {
height: 100%;
margin: 0;
padding: 0;
background: lightgrey; background: lightgrey;
} }
#container { #container {
height: auto; width: 100vw;
width: auto; height: 100vh;
background: white; background: white;
} }