mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 03:52:59 +08:00
Merge pull request #13193 from dataease/pr@dev-v2@chart-map-tooltip-style
style(图表): 优化地图轮播提示的代码
This commit is contained in:
commit
95d5d949ac
@ -135,7 +135,7 @@ export class BubbleMap extends L7PlotChartView<ChoroplethOptions, Choropleth> {
|
|||||||
})
|
})
|
||||||
dotLayer.once('loaded', () => {
|
dotLayer.once('loaded', () => {
|
||||||
chart.container = container
|
chart.container = container
|
||||||
configCarouselTooltip(chart, view, chart.data?.data || [], null, areaId)
|
configCarouselTooltip(chart, view, chart.data?.data || [], null)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return view
|
return view
|
||||||
|
@ -178,7 +178,7 @@ export class Map extends L7PlotChartView<ChoroplethOptions, Choropleth> {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
chart.container = container
|
chart.container = container
|
||||||
configCarouselTooltip(chart, view, data, null, areaId)
|
configCarouselTooltip(chart, view, data, null)
|
||||||
})
|
})
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
@ -6,19 +6,13 @@ import { parseJson } from '@/views/chart/components/js/util'
|
|||||||
import { Scene } from '@antv/l7-scene'
|
import { Scene } from '@antv/l7-scene'
|
||||||
import { deepCopy } from '@/utils/utils'
|
import { deepCopy } from '@/utils/utils'
|
||||||
|
|
||||||
export const configCarouselTooltip = (chart, view, data, scene, areaId?) => {
|
export const configCarouselTooltip = (chart, view, data, scene) => {
|
||||||
if (['bubble-map', 'map'].includes(chart.type)) {
|
if (['bubble-map', 'map'].includes(chart.type)) {
|
||||||
data = view.source.data.dataArray
|
data = view.source.data.dataArray
|
||||||
?.filter(i => i.dimensionList?.length > 0)
|
?.filter(i => i.dimensionList?.length > 0)
|
||||||
.reduce((acc, current) => {
|
.reduce((acc, current) => {
|
||||||
const existingItem = acc.find(obj => {
|
const existingItem = acc.find(obj => {
|
||||||
if (areaId.startsWith('000')) {
|
return obj.name === current.name || (obj.adcode && obj.adcode === current.adcode)
|
||||||
return obj.name === current.name
|
|
||||||
} else if (areaId.startsWith('156')) {
|
|
||||||
return obj.adcode === current.adcode
|
|
||||||
} else {
|
|
||||||
return obj.name === current.name
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
if (!existingItem) {
|
if (!existingItem) {
|
||||||
acc.push(current)
|
acc.push(current)
|
||||||
|
Loading…
Reference in New Issue
Block a user