yudao-init/src/views/copilot/yield/options/double-ring-chart-options.js
‘937886381’ 96f7798708 导出
2024-07-09 10:19:54 +08:00

157 lines
4.0 KiB
JavaScript

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: `<span style='display:inline-block;width:150px;color:rgba(255,255,255,0855);font-size:14px;'>${currentName}</span>` +
`<span style='color:rgba(255,255,255,0.65);font-size:14px;'>${currentSum}</span>`
},
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: `<span style='display:inline-block;width:150px;color:rgba(255,255,255,0855);font-size:14px;'>${currentName}</span>` +
`<span style='color:rgba(255,255,255,0.65);font-size:14px;'>${currentSum}</span>`
},
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: `<span style='display:inline-block;width:150px;color:rgba(255,255,255,0855);font-size:14px;'>${preName}</span>` +
`<span style='color:rgba(255,255,255,0.65);font-size:14px;'>${previousSum}</span>`
},
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: `<span style='display:inline-block;width:150px;color:rgba(255,255,255,0855);font-size:14px;'>${preName}</span>` +
`<span style='color:rgba(255,255,255,0.65);font-size:14px;'>${previousSum}</span>`
},
itemStyle: { color: "transparent" },
label: { show: false },
},
],
},
],
});