let form, layer, myChart; let user = getUser(); let changeModel = sessionStorage.getItem("changeModel"); layui.use(['form', 'layer'], function () { form = layui.form; layer = layui.layer; myChart = echarts.init(document.getElementById('echarts-box')); loadDayPlanAjax('2'); }) // 日计划 - 全省 function loadDayPlanAjax(type) { let url = dataUrl + 'proteam/pot/sup/getDayPlanMaps'; let params = { 'isSup': user.isSup, 'orgId': user.orgId, 'type': type }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { if (parseInt(result.code) == 200) { initEchartsOne(result.cityList, result.planList, result.dayList); } else if (parseInt(result.code) === 500) { layer.alert('服务异常', { icon: 2 }) } else if (parseInt(result.code) === 401) { logout(1); } }, function (xhr) { }); } function initEchartsOne(nameList, valueList, valueList2) { let fontSize = '16', fontFamily = 'Alibaba PuHuiTi R', fontColor = (changeModel === '2' || !changeModel ? '#fff' : '#000'), fontColor2 = '#000'; let option = { backgroundColor: 'transparent', tooltip: { show: true, trigger: 'axis', axisPointer: { type: 'shadow' }, // backgroundColor: 'rgba(0, 0, 0, 0.63)', //设置背景颜色 textStyle: { color: fontColor2, fontFamily: fontFamily }, // borderColor: "rgba(255,255,255, .5)", }, legend: { icon: 'circle', data: ['未执行', '已执行'], right: 20, textStyle: { color: fontColor, fontSize: fontSize, fontFamily: fontFamily }, itemWidth: 15, itemHeight: 15, itemGap: 35 }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [{ type: 'category', data: nameList, axisLine: { show: true, lineStyle: { color: "#063374", width: 1, type: "solid" } }, axisTick: { show: false, }, axisLabel: { show: true, interval: 0, // 强制显示所有标签 textStyle: { color: fontColor, fontFamily: fontFamily, fontSize: fontSize } }, }], yAxis: [{ type: 'value', axisTick: { show: false, }, axisLine: { show: false, lineStyle: { color: fontColor, width: 1, type: "solid", }, }, splitLine: { lineStyle: { color: '#063374', type: 'dashed' } } }], series: [{ name: '未执行', type: 'bar', data: valueList, barWidth: 10, //柱子宽度 barGap: 0.5, //柱子之间间距 itemStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: '#59A5FF' }, { offset: 1, color: '#36EBCA' }]), opacity: 1, } }, label: { normal: { show: true, position: 'top', formatter: '{c}', textStyle: { color: fontColor, fontSize: '14px', fontFamily: fontFamily } } }, }, { name: '已执行', type: 'bar', data: valueList2, barWidth: 10, barGap: 0.5, itemStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: '#FFFB99' }, { offset: 1, color: '#A4FFFA' }]), opacity: 1, } }, label: { normal: { show: true, position: 'top', formatter: '{c}', textStyle: { color: fontColor, fontSize: '14px', fontFamily: fontFamily } } }, }] }; myChart.setOption(option, true); window.addEventListener("resize", function () { myChart.resize(); }); }