Files: 981ed08561e580c3f6f34242a8388c7614bdcb69 / index.js
648 bytesRaw
1 | const fs = require('fs') |
2 | const Path = require('path') |
3 | const fromJson = require('ngraph.fromjson') |
4 | const Renderer = require('ngraph.pixel') |
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: () => { |
16 | return { |
17 | fromColor: 0x000066, |
18 | toColor: 0x000066 |
19 | } |
20 | } |
21 | } |
22 | |
23 | module.exports = function (sbot, cb) { |
24 | Graph(sbot, (err, data) => { |
25 | if (err) return cb(err) |
26 | const str = JSON.stringify(data) |
27 | const graph = fromJson(str) |
28 | const display = Renderer(graph, config) |
29 | cb(null, display) |
30 | }) |
31 | } |
32 |
Built with git-ssb-web