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(() => {