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 81eda6205d..b43d04d788 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) + ')' : '' }} - +