Sha256: 98523cd40205102afd36f9346a2a104209cf21c3bb9ad1beada53701d432f21f
Contents?: true
Size: 1.16 KB
Versions: 25
Compression:
Stored size: 1.16 KB
Contents
var r = 960 / 2; var cluster = d3.layout.cluster() .size([360, r - 120]); var diagonal = d3.svg.diagonal.radial() .projection(function(d) { return [d.y, d.x / 180 * Math.PI]; }); var vis = d3.select("#chart").append("svg") .attr("width", r * 2) .attr("height", r * 2) .append("g") .attr("transform", "translate(" + r + "," + r + ")"); d3.json("../data/flare.json", function(json) { var nodes = cluster.nodes(json); var link = vis.selectAll("path.link") .data(cluster.links(nodes)) .enter().append("path") .attr("class", "link") .attr("d", diagonal); var node = vis.selectAll("g.node") .data(nodes) .enter().append("g") .attr("class", "node") .attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; }) node.append("circle") .attr("r", 4.5); node.append("text") .attr("dx", function(d) { return d.x < 180 ? 8 : -8; }) .attr("dy", ".31em") .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; }) .attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; }) .text(function(d) { return d.name; }); });
Version data entries
25 entries across 25 versions & 1 rubygems