赞
踩
1.通过npm安装 :npm install openlayers_echart
2.代码
import ADLayer from 'openlayers_echart' //BJData数据格式 [ [[[{name:天津, value: 100, point: [106.7,32]}, {name: 北京, point: [107.9,34.3]}]]], [[[{name:上海, value: 100, point: [108.7,32]}, {name: 大连, point: [109.9,34.3]}]]] ] static move(BJData){ var convertData = function (data) { var res = []; for (var i = 0; i < data.length; i++) { var dataItem = data[i]; var fromCoord =dataItem[0].point; var toCoord = dataItem[1].point; if (fromCoord && toCoord) { res.push([{ coord: fromCoord, value: dataItem[0].value }, { coord: toCoord }]); } } return res; }; var color = ['#a6c84c', '#ffa022', '#46bee9']; var series = []; BJData.forEach(function(item, i) { series.push( { type: 'lines', zlevel: 2, effect: { show: true, period: 4, trailLength: 0.02, symbol: 'arrow', symbolSize: 10, }, lineStyle: { normal: { color:"#2985F7", width: 3, opacity: 0.6, curveness: 0.2 } }, data: convertData(item[0]) }, ); }); var option = { tooltip : { trigger: 'item' }, series: series }; var oe= new ADLayer(option,map,echarts) oe.render() }
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。