-
Notifications
You must be signed in to change notification settings - Fork 9
/
top.html
85 lines (85 loc) · 2.43 KB
/
top.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
<html>
<head>
<meta charset="utf-8">
<title>慢SQL执行时间统计图</title>
<script src="js/echarts.common.min.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
</head>
<body>
<div id="main" style="height:400px"></div>
<script type="text/javascript">
var myChart = echarts.init(document.getElementById('main'));
var arr1=[],arr2=[];
function arrTest(){
$.ajax({
type:"post",
async:false,
url:"get_top_data.php",
data:{},
dataType:"json",
success:function(result){
if (result) {
for (var i = 0; i < result.length; i++) {
arr1.push(result[i].dbname);
//arr2.push(result[i].user_max);
arr2.push(result[i].top_count);
}
}
}
})
return arr1,arr2;
}
arrTest();
var option = {
title: {
text: '一个迭代慢查询数量龙虎榜TOP排名',
//backgroundColor: 'FFFFFF'
},
tooltip: {
trigger: 'axis'
//show: true
},
legend: {
data:['数量']
},
xAxis : [
{
type : 'category',
data : arr1
}
],
yAxis : [
{
type : 'value',
axisLabel: {
formatter:'{value}(个)'
}
}
],
series : [
{
"name":"数量",
"type":"bar",
"smooth": "true",
"data": arr2,
stack: '数量',
areaStyle: {
normal: {
color: '#48A43F' //改变区域颜色
}
},
itemStyle : {
normal : {
color:'#48A43F',
lineStyle: {
color: '#3300FF',
width: 3,
}}}
}
]
};
// 为echarts对象加载数据
myChart.setOption(option);
// }
</script>
</body>