fix: 主题hook图表相关字段错误

This commit is contained in:
zxc 2024-09-14 22:40:07 +08:00
parent dcd9429c81
commit 1b5bf46bcb
2 changed files with 9 additions and 10 deletions

View File

@ -150,7 +150,7 @@ export default () => {
if (el.fill) { if (el.fill) {
themeColorValues.push({ area: area * 0.5, value: el.fill }) themeColorValues.push({ area: area * 0.5, value: el.fill })
} }
themeColorValues.push({ area: area * 0.5, value: el.themeColor[0] }) themeColorValues.push({ area: area * 0.5, value: el.themeColors[0] })
} }
else if (el.type === 'line') { else if (el.type === 'line') {
themeColorValues.push({ area, value: el.color }) themeColorValues.push({ area, value: el.color })
@ -218,8 +218,8 @@ export default () => {
const color = tinycolor(el.theme.color).toRgbString() const color = tinycolor(el.theme.color).toRgbString()
if (!colors.includes(color)) colors.push(color) if (!colors.includes(color)) colors.push(color)
} }
if (el.type === 'chart' && el.fill && tinycolor(el.fill).getAlpha() !== 0) { if (el.type === 'chart' && el.themeColors[0] && tinycolor(el.themeColors[0]).getAlpha() !== 0) {
const color = tinycolor(el.fill).toRgbString() const color = tinycolor(el.themeColors[0]).toRgbString()
if (!colors.includes(color)) colors.push(color) if (!colors.includes(color)) colors.push(color)
} }
if (el.type === 'line' && tinycolor(el.color).getAlpha() !== 0) { if (el.type === 'line' && tinycolor(el.color).getAlpha() !== 0) {
@ -283,8 +283,8 @@ export default () => {
} }
} }
if (el.type === 'chart') { if (el.type === 'chart') {
el.themeColor = [colorMap[tinycolor(el.themeColor[0]).toRgbString()]] || el.themeColor el.themeColors = [colorMap[tinycolor(el.themeColors[0]).toRgbString()]] || el.themeColors
el.gridColor = theme.fontColor el.textColor = theme.fontColor
} }
if (el.type === 'line') el.color = colorMap[tinycolor(el.color).toRgbString()] || el.color if (el.type === 'line') el.color = colorMap[tinycolor(el.color).toRgbString()] || el.color
if (el.type === 'audio') el.color = colorMap[tinycolor(el.color).toRgbString()] || el.color if (el.type === 'audio') el.color = colorMap[tinycolor(el.color).toRgbString()] || el.color
@ -357,8 +357,8 @@ export default () => {
} }
} }
else if (el.type === 'chart') { else if (el.type === 'chart') {
el.themeColor = [themeColor] el.themeColors = [themeColor]
el.gridColor = fontColor el.textColor = fontColor
} }
else if (el.type === 'latex') el.color = fontColor else if (el.type === 'latex') el.color = fontColor
else if (el.type === 'audio') el.color = themeColor else if (el.type === 'audio') el.color = themeColor

View File

@ -204,11 +204,10 @@ export const getChartOption = ({
} : {}, } : {},
type: 'pie', type: 'pie',
radius: ['40%', '70%'], radius: ['40%', '70%'],
padAngle: 1,
avoidLabelOverlap: false, avoidLabelOverlap: false,
itemStyle: { itemStyle: {
borderRadius: 10, borderRadius: 4,
borderColor: '#fff',
borderWidth: 2
}, },
emphasis: { emphasis: {
label: { label: {