-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrank.html
126 lines (115 loc) · 5.51 KB
/
rank.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html style="height: 100%">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="assets/img/logo-fav.png">
<title>头玩交易所</title>
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script src="assets/lib/jquery/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="assets/js/echarts.min.js"></script>
<!--<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts.min.js"></script>-->
<!--<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-gl/echarts-gl.min.js"></script>-->
<!--<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-stat/ecStat.min.js"></script>-->
<!--<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/dataTool.min.js"></script>-->
<!--<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/map/js/china.js"></script>-->
<!--<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/map/js/world.js"></script>-->
<!--<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=ZUONbpqGBsYGXNIYHicvbAbM"></script>-->
<!--<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/bmap.min.js"></script>-->
<!--<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/simplex.js"></script>-->
<script type="text/javascript">
$.ajaxSetup({
cache: false
});
function getPlayers(callback){
$.get("https://cgplayerone.com/data/players.json", function (resp) {
callback && callback(resp)
})
// $.get("http://localhost:63342/capitalgame/data/players.json", function (resp) {
// callback && callback(resp)
// })
}
var dom = document.getElementById("container");
var myChart = echarts.init(dom);
var app = {};
option = null;
var data = genData();
function genData() {
getPlayers(function(resp){
var playerList = resp;
var legendData = [];
var seriesData = [];
var selected = {};
for (var i = 0; i < playerList.length; i++) {
if(playerList[i][1] < 10) continue;
name = '用户 #' + playerList[i][2];
legendData.push(name);
seriesData.push({
name: name,
value: playerList[i][1]
});
selected[name] = playerList[i][1] >= 1000;
}
var data = {
legendData: legendData,
seriesData: seriesData,
selected: selected
};
option = {
title : {
text: '用户排名',
subtext: '按CGT持有量',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 10,
top: 20,
bottom: 20,
data: data.legendData,
selected: data.selected
},
series : [
{
name: '用户',
type: 'pie',
radius : '55%',
center: ['40%', '50%'],
data: data.seriesData,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
if (option && typeof option === "object") {
myChart.setOption(option, true);
}
return data;
});
// function makeWord(max, min) {
// var nameLen = Math.ceil(Math.random() * max + min);
// var name = [];
// for (var i = 0; i < nameLen; i++) {
// name.push(nameList[Math.round(Math.random() * nameList.length - 1)]);
// }
// return name.join('');
// }
}
</script>
</body>
</html>