在绑定数据的方法里,加入属性 lineStyle: {
normal: {
color: color[i%4],
width: 1,
opacity: 0.6,
curveness: 0.2
}
}
normal: {
color: color[i%4],
width: 1,
opacity: 0.6,
curveness: 0.2
}
}
如下所示:
var convertData = function (data) {
var res = [];
for (var i = 0; i < data.length; i++) {
var dataItem = data[i];
var fromCoord = geoCoordMap[dataItem[0].name];
var toCoord = geoCoordMap[dataItem[1].name];
if (fromCoord && toCoord) {
res.push({
fromName: dataItem[0].name,
toName: dataItem[1].name,
coords: [fromCoord, toCoord],
lineStyle: {
normal: {
color: color[i%4],
width: 1,
opacity: 0.6,
curveness: 0.2
}
}
});
}
}
console.log(res);
return res;
};
var res = [];
for (var i = 0; i < data.length; i++) {
var dataItem = data[i];
var fromCoord = geoCoordMap[dataItem[0].name];
var toCoord = geoCoordMap[dataItem[1].name];
if (fromCoord && toCoord) {
res.push({
fromName: dataItem[0].name,
toName: dataItem[1].name,
coords: [fromCoord, toCoord],
lineStyle: {
normal: {
color: color[i%4],
width: 1,
opacity: 0.6,
curveness: 0.2
}
}
});
}
}
console.log(res);
return res;
};