yudao-init/src/views/copilot/yield/options/double-ring-chart-options.js

139 lines
2.8 KiB
JavaScript
Raw Normal View History

2024-04-26 17:05:26 +08:00
export default ({
titleValue,
subtitle,
previousSum,
currentSum,
targetSum,
2024-05-29 17:05:55 +08:00
currentName,
preName,
2024-04-26 17:05:26 +08:00
}) => ({
2024-04-18 17:01:10 +08:00
grid: {
left: 0,
right: 0,
bottom: 0,
top: 0,
containLabel: true,
},
tooltip: {},
title: {
2024-04-26 17:05:26 +08:00
text: titleValue,
2024-05-10 11:10:42 +08:00
left: "44%",
top: "37%",
2024-04-18 17:01:10 +08:00
textAlign: "center",
textStyle: {
fontWeight: 600,
fontSize: 32,
color: "#fffd",
},
2024-04-26 17:05:26 +08:00
subtext: `\u2002${subtitle}\u2002`,
2024-04-18 17:01:10 +08:00
subtextStyle: {
fontSize: 14,
fontWeight: 100,
color: "#fffd",
align: "right",
},
},
series: [
2024-04-26 17:05:26 +08:00
// 背景 series
2024-04-18 17:01:10 +08:00
{
type: "pie",
2024-04-26 17:05:26 +08:00
name: "当前目标",
2024-04-18 17:01:10 +08:00
radius: ["70%", "85%"],
2024-05-10 11:10:42 +08:00
center: ["45%", "52%"],
2024-04-18 17:01:10 +08:00
emptyCircleStyle: {
color: "#042c5f33",
},
},
2024-04-26 17:05:26 +08:00
// 数据 series
2024-04-18 17:01:10 +08:00
{
type: "pie",
radius: ["70%", "85%"],
2024-05-10 11:10:42 +08:00
center: ["45%", "52%"],
2024-04-18 17:01:10 +08:00
avoidLabelOvervlap: false,
label: {
show: false,
},
labelLine: {
show: false,
},
data: [
{
2024-04-26 17:05:26 +08:00
value: currentSum,
2024-05-29 17:05:55 +08:00
name: currentName,
2024-04-18 17:01:10 +08:00
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" },
],
},
},
},
{
2024-06-03 08:23:40 +08:00
value:currentSum == 0
? 1
2024-04-26 17:05:26 +08:00
: 0,
name: "未达成累计",
2024-04-18 17:01:10 +08:00
itemStyle: { color: "transparent" },
label: { show: false },
},
],
},
// 数据 series2 - 2023累计
{
type: "pie",
radius: ["55%", "70%"],
2024-05-10 11:10:42 +08:00
center: ["45%", "52%"],
2024-04-18 17:01:10 +08:00
avoidLabelOvervlap: false,
label: {
show: false,
},
labelLine: {
show: false,
},
data: [
{
2024-04-26 17:05:26 +08:00
value: previousSum,
2024-05-29 17:05:55 +08:00
name: preName,
2024-04-18 17:01:10 +08:00
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" },
],
},
},
},
{
2024-06-03 08:23:40 +08:00
value:previousSum == 0
2024-04-28 10:59:05 +08:00
? 1
: 0,
2024-04-18 17:01:10 +08:00
name: "-",
itemStyle: { color: "transparent" },
label: { show: false },
},
],
},
],
2024-04-26 17:05:26 +08:00
});