echarts 实时航线动画效果突然失效问题 #4692https://github.com/ecomfe/echarts/issues/4692
配置项如下
var uploadedDataURL = "/asset/get/s/data-1469162638978-rJDcVXku.json";
app.title = '65k+ 飞机航线';
$.getJSON(uploadedDataURL, function(data) {
// 获取坐标
function getAirportCoord(idx) {
return [data.airports[idx][3], data.airports[idx][4]];
}
//
var routes = data.routes.map(function (airline) {
return [
getAirportCoord(airline[1]),
getAirportCoord(airline[2])
];
});
var planePath = 'path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z';
var lines = [];
var i = 0;
setInterval(function() {
var index = parseInt(Math.random()*1000);
// 从data中随机选取一条记录
lines.push({
id: parseInt(String(index)+String((new Date()).getTime())),
coords: routes[index]
});
if(lines.length > 100) {
lines.shift();
}
myChart.setOption(options());
i++;
// console.info(i);
},100);
function options() {
var option = {
title: {
text: '实时动态航线',
left: 'center',
textStyle: {
color: '#eee'
}
},
backgroundColor: '#003',
geo: {
map: 'world',
left: 0,
right: 0,
silent: true,
roam:true,
itemStyle: {
normal: {
borderColor: '#003',
color: '#005'
}
}
},
series: [{
type: 'lines',
coordinateSystem: 'geo',
data: lines,
zlevel:10,
animation:true,
// animationThreshold:2,
effect: {
show: true,
period: 1,
trailLength: 0,
// constantSpeed: 20,
color: '#fff',
loop:false,
symbolSize: 0.8,
//symbol:'',
},
//large: true,
largeThreshold: 100,
lineStyle: {
normal: {
// opacity: 0.05,
width: 0.5,
curveness: 0.1
}
},
// 设置混合模式为叠加
blendMode: 'lighter'
}]
};
return option;
};
});