export default ({ titleValue, subtitle, previousSum, currentSum, targetSum, currentName, preName, }) => ({ grid: { left: 0, right: 0, bottom: 0, top: 0, containLabel: true, }, tooltip: { trigger: "item", extraCssText: 'box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.38); border- radius: 4px;opacity: 0.6;backdrop- filter: blur(6px);', backgroundColor: '#001829', borderColor: '#001829', }, title: { text: titleValue, left: "48.5%", top: "35%", textAlign: "center", textStyle: { fontWeight: 400, fontSize: 32, color: "#fffd", }, subtext: `\u2002${subtitle}\u2002`, subtextStyle: { fontSize: 14, fontWeight: 100, color: "#fffd", align: "right", }, }, series: [ // 背景 series { type: "pie", name: "当前目标", radius: ["80%", "95%"], center: ["50%", "48%"], emptyCircleStyle: { color: "#042c5f33", }, }, // 数据 series { type: "pie", radius: ["80%", "95%"], center: ["50%", "48%"], avoidLabelOvervlap: false, label: { show: false, }, labelLine: { show: false, }, data: [ { value: currentSum, name: currentName, selected: false, tooltip: { formatter: `${currentName}` + `${currentSum}` }, itemStyle: { borderJoin: "round", borderCap: "round", borderWidth: 12, borderRadius: "50%", color: { type: "linear", x: 1, y: 0, x2: 0, y2: 1, colorStops: [ { offset: 0, color: "#4CF0E811" }, { offset: 1, color: "#4CF0E8" }, ], }, }, }, { value:(targetSum - currentSum) === 0 ? 1 : (targetSum - currentSum), name: currentName, tooltip: { formatter: `${currentName}` + `${currentSum}` }, itemStyle: { color: "transparent" }, label: { show: false }, }, ], }, // 数据 series2 - 2023累计 { type: "pie", radius: ["65%", "80%"], center: ["50%", "48%"], avoidLabelOvervlap: false, label: { show: false, }, labelLine: { show: false, }, data: [ { value: previousSum, name: preName, selected: false, tooltip: { formatter: `${preName}` + `${previousSum}` }, itemStyle: { borderJoin: "round", borderCap: "round", borderWidth: 12, borderRadius: "50%", color: { type: "linear", x: 1, y: 0, x2: 0, y2: 1, colorStops: [ { offset: 0, color: "#1065ff66" }, { offset: 1, color: "#1065ff" }, ], }, }, }, { value:previousSum === 0 ? 1 : 0, name: preName, tooltip: { formatter: `${preName}` + `${previousSum}` }, itemStyle: { color: "transparent" }, label: { show: false }, }, ], }, ], });