From 3bb705ec3f3721557f9076ce5f7beb2253f66d76 Mon Sep 17 00:00:00 2001 From: a0049873 <79py69t9wb@privaterelay.appleid.com> Date: Tue, 2 Aug 2022 18:37:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=B8=82=E7=AB=99=E7=82=B9=20=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E9=BC=A0=E6=A0=87=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/views/home/mapTest/index.vue | 94 ++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 5 deletions(-) diff --git a/front/src/views/home/mapTest/index.vue b/front/src/views/home/mapTest/index.vue index 1d0ba2f0..46ca48f9 100644 --- a/front/src/views/home/mapTest/index.vue +++ b/front/src/views/home/mapTest/index.vue @@ -175,6 +175,8 @@ ] } else if (val.name === '市北区') { geoCoordMap[val.name] = [val.coord[0], val.coord[1]] + } else if (val.name === '城阳区') { + geoCoordMap[val.name] = [val.coord[0] - 0.057495, val.coord[1]] } else if (val.name === '市南区') { geoCoordMap[val.name] = [120.364482, 36.065671] } @@ -573,7 +575,7 @@ symbolOffset: [0, -20], data: [ { - name: '西海岸', + name: '', value: geoCoordMap['西海岸'].concat([10]), }, ], @@ -610,7 +612,7 @@ symbolOffset: [0, -20], data: [ { - name: '崂山区', + name: '', value: geoCoordMap['崂山区'].concat([10]), }, ], @@ -647,7 +649,7 @@ symbolOffset: [0, -20], data: [ { - name: '城阳区', + name: '', value: geoCoordMap['城阳区'].concat([10]), }, ], @@ -684,7 +686,7 @@ symbolOffset: [0, -20], data: [ { - name: '李沧区', + name: '', value: geoCoordMap['李沧区'].concat([10]), }, ], @@ -701,11 +703,93 @@ } onMounted(() => { initMap() - myChart.on('mouseover', function () { + myChart.on('mouseover', function (params) { + console.log(params.value) myChart.dispatchAction({ type: 'downplay', }) + let flag = true + if ( + params.value[0] == '119.825774' && + params.value[1] == '35.739174000000006' + ) { + if (option.series[8].data[0].name == '西海岸') { + flag = false + } + option.series[8].data[0].name = '西海岸' + option.series[9].data[0].name = '' + option.series[10].data[0].name = '' + option.series[11].data[0].name = '' + if (flag) { + myChart.clear() + myChart.setOption(option, true) + } + } else if ( + params.value[0] == '120.579994' && + params.value[1] == '36.189191' + ) { + if (option.series[9].data[0].name == '崂山区') { + flag = false + } + option.series[8].data[0].name = '' + option.series[9].data[0].name = '崂山区' + option.series[10].data[0].name = '' + option.series[11].data[0].name = '' + if (flag) { + myChart.clear() + myChart.setOption(option, true) + } + } else if ( + params.value[0] == '120.421977' && + params.value[1] == '36.18555' + ) { + if (option.series[11].data[0].name == '李沧区') { + flag = false + } + option.series[8].data[0].name = '' + option.series[9].data[0].name = '' + option.series[10].data[0].name = '' + option.series[11].data[0].name = '李沧区' + if (flag) { + myChart.clear() + myChart.setOption(option, true) + } + } else if ( + params.value[0] == '120.272216' && + params.value[1] == '36.27479' + ) { + if (option.series[10].data[0].name == '城阳区') { + flag = false + } + option.series[8].data[0].name = '' + option.series[9].data[0].name = '' + option.series[10].data[0].name = '城阳区' + option.series[11].data[0].name = '' + if (flag) { + myChart.clear() + myChart.setOption(option, true) + } + } }) + // myChart.on('mouseout', function (params) { + // console.log(params) + // switch (params.name) { + // case '西海岸': + // option.series[8].data[0].name = '' + // break + // case '崂山区': + // option.series[9].data[0].name = '' + // break + // case '城阳区': + // option.series[10].data[0].name = '' + // break + // case '李沧区': + // option.series[11].data[0].name = '' + // break + // } + // myChart.clear() + // myChart.setOption(option, true) + // }) myChart.on('click', function (params) { console.log(params) params.event.event.stopPropagation()