window.onresize = function () {
main1.resize();
main2.resize();
main3.resize();
main4.resize();
main5.resize();
main6.resize();
worldMap.resize();
};
var main1 = echarts.init(document.getElementById('main1'), 'dark');
var main2 = echarts.init(document.getElementById('main2'), 'dark');
var main3 = echarts.init(document.getElementById('main3'), 'dark');
var main4 = echarts.init(document.getElementById('main4'), 'dark');
var main5 = echarts.init(document.getElementById('main5'));
var main6 = echarts.init(document.getElementById('main6'));
var worldMap = echarts.init(document.getElementById('worldMap'));
function main1_data() {
$.ajax({
type: "GET",
url: "/data/get/china",
dataType: "json",
success: function (e) {
var d = e.data;
var listx = [];
for (var i = 0; i < d.regionList.length; i++) {
listx.push(d.regionList[i].name);
}
var option = {
tooltip: {
trigger: 'item',
formatter: "{a}
{b} : {c} ({d}%)"
},
legend: {
bottom: 10,
left: 'center',
data: listx,
textStyle: {
color: "#fff"
}
},
series: [{
name: '来源地区',
type: 'pie',
radius: '60%',
center: ['50%', '40%'],
label: {
normal: {
show: false,
position: 'center'
}
},
data: d.regionList,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
main1.setOption(option);
}
});
}
function main2_data() {
$.ajax({
type: "GET",
url: "/data/get/country",
dataType: "json",
success: function (e) {
var d = e.data;
var listx = [];
for (var i = 0; i < d.regionList.length; i++) {
listx.push(d.regionList[i].name);
}
var option = {
tooltip: {
trigger: 'item',
formatter: "{a}
{b} : {c} ({d}%)"
},
legend: {
bottom: 10,
left: 'center',
data: listx,
textStyle: {
color: "#fff"
}
},
series: [{
name: '来源国家',
type: 'pie',
radius: '60%',
center: ['50%', '40%'],
label: {
normal: {
show: false,
position: 'center'
}
},
data: d.regionList,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
main2.setOption(option);
}
});
}
function main3_data() {
$.ajax({
type: "GET",
url: "/data/get/ip",
dataType: "json",
success: function (e) {
var d = e.data;
var option = {
tooltip: {
trigger: 'item',
formatter: "{a}
{b} : {c} ({d}%)"
},
series: [{
name: 'IP分布',
type: 'pie',
radius: '30%',
center: ['50%', '50%'],
data: d.ipList,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
main3.setOption(option);
}
});
}
function main4_data() {
$.ajax({
type: "GET",
url: "/data/get/type",
dataType: "json",
success: function (e) {
var d = e.data;
var dataN = [];
var dataV = [];
for (var i = d.typeList.length - 1; i >= 0; i--) {
dataN.push(d.typeList[i].name);
dataV.push(d.typeList[i].value);
}
var option = {
tooltip: {},
xAxis: {
type: 'value',
show: false
},
yAxis: {
type: 'category',
data: dataN,
axisLine: {
lineStyle: {
color: '#67c8fd'
}
}
},
grid: {
left: '0%',
right: '0%',
bottom: '0%',
top: '3%',
containLabel: true
},
series: [{
data: dataV,
type: 'bar',
label: {
normal: {
show: true,
position: 'inside',
color: '#fff'
}
},
itemStyle: {
normal: {
color: '#49b2c0'
}
}
}]
};
main4.setOption(option);
}
});
}
function main5_data() {
$.ajax({
type: "GET",
url: "/data/get/account",
dataType: "json",
success: function (e) {
var d = e.data;
var option = {
tooltip: {
show: true
},
series: [{
name: '账号',
type: "wordCloud",
gridSize: 6,
shape: 'circle',
sizeRange: [12, 50],
width: '100%',
height: '80%',
textStyle: {
normal: {
color: function () {
return 'rgb(' + [
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
Math.round(Math.random() * 160)
].join(',') + ')';
}
},
emphasis: {
shadowBlur: 10,
shadowColor: '#333'
}
},
data: d
}]
};
main5.setOption(option);
}
});
}
function main6_data() {
$.ajax({
type: "GET",
url: "/data/get/password",
dataType: "json",
success: function (e) {
var d = e.data;
var option = {
tooltip: {
show: true
},
series: [{
name: '密码',
type: "wordCloud",
gridSize: 6,
shape: 'circle',
sizeRange: [12, 50],
width: '100%',
height: '80%',
textStyle: {
normal: {
color: function () {
return 'rgb(' + [
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
Math.round(Math.random() * 160)
].join(',') + ')';
}
},
emphasis: {
shadowBlur: 10,
shadowColor: '#333'
}
},
data: d
}]
};
main6.setOption(option);
}
});
}
function mainInfo() {
$.ajax({
type: "GET",
url: "/data/get/info",
dataType: "json",
success: function (e) {
var d = e.data;
var _h = '';
var result = d.result;
for (var i = 0; i < result.length; i++) {
_h += '