From fad7f484e1ae3850aca5ae52a6e2a19bfad0d1d8 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Fri, 19 Apr 2024 14:56:23 +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=E4=B8=AD=E6=8C=87=E6=A0=87?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E6=98=BE=E7=A4=BA=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor-style/components/TooltipSelector.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 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 ad34c1eba9..6834fb029d 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 @@ -12,6 +12,7 @@ import chartViewManager from '../../../js/panel' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { storeToRefs } from 'pinia' import { useEmitt } from '@/hooks/web/useEmitt' +import { deepCopy } from '@/utils/utils' const { t } = useI18n() @@ -45,6 +46,11 @@ const initSeriesTooltip = () => { if (!showSeriesTooltipFormatter.value) { return } + if (!props.chart.customAttr.tooltip.seriesTooltipFormatter.length) { + state.tooltipForm.seriesTooltipFormatter = deepCopy( + props.chart.customAttr.tooltip.seriesTooltipFormatter + ) + } const formatter = state.tooltipForm.seriesTooltipFormatter const seriesAxisMap = formatter.reduce((pre, next) => { next.seriesId = next.seriesId ?? next.id @@ -158,9 +164,6 @@ watch( watch( [quotaData, () => props.chart.type], newVal => { - if (!newVal?.[0]?.length) { - return - } initSeriesTooltip() }, { deep: false } @@ -198,6 +201,11 @@ const init = () => { if (customAttr.tooltip) { state.tooltipForm = defaultsDeep(customAttr.tooltip, cloneDeep(DEFAULT_TOOLTIP)) formatterSelector.value?.blur() + if (!props.chart.customAttr.tooltip.seriesTooltipFormatter.length) { + state.tooltipForm.seriesTooltipFormatter = deepCopy( + props.chart.customAttr.tooltip.seriesTooltipFormatter + ) + } // 新增图表 const formatter = state.tooltipForm.seriesTooltipFormatter if (!formatter.length) { @@ -537,7 +545,7 @@ onMounted(() => {