$(document).ready(function () { let dom = document.getElementById("sjsq5"); let myChart = echarts.init(dom); let app = {}; let colors0 = ['#cc9933', '#00cc99', '#3043f2', '#3414d9']; let colors1 = ['#ffcc00', '#00ffcc', '#00fff0', '#5519ff']; let option; $.post(ctx + "fzjc/sjsqYsjzstj",function (res){ option = { tooltip: { trigger: 'axis' }, grid: { top:'20%', left: '2%', right: '2%', bottom: '2%', containLabel: true }, legend: { data: ['上报总数', '办结总数'], textStyle: { color:'#00cdef' } }, xAxis: [ { type: 'category', data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], axisLabel: { color: '#00cdef' }, axisLine: { show: true, lineStyle: { color: '#00cdef' } }, splitLine: { show: false }, axisPointer: { type: 'shadow' } } ], yAxis: [ { type: 'value', name: '上报总数', axisLabel: { formatter: '{value}', color: '#00cdef' }, axisLine: { show: true, lineStyle: { color: '#00cdef' } }, splitLine: { show: false }, } ], series: [ { name: '上报总数', type: 'bar', data: res.sjsbtj, itemStyle: { color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{ offset: 0, color: "#006aff" }, { offset: 1, color: "#00cfe4" }]), } }, { name: '办结总数', type: 'line', data: res.sjbjtj, itemStyle: { color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{ offset: 0, color: "#ddbb00" }, { offset: 1, color: "#00dd9c" }]), } }, ] }; if (option && typeof option === 'object') { myChart.setOption(option); myChart.on("click",function (params) { let prefix = ctx ; let month; let type; month = params.name.replace("月","");//月份 switch(params.seriesName){//类型 1上报,2办结 case "上报总数" : type = 1; break; case "办结总数" : type = 2; break; } console.log(prefix + "fzjc/goSjsqBar/"+month+"/"+type); let btn = [' 关闭']; let options = { title: '月事件总数统计', width: "1000", height: "550", url: prefix + "fzjc/goSjsqBar/"+month+"/"+type, btn: btn, callBack: doSubmit }; $.modal.openOptions(options); }); function doSubmit(index, layero){ layer.close(index); } } }); });