config.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
  2. import { SScatterLogarithmicRegressionConfig } from './index'
  3. import { CreateComponentType } from '@/packages/index.d'
  4. import cloneDeep from 'lodash/cloneDeep'
  5. import dataJson from './data.json'
  6. export const includes = ['legend', 'xAxis', 'yAxis']
  7. export const option = {
  8. dataset: dataJson,
  9. tooltip: {
  10. showDelay: 0,
  11. axisPointer: {
  12. show: true,
  13. type: 'cross',
  14. lineStyle: {
  15. type: 'dashed',
  16. width: 1
  17. }
  18. }
  19. },
  20. legend: {
  21. data: dataJson
  22. .filter(i => i?.transform?.type === 'filter' && i?.transform?.config?.eq)
  23. .map(i => i.transform?.config?.eq)
  24. },
  25. xAxis: {
  26. show: true,
  27. type: 'value',
  28. splitLine: {
  29. lineStyle: {
  30. type: 'dashed'
  31. }
  32. }
  33. },
  34. yAxis: {
  35. show: true,
  36. type: 'value',
  37. splitLine: {
  38. lineStyle: {
  39. type: 'dashed'
  40. }
  41. }
  42. },
  43. visualMap: {
  44. show: false,
  45. dimension: 2,
  46. min: 20000,
  47. max: 1500000000,
  48. seriesIndex: [0, 1],
  49. inRange: {
  50. symbolSize: [10, 70]
  51. }
  52. },
  53. series: [
  54. {
  55. type: 'scatter',
  56. datasetIndex: 1
  57. },
  58. {
  59. type: 'scatter',
  60. datasetIndex: 2
  61. },
  62. {
  63. type: 'line',
  64. smooth: true,
  65. datasetIndex: 3,
  66. symbolSize: 0.1,
  67. symbol: 'circle',
  68. label: { show: true, fontSize: 16 },
  69. labelLayout: { dx: -20 },
  70. encode: { label: 2, tooltip: 1 }
  71. }
  72. ]
  73. }
  74. export default class Config extends PublicConfigClass implements CreateComponentType {
  75. public key = SScatterLogarithmicRegressionConfig.key
  76. public chartConfig = cloneDeep(SScatterLogarithmicRegressionConfig)
  77. // 图表配置项
  78. public option = echartOptionProfixHandle(option, includes)
  79. }