config.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
  6. export const includes = ['legend', 'xAxis', 'yAxis']
  7. const options = {
  8. legend: {
  9. show: true
  10. },
  11. tooltip: {
  12. show: true,
  13. trigger: 'axis',
  14. axisPointer: {
  15. type: 'line'
  16. }
  17. },
  18. xAxis: {
  19. show: true,
  20. type: 'category',
  21. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  22. },
  23. yAxis: {
  24. show: true,
  25. type: 'value'
  26. },
  27. series: [
  28. {
  29. name: 'data1',
  30. type: 'line',
  31. smooth: false,
  32. lineStyle: {
  33. normal: {
  34. width: 3
  35. }
  36. },
  37. areaStyle: {
  38. opacity: 0.8,
  39. color: new graphic.LinearGradient(0, 0, 0, 1, [
  40. {
  41. offset: 0,
  42. color: chartColorsSearch[defaultTheme][3]
  43. },
  44. {
  45. offset: 1,
  46. color: 'rgba(0,0,0,0)'
  47. }
  48. ])
  49. },
  50. data: [120, 200, 150, 80, 70, 110, 130]
  51. }
  52. ]
  53. }
  54. export default class Config extends publicConfig
  55. implements CreateComponentType {
  56. public key: string = LineGradientSingleConfig.key
  57. public chartConfig = LineGradientSingleConfig
  58. // 图表配置项
  59. public option = echartOptionProfixHandle(options, includes)
  60. }