config.ts
1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { OverrideBarCommonConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
// 其它配置项比如新增(动画)
const otherConfig = {
// 轮播动画
isCarousel: false
}
export const seriesItem = {
type: 'bar',
barWidth: 15,
label: {
show: true,
position: 'top',
color: '#fff',
fontSize: 12
},
itemStyle: {
color: null,
borderRadius: 2
}
}
export const option = {
...otherConfig,
tooltip: {
show: true,
trigger: 'axis',
axisPointer: {
show: true,
type: 'shadow'
}
},
xAxis: {
show: true,
type: 'category'
},
yAxis: {
show: true,
type: 'value'
},
dataset: { ...dataJson },
series: [seriesItem, seriesItem]
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key = OverrideBarCommonConfig.key
public chartConfig = cloneDeep(OverrideBarCommonConfig)
// 图表配置项
public option = echartOptionProfixHandle(option, includes)
}