157 lines
3.9 KiB
TypeScript
Raw Normal View History

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'
import dataJson from './data.json'
export const includes = []
export const option = {
dataset: dataJson,
mapRegion: {
adcode: 'china',
2022-09-25 17:48:51 +08:00
showHainanIsLands: true
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-25 17:48:51 +08:00
color: '#FFF',
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
},
data: []
},
{
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',
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',
fontSize: 12,
},
emphasis: {
2022-09-25 17:48:51 +08:00
disabled: false,
label: {
2022-09-29 12:37:19 +08:00
color: '#FFFFFF',
fontSize: 12,
},
2022-09-25 17:48:51 +08:00
itemStyle: {
areaColor: '#389BB7',
shadowColor: '#389BB7',
borderWidth: 1
}
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
}
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-09-25 17:48:51 +08:00
public chartConfig = MapBaseConfig
2022-09-22 17:09:26 +08:00
public option = echartOptionProfixHandle(option, includes)
}