去除 西海岸和崂山区以外的 箭头动画

This commit is contained in:
a0049873 2022-06-15 15:53:37 +08:00
parent cdf9298f58
commit 4a0516fe11
1 changed files with 72 additions and 25 deletions

View File

@ -315,6 +315,7 @@
let res = []
for (let i = 0; i < data.length; i++) {
let dataItem = data[i]
if (dataItem.name === '西海岸' || dataItem.name === '崂山区') {
let fromCoord = geoCoordMap[dataItem.name]
let toCoord = [120.364482, 36.065671]
if (fromCoord && toCoord) {
@ -329,12 +330,14 @@
])
}
}
}
return res
}
const convertData2 = 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) {
@ -349,10 +352,34 @@
])
}
}
}
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(() => {