function satisfaction(start, end, areaTwoVal) { // if(!areaTwoVal) { // areaTwoVal = "sqs12345" // } // if(!start){ // start="2019-11-01" // } // if(!end){ // end="2019-11-30" // } $.ajax({ type: "get", url: huayi.config.callcenter_url + '/info/GetSourceByDateNew', async: true, dataType: 'json', data: { start: start, end: end, branchcode: areaTwoVal }, success: function(data) { if(data.state == "success") { var sorceData=data.data var option = { // tooltip: { // formatter: "{b} : {c} ({d}%)" // }, tooltip: { formatter: function (val) { // console.log(val);// 打印可以看到里面包含什么 var percent = val.data.name+":"+val.data.text; // 下面return的值可以随便填。填你所需要的值就好。 return percent; } }, legend: { orient: 'vertical', top: 'middle', x: 'top', left: 10, top: 0, //data: ['12345邮箱', '电话', '市县转单', '手机APP', '网站', '微博', '微信', '政府服务网'] }, series: [{ type: 'pie', radius: '70%', selectedMode: 'single', center: ['50%', '50%'], label: { normal: { show: false, // formatter: "{b} : {c} ", // textStyle: { // color:'' // 改变标示文字的颜色 // } } }, itemStyle: { normal: { // color:function(params) { // //自定义颜色 // var colorList = [ // '#159FE9','#159FE9','#159FE9','#159FE9','#159FE9', // '#159FE9','#159FE9','#159FE9' // ]; // return colorList[params.dataIndex] // }, color:'#159FE9', //borderWidth:10, //边框的宽度 opacity:0.3, }, emphasis: { opacity:1, opacity:1 } }, labelLine: { normal: { show: false, // lineStyle: { // color: "" // 改变标示线的颜色 // } } }, data: [{ value: 0, text: sorceData[0].Count, name: '12345邮箱', }, { value: 0, text: sorceData[1].Count, name: '电话', }, { value: 0, text: sorceData[2].Count, name: '市县转单', }, { value: 0, text: sorceData[3].Count, name: '手机APP', }, { value: 0, text: sorceData[4].Count, name: '网站', }, { value: 0, text: sorceData[5].Count, name: '微博', }, { value: 0, text: sorceData[6].Count, name: '微信', }, { value: 0, text: sorceData[7].Count, name: '政府服务网', } ], }] }; echartsPie = echarts.init(document.getElementById('phoneTimeCount')); echartsPie.setOption(option); } }, error: function(data) { console.log(data.message); } }); // option = { // title: { // text: '某站点用户访问来源', // subtext: '纯属虚构', // x: 'center' // }, // tooltip: { // trigger: 'item', // formatter: "{a}
{b} : {c} ({d}%)" // }, // legend: { // orient: 'vertical', // left: 'left', // data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎'] // }, // series: [{ // name: '访问来源', // type: 'pie', // radius: '55%', // center: ['50%', '60%'], // data: [{ // value: 335, // name: '直接访问' // }, // { // value: 310, // name: '邮件营销' // }, // { // value: 234, // name: '联盟广告' // }, // { // value: 135, // name: '视频广告' // }, // { // value: 1548, // name: '搜索引擎' // } // ], // itemStyle: { // emphasis: { // shadowBlur: 10, // shadowOffsetX: 0, // shadowColor: 'rgba(0, 0, 0, 0.5)' // } // } // }] // } }