config.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { echartOptionProfixHandle, PublicConfigClass } 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. import dataJson from './data.json'
  7. export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
  8. const options = {
  9. tooltip: {
  10. show: true,
  11. trigger: 'axis',
  12. axisPointer: {
  13. type: 'line'
  14. }
  15. },
  16. xAxis: {
  17. show: true,
  18. type: 'category'
  19. },
  20. yAxis: {
  21. show: true,
  22. type: 'value'
  23. },
  24. dataset: { ...dataJson },
  25. series: [
  26. {
  27. type: 'line',
  28. smooth: false,
  29. symbolSize: 5, //设定实心点的大小
  30. label: {
  31. show: true,
  32. position: 'top',
  33. color: '#fff',
  34. fontSize: 12
  35. },
  36. lineStyle: {
  37. type: 'solid',
  38. width: 3
  39. },
  40. areaStyle: {
  41. opacity: 0.8,
  42. color: new graphic.LinearGradient(0, 0, 0, 1, [
  43. {
  44. offset: 0,
  45. color: chartColorsSearch[defaultTheme][3]
  46. },
  47. {
  48. offset: 1,
  49. color: 'rgba(0,0,0,0)'
  50. }
  51. ])
  52. }
  53. }
  54. ]
  55. }
  56. export default class Config extends PublicConfigClass implements CreateComponentType {
  57. public key: string = LineGradientSingleConfig.key
  58. public chartConfig = LineGradientSingleConfig
  59. // 图表配置项
  60. public option = echartOptionProfixHandle(options, includes)
  61. }