config.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. symbolSize: 5, //设定实心点的大小
  33. label: {
  34. show: true,
  35. position: 'top',
  36. color: '#fff',
  37. fontSize: 12
  38. },
  39. lineStyle: {
  40. width: 3,
  41. type: 'solid'
  42. },
  43. areaStyle: {
  44. opacity: 0.8,
  45. color: new graphic.LinearGradient(0, 0, 0, 1, [
  46. {
  47. offset: 0,
  48. color: chartColorsSearch[defaultTheme][3]
  49. },
  50. {
  51. offset: 1,
  52. color: 'rgba(0,0,0,0)'
  53. }
  54. ])
  55. }
  56. },
  57. {
  58. type: 'line',
  59. smooth: false,
  60. label: {
  61. show: true,
  62. position: 'top',
  63. color: '#fff',
  64. fontSize: 12
  65. },
  66. lineStyle: {
  67. width: 3,
  68. type: 'solid'
  69. },
  70. areaStyle: {
  71. opacity: 0.8,
  72. color: new graphic.LinearGradient(0, 0, 0, 1, [
  73. {
  74. offset: 0,
  75. color: chartColorsSearch[defaultTheme][4]
  76. },
  77. {
  78. offset: 1,
  79. color: 'rgba(0,0,0,0)'
  80. }
  81. ])
  82. }
  83. }
  84. ]
  85. }
  86. export default class Config extends PublicConfigClass implements CreateComponentType {
  87. public key: string = LineGradientsConfig.key
  88. public chartConfig = LineGradientsConfig
  89. // 图表配置项
  90. public option = echartOptionProfixHandle(option, includes)
  91. }