let myChart = echarts.init(document.getElementById('echarts-one')); let myChart2 = echarts.init(document.getElementById('echarts-two')); function initEchartsOne(valueList) { let fontSize = '14', fontFamily = 'Alibaba PuHuiTi R', fontColor = '#000'; let option = { color: ['#37a2da', '#32c5e9', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293', '#e7bcf3', '#8378ea'], tooltip: { trigger: 'item', formatter: '{a}
{b} : {c} ({d}%)', textStyle: { color: fontColor, fontFamily: fontFamily }, }, toolbox: { show: true, }, legend: { x: '10%', //水平位置,【left\center\right\数字】 y: '350', //垂直位置,【top\center\bottom\数字】 align: 'left', //字在图例的左边或右边【left/right】 orient: 'horizontal', //图例方向【horizontal/vertical】 icon: 'circle', //图例形状【circle\rect\roundRect\triangle\diamond\pin\arrow\none】 textStyle: { color: '#000', fontFamily: fontFamily, fontSize: fontSize }, }, series: [ { name: '监理单位', type: 'pie', radius: [0, 130], center: ["50%", "40%"], label: { textStyle: { color: '#000', fontFamily: fontFamily, fontSize: fontSize }, }, data: valueList, }, ], }; myChart.setOption(option, true); window.addEventListener("resize", function () { myChart.resize(); }); } // 施工单位 function initEchartsTwo(valueList) { let fontSize = '14', fontFamily = 'Alibaba PuHuiTi R', fontColor = '#000'; let option = { color: ['#37a2da', '#32c5e9', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293', '#e7bcf3', '#8378ea'], tooltip: { trigger: 'item', formatter: '{a}
{b} : {c} ({d}%)', textStyle: { color: fontColor, fontFamily: fontFamily }, }, toolbox: { show: true, }, legend: { x: '10%', //水平位置,【left\center\right\数字】 y: '350', //垂直位置,【top\center\bottom\数字】 align: 'left', //字在图例的左边或右边【left/right】 orient: 'horizontal', //图例方向【horizontal/vertical】 icon: 'circle', //图例形状【circle\rect\roundRect\triangle\diamond\pin\arrow\none】 textStyle: { color: '#000', fontFamily: fontFamily, fontSize: fontSize }, }, series: [ { name: '施工单位', type: 'pie', radius: [0, 130], center: ["50%", "40%"], label: { textStyle: { color: '#000', fontFamily: fontFamily, fontSize: fontSize }, }, data: valueList, }, ], }; myChart2.setOption(option, true); window.addEventListener("resize", function () { myChart2.resize(); }); }