我正在尝试学习如何将 sigma.js 与 neo4j 一起使用,并且希望获得一些帮助,让布局算法与 sigma.neo4j.cypher 一起使用。当与 sigma.neo4j.cypher 一起使用时,sigma.layout.fruchtermanReingold.js 布局在下面的代码中不起作用。我非常有信心我拥有所有 sigma 导入,但如果您认为问题可能存在,可以将它们添加到问题中。
非常感谢。
<div id="container">
<style>
#graph-container {
top: 0;
bottom: 0;
left: 0;
right: 0;
position: absolute;
}
</style>
<div id="graph-container"></div>
</div>
<script src="../plugins/sigma.layout.forceAtlas2/worker.js"></script>
<script src="../plugins/sigma.layout.forceAtlas2/supervisor.js"></script>
<script src="../plugins/sigma.plugins.animate/sigma.plugins.animate.js"></script>
<script src="../plugins/sigma.layout.fruchtermanReingold/sigma.layout.fruchtermanReingold.js"></script>
<script type="application/javascript">
sigma.neo4j.cypher(
{ url: 'http://localhost:7474', user: 'neo4j', password: 'admin' },
'MATCH (n) OPTIONAL MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 100',
{ container: 'graph-container' } ,
function(s) {
console.log('Number of nodes :'+ s.graph.nodes().length);
console.log('Number of edges :'+ s.graph.edges().length);
}
);
// Configure the Fruchterman-Reingold algorithm:
var frListener = sigma.layouts.fruchtermanReingold.configure(s, {
maxIterations: 500,
easing: 'quadraticInOut',
duration: 800
});
// Bind the events:
frListener.bind('start stop interpolate', function(e) {
console.log(e.type);
});
// Start the Fruchterman-Reingold algorithm:
sigma.layouts.fruchtermanReingold.start(s);
</script>
最佳答案
回复,
我在这里做了一个 plunkr 演示:http://embed.plnkr.co/daMtV25BYEh5ZQFG2fnk/preview
现在,我看到了一个图表,但没有任何动人的内容......并且 fruchtermanReingold 示例在链接性存储库上不起作用。
希望对你有帮助
关于neo4j - 使用 neo4j 和 sigma.js 进行布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31225322/