From ca3ba006185bc95e821135b3251df2c6286dc418 Mon Sep 17 00:00:00 2001 From: ulleo Date: Wed, 14 Aug 2024 16:57:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=9F=B1=E7=BA=BF=E7=BB=84=E5=90=88=E5=9B=BE=E5=B7=A6=E8=BD=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=A0=B9=E6=8D=AE=E7=BB=B4=E5=BA=A6=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A2=9C=E8=89=B2=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../panel/charts/others/chart-mix-common.ts | 3 ++- .../js/panel/charts/others/chart-mix.ts | 27 +++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix-common.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix-common.ts index e881172469..5358081ab4 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix-common.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix-common.ts @@ -29,7 +29,8 @@ export const CHART_MIX_EDITOR_PROPERTY_INNER: EditorPropertyInner = { 'lineSymbolSize', 'lineSmooth', 'radiusColumnBar', - 'subSeriesColor' + 'subSeriesColor', + 'seriesColor' ], 'x-axis-selector': [ 'name', diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts index cbffc6fee8..a5ff2ac46b 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts @@ -279,6 +279,25 @@ export class ColumnLineMix extends G2PlotChartView { ...options } const basicStyle = parseJson(chart.customAttr).basicStyle as MixChartBasicStyle + + const { seriesColor } = basicStyle + if (seriesColor?.length) { + const seriesMap = seriesColor.reduce((p, n) => { + p[n.id] = n + return p + }, {}) + const { yAxis } = chart + yAxis?.forEach((axis, index) => { + const curAxisColor = seriesMap[axis.id] + if (curAxisColor) { + if (index + 1 > basicStyle.colors.length) { + basicStyle.colors.push(curAxisColor.color) + } else { + basicStyle.colors[index] = curAxisColor.color + } + } + }) + } //左轴 const color = basicStyle.colors.map(ele => { const tmp = hexColorToRGBA(ele, basicStyle.alpha) @@ -568,10 +587,6 @@ export class GroupColumnLineMix extends ColumnLineMix { axis: AxisType[] = [...this['axis'], 'xAxisExt'] propertyInner = { ...CHART_MIX_EDITOR_PROPERTY_INNER, - 'dual-basic-style-selector': [ - ...CHART_MIX_EDITOR_PROPERTY_INNER['dual-basic-style-selector'], - 'seriesColor' - ], 'label-selector': ['vPosition', 'seriesLabelFormatter'], 'tooltip-selector': [ ...CHART_MIX_EDITOR_PROPERTY_INNER['tooltip-selector'], @@ -683,10 +698,6 @@ export class StackColumnLineMix extends ColumnLineMix { axis: AxisType[] = [...this['axis'], 'extStack'] propertyInner = { ...CHART_MIX_EDITOR_PROPERTY_INNER, - 'dual-basic-style-selector': [ - ...CHART_MIX_EDITOR_PROPERTY_INNER['dual-basic-style-selector'], - 'seriesColor' - ], 'label-selector': ['vPosition', 'seriesLabelFormatter'], 'tooltip-selector': [ ...CHART_MIX_EDITOR_PROPERTY_INNER['tooltip-selector'],