From 22e3e1e974c1c951148c93832f1489d99a7a36df Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Mon, 21 Oct 2024 15:35:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=8F=90=E7=A4=BA=E8=BD=AE=E6=92=AD=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=AD=E5=9B=BD=E5=9C=B0=E5=9B=BE=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=BD=AE=E6=92=AD=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=9C=B0=E5=9B=BE=E8=87=AA=E5=AE=9A=E4=B9=89=E5=8C=BA?= =?UTF-8?q?=E9=97=B4=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/LegendSelector.vue | 2 -- .../components/js/panel/charts/map/map.ts | 29 +++++++++++++++++-- .../js/panel/charts/map/tooltip-carousel.ts | 2 +- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/LegendSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/LegendSelector.vue index 6dd48f5423..cc50167c3c 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/LegendSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/LegendSelector.vue @@ -356,7 +356,6 @@ onMounted(() => { { { }, 'l7plot-legend__category-marker': { ...LEGEND_SHAPE_STYLE_MAP[legend.icon], - width: '8px', - height: '8px' + width: '9px', + height: '9px', + border: '0.01px solid #f4f4f4' } } } @@ -311,9 +312,15 @@ export class Map extends L7PlotChartView { ranges.forEach((range, index) => { const tmpRange = [range[0]?.toFixed(0), range[1]?.toFixed(0)] const colorIndex = index % colors.length + // 当区间第一个值小于最小值时,颜色取地图底色 + const isLessThanMin = range[0] < ranges[0][0] + let rangeColor = colors[colorIndex] + if (isLessThanMin) { + rangeColor = hexColorToRGBA(basicStyle.areaBaseColor, basicStyle.alpha) + } items.push({ value: tmpRange, - color: colors[colorIndex] + color: rangeColor }) }) customLegend['items'] = items @@ -332,6 +339,17 @@ export class Map extends L7PlotChartView { const c = findColorByValue(t.value, items) return c ? c : null } + customLegend['domStyles'] = { + ...customLegend['domStyles'], + 'l7plot-legend l7plot-legend__category': { + 'box-shadow': '0px 0px 0px 0px', + 'background-color': 'var(--bgColor)', + padding: 0 + }, + 'l7plot-legend__list-item': { + 'margin-bottom': '3px' + } + } } else { customLegend['customContent'] = (_: string, items: CategoryLegendListItem[]) => { const showItems = items?.length > 30 ? items.slice(0, 30) : items @@ -368,6 +386,11 @@ export class Map extends L7PlotChartView { return options } + setupDefaultOptions(chart: ChartObj): ChartObj { + chart.customAttr.basicStyle.areaBaseColor = '#f4f4f4' + return chart + } + protected setupOptions( chart: Chart, options: ChoroplethOptions, diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/tooltip-carousel.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/tooltip-carousel.ts index 656c361480..ae451b5940 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/tooltip-carousel.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/tooltip-carousel.ts @@ -12,7 +12,7 @@ export const configCarouselTooltip = (chart, view, data, scene) => { ?.filter(i => i.dimensionList?.length > 0) .reduce((acc, current) => { const existingItem = acc.find(obj => { - if (obj.abbrev === 'China') { + if (!obj.abbrev || obj.abbrev === 'China') { return obj.adcode === current.adcode } else { return obj.abbrev === current.abbrev