Created
March 15, 2020 14:51
-
-
Save SergeyPirogov/04860f6be77f3299c7298f7b878eeb5c to your computer and use it in GitHub Desktop.
SigmaJS Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>SigmaJS example</title> | |
<!-- Sigma core --> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/sigma.core.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/conrad.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/utils/sigma.utils.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/utils/sigma.polyfills.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/sigma.settings.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/classes/sigma.classes.dispatcher.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/classes/sigma.classes.configurable.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/classes/sigma.classes.graph.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/classes/sigma.classes.camera.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/classes/sigma.classes.quad.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/classes/sigma.classes.edgequad.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/captors/sigma.captors.mouse.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/captors/sigma.captors.touch.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/sigma.renderers.canvas.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/sigma.renderers.webgl.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/sigma.renderers.svg.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/sigma.renderers.def.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.labels.def.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.hovers.def.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.nodes.def.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.edges.def.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.edges.curve.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.edges.arrow.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.edges.curvedArrow.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.edgehovers.def.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.edgehovers.curve.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.edgehovers.arrow.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.edgehovers.curvedArrow.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/renderers/canvas/sigma.canvas.extremities.def.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/middlewares/sigma.middlewares.rescale.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/middlewares/sigma.middlewares.copy.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/misc/sigma.misc.animation.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/misc/sigma.misc.bindEvents.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/misc/sigma.misc.bindDOMEvents.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/misc/sigma.misc.drawHovers.js"></script> | |
</head> | |
<body> | |
<div id='sigma-container'></div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s = new sigma( | |
{ | |
renderer: { | |
container: document.getElementById('sigma-container'), | |
type: 'canvas' | |
}, | |
settings: { | |
labelColor: 'node', | |
minEdgeSize: 0.1, | |
maxEdgeSize: 2, | |
minNodeSize: 5, | |
maxNodeSize: 5, | |
} | |
} | |
); | |
var graph = { | |
nodes: [ | |
{ id: "n0", label: "node 1", x: 0, y: 0, size: 3, color: '#00BCD4' }, | |
{ id: "n1", label: "node 2", x: 3, y: 1, size: 2, color: '#00BCD4' }, | |
{ id: "n2", label: "node 3", x: 1, y: 3, size: 1, color: '#00BCD4' }, | |
{ id: "n3", label: "node 4", x: 6, y: 0, size: 3, color: '#00BCD4' }, | |
{ id: "n4", label: "node 5", x: 5, y: 1, size: 2, color: '#00BCD4' }, | |
{ id: "n5", label: "node 6", x: 4, y: 3, size: 1, color: '#00BCD4' } | |
], | |
edges: [ | |
{ id: "e0", source: "n0", target: "n1", color: '#545454', type:'line'}, | |
{ id: "e1", source: "n1", target: "n2", color: '#545454', type:'line'}, | |
{ id: "e2", source: "n1", target: "n3", color: '#545454', type:'line'}, | |
{ id: "e3", source: "n1", target: "n4", color: '#545454', type:'line'}, | |
{ id: "e4", source: "n2", target: "n0", color: '#545454', type:'line'}, | |
{ id: "e5", source: "n2", target: "n3", color: '#545454', type:'line'}, | |
{ id: "e6", source: "n3", target: "n2", color: '#545454', type:'line'}, | |
{ id: "e7", source: "n4", target: "n5", color: '#545454', type:'line'}, | |
{ id: "e8", source: "n4", target: "n3", color: '#545454', type:'line'}, | |
{ id: "e9", source: "n5", target: "n0", color: '#545454', type:'line'} | |
] | |
} | |
s.graph.read(graph); | |
s.refresh(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { height:100%; color: #fff!important;} | |
body {height: 100%; margin:0; color: #fff!important;} | |
#sigma-container { width:100%; height:100%; background-color:#242424; color: #fff!important;} | |
#sigma-mouse{ | |
background: transparent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment