D3 Example from Beaker

node v0.12.18
version: 3.0.0
endpointsharetweet
Original example using Python here: http://sharing.beakernotebook.com/gist/anonymous/e21582541d7c1fe60eb4
var R = require("ramda"); var randrange = require("random-number-in-range"); var count = 100; var nodes = R.range(0, 100).map((_, x) => ({ "name": x, "group": Math.floor(x * 7 / count) })); var links = R.range(0, Math.floor(count * 1.15)).map(function(_, x) { var source = x % count; var target = Math.floor(Math.log(1 + randrange(0, count)) / Math.log(1.3)); var value = 10.0 / (1 + Math.abs(source - target)); return { "source": source, "target": target, "value": value }; }) var d3Graph = require("notebook")("tonic/d3-graph/4.0.0"); d3Graph(nodes, links)
Loading…

no comments

    sign in to comment