Files: 915c479a5dddab0aacc02f7e0f910c9154e48806 / index.js
756 bytesRaw
1 | const fs = require('fs') |
2 | const Path = require('path') |
3 | const fromJson = require('ngraph.fromjson') |
4 | const Renderer = require('./renderer') |
5 | const Graph = require('./graph') |
6 | |
7 | const config = { |
8 | physics: { |
9 | springLength : 80, |
10 | springCoeff : 0.00005, |
11 | gravity: -0.4, |
12 | theta : 0.4, |
13 | dragCoeff : 0.04 |
14 | }, |
15 | link: (link) => { |
16 | // if (link.data.hidden) return |
17 | // makes linkUI element not exist ? => display.getLink doesn't work |
18 | |
19 | return { |
20 | fromColor: 0x000066, |
21 | toColor: 0x000066 |
22 | } |
23 | } |
24 | } |
25 | |
26 | module.exports = function (sbot, cb) { |
27 | Graph(sbot, (err, data) => { |
28 | if (err) return cb(err) |
29 | const str = JSON.stringify(data) |
30 | var graph = fromJson(str) |
31 | var display = Renderer(graph, config) |
32 | cb(null, display) |
33 | }) |
34 | } |
35 | |
36 |
Built with git-ssb-web