config.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { echartOptionProfixHandle, publicConfig } from '@/packages/public'
  2. import { LineLinearSingleConfig } from './index'
  3. import { CreateComponentType } from '@/packages/index.d'
  4. import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
  5. import dataJson from './data.json'
  6. export const includes = ['legend', 'xAxis', 'yAxis']
  7. export const option = {
  8. tooltip: {
  9. show: true,
  10. trigger: 'axis',
  11. axisPointer: {
  12. type: 'line'
  13. }
  14. },
  15. legend: {
  16. show: true
  17. },
  18. xAxis: {
  19. show: true,
  20. type: 'category',
  21. },
  22. yAxis: {
  23. show: true,
  24. type: 'value'
  25. },
  26. dataset: { ...dataJson },
  27. series: [
  28. {
  29. type: 'line',
  30. lineStyle: {
  31. type: 'solid',
  32. width: 3,
  33. color: {
  34. type: 'linear',
  35. colorStops: [
  36. {
  37. offset: 0,
  38. color: chartColorsSearch[defaultTheme][0] // 0% 处的颜色
  39. },
  40. {
  41. offset: 1,
  42. color: chartColorsSearch[defaultTheme][1] // 100% 处的颜色
  43. }
  44. ],
  45. globalCoord: false // 缺省为 false
  46. },
  47. shadowColor: chartColorsSearch[defaultTheme][2],
  48. shadowBlur: 10,
  49. shadowOffsetY: 20
  50. },
  51. }
  52. ]
  53. }
  54. export default class Config extends publicConfig
  55. implements CreateComponentType {
  56. public key: string = LineLinearSingleConfig.key
  57. public chartConfig = LineLinearSingleConfig
  58. // 图表配置项
  59. public option = echartOptionProfixHandle(option, includes)
  60. }