config.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { echartOptionProfixHandle, publicConfig } from '@/packages/public'
  2. import { LineGradientsConfig } from './index'
  3. import { CreateComponentType } from '@/packages/index.d'
  4. import { graphic } from 'echarts/core'
  5. export const includes = ['legend', 'xAxis', 'yAxis']
  6. const option = {
  7. legend: {
  8. show: true
  9. },
  10. tooltip: {
  11. show: true,
  12. trigger: 'axis',
  13. axisPointer: {
  14. type: 'line'
  15. }
  16. },
  17. xAxis: {
  18. show: true,
  19. type: 'category',
  20. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  21. },
  22. yAxis: {
  23. show: true,
  24. type: 'value'
  25. },
  26. series: [
  27. {
  28. name: 'data1',
  29. type: 'line',
  30. smooth: false,
  31. lineStyle: {
  32. normal: {
  33. width: 3
  34. }
  35. },
  36. areaStyle: {
  37. opacity: 0.8,
  38. color: new graphic.LinearGradient(0, 0, 0, 1, [
  39. {
  40. offset: 0,
  41. color: 'rgba(25,163,223,.3)'
  42. },
  43. {
  44. offset: 1,
  45. color: 'rgba(25,163,223, 0)'
  46. }
  47. ])
  48. },
  49. data: [120, 200, 150, 80, 70, 110, 130]
  50. },
  51. {
  52. name: 'data2',
  53. type: 'line',
  54. smooth: false,
  55. lineStyle: {
  56. normal: {
  57. width: 3
  58. }
  59. },
  60. areaStyle: {
  61. opacity: 0.8,
  62. color: new graphic.LinearGradient(0, 0, 0, 1, [
  63. {
  64. offset: 0,
  65. color: 'rgba(0,202,149,0.3)'
  66. },
  67. {
  68. offset: 1,
  69. color: 'rgba(0,202,149,0)'
  70. }
  71. ])
  72. },
  73. data: [130, 130, 312, 268, 155, 117, 160]
  74. }
  75. ]
  76. }
  77. export default class Config extends publicConfig
  78. implements CreateComponentType {
  79. public key: string = LineGradientsConfig.key
  80. public chartConfig = LineGradientsConfig
  81. // 图表配置项
  82. public option = echartOptionProfixHandle(option, includes)
  83. }