画图有个需求是“同时显示散点和多边形,且多边形在散点之上”,调整series中的顺序并不能使散点显示在多边形下,找了半天发现echart有个参数zlevel可以解决这个问题。
zlevel小的会被大的覆盖,这样series同时显示多种覆盖物时就可以调整显示优先级了。
showChart.setOption({
series:[
{
name: 'scatterInZone',
type: 'scatter',
coordinateSystem: 'bmap',
symbolSize: 5,
data: scatterInZone,
itemStyle:{
normal:{
color:params=>{
return COLOR_ALL[params.data.status + 1];
}
}
},
zlevel:1
},
{
id: 'fence',
type: 'lines',
coordinateSystem: 'bmap',
smooth: true,
data: fencelines,
polyline: true,
lineStyle: {
color: 'black',
opacity: 0.6,
width: 3
},
zlevel:100
}
]
});