$(document).ready(function() {
//part 1
var main1 = echarts.init(document.getElementById('main1'));
main1.setOption({
tooltip: {
trigger: 'item',
formatter: "{a}
{b} : {c} ({d}%)",
axisPointer: {
crossStyle: {
color: '#fff'
}
}
},
legend: {
// orient: 'vertical',
bottom: 'bottom',
data: [],
textStyle: {
color: '#fff'
}
},
series: [{
name: '数据',
type: 'pie',
radius: '55%',
center: ['50%', '50%'],
data: [],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
normal:{
label:{
show: true,
formatter: '{b} : {c} ({d}%)'
},
labelLine :{show:true}
}
},
label: {
normal: {
textStyle: {
color: '#fff'
}
}
}
}]
});
//part 2
var phone_num = echarts.init(document.getElementById('phone_num'));
phone_num.setOption({
title: {
// text: '投诉/举报汇总',
x: 'center',
textStyle: {
color: '#fff',
fontSize: 16
},
},
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'line' // 默认为直线,可选为:'line' | 'shadow'
}
},
toolbox: {
show: true,
},
calculable: true,
xAxis: [{
type: 'category',
// name: '月份',
splitLine: {
show: false
}, //去除网格线
data: ["话务来电总量(通)", "接通总量(通)"],
// axisTick: {
// alignWithLabel: true
// },
axisLine: {
show: false,
lineStyle: {
color: '#fff'
}
},
// axisLine: {},
axisTick: {
show: false
}
}],
yAxis: [{
show: false
}],
series: [{
name: '数量',
type: 'bar',
barWidth: '30%', //图形宽度
data: [],
itemStyle: {
normal: {
label: {
show: true,
textStyle: {
color: '#fff' //顶部数据颜色
}
}
}
},
label: {
normal: {
show: true,
position: 'top' //顶部数据显示位置
}
}
}
]
// color: ['#ff9800','#61a0a8','#1ab394']
});
//接通率报表part3
var jtv = echarts.init(document.getElementById('jtv_num'));
jtv.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true,
backgroundColor: '#333'
}
},
formatter: function(datas)
{
var res = datas[0].name + '
', val;
for(var i = 0, length = datas.length; i < length; i++) {
val = (datas[i].value) + '%';
res += datas[i].seriesName + ':' + val + '
';
}
return res;
}
},
legend: {
// top: 30,
bottom:'bottom',
data: [],
textStyle: {
color: '#fff'
}
},
xAxis: {
name: '部门',
data: [],
axisLine: {
lineStyle: {
color: '#ccc'
}
},
},
yAxis: {
name: '数量',
splitLine: {
show: false
},
axisLine: {
lineStyle: {
color: '#ccc'
}
}
},
series: [{
name: '诉求量',
type: 'bar',
barWidth: 8,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{
offset: 0,
color: '#14c8d4'
},
{
offset: 1,
color: '#43eec6'
}
]
)
}
},
data: []
}]
});
//通话时长part4
var th_nums = echarts.init(document.getElementById('th_nums'));
th_nums.setOption({
tooltip: {
trigger: 'item',
formatter: "{a}
{b} : {c} ({d}%)",
axisPointer: {
crossStyle: {
color: '#fff'
}
}
},
legend: {
// orient: 'vertical',
bottom: 'bottom',
data: [],
textStyle: {
color: '#fff'
}
},
series: [{
name: '数据',
type: 'pie',
radius: '55%',
center: ['50%', '50%'],
data: [],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
normal:{
label:{
show: true,
formatter: '{b} : {c} ({d}%)'
},
labelLine :{show:true}
}
},
label: {
normal: {
textStyle: {
color: '#fff'
}
}
}
}]
});
Ajax();
function Ajax(){
$.ajax({
type: "get",
url: huayi.config.callcenter_url + "Info/GetScreen",
async: true,
dataType: "json",
data: {
// token: $.cookie("token")
},
success: function(data) {
if(data.state.toLowerCase() == "success") {
// layer.close(index);
var part_a = data.data.a;//图二
phone_num.setOption({
series: [{
data: [part_a.jtcount, part_a.zldcount]
// data: [20, 100, 5, 80]
}]
})
var part_b = data.data.b;//图1
var part_1_legend =[];
var part_1_ser = [];
$(part_b).each(function(i,n){
part_1_legend.push(n.Source);
var part_1_obj = {};
part_1_obj.value = n.Count;
part_1_obj.name = n.Source;
part_1_ser.push(part_1_obj)
})
main1.setOption({
legend: {
data: part_1_legend
},
series: [{
data: part_1_ser
}]
})
var part_c = data.data.c;//图3
var part_3_legend =[];
var part_3_ser = [];
$(part_c).each(function(j,m){
part_3_legend.push(m.DeptName)
part_3_ser.push(m.Count)
})
jtv.setOption({
// legend: {
// data:part_3_legend,
// },
xAxis: {
data:part_3_legend
},
series: [{
data:part_3_ser
}]
})
var part_d = data.data.d;//图4
var part_4_legend =[];
var part_4_ser = [];
$(part_d).each(function(y,s){
part_4_legend.push(s.TypeName);
var part_4_obj = {};
part_4_obj.value = s.Count;
part_4_obj.name = s.TypeName;
part_4_ser.push(part_4_obj)
})
th_nums.setOption({
legend: {
data: part_4_legend
},
series: [{
data: part_4_ser
}]
})
}
}
});
}
setInterval(Ajax, huayi.config.indextime); //Ajax调用函数
})