-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtree.js
More file actions
61 lines (39 loc) · 1.03 KB
/
tree.js
File metadata and controls
61 lines (39 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
var makeTreeViz = function(treeData) {
var width = 3200;
var height = 1800;
var canvas = d3.select('body').append('svg')
.attr('width', width)
.attr('height', height)
.append('g')
.attr('transform', 'translate(50, 50)');
var tree = d3.layout.tree()
.size([2900, 1400]);
var nodes = tree.nodes(treeData);
var links = tree.links(nodes);
var node = canvas.selectAll(".node")
.data(nodes)
.enter()
.append('g')
.attr("class", "node")
.attr("transform", function (d) {
return "translate(" + d.x + "," + (d.y) + ")";
} );
node.append("circle")
.attr("r", function(d) {return d.r;})
.attr("fill", "green")
.attr("opacity", 0.25)
.attr("stroke", "#ADADAD")
.attr("stroke-width", "2");
node.append("text").attr("class", "texticles")
.text(function(d) {return d.name })
var diagonal = d3.svg.diagonal();
canvas.selectAll(".link")
.data(links)
.enter()
.append("path")
.attr("class", "link")
// .style("fill", "none")
// .style("stroke", "#FF0000")
.attr('d', d3.svg.diagonal())
}
makeTreeViz(treeData);