From 1716885dc4f14b946b350618ca2e36c716cc6948 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Wed, 17 Apr 2024 14:09:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8-=E6=A0=B7=E5=BC=8F):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8F=90=E7=A4=BA=E6=8C=87=E6=A0=87=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E6=95=B0=E6=8D=AE=EF=BC=8C=E6=9C=89=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=AD=98=E5=9C=A8=E7=BC=BA=E5=A4=B1=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor/editor-style/components/TooltipSelector.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/TooltipSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/TooltipSelector.vue index 014b7e45e9..ad34c1eba9 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/TooltipSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/TooltipSelector.vue @@ -7,7 +7,7 @@ import cloneDeep from 'lodash-es/cloneDeep' import defaultsDeep from 'lodash-es/defaultsDeep' import { formatterType, unitType } from '../../../js/formatter' import { fieldType } from '@/utils/attr' -import { partition } from 'lodash-es' +import { partition, uniqWith, isEqual } from 'lodash-es' import chartViewManager from '../../../js/panel' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { storeToRefs } from 'pinia' @@ -255,6 +255,9 @@ const updateSeriesTooltipFormatter = (form: AxisEditForm) => { const addAxis = (form: AxisEditForm) => { const { axis, axisType } = form const axisMap = axis.reduce((pre, next) => { + if (!next) { + return pre + } next.axisType = axisType next.seriesId = `${next.id}-${axisType}` pre[next.id] = next @@ -278,12 +281,15 @@ const addAxis = (form: AxisEditForm) => { } } }) + const dupAxisDistinct = uniqWith(dupAxis, isEqual) || [] state.tooltipForm.seriesTooltipFormatter = - state.tooltipForm.seriesTooltipFormatter.concat(dupAxis) + state.tooltipForm.seriesTooltipFormatter.concat(dupAxisDistinct) state.tooltipForm.seriesTooltipFormatter = partition( state.tooltipForm.seriesTooltipFormatter, ele => quotaAxis.value.findIndex(item => item.id === ele.id) !== -1 ).flat() + state.tooltipForm.seriesTooltipFormatter = + uniqWith(state.tooltipForm.seriesTooltipFormatter, isEqual) || [] } const removeAxis = (form: AxisEditForm) => { const { axis, axisType } = form