Merge pull request #6312 from dataease/pr@dev@fix_symbol_map_empty

fix: 符号地图数据包涵经纬度为空的记录label无法展示
This commit is contained in:
fit2cloud-chenyw 2023-10-23 17:07:15 +08:00 committed by GitHub
commit e6402ff9b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -352,13 +352,12 @@ export default {
const defaultTemplate = "经度:${longitude},纬度:${latitude}"
const templateWithField = getDefaultTemplate(chart, 'labelAxis', false, false)
const labelTemplate = customAttr.label.labelTemplate || templateWithField || defaultTemplate
originData.forEach(item => {
const data = originData.filter(item => item.longitude && item.latitude)
data.forEach(item => {
const properties = item.properties || {}
properties.longitude = item.longitude
properties.latitude = item.latitude
try {
item.labelResult = this.fillStrTemplate(labelTemplate, properties)
}catch (error) {
@ -369,7 +368,7 @@ export default {
})
this.textLayer = new PointLayer({})
.source(originData,
.source(data,
{
parser: {
type: 'json',
@ -399,7 +398,6 @@ export default {
},
setLayerAttr (chart) {
let defaultSymbol = 'marker'
let customAttr = {}
let layerStyle = {}
@ -417,7 +415,8 @@ export default {
}
this.myChart.removeAllLayer().then(() => {
const data = chart.data && chart.data.data || []
let data = chart.data && chart.data.data || []
data = data.filter(item => item.longitude && item.latitude)
this.pointLayer = new PointLayer({autoFit: true})
this.pointLayer.source(data, {
parser: {