Skip to content

Commit 93973da

Browse files
Merge pull request dataease#11240 from dataease/pr@dev-v2@chart-symbolic-map-auto-zoom-style
style(图表-符号地图): 根据数据自适应缩放
2 parents f6a8223 + 3c308e5 commit 93973da

File tree

1 file changed

+2
-24
lines changed
  • core/core-frontend/src/views/chart/components/js/panel/charts/map

1 file changed

+2
-24
lines changed

core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -139,30 +139,8 @@ export class SymbolicMap extends L7ChartView<Scene, L7Config> {
139139
}
140140
})
141141
})
142-
scene.once('loaded', () => {
143-
this.autoZoom(symbolicLayer, scene)
144-
})
145-
return new L7Wrapper(scene, configList)
146-
}
147142

148-
/**
149-
* 根据数据自动缩放大小及位置
150-
* @param symbolicLayer
151-
* @param scene
152-
*/
153-
autoZoom = (symbolicLayer, scene) => {
154-
const roamMap = flag => {
155-
return flag ? scene.zoomIn() : scene.zoomOut()
156-
}
157-
const resetZoom = () => {
158-
symbolicLayer.fitBounds()
159-
}
160-
symbolicLayer && resetZoom()
161-
// 自动放大两级
162-
let index = 2
163-
while (index--) {
164-
roamMap(true)
165-
}
143+
return new L7Wrapper(scene, configList)
166144
}
167145

168146
/**
@@ -199,7 +177,7 @@ export class SymbolicMap extends L7ChartView<Scene, L7Config> {
199177
}
200178
})
201179
: []
202-
const pointLayer = new PointLayer()
180+
const pointLayer = new PointLayer({ autoFit: true })
203181
.source(data, {
204182
parser: {
205183
type: 'json',

0 commit comments

Comments
 (0)