config.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
  2. import { LineCommonConfig } 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 seriesItem = {
  8. type: 'line',
  9. label: {
  10. show: true,
  11. position: 'top',
  12. color: '#fff',
  13. fontSize: 12
  14. },
  15. symbolSize: 5, //设定实心点的大小
  16. itemStyle: {
  17. color: null,
  18. borderRadius: 0
  19. },
  20. lineStyle: {
  21. type: 'solid',
  22. width: 3,
  23. color: null,
  24. }
  25. }
  26. export const option = {
  27. tooltip: {
  28. show: true,
  29. trigger: 'axis',
  30. axisPointer: {
  31. type: 'line'
  32. }
  33. },
  34. legend: {
  35. show: true
  36. },
  37. xAxis: {
  38. show: true,
  39. type: 'category'
  40. },
  41. yAxis: {
  42. show: true,
  43. type: 'value'
  44. },
  45. dataset: { ...dataJson },
  46. series: [seriesItem, seriesItem]
  47. }
  48. export default class Config extends PublicConfigClass implements CreateComponentType {
  49. public key: string = LineCommonConfig.key
  50. public chartConfig = LineCommonConfig
  51. // 图表配置项
  52. public option = echartOptionProfixHandle(option, includes)
  53. }