tree.rb 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,99 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
5
- </head>
6
- <body>
7
-
8
-
9
- <div id="viz"></div>
10
-
11
- <div id="#chart"></div>
12
-
13
- <script type="text/javascript">
14
-
15
- var sampleSVG = d3.select("#viz")
16
- .append("svg")
17
- .attr("width", 100)
18
- .attr("height", 100);
19
-
20
- sampleSVG.append("circle")
21
- .style("stroke", "gray")
22
- .style("fill", "white")
23
- .attr("r", 40)
24
- .attr("cx", 50)
25
- .attr("cy", 50)
26
- .on("mouseover", function () {d3.select(this).style("fill", "aliceblue");})
27
- .on("mouseout", function () {d3.select(this).style("fill", "white");});
28
-
29
- </script>
30
-
31
-
32
-
33
- <script type="text/javascript" src="flare.js">
34
-
35
- </script>
36
-
37
-
38
- <script type="text/javascript">
39
-
40
-
41
- var width = 960,
42
- height = 500,
43
- color = d3.scale.category20c();
44
-
45
- var treemap = d3.layout.treemap()
46
- .size([width, height])
47
- .sticky(true)
48
- .value(function (d) { return d.size; });
49
-
50
- var div = d3.select("#chart").append("div")
51
- .style("position", "relative")
52
- .style("width", width + "px")
53
- .style("height", height + "px");
54
-
55
-
56
- d3.json("flare.json", function (json) {
57
- div.data([json]).selectAll("div")
58
- .data(treemap.nodes)
59
- .enter().append("div")
60
- .attr("class", "cell")
61
- .style("background", function (d) { return d.children ? color(d.name) : null; })
62
- .call(cell)
63
- .text(function (d) { return d.children ? null : d.name; });
64
-
65
- d3.select("#size").on("click", function () {
66
- div.selectAll("div")
67
- .data(treemap.value(function (d) { return d.size; }))
68
- .transition()
69
- .duration(1500)
70
- .call(cell);
71
-
72
- d3.select("#size").classed("active", true);
73
- d3.select("#count").classed("active", false);
74
- });
75
-
76
- d3.select("#count").on("click", function () {
77
- div.selectAll("div")
78
- .data(treemap.value(function (d) { return 1; }))
79
- .transition()
80
- .duration(1500)
81
- .call(cell);
82
-
83
- d3.select("#size").classed("active", false);
84
- d3.select("#count").classed("active", true);
85
- });
86
- });
87
-
88
- function cell() {
89
- this
90
- .style("left", function (d) { return d.x + "px"; })
91
- .style("top", function (d) { return d.y + "px"; })
92
- .style("width", function (d) { return Math.max(0, d.dx - 1) + "px"; })
93
- .style("height", function (d) { return Math.max(0, d.dy - 1) + "px"; });
94
- }
95
-
96
-
97
- </script>
98
- </body>
99
- </html>
@@ -1,22 +0,0 @@
1
-
2
- <!DOCTYPE html>
3
- <html lang="en">
4
- <head>
5
- <meta charset="utf-8">
6
- <title>D3 Test</title>
7
- <script type="text/javascript" src="../../d3/d3.v2.js"></script>
8
- </head>
9
- <body>
10
- <script type="text/javascript">
11
-
12
- var dataset = [ 5, 10, 15, 20, 25 ];
13
-
14
- d3.select("body").selectAll("p")
15
- .data(dataset)
16
- .enter()
17
- .append("p")
18
- .text("New paragraph!");
19
-
20
- </script>
21
- </body>
22
- </html>