配置项如下
option = {
geo: {
type:'map',
map: 'china',
},
series : [
{
type: 'custom',
coordinateSystem: 'geo',
renderItem: (params, api)=>{
var rect_width = 100;
var rect_height = 100;
var point = api.coord(api.value(0).split(','));
var points = api.value(1).split('||').map(function(item){
return api.coord(item.split(','));
});
var title = api.value(2);
var text = api.value(3);
return {
type: 'group',
children: [
{
type: 'rect',
shape: {
x: point[0] - rect_width/2,
y: point[1] - rect_height/2,
width : rect_width,
height: rect_height,
},
style: {
stroke: '#999',
fill: '#fff',
}
},
{
type: 'text',
style :{
x: point[0] - rect_width/2 + 10,
y: point[1] - rect_height/2 + 20,
text: title + '\n' + text,
},
},
{
type: 'polyline',
shape: {
points: points
},
style: {
stroke: 'red',
lineWidth: 2,
fill: null
}
}
]
}
},
data: [
['80.00,20.00', '85.00,20.00||90.00,20.00||95.00,30.00', '西南', '指标1:1.234\n指标2:1.345' ]
],
}
]
};