fix(图表): 修复世界地图轮播提示丢失的问题 #12679

This commit is contained in:
jianneng-fit2cloud 2024-11-06 22:03:38 +08:00
parent be53950a54
commit 29b591bbe4
3 changed files with 7 additions and 5 deletions

View File

@ -135,7 +135,7 @@ export class BubbleMap extends L7PlotChartView<ChoroplethOptions, Choropleth> {
})
dotLayer.once('loaded', () => {
chart.container = container
configCarouselTooltip(chart, view, chart.data?.data || [], null)
configCarouselTooltip(chart, view, chart.data?.data || [], null, areaId)
})
})
return view

View File

@ -178,7 +178,7 @@ export class Map extends L7PlotChartView<ChoroplethOptions, Choropleth> {
})
})
chart.container = container
configCarouselTooltip(chart, view, data, null)
configCarouselTooltip(chart, view, data, null, areaId)
})
return view
}

View File

@ -6,16 +6,18 @@ import { parseJson } from '@/views/chart/components/js/util'
import { Scene } from '@antv/l7-scene'
import { deepCopy } from '@/utils/utils'
export const configCarouselTooltip = (chart, view, data, scene) => {
export const configCarouselTooltip = (chart, view, data, scene, areaId?) => {
if (['bubble-map', 'map'].includes(chart.type)) {
data = view.source.data.dataArray
?.filter(i => i.dimensionList?.length > 0)
.reduce((acc, current) => {
const existingItem = acc.find(obj => {
if (!obj.abbrev || obj.abbrev === 'China') {
if (areaId.startsWith('000')) {
return obj.name === current.name
} else if (areaId.startsWith('156')) {
return obj.adcode === current.adcode
} else {
return obj.abbrev === current.abbrev
return obj.name === current.name
}
})
if (!existingItem) {