config.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
  2. import { PieCommonConfig } from './index'
  3. import { CreateComponentType } from '@/packages/index.d'
  4. import dataJson from './data.json'
  5. export const includes = ['legend']
  6. export enum PieTypeEnum {
  7. NORMAL = '常规图',
  8. RING = '环形图',
  9. ROSE = '玫瑰图'
  10. }
  11. export const PieTypeObject = {
  12. [PieTypeEnum.NORMAL]: 'nomal',
  13. [PieTypeEnum.RING]: 'ring',
  14. [PieTypeEnum.ROSE]: 'rose'
  15. }
  16. const option = {
  17. type: 'ring',
  18. tooltip: {
  19. show: true,
  20. trigger: 'item'
  21. },
  22. legend: {
  23. show: true
  24. },
  25. dataset: { ...dataJson },
  26. series: [
  27. {
  28. type: 'pie',
  29. radius: ['40%', '65%'],
  30. center: ['50%', '60%'],
  31. roseType: false,
  32. avoidLabelOverlap: false,
  33. itemStyle: {
  34. show: true,
  35. borderRadius: 10,
  36. borderColor: '#fff',
  37. borderWidth: 2
  38. },
  39. label: {
  40. show: false,
  41. position: 'center'
  42. },
  43. emphasis: {
  44. label: {
  45. show: true,
  46. fontSize: '40',
  47. fontWeight: 'bold'
  48. }
  49. },
  50. labelLine: {
  51. show: false
  52. }
  53. }
  54. ]
  55. }
  56. export default class Config extends PublicConfigClass implements CreateComponentType {
  57. public key: string = PieCommonConfig.key
  58. public chartConfig = PieCommonConfig
  59. // 图表配置项
  60. public option = echartOptionProfixHandle(option, includes)
  61. }