2022-09-22 17:09:26 +08:00
|
|
|
|
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
2022-09-25 17:48:51 +08:00
|
|
|
|
import { MapBaseConfig } from './index'
|
2022-09-22 17:09:26 +08:00
|
|
|
|
import { chartInitConfig } from '@/settings/designSetting'
|
|
|
|
|
import { CreateComponentType } from '@/packages/index.d'
|
2022-11-12 15:37:41 +08:00
|
|
|
|
import cloneDeep from 'lodash/cloneDeep'
|
2022-09-22 17:09:26 +08:00
|
|
|
|
import dataJson from './data.json'
|
|
|
|
|
|
|
|
|
|
export const includes = []
|
|
|
|
|
|
|
|
|
|
export const option = {
|
|
|
|
|
dataset: dataJson,
|
|
|
|
|
mapRegion: {
|
|
|
|
|
adcode: 'china',
|
2023-09-16 16:52:55 +08:00
|
|
|
|
showHainanIsLands: true,
|
|
|
|
|
enter: false,
|
|
|
|
|
backSize: 20,
|
|
|
|
|
backColor: '#ffffff'
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
show: true,
|
|
|
|
|
trigger: 'item'
|
|
|
|
|
},
|
|
|
|
|
visualMap: {
|
|
|
|
|
show: true,
|
2022-09-25 17:48:51 +08:00
|
|
|
|
orient: 'vertical',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
pieces: [
|
2022-09-25 17:48:51 +08:00
|
|
|
|
{ gte: 1000, label: '>1000' }, // 不指定 max,表示 max 为无限大(Infinity)。
|
|
|
|
|
{ gte: 600, lte: 999, label: '600-999' },
|
|
|
|
|
{ gte: 200, lte: 599, label: '200-599' },
|
|
|
|
|
{ gte: 50, lte: 199, label: '49-199' },
|
|
|
|
|
{ gte: 10, lte: 49, label: '10-49' },
|
|
|
|
|
{ lte: 9, label: '<9' } // 不指定 min,表示 min 为无限大(-Infinity)。
|
2022-09-22 17:09:26 +08:00
|
|
|
|
],
|
|
|
|
|
inRange: {
|
|
|
|
|
// 渐变颜色,从小到大
|
2022-09-25 17:48:51 +08:00
|
|
|
|
color: ['#c3d7df', '#5cb3cc', '#8abcd1', '#66a9c9', '#2f90b9', '#1781b5']
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
textStyle: {
|
2022-09-25 17:48:51 +08:00
|
|
|
|
color: '#fff'
|
|
|
|
|
}
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
geo: {
|
2022-09-25 17:48:51 +08:00
|
|
|
|
show: false,
|
2022-09-22 17:09:26 +08:00
|
|
|
|
type: 'map',
|
|
|
|
|
roam: false,
|
2022-09-25 17:48:51 +08:00
|
|
|
|
map: 'china',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
selectedMode: false, //是否允许选中多个区域
|
2022-09-25 17:48:51 +08:00
|
|
|
|
zoom: 1
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
name: '',
|
2022-09-25 17:48:51 +08:00
|
|
|
|
type: 'effectScatter',
|
|
|
|
|
coordinateSystem: 'geo',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
symbolSize: 4,
|
|
|
|
|
legendHoverLink: true,
|
2022-09-25 17:48:51 +08:00
|
|
|
|
showEffectOn: 'render',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
rippleEffect: {
|
|
|
|
|
scale: 6,
|
2022-09-25 17:48:51 +08:00
|
|
|
|
color: '#FFFFFF',
|
|
|
|
|
brushType: 'fill'
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
show: true,
|
2022-09-25 17:48:51 +08:00
|
|
|
|
backgroundColor: 'rgba(0,0,0,.6)',
|
|
|
|
|
borderColor: 'rgba(147, 235, 248, .8)',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
textStyle: {
|
2022-09-25 17:48:51 +08:00
|
|
|
|
color: '#FFF'
|
|
|
|
|
}
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
label: {
|
|
|
|
|
formatter: '{b}',
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
offset: [0, 2],
|
2022-09-25 17:48:51 +08:00
|
|
|
|
position: 'bottom',
|
|
|
|
|
textBorderColor: '#fff',
|
|
|
|
|
textShadowColor: '#000',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
textShadowBlur: 10,
|
|
|
|
|
textBorderWidth: 0,
|
2022-09-29 15:23:32 +08:00
|
|
|
|
color: '#FFFFFF',
|
2022-09-25 17:48:51 +08:00
|
|
|
|
show: true
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
itemStyle: {
|
2022-09-25 17:48:51 +08:00
|
|
|
|
color: '#FFFFFF',
|
|
|
|
|
borderColor: 'rgba(225,255,255,2)',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
borderWidth: 4,
|
2022-09-25 17:48:51 +08:00
|
|
|
|
shadowColor: '#E1FFFF',
|
|
|
|
|
shadowBlur: 10
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
2023-08-09 09:28:48 +08:00
|
|
|
|
data: [],
|
|
|
|
|
encode: {
|
|
|
|
|
value: 2
|
|
|
|
|
}
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '区域',
|
2022-09-25 17:48:51 +08:00
|
|
|
|
type: 'map',
|
|
|
|
|
map: 'china',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
data: [],
|
2022-09-25 17:48:51 +08:00
|
|
|
|
selectedMode: false,
|
2022-09-22 17:09:26 +08:00
|
|
|
|
zoom: 1,
|
|
|
|
|
geoIndex: 1,
|
|
|
|
|
tooltip: {
|
|
|
|
|
show: true,
|
2022-09-29 12:37:19 +08:00
|
|
|
|
backgroundColor: '#00000060',
|
|
|
|
|
borderColor: 'rgba(147, 235, 248, 0.8)',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
textStyle: {
|
2022-09-29 12:37:19 +08:00
|
|
|
|
color: '#FFFFFF',
|
2023-09-16 16:52:55 +08:00
|
|
|
|
fontSize: 12
|
2022-09-25 17:48:51 +08:00
|
|
|
|
}
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
label: {
|
2022-09-29 12:37:19 +08:00
|
|
|
|
show: false,
|
|
|
|
|
color: '#FFFFFF',
|
2023-09-16 16:52:55 +08:00
|
|
|
|
fontSize: 12
|
2022-09-24 18:54:05 +08:00
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
2022-09-25 17:48:51 +08:00
|
|
|
|
disabled: false,
|
2022-09-24 18:54:05 +08:00
|
|
|
|
label: {
|
2022-09-29 12:37:19 +08:00
|
|
|
|
color: '#FFFFFF',
|
2023-09-16 16:52:55 +08:00
|
|
|
|
fontSize: 12
|
2022-09-24 18:54:05 +08:00
|
|
|
|
},
|
2022-09-25 17:48:51 +08:00
|
|
|
|
itemStyle: {
|
|
|
|
|
areaColor: '#389BB7',
|
|
|
|
|
shadowColor: '#389BB7',
|
|
|
|
|
borderWidth: 1
|
2022-09-24 18:54:05 +08:00
|
|
|
|
}
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
itemStyle: {
|
|
|
|
|
borderColor: '#93EBF8',
|
|
|
|
|
borderWidth: 1,
|
|
|
|
|
areaColor: {
|
2022-09-25 17:48:51 +08:00
|
|
|
|
type: 'radial',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
x: 0.5,
|
|
|
|
|
y: 0.5,
|
|
|
|
|
r: 0.8,
|
|
|
|
|
colorStops: [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
2022-09-29 12:37:19 +08:00
|
|
|
|
color: '#93ebf800' // 0% 处的颜色
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
2022-09-29 12:37:19 +08:00
|
|
|
|
color: '#93ebf820' // 100% 处的颜色
|
2022-09-25 17:48:51 +08:00
|
|
|
|
}
|
2022-09-22 17:09:26 +08:00
|
|
|
|
],
|
2022-09-25 17:48:51 +08:00
|
|
|
|
globalCoord: false
|
2022-09-22 17:09:26 +08:00
|
|
|
|
},
|
2022-09-25 17:48:51 +08:00
|
|
|
|
shadowColor: '#80D9F842',
|
2022-09-22 17:09:26 +08:00
|
|
|
|
shadowOffsetX: -2,
|
|
|
|
|
shadowOffsetY: 2,
|
2022-09-25 17:48:51 +08:00
|
|
|
|
shadowBlur: 10
|
|
|
|
|
}
|
2023-09-16 16:52:55 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'lines',
|
|
|
|
|
zlevel: 2,
|
|
|
|
|
effect: {
|
|
|
|
|
show: true,
|
|
|
|
|
period: 4, //箭头指向速度,值越小速度越快
|
|
|
|
|
trailLength: 0.4, //特效尾迹长度[0,1]值越大,尾迹越长重
|
|
|
|
|
symbol: 'arrow', //箭头图标
|
|
|
|
|
symbolSize: 7 //图标大小
|
|
|
|
|
},
|
|
|
|
|
lineStyle: {
|
|
|
|
|
normal: {
|
|
|
|
|
color: '#4fb6d2',
|
|
|
|
|
width: 1, //线条宽度
|
|
|
|
|
opacity: 0.1, //尾迹线条透明度
|
|
|
|
|
curveness: 0.3 //尾迹线条曲直度
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data: []
|
2022-09-22 17:09:26 +08:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
export const MapDefaultConfig = { ...option }
|
|
|
|
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
2022-09-25 17:48:51 +08:00
|
|
|
|
public key: string = MapBaseConfig.key
|
2022-09-22 17:09:26 +08:00
|
|
|
|
public attr = { ...chartInitConfig, w: 750, h: 800, zIndex: -1 }
|
2022-11-12 15:37:41 +08:00
|
|
|
|
public chartConfig = cloneDeep(MapBaseConfig)
|
2022-09-22 17:09:26 +08:00
|
|
|
|
public option = echartOptionProfixHandle(option, includes)
|
|
|
|
|
}
|