config.ts 1.1 KB

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