forked from gajus/pie-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
94 lines (80 loc) · 2.58 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="d3.v2.js"></script>
<script type="text/javascript" src="d3.ay-pie-chart.js"></script>
<script type="text/javascript">
var get_random_data = function(limit)
{
var data = [];
var getRandomInt = function(min, max)
{
return Math.floor(Math.random() * (max - min + 1)) + min;
}
for(var i = 1; i < limit; i++)
{
data.push({
index: i,
name: 'test',
value: getRandomInt(0,1000)
});
}
return data;
}
$(function(){
ay.pie_chart('pie-a', get_random_data(5), {percentage: false});
ay.pie_chart('pie-b', get_random_data(10), {radius_inner: 50});
ay.pie_chart('pie-c', get_random_data(20), {group_data: 1});
});
</script>
<style>
html, body { margin: 0; padding: 0; font: 12px/20px monospace; }
.authorship { margin: 20px; }
.container { overflow: hidden; margin: 20px; }
.chart { float: left; width: 400px; height: 400px; background: #eee; margin: 0 20px 0 0; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
svg { width: 100%; height: 100%; }
path.g-1 { fill: #1f77b4; }
path.g-2 { fill: #aec7e8; }
path.g-3 { fill: #ff7f0e; }
path.g-4 { fill: #ffbb78; }
path.g-5 { fill: #2ca02c; }
path.g-6 { fill: #98df8a; }
path.g-7 { fill: #d62728; }
path.g-8 { fill: #ff9896; }
path.g-9 { fill: #9467bd; }
path.g-10 { fill: #c5b0d5; }
path.g-11 { fill: #8c564b; }
path.g-12 { fill: #c49c94; }
path.g-13 { fill: #e377c2; }
path.g-14 { fill: #f7b6d2; }
path.g-15 { fill: #7f7f7f; }
path.g-16 { fill: #c7c7c7; }
path.g-17 { fill: #bcbd22; }
path.g-18 { fill: #dbdb8d; }
path.g-19 { fill: #17becf; }
path.g-20 { fill: #9edae5; }
svg > g.label { text-anchor: middle; }
svg > g.labels g.label { -moz-pointer-events: none; -webkit-pointer-events: none; -o-pointer-events: none; pointer-events: none; }
svg > g.labels g.label rect { stroke: none; fill: #fff; fill-opacity: .5; shape-rendering: crispEdges; }
svg > g.labels g.label text { font-size: 12px; text-anchor: left; }
svg > g.labels g.label.active rect { fill-opacity: 1; }
</style>
</head>
<body>
<div class="container">
<div class="chart">
<svg class="pie-a"></svg>
</div>
<div class="chart">
<svg class="pie-b"></svg>
</div>
<div class="chart">
<svg class="pie-c"></svg>
</div>
</div>
<div class="authorship">
This is a demo of the <a href="https://github.com/gajus/pie-chart" target="_blank">pie-chart plugin</a>.
</div>
</body>
</html>