From 4a0516fe11412d293644b1d0cbb697763c14ca5c Mon Sep 17 00:00:00 2001 From: a0049873 <79py69t9wb@privaterelay.appleid.com> Date: Wed, 15 Jun 2022 15:53:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=20=E8=A5=BF=E6=B5=B7?= =?UTF-8?q?=E5=B2=B8=E5=92=8C=E5=B4=82=E5=B1=B1=E5=8C=BA=E4=BB=A5=E5=A4=96?= =?UTF-8?q?=E7=9A=84=20=E7=AE=AD=E5=A4=B4=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/views/home/mapTest/index.vue | 97 +++++++++++++++++++------- 1 file changed, 72 insertions(+), 25 deletions(-) diff --git a/front/src/views/home/mapTest/index.vue b/front/src/views/home/mapTest/index.vue index 8099ebcb..e9e831ba 100644 --- a/front/src/views/home/mapTest/index.vue +++ b/front/src/views/home/mapTest/index.vue @@ -315,18 +315,20 @@ let res = [] for (let i = 0; i < data.length; i++) { let dataItem = data[i] - let fromCoord = geoCoordMap[dataItem.name] - let toCoord = [120.364482, 36.065671] - if (fromCoord && toCoord) { - res.push([ - { - coord: fromCoord, - value: dataItem.value, - }, - { - coord: toCoord, - }, - ]) + if (dataItem.name === '西海岸' || dataItem.name === '崂山区') { + let fromCoord = geoCoordMap[dataItem.name] + let toCoord = [120.364482, 36.065671] + if (fromCoord && toCoord) { + res.push([ + { + coord: fromCoord, + value: dataItem.value, + }, + { + coord: toCoord, + }, + ]) + } } } return res @@ -335,24 +337,49 @@ let res = [] for (let i = 0; i < data.length; i++) { let dataItem = data[i] - let fromCoord = [120.364482, 36.065671] - let toCoord = geoCoordMap[dataItem.name] - if (fromCoord && toCoord) { - res.push([ - { - coord: fromCoord, - value: dataItem.value, - }, - { - coord: toCoord, - }, - ]) + if (dataItem.name === '西海岸' || dataItem.name === '崂山区') { + let fromCoord = [120.364482, 36.065671] + let toCoord = geoCoordMap[dataItem.name] + if (fromCoord && toCoord) { + res.push([ + { + coord: fromCoord, + value: dataItem.value, + }, + { + coord: toCoord, + }, + ]) + } + } + } + return res + } + const notShowData = function (data) { + let res = [] + for (let i = 0; i < data.length; i++) { + let dataItem = data[i] + if (dataItem.name !== '西海岸' && dataItem.name !== '崂山区') { + let fromCoord = [120.364482, 36.065671] + let toCoord = geoCoordMap[dataItem.name] + if (fromCoord && toCoord) { + res.push([ + { + coord: fromCoord, + value: dataItem.value, + }, + { + coord: toCoord, + }, + ]) + } } } return res } ;[['市南区', areaMenuList.value]].forEach(function (item) { option.series.push( + // 显示箭头 { type: 'lines', zlevel: 2, @@ -391,6 +418,26 @@ }, data: convertData2(item[1]), }, + // 不显示箭头 + { + type: 'lines', + zlevel: 2, + effect: { + show: false, + period: 4, //箭头指向速度,值越小速度越快 + trailLength: 0.02, //特效尾迹长度[0,1]值越大,尾迹越长重 + symbol: 'arrow', //箭头图标 + symbolSize: 5, //图标大小 + }, + lineStyle: { + normal: { + width: 1, //尾迹线条宽度 + opacity: 1, //尾迹线条透明度 + curveness: -0.3, //尾迹线条曲直度 + }, + }, + data: notShowData(item[1]), + }, { type: 'effectScatter', coordinateSystem: 'geo', @@ -548,7 +595,7 @@ } ) }) - + console.log('echarts配置==================>', option) myChart.setOption(option) } onMounted(() => {