72 lines
1.5 KiB
TypeScript
Raw Normal View History

import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
2022-02-02 18:17:45 +08:00
import { PieCommonConfig } from './index'
2022-02-24 10:21:33 +08:00
import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep'
2022-03-20 18:11:26 +08:00
import dataJson from './data.json'
2022-02-02 18:17:45 +08:00
export const includes = ['legend']
2022-09-26 11:17:00 +08:00
export enum PieTypeEnum {
NORMAL = '常规图',
RING = '环形图',
ROSE = '玫瑰图'
}
export const PieTypeObject = {
[PieTypeEnum.NORMAL]: 'nomal',
[PieTypeEnum.RING]: 'ring',
[PieTypeEnum.ROSE]: 'rose'
}
2022-02-26 17:38:24 +08:00
const option = {
2022-09-26 11:17:00 +08:00
type: 'ring',
tooltip: {
show: true,
trigger: 'item'
},
legend: {
2022-09-26 17:34:33 +08:00
show: true
},
2022-03-20 18:11:26 +08:00
dataset: { ...dataJson },
series: [
{
type: 'pie',
2022-02-26 17:38:24 +08:00
radius: ['40%', '65%'],
center: ['50%', '60%'],
2022-09-26 11:17:00 +08:00
roseType: false,
avoidLabelOverlap: false,
itemStyle: {
2022-02-24 17:55:29 +08:00
show: true,
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: {
show: false,
position: 'center',
formatter: '{b}',
fontSize:12
},
emphasis: {
label: {
show: true,
fontSize: '40',
fontWeight: 'bold'
}
},
labelLine: {
show: false
2022-03-20 18:11:26 +08:00
}
}
]
2022-02-26 17:38:24 +08:00
}
export default class Config extends PublicConfigClass implements CreateComponentType {
2022-02-02 18:17:45 +08:00
public key: string = PieCommonConfig.key
public chartConfig = cloneDeep(PieCommonConfig)
2022-02-02 18:17:45 +08:00
// 图表配置项
2022-02-26 17:38:24 +08:00
public option = echartOptionProfixHandle(option, includes)
2022-02-02 18:17:45 +08:00
}