From 2deb396213cb3a077cffab71871a916c665364e2 Mon Sep 17 00:00:00 2001 From: ulleo Date: Tue, 24 Dec 2024 16:39:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=AC=A6=E5=8F=B7=E5=9C=B0=E5=9B=BE=E6=9D=A1=E4=BB=B6=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E8=AE=BE=E7=BD=AE=E5=88=A4=E6=96=AD=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/map/symbolic-map.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts index e12fa58245..f3cc99a6ef 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts @@ -237,7 +237,7 @@ export class SymbolicMap extends L7ChartView { const colorAssignments = new Map() const sizeKey = extBubble.length > 0 ? extBubble[0].dataeaseName : '' - //todo 条件颜色 + //条件颜色 const { threshold } = parseJson(chart.senior) let conditions = [] if (threshold.enable) { @@ -279,49 +279,43 @@ export class SymbolicMap extends L7ChartView { const end = parseFloat(t.max) if (start <= value && value <= end) { color = hexColorToRGBA(_color, alpha) - colorsWithAlpha[index] = color baseColorList[index] = color } } else if ('lt' === t.term) { if (value < v) { color = hexColorToRGBA(_color, alpha) - colorsWithAlpha[index] = color baseColorList[index] = color } } else if ('le' === t.term) { if (value <= v) { color = hexColorToRGBA(_color, alpha) - colorsWithAlpha[index] = color baseColorList[index] = color } } else if ('gt' === t.term) { if (value > v) { color = hexColorToRGBA(_color, alpha) - colorsWithAlpha[index] = color baseColorList[index] = color } } else if ('ge' === t.term) { if (value >= v) { color = hexColorToRGBA(_color, alpha) - colorsWithAlpha[index] = color baseColorList[index] = color } } else if ('eq' === t.term) { if (value === v) { color = hexColorToRGBA(_color, alpha) - colorsWithAlpha[index] = color baseColorList[index] = color } } else if ('not_eq' === t.term) { if (value !== v) { color = hexColorToRGBA(_color, alpha) - colorsWithAlpha[index] = color baseColorList[index] = color } } } } } + return { ...item, color, @@ -348,8 +342,8 @@ export class SymbolicMap extends L7ChartView { pointLayer.shape('customIcon') } else { const parser = new DOMParser() - for (let index = 0; index < Math.min(colorsWithAlpha.length, colorIndex + 1); index++) { - const color = colorsWithAlpha[index] + for (let index = 0; index < Math.min(baseColorList.length, colorIndex + 1); index++) { + const color = baseColorList[index] const fillRegex = /(fill="[^"]*")/g const svgStr = basicStyle.customIcon.replace(fillRegex, '') const doc = parser.parseFromString(svgStr, 'image/svg+xml') @@ -363,7 +357,7 @@ export class SymbolicMap extends L7ChartView { }) } } else { - pointLayer.shape(mapSymbol).color('_index', colorsWithAlpha) + pointLayer.shape(mapSymbol).color('_index', baseColorList) pointLayer.style({ stroke: { field: 'color'