config.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { echartOptionProfixHandle, publicConfig } from '@/packages/public'
  2. import { LineCommonConfig } from './index'
  3. import { CreateComponentType } from '@/packages/index.d'
  4. import omit from 'lodash/omit'
  5. export const includes = ['legend', 'xAxis', 'yAxis']
  6. export const option = {
  7. tooltip: {
  8. show: true,
  9. trigger: 'axis',
  10. axisPointer: {
  11. type: 'line'
  12. }
  13. },
  14. legend: {
  15. show: true
  16. },
  17. xAxis: {
  18. show: true,
  19. type: 'category',
  20. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  21. },
  22. yAxis: {
  23. show: true,
  24. type: 'value'
  25. },
  26. series: [
  27. {
  28. name: 'data1',
  29. type: 'line',
  30. lineStyle: {
  31. type: 'solid',
  32. width: 3,
  33. color: {
  34. type: 'linear',
  35. colorStops: [
  36. {
  37. offset: 0,
  38. color: '#42a5f5' // 0% 处的颜色
  39. },
  40. {
  41. offset: 1,
  42. color: '#48D8BF' // 100% 处的颜色
  43. }
  44. ],
  45. globalCoord: false // 缺省为 false
  46. },
  47. shadowColor: 'rgba(68, 181, 226, 0.3)',
  48. shadowBlur: 5,
  49. shadowOffsetY: 20
  50. },
  51. data: [120, 200, 150, 80, 70, 110, 130]
  52. }
  53. ]
  54. }
  55. export default class Config extends publicConfig
  56. implements CreateComponentType {
  57. public key: string = LineCommonConfig.key
  58. public chartConfig = omit(LineCommonConfig, ['node', 'conNode'])
  59. // 图表配置项
  60. public option = echartOptionProfixHandle(option, includes)
  61. }