config.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. 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. normal: {
  55. width: 3
  56. }
  57. },
  58. areaStyle: {
  59. opacity: 0.8,
  60. color: new graphic.LinearGradient(0, 0, 0, 1, [
  61. {
  62. offset: 0,
  63. color: chartColorsSearch[defaultTheme][4]
  64. },
  65. {
  66. offset: 1,
  67. color: 'rgba(0,0,0,0)'
  68. }
  69. ])
  70. },
  71. }
  72. ]
  73. }
  74. export default class Config extends publicConfig
  75. implements CreateComponentType {
  76. public key: string = LineGradientsConfig.key
  77. public chartConfig = LineGradientsConfig
  78. // 图表配置项
  79. public option = echartOptionProfixHandle(option, includes)
  80. }