/
index.html
80 lines (66 loc) · 1.52 KB
/
index.html
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<html>
<head>
<title>d3 Nested Pie Chart</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>
<style type="text/css">
.viz {
font: 10px sans-serif;
margin: 0px auto;
width: 700px;
height: 700px;
}
.border {
stroke: #ddd;
fill: #f5f5f5;
}
.reset_button {
stroke: #00A060;
fill: #00A060;
}
.reset_button_disabled {
stroke: #f5f5f5;
fill: #f5f5f5;
}
.pie_title {
font-size: 12px;
}
</style>
</head>
<body>
<div id="chart-1" class="viz"></div>
<div id="chart-2" class="viz"></div>
<script src="d3-nested-pie-chart.js"></script>
<script>
fillPalette = [
"red", "blue",
"yellow", "grey",
"green", "black"
];
strokePalette = [
"red", "blue",
"yellow", "grey",
"green", "black"
];
chart1 = d3NestedPieChart()
.fillPalette(fillPalette)
.strokePalette(strokePalette)
.width(500)
.height(500);
chart2 = d3NestedPieChart()
.fillPalette(fillPalette)
.strokePalette(strokePalette)
.width(300)
.height(300);
d3.json("data.json", function(data) {
d3.select("#chart-1")
.datum(data)
.call(chart1);
});
d3.json("data.json", function(data) {
d3.select("#chart-2")
.datum(data)
.call(chart2);
});
</script>
</body>
</html>