From 6a2fb192d982a0e61fa3d57056391bf697db49a3 Mon Sep 17 00:00:00 2001 From: ulleo Date: Mon, 1 Jul 2024 14:51:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=9F=B1=E7=BA=BF=E7=BB=84=E5=90=88=E5=9B=BE=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=B8=AD=E6=B2=A1=E6=9C=89=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=AD=97=E6=AE=B5=E5=90=8E=E5=AF=BC=E8=87=B4=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA=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 --- .../components/TooltipSelector.vue | 59 +++++++++++-------- 1 file changed, 33 insertions(+), 26 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 0dcec8ec49..3638cc28d6 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 { defaultTo, partition, union } from 'lodash-es' +import { defaultTo, partition, map, includes } from 'lodash-es' import chartViewManager from '../../../js/panel' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { storeToRefs } from 'pinia' @@ -41,13 +41,7 @@ const toolTip = computed(() => { }) const emit = defineEmits(['onTooltipChange', 'onExtTooltipChange']) const curSeriesFormatter = ref>({}) -const realQuota = ref(inject('quotaData')) -const yAxis = computed(() => { - return union(defaultTo(props.chart.yAxis, []), defaultTo(props.chart.yAxisExt, [])) -}) -const quotaData = computed(() => { - return props.chart.type.includes('chart-mix') ? yAxis.value : realQuota.value -}) +const quotaData = ref(inject('quotaData')) const showSeriesTooltipFormatter = computed(() => { return showProperty('seriesTooltipFormatter') && !batchOptStatus.value && props.chart.id }) @@ -116,6 +110,18 @@ const quotaAxis = computed(() => { }) return result }) + +const quotaAxisIds = computed(() => { + return map(quotaAxis.value, a => a.id) +}) + +function showOption(item) { + if (props.chart.type.includes('chart-mix')) { + return includes(quotaAxisIds.value, item.id) + } + return true +} + const extTooltip = computed(() => { const quotaIds = quotaAxis.value?.map(i => i.id) return state.tooltipForm.seriesTooltipFormatter.filter( @@ -617,24 +623,25 @@ onMounted(() => { /> - - - - - {{ item.name }} - {{ item.summary !== '' ? '(' + t('chart.' + item.summary) + ')' : '' }} - +