From c28c7dd40557e71573cc50b73705436f603f494c Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Sun, 21 Jul 2024 20:57:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E8=B7=9F=E9=9A=8F=E4=B8=BB=E4=BD=93=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/utils/canvasStyle.ts | 19 +++++++++++++++++++ .../editor/editor-style/ChartStyle.vue | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/utils/canvasStyle.ts b/core/core-frontend/src/utils/canvasStyle.ts index feb3b8a232..8c52c2add1 100644 --- a/core/core-frontend/src/utils/canvasStyle.ts +++ b/core/core-frontend/src/utils/canvasStyle.ts @@ -296,6 +296,23 @@ export function getScaleValue(propValue, scale) { const propValueTemp = Math.round(propValue * scale) return propValueTemp > 1 ? propValueTemp : 1 } +export const THEME_ATTR_TRANS_ARR_MAIN = { + label: { + seriesLabelFormatter: { + isArray: [] + } + } +} + +export function seriesAdaptor(template, color) { + template.label?.seriesLabelFormatter?.forEach(series => { + series['color'] = color + }) + + template.label?.seriesTooltipFormatter?.forEach(series => { + series['color'] = color + }) +} export function recursionTransObj(template, infoObj, scale, terminal) { for (const templateKey in template) { @@ -378,6 +395,7 @@ export function adaptCurTheme(customStyle, customAttr) { customAttr, LIGHT_THEME_COMPONENT_BACKGROUND ) + seriesAdaptor(customAttr, LIGHT_THEME_COLOR_MAIN) merge(customAttr, DEFAULT_COLOR_CASE, canvasStyle.component.chartColor) } else { recursionThemTransObj(THEME_STYLE_TRANS_MAIN, customStyle, DARK_THEME_COLOR_MAIN) @@ -388,6 +406,7 @@ export function adaptCurTheme(customStyle, customAttr) { customAttr, DARK_THEME_COMPONENT_BACKGROUND_BACK ) + seriesAdaptor(customAttr, DARK_THEME_COLOR_MAIN) merge(customAttr, DEFAULT_COLOR_CASE_DARK, canvasStyle.component.chartColor) } customStyle['text'] = { diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue index be2a4bb9f6..06330d8276 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue @@ -347,7 +347,7 @@ watch( v-model="chart.customAttr.label.show" :change-model="chart.customAttr.label" @modelChange="val => onLabelChange(val, 'show')" - :title="$t('chart.label')" + :title="$t('chart.label') + '11'" name="label" >