测试了一下,这样也无法传自定义参数。
[JavaScript] 纯文本查看 复制代码 const renderItem = (params, api, myParam) => {
console.log('myParam', myParam)
// myParam undefined
const coords = [
[116.7, 39.53],
[103.73, 36.03],
[112.91, 27.87],
[120.65, 28.01],
[119.57, 39.95]
];
let points = [];
for (let i = 0; i < coords.length; i++) {
points.push(api.coord(coords[i]));
}
let color = api.visual('color');
return {
type: 'polygon',
shape: {
points: echarts.graphic.clipPointsByRect(points, {
x: params.coordSys.x,
y: params.coordSys.y,
width: params.coordSys.width,
height: params.coordSys.height
})
},
style: api.style({
fill: color,
stroke: echarts.color.lift(color)
})
};
}
const objPolygonSeries = {
type: 'custom',
coordinateSystem: 'bmap',
myParam: 'myParam',
renderItem: renderItem,
tooltip: '这是提示文本',
itemStyle: {
opacity: 0.5
},
data: [0],
z: -10
} |