-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
110 lines (104 loc) · 2.73 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<title>zoo-charts</title>
<link rel="shortcut icon" href="assets/zoo.png">
<link rel="stylesheet" type="text/css" href="assets/normalize.css">
<link rel="stylesheet" type="text/css" href="assets/index.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<div class="header">
<div class="content">
<a href="https://github.com/zoo-js" target="_blank">
<img style="margin-top: 8px;" src="https://avatars1.githubusercontent.com/u/70757173?s=60&v=4" />
</a>
<a class="logo" href="https://github.com/zoo-js/zoo-charts" target="_blank">
<h1>Zoo charts </h1>
</a>
<div class="h1-tip">
The number of people adopt pets Top 10
</div>
</div>
</div>
<div class="main">
<div class="box">
<div id="zoo-charts-bar"></div>
</div>
<div class="box">
<div id="zoo-charts-pie"></div>
</div>
<a href="https://zoo-js.github.io/zoo-issue-helper/" target="_blank" class="goto">
Now adopt!
</a>
</div>
<div class="footer">
Source on <a href="https://github.com/zoo-js/zoo-charts" target="_blank">zoo-charts</a><br/>
Data by <a href="https://github.com/zoo-js/zoo-data" target="_blank">zoo-data</a>
</div>
<script>
(function () {
const url = 'https://raw.githubusercontent.com/zoo-js/zoo-data/main/json/members.json';
axios.get(url).then(res => {
const arr = res.data.data.sort((a, b) => b.number - a.number).slice(0,10);
const x = [];
const y = [];
arr.map(it =>{
x.push(it.name);
y.push(it.number);
});
new roughViz.BarH({
element: '#zoo-charts-bar',
data: {
labels: x,
values: y
},
margin: {
top: 50, right: 0, bottom: 50, left: 100
},
color: '#26A699',
axisFontSize: '1.2rem',
padding: 0.3,
fillWeight: 1,
tooltipFontSize: '1rem',
});
new roughViz.Pie({
element: '#zoo-charts-pie',
data: {
labels: x,
values: y
},
fillStyle: 'zigzag-line',
strokeWidth: 3,
highlight: '#000',
legendPosition: 'left',
margin: {
top: 60, right: 10, bottom: 50, left: 80
},
padding: 0,
roughness: 1,
tooltipFontSize: '1rem',
colors: [
'#60acfc',
'#32d3eb',
'#5bc49f',
'#feb64d',
'#9287e7',
'#3db3ea',
'#43cec7',
'#d4ec59',
'#f7816d',
'#d660a8'
],
});
}).catch(err => {
console.log(err);
});
})();
</script>
</body>
</html>