config.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. itemStyle: {
  11. color: null,
  12. borderRadius: 0
  13. }
  14. }
  15. export const option = {
  16. tooltip: {
  17. show: true,
  18. trigger: 'axis',
  19. axisPointer: {
  20. show: true,
  21. type: 'shadow'
  22. }
  23. },
  24. legend: {
  25. show: true
  26. },
  27. xAxis: {
  28. show: true,
  29. type: 'value',
  30. },
  31. yAxis: {
  32. show: true,
  33. type: 'category'
  34. },
  35. dataset: { ...dataJson },
  36. series: [seriesItem, seriesItem]
  37. }
  38. export default class Config extends PublicConfigClass implements CreateComponentType {
  39. public key = BarCrossrangeConfig.key
  40. public chartConfig = cloneDeep(BarCrossrangeConfig)
  41. // 图表配置项
  42. public option = echartOptionProfixHandle(option, includes)
  43. }