forked from github/dataease
style(图表-符号地图): 根据数据自适应缩放
This commit is contained in:
parent
f6a8223c97
commit
3c308e53f0
@ -139,30 +139,8 @@ export class SymbolicMap extends L7ChartView<Scene, L7Config> {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
scene.once('loaded', () => {
|
|
||||||
this.autoZoom(symbolicLayer, scene)
|
|
||||||
})
|
|
||||||
return new L7Wrapper(scene, configList)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return new L7Wrapper(scene, configList)
|
||||||
* 根据数据自动缩放大小及位置
|
|
||||||
* @param symbolicLayer
|
|
||||||
* @param scene
|
|
||||||
*/
|
|
||||||
autoZoom = (symbolicLayer, scene) => {
|
|
||||||
const roamMap = flag => {
|
|
||||||
return flag ? scene.zoomIn() : scene.zoomOut()
|
|
||||||
}
|
|
||||||
const resetZoom = () => {
|
|
||||||
symbolicLayer.fitBounds()
|
|
||||||
}
|
|
||||||
symbolicLayer && resetZoom()
|
|
||||||
// 自动放大两级
|
|
||||||
let index = 2
|
|
||||||
while (index--) {
|
|
||||||
roamMap(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -199,7 +177,7 @@ export class SymbolicMap extends L7ChartView<Scene, L7Config> {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
: []
|
: []
|
||||||
const pointLayer = new PointLayer()
|
const pointLayer = new PointLayer({ autoFit: true })
|
||||||
.source(data, {
|
.source(data, {
|
||||||
parser: {
|
parser: {
|
||||||
type: 'json',
|
type: 'json',
|
||||||
|
Loading…
Reference in New Issue
Block a user