export default ({
titleValue,
subtitle,
titleSize,
subtitleSize,
previousSum,
currentSum,
targetSum,
currentName,
preName,
yesterday,
}) => ({
grid: {
left: 300,
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%",
top: "middle",
textAlign: "center",
textVerticalAlign:'auto',
textStyle: {
fontWeight: 400,
fontSize: titleSize,
color: "rgba(223,241,254,1)",
},
subtext: `\u2002${yesterday + '日良率'}\u2002`,
subtextStyle: {
fontSize: subtitleSize,
fontWeight: 100,
color: "rgba(255,255,255,.7)",
align: "right",
},
},
series: [
// 背景 series
{
type: "pie",
name: "当前良率",
radius: ["80%", "92%"],
center: ["50%", "50%"],
emptyCircleStyle: {
color: "#003982",
},
},
// 数据 series
{
type: "pie",
radius: ["80%", "92%"],
center: ["50%", "50%"],
avoidLabelOvervlap: false,
label: {
show: false,
},
labelLine: {
show: false,
},
data: [
{
value: currentSum,
name: currentName,
tooltip: {
backgroundColor: 'rgba(0,0,0,0)', // tooltip默认背景为白色,手动置为透明
extraCssText: 'padding:0;border-width:0',
formatter:`
${currentName}
${currentSum}
`
},
selected: false,
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: {
backgroundColor: 'rgba(0,0,0,0)', // tooltip默认背景为白色,手动置为透明
extraCssText: 'padding:0;border-width:0',
formatter:`
${currentName}
${currentSum}
`
},
itemStyle: { color: "transparent" },
label: { show: false },
},
],
},
// 数据 series2 - 2023累计
{
type: "pie",
radius: ["70%", "80%"],
center: ["50%", "50%"],
avoidLabelOvervlap: false,
label: {
show: false,
},
labelLine: {
show: false,
},
data: [
{
value: previousSum,
name: preName,
tooltip: {
backgroundColor: 'rgba(0,0,0,0)', // tooltip默认背景为白色,手动置为透明
extraCssText: 'padding:0;border-width:0',
formatter:`
${preName}
${previousSum}
`
},
selected: false,
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: {
backgroundColor: 'rgba(0,0,0,0)', // tooltip默认背景为白色,手动置为透明
extraCssText: 'padding:0;border-width:0',
formatter:`
${preName}
${previousSum}
`
},
itemStyle: { color: "transparent" },
label: { show: false },
},
],
},
],
});