//总公里 let totalLength = 7779.200 // legend let legendData = ["管养地方高速", "管养国家高速"] // 数值 let value = [2362.213,5352.581] // 颜色 let color = ["#04e389","#fc874b"] option = { "toolbox": { "show": true, "right": "0", "feature": { "mark": { "show": true }, "restore": { "show": false }, "saveAsImage": { "show": true, "pixelRatio": 1, "title": "保存为图片", "type": "png", "lang": ["点击保存"] } } }, "color": ["#04e389", "#fc874b"], "title": { "text": "总里程\n"+totalLength.toFixed(3)+"\n公里", "top": "45%", "textAlign": "center", "left": "49%", // "textStyle": { // "color": "#000", // "fontSize": 12, // "fontWeight": "400" // } }, "tooltip": { "show": true, "transitionDuration": 0 }, "legend": { "icon": "circle", "orient": "vertical", "data": legendData, "left": "left", "top": "middle", "textStyle": { "color": "#000" } }, "series": function(){ let series=[{ color: ['rgba(0,0,0,0)', '#fc874b', 'rgba(0,0,0,0)','#fc874b','rgba(0,0,0,0)', '#fc874b', 'rgba(0,0,0,0)','#fc874b'], type: "pie", startAngle: 15, radius: ["52%", "53%"], center: ["50%", "50%"], label: { show: false, }, select: { display: false, }, hoverAnimation: false, tooltip: { show: false, }, data: [25, 50, 25, 50,25, 50, 25, 50], }] let seriesData = [] for(let i = 0; i < legendData.length; i++){ let serie = { "value": value[i], "name": "管养地方高速", "itemStyle": { "borderRadius": '50%', "normal": { "borderWidth": 5, "shadowBlur": 20, "color": color[i], "borderColor": color[i], "shadowColor": color[i] } } } seriesData.push(serie) } series.push({ "name": "", "type": "pie", "clockWise": false, "radius": ["60%", "65%"], "hoverAnimation": false, "itemStyle": { "normal": { "label": { "show": true, "position": "outside", "color": "#000" }, "labelLine": { "length": 5, "length2": 20, "show": true, "color": "#00ffff" } } }, data: seriesData }) return series }() }