$(document).ready(function () { let dom = document.getElementById("sjsq2"); let myChart = echarts.init(dom); let app = {}; let option; $.post(ctx + "fzjc/sjsqSbsZs",function (res){ option = { tooltip: { trigger: 'item', }, series: [ { name: '事件诉求', type: 'pie', radius: ['60%', '70%'], selectedOffset: 0, //选中块的偏移量 label: { show: true, position: 'center', textStyle: { color: '#fff' }, formatter: '{d}%' }, emphasis: { label: { show: true, fontSize: '15', fontWeight: 'bold', color: '83bff6' } }, labelLine: { show: false }, data: [ { value: res[1].data, name: res[1].name, itemStyle: { color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{ offset: 0, color: '#1270d9' }, { offset: 1, color: '#00ffeb' }]), }, selected: true, //默认选中第一块 label: { show: true, //默认显示第一块 fontSize: '20', fontWeight: 'bold' } }, { value: res[0].data, name: res[0].name, itemStyle: { color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{ offset: 0, color: '#ff8404' }, { offset: 1, color: '#ffd904' }]), } }, ] } ] }; if (option && typeof option === 'object') { myChart.setOption(option); myChart.on("click",function (params) { let prefix = ctx ; let url; /**环状图参数:1上报,2签收,3办结,4总数**/ switch (params.name) { case "上报数" : url = prefix + "fzjc/goSjsqPie/1"; break; case "总数" : url = prefix + "fzjc/goSjsqPie/4"; break; } let btn = [' 关闭']; let options = { title: '上报数/总数占比', width: "1000", height: "550", url: url, btn: btn, callBack: doSubmit }; $.modal.openOptions(options); }); function doSubmit(index, layero){ layer.close(index); } } }); });