config.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { echartOptionProfixHandle, publicConfig } from '@/packages/public'
  2. import { LineGradientSingleConfig } from './index'
  3. import { CreateComponentType } from '@/packages/index.d'
  4. import { graphic } from 'echarts/core'
  5. import omit from 'lodash/omit'
  6. export const includes = ['legend', 'xAxis', 'yAxis']
  7. const options = echartOptionProfixHandle(
  8. {
  9. legend: {
  10. show: true
  11. },
  12. xAxis: {
  13. show: true,
  14. type: 'category',
  15. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  16. },
  17. yAxis: {
  18. show: true,
  19. type: 'value'
  20. },
  21. series: [
  22. {
  23. name: 'data1',
  24. type: 'line',
  25. smooth: false,
  26. areaStyle: {
  27. opacity: 0.8,
  28. color: new graphic.LinearGradient(0, 0, 0, 1, [
  29. {
  30. offset: 0,
  31. color: 'rgba(25,163,223,.3)'
  32. },
  33. {
  34. offset: 1,
  35. color: 'rgba(25,163,223, 0)'
  36. }
  37. ])
  38. },
  39. data: [120, 200, 150, 80, 70, 110, 130]
  40. }
  41. ]
  42. },
  43. includes
  44. )
  45. export default class Config extends publicConfig
  46. implements CreateComponentType {
  47. public key: string = LineGradientSingleConfig.key
  48. public chartConfig = omit(LineGradientSingleConfig, ['node'])
  49. // 图表配置项
  50. public option = options
  51. }