config.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
  2. import { LineGradientsConfig } from './index'
  3. import { CreateComponentType } from '@/packages/index.d'
  4. import { graphic } from 'echarts/core'
  5. import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
  6. import dataJson from './data.json'
  7. export const includes = ['legend', 'xAxis', 'yAxis']
  8. const option = {
  9. legend: {
  10. show: true
  11. },
  12. tooltip: {
  13. show: true,
  14. trigger: 'axis',
  15. axisPointer: {
  16. type: 'line'
  17. }
  18. },
  19. xAxis: {
  20. show: true,
  21. type: 'category'
  22. },
  23. yAxis: {
  24. show: true,
  25. type: 'value'
  26. },
  27. dataset: { ...dataJson },
  28. series: [
  29. {
  30. type: 'line',
  31. smooth: false,
  32. lineStyle: {
  33. width: 3,
  34. type: 'solid'
  35. },
  36. areaStyle: {
  37. opacity: 0.8,
  38. color: new graphic.LinearGradient(0, 0, 0, 1, [
  39. {
  40. offset: 0,
  41. color: chartColorsSearch[defaultTheme][3]
  42. },
  43. {
  44. offset: 1,
  45. color: 'rgba(0,0,0,0)'
  46. }
  47. ])
  48. }
  49. },
  50. {
  51. type: 'line',
  52. smooth: false,
  53. lineStyle: {
  54. width: 3,
  55. type: 'solid'
  56. },
  57. areaStyle: {
  58. opacity: 0.8,
  59. color: new graphic.LinearGradient(0, 0, 0, 1, [
  60. {
  61. offset: 0,
  62. color: chartColorsSearch[defaultTheme][4]
  63. },
  64. {
  65. offset: 1,
  66. color: 'rgba(0,0,0,0)'
  67. }
  68. ])
  69. }
  70. }
  71. ]
  72. }
  73. export default class Config extends PublicConfigClass implements CreateComponentType {
  74. public key: string = LineGradientsConfig.key
  75. public chartConfig = LineGradientsConfig
  76. // 图表配置项
  77. public option = echartOptionProfixHandle(option, includes)
  78. }