import * as echarts from 'echarts' export function pieOption() { const center = ["50%", "170px"]; return { title: { text: "0", top: 45, left: "center", textStyle: { width: "100%", fontSize: 24, color: "#FFFFFF", fontWeight: 400, }, itemGap: 5, // subtext: "总数", // subtextStyle: { // fontSize: 20, // color: "#fff", // fontWeight: 400, // }, }, tooltip: { show: false, }, // legend: { // top: 350, // bottom: 0, // itemWidth: 20, // itemHeight: 10, // textStyle: { // color: '#D2E7FF', // fontSize: 16, // lineHeight: 20, // }, // }, series: [ { name: 'Access From', type: 'pie', radius: ['60%', '90%'], avoidLabelOverlap: false, label: { show: false, position: 'center' }, // emphasis: { // label: { // show: true, // fontSize: 40, // fontWeight: 'bold' // } // }, labelLine: { show: false }, itemStyle: { normal: { color: (list) => { // 注意 !!!!! 这里的数组一定要和实际的类目长度相等或大于,不然会缺少颜色报错 var colorList = [ { colorStart:'#00023A', colorEnd:'#6FDEFF' }, { colorStart:'#00023A', colorEnd:'#FFAA00' }, { colorStart:'#00023A', colorEnd:'#1A95FF' }, ] return new echarts.graphic.LinearGradient(1, 0, 0, 0, [{ //左、下、右、上 offset: 0, color: colorList[list.dataIndex]['colorStart'] }, { offset: 1, color: colorList[list.dataIndex]['colorEnd'] }]) } } }, data: [ ] } ] }; }