我想发现sigma.js,这样我就可以在项目中使用它。我已经知道一点d3,但是通过在互联网上的搜索,人们提到sigma更适合于图形,而在我的例子中,例如在图形数据库中,sigma可能更好。但我搜索了一下,找不到很多关于sigma或任何教程的文档。即使是jacomy网站上的例子也不存在。有人能建议我从哪里开始学习sigma.js吗?
发布于 2016-12-01 10:25:57
我在这个项目的GitHub上找到了一些教程:
https://github.com/jacomyal/sigma.js/tree/master/examples
也在这个网站上:
http://thewhyaxis.info/hairball/
这是官方页面:
http://sigmajs.org/
例如,您可以从官方教程页面中看到,一个简单的示例可能如下所示:
对于Data
{
"nodes": [
{
"id": "n0",
"label": "A node",
"x": 0,
"y": 0,
"size": 3
},
{
"id": "n1",
"label": "Another node",
"x": 3,
"y": 1,
"size": 2
},
{
"id": "n2",
"label": "And a last one",
"x": 1,
"y": 3,
"size": 1
}
],
"edges": [
{
"id": "e0",
"source": "n0",
"target": "n1"
},
{
"id": "e1",
"source": "n1",
"target": "n2"
},
{
"id": "e2",
"source": "n2",
"target": "n0"
}
]
}对于html
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
#container {
max-width: 400px;
height: 400px;
margin: auto;
}
</style>
</head>
<body>
<div id="container"></div>
<script src="sigma.min.js"></script>
<script src="sigma.parsers.json.min.js"></script>
<script>
sigma.parsers.json('data.json', {
container: 'container',
settings: {
defaultNodeColor: '#ec5148'
}
});
</script>
</body>
</html>这将导致:

发布于 2016-12-05 21:07:37
这是一个非常好且简单的示例:Github example
sigma.js github存储库的维基也很详细:Sigma.js – Wiki
https://stackoverflow.com/questions/40901131
复制相似问题