试过了offset和很多Api,都无法实现label居中
后来无意中发现,原来在geojson注册的时候,可以定义 properties.cp 属性,实现文本的坐标自定义,实现居中。
echarts.registerMap('china', {
"type": "FeatureCollection",
"features": [{
"id": "650000",
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [],
"encodeOffsets": [[, ]]
},
"properties": {
"cp": [87.617733, 43.792818],
"name": "*",
"childNum":
}
}],
"UTF8Encoding": true
});