From 45b773ba4a67f401a7b43c72f2457b65d05cfc92 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Fri, 24 Oct 2025 10:56:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=83=AD=E5=8A=9B=E5=9B=BE=E9=A2=9C=E8=89=B2=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=B8=BA=E6=8C=87=E6=A0=87=E6=97=B6=E5=9B=BE=E4=BE=8B=E5=BC=80?= =?UTF-8?q?=E5=85=B3=E5=AF=BC=E8=87=B4=E9=85=8D=E8=89=B2=E6=94=B9=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/g2/table/t-heatmap.ts | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/table/t-heatmap.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/table/t-heatmap.ts index b46956df9c..ed4cb53cfd 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/table/t-heatmap.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/table/t-heatmap.ts @@ -235,6 +235,21 @@ export class TableG2Chart extends G2ChartView { protected configLegend(chart: Chart, options: G2Spec, context: Record): G2Spec { const { legend } = parseJson(chart.customStyle) + const colorField = chart.extColor[0] + const colors = options.theme.category10 + if (colorField.groupType === 'q') { + const colorQuotaScale = { + scale: { + color: { + type: 'linear', + interpolate() { + return c => colors[Math.floor(c * (colors.length - 1))] + } + } + } + } + defaultsDeep(options, colorQuotaScale) + } if (!legend.show) { return { ...options, legend: false } } @@ -250,20 +265,10 @@ export class TableG2Chart extends G2ChartView { } } defaultsDeep(options, tmpLegend) - const colorField = chart.extColor[0] if (colorField.groupType === 'q') { const { container } = context const containerDom = document.getElementById(container) - const colors = options.theme.category10 const quotaLegendOption = { - scale: { - color: { - type: 'linear', - interpolate() { - return c => colors[Math.floor(c * (colors.length - 1))] - } - } - }, legend: { color: { color: colors,