以下是Echart画的运动轨迹动画:
datagj为实时的坐标,每一个坐标需要有唯一的name【重要】;
links标识轨迹从按照name的顺序依次进行运动;
var datagj = [{name:'1',x:12.295,y:0.000},{name:'2',x:22.235,y:10.000}, {name:'3',x:20.305,y:10.000},{name:'4',x:27.885,y:20.000}, {name:'5',x:27.915,y:20.000},{name:'6',x:12.305,y:10.000},{name:'7',x:20.000,y:10.950},{name:'8',x:27.885,y:20.000},{name:'9',x:22.155,y:20.000},{name:'10',x:17.705,y:10.000}
];
var links = datagj.map(function (item, i) {
return {
source: i,*//运动起始点*
target: i + 1*//运动终点*
};
});
links.pop();
option = {
xAxis: {
scale: true
},
yAxis: {
scale: true
},
series: [{
type: 'effectScatter',*//点的类型*
symbolSize: 40,*//点的大小*
label: {
normal: {
show: true,
formatter: function (p