@orbcharts/plugins-basic 3.0.0-alpha.69 → 3.0.0-alpha.71

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. package/dist/lib/core-types.d.ts +1 -0
  2. package/dist/lib/core.d.ts +1 -0
  3. package/dist/orbcharts-plugins-basic.es.js +8861 -7395
  4. package/dist/orbcharts-plugins-basic.umd.js +19 -15
  5. package/dist/src/base/BaseBarStack.d.ts +1 -1
  6. package/dist/src/base/BaseBars.d.ts +1 -1
  7. package/dist/src/base/BaseBarsTriangle.d.ts +1 -1
  8. package/dist/src/base/BaseDots.d.ts +1 -1
  9. package/dist/src/base/BaseGroupAxis.d.ts +1 -1
  10. package/dist/src/base/BaseLegend.d.ts +1 -1
  11. package/dist/src/base/BaseLineAreas.d.ts +1 -1
  12. package/dist/src/base/BaseLines.d.ts +1 -1
  13. package/dist/src/base/BaseValueAxis.d.ts +1 -1
  14. package/dist/src/const.d.ts +10 -0
  15. package/dist/src/grid/gridObservables.d.ts +1 -1
  16. package/dist/src/grid/plugins/BarStack.d.ts +1 -1
  17. package/dist/src/grid/plugins/Bars.d.ts +1 -1
  18. package/dist/src/grid/plugins/BarsPN.d.ts +1 -1
  19. package/dist/src/grid/plugins/BarsTriangle.d.ts +1 -1
  20. package/dist/src/grid/plugins/Dots.d.ts +1 -1
  21. package/dist/src/grid/plugins/GridLegend.d.ts +1 -1
  22. package/dist/src/grid/plugins/GroupAux.d.ts +1 -1
  23. package/dist/src/grid/plugins/GroupAxis.d.ts +1 -1
  24. package/dist/src/grid/plugins/LineAreas.d.ts +1 -1
  25. package/dist/src/grid/plugins/Lines.d.ts +1 -1
  26. package/dist/src/grid/plugins/ScalingArea.d.ts +1 -1
  27. package/dist/src/grid/plugins/ValueAxis.d.ts +1 -1
  28. package/dist/src/grid/plugins/ValueStackAxis.d.ts +1 -1
  29. package/dist/src/grid/types.d.ts +1 -1
  30. package/dist/src/multiGrid/multiGridObservables.d.ts +1 -1
  31. package/dist/src/multiGrid/plugins/MultiBarStack.d.ts +1 -1
  32. package/dist/src/multiGrid/plugins/MultiBars.d.ts +1 -1
  33. package/dist/src/multiGrid/plugins/MultiBarsTriangle.d.ts +1 -1
  34. package/dist/src/multiGrid/plugins/MultiDots.d.ts +1 -1
  35. package/dist/src/multiGrid/plugins/MultiGridLegend.d.ts +1 -1
  36. package/dist/src/multiGrid/plugins/MultiGroupAxis.d.ts +1 -1
  37. package/dist/src/multiGrid/plugins/MultiLineAreas.d.ts +1 -1
  38. package/dist/src/multiGrid/plugins/MultiLines.d.ts +1 -1
  39. package/dist/src/multiGrid/plugins/MultiValueAxis.d.ts +1 -1
  40. package/dist/src/multiGrid/plugins/MultiValueStackAxis.d.ts +1 -1
  41. package/dist/src/multiGrid/plugins/OverlappingValueAxes.d.ts +1 -1
  42. package/dist/src/multiGrid/plugins/OverlappingValueStackAxes.d.ts +1 -1
  43. package/dist/src/multiGrid/types.d.ts +1 -1
  44. package/dist/src/noneData/plugins/Container.d.ts +1 -1
  45. package/dist/src/noneData/plugins/Tooltip.d.ts +2 -2
  46. package/dist/src/noneData/types.d.ts +1 -1
  47. package/dist/src/series/plugins/Bubbles.d.ts +1 -1
  48. package/dist/src/series/plugins/Pie.d.ts +1 -1
  49. package/dist/src/series/plugins/PieEventTexts.d.ts +1 -1
  50. package/dist/src/series/plugins/PieLabels.d.ts +1 -1
  51. package/dist/src/series/plugins/Rose.d.ts +2 -2
  52. package/dist/src/series/plugins/RoseLabels.d.ts +1 -1
  53. package/dist/src/series/plugins/SeriesLegend.d.ts +1 -1
  54. package/dist/src/series/seriesObservables.d.ts +1 -1
  55. package/dist/src/series/seriesUtils.d.ts +1 -1
  56. package/dist/src/series/types.d.ts +1 -1
  57. package/dist/src/tree/plugins/TreeLegend.d.ts +1 -1
  58. package/dist/src/tree/plugins/TreeMap.d.ts +1 -1
  59. package/dist/src/tree/types.d.ts +1 -1
  60. package/dist/src/utils/orbchartsUtils.d.ts +1 -1
  61. package/lib/core-types.ts +7 -0
  62. package/lib/core.ts +6 -0
  63. package/package.json +3 -2
  64. package/src/base/BaseBarStack.ts +1 -1
  65. package/src/base/BaseBars.ts +1 -1
  66. package/src/base/BaseBarsTriangle.ts +1 -1
  67. package/src/base/BaseDots.ts +1 -1
  68. package/src/base/BaseGroupAxis.ts +7 -4
  69. package/src/base/BaseLegend.ts +1 -1
  70. package/src/base/BaseLineAreas.ts +1 -2
  71. package/src/base/BaseLines.ts +1 -1
  72. package/src/base/BaseValueAxis.ts +2 -2
  73. package/src/const.ts +30 -0
  74. package/src/grid/gridObservables.ts +5 -3
  75. package/src/grid/plugins/BarStack.ts +23 -2
  76. package/src/grid/plugins/Bars.ts +27 -2
  77. package/src/grid/plugins/BarsPN.ts +27 -2
  78. package/src/grid/plugins/BarsTriangle.ts +33 -2
  79. package/src/grid/plugins/Dots.ts +33 -2
  80. package/src/grid/plugins/GridLegend.ts +39 -2
  81. package/src/grid/plugins/GroupAux.ts +115 -31
  82. package/src/grid/plugins/GroupAxis.ts +63 -2
  83. package/src/grid/plugins/LineAreas.ts +27 -2
  84. package/src/grid/plugins/Lines.ts +21 -2
  85. package/src/grid/plugins/ScalingArea.ts +105 -61
  86. package/src/grid/plugins/ValueAxis.ts +60 -3
  87. package/src/grid/plugins/ValueStackAxis.ts +60 -3
  88. package/src/grid/types.ts +1 -1
  89. package/src/multiGrid/multiGridObservables.ts +1 -1
  90. package/src/multiGrid/plugins/MultiBarStack.ts +30 -2
  91. package/src/multiGrid/plugins/MultiBars.ts +33 -2
  92. package/src/multiGrid/plugins/MultiBarsTriangle.ts +39 -2
  93. package/src/multiGrid/plugins/MultiDots.ts +39 -2
  94. package/src/multiGrid/plugins/MultiGridLegend.ts +61 -2
  95. package/src/multiGrid/plugins/MultiGroupAxis.ts +69 -2
  96. package/src/multiGrid/plugins/MultiLineAreas.ts +33 -3
  97. package/src/multiGrid/plugins/MultiLines.ts +27 -3
  98. package/src/multiGrid/plugins/MultiValueAxis.ts +66 -2
  99. package/src/multiGrid/plugins/MultiValueStackAxis.ts +66 -2
  100. package/src/multiGrid/plugins/OverlappingValueAxes.ts +133 -4
  101. package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +133 -4
  102. package/src/multiGrid/types.ts +1 -1
  103. package/src/noneData/defaults.ts +8 -8
  104. package/src/noneData/plugins/Container.ts +19 -2
  105. package/src/noneData/plugins/Tooltip.ts +46 -4
  106. package/src/noneData/types.ts +1 -1
  107. package/src/series/defaults.ts +1 -1
  108. package/src/series/plugins/Bubbles.ts +61 -3
  109. package/src/series/plugins/Pie.ts +43 -4
  110. package/src/series/plugins/PieEventTexts.ts +25 -4
  111. package/src/series/plugins/PieLabels.ts +39 -3
  112. package/src/series/plugins/Rose.ts +38 -3
  113. package/src/series/plugins/RoseLabels.ts +32 -3
  114. package/src/series/plugins/SeriesLegend.ts +39 -2
  115. package/src/series/seriesObservables.ts +1 -1
  116. package/src/series/seriesUtils.ts +1 -1
  117. package/src/series/types.ts +1 -1
  118. package/src/tree/plugins/TreeLegend.ts +39 -2
  119. package/src/tree/plugins/TreeMap.ts +31 -3
  120. package/src/tree/types.ts +1 -1
  121. package/src/utils/orbchartsUtils.ts +1 -1
@@ -6,15 +6,74 @@ import {
6
6
  takeUntil,
7
7
  Observable,
8
8
  Subject } from 'rxjs'
9
+ import type { DefinePluginConfig } from '../../../lib/core-types'
9
10
  import {
10
- defineMultiGridPlugin, mergeOptionsWithDefault } from '@orbcharts/core'
11
+ defineMultiGridPlugin, mergeOptionsWithDefault } from '../../../lib/core'
11
12
  import { DEFAULT_MULTI_GRID_LEGEND_PARAMS } from '../defaults'
12
13
  import { createBaseLegend } from '../../base/BaseLegend'
13
14
  import type { BaseLegendParams } from '../../base/BaseLegend'
15
+ import { LAYER_INDEX_OF_INFO } from '../../const'
14
16
 
15
17
  const pluginName = 'MultiGridLegend'
16
18
 
17
- export const MultiGridLegend = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_GRID_LEGEND_PARAMS)(({ selection, rootSelection, observer, subject }) => {
19
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_MULTI_GRID_LEGEND_PARAMS> = {
20
+ name: pluginName,
21
+ defaultParams: DEFAULT_MULTI_GRID_LEGEND_PARAMS,
22
+ layerIndex: LAYER_INDEX_OF_INFO,
23
+ validator: (params, { validateColumns }) => {
24
+ const result = validateColumns(params, {
25
+ padding: {
26
+ toBeTypes: ['number']
27
+ },
28
+ backgroundFill: {
29
+ toBeOption: 'ColorType',
30
+ },
31
+ backgroundStroke: {
32
+ toBeOption: 'ColorType',
33
+ },
34
+ gap: {
35
+ toBeTypes: ['number']
36
+ },
37
+ listRectWidth: {
38
+ toBeTypes: ['number']
39
+ },
40
+ listRectHeight: {
41
+ toBeTypes: ['number']
42
+ },
43
+ listRectRadius: {
44
+ toBeTypes: ['number']
45
+ },
46
+ gridList: {
47
+ toBeTypes: ['object[]']
48
+ },
49
+ textColorType: {
50
+ toBeOption: 'ColorType',
51
+ }
52
+ })
53
+ if (params.gridList) {
54
+ const gridListResult = params.gridList.map((grid, gridIndex) => {
55
+ return validateColumns(grid, {
56
+ listRectWidth: {
57
+ toBeTypes: ['number']
58
+ },
59
+ listRectHeight: {
60
+ toBeTypes: ['number']
61
+ },
62
+ listRectRadius: {
63
+ toBeTypes: ['number']
64
+ }
65
+ })
66
+ })
67
+ const errorResult = gridListResult.find(r => r.status === 'error')
68
+ if (errorResult) {
69
+ return errorResult
70
+ }
71
+ }
72
+ return result
73
+ }
74
+ }
75
+
76
+ export const MultiGridLegend = defineMultiGridPlugin(pluginConfig)(({ selection, rootSelection, observer, subject }) => {
18
77
 
19
78
  const destroy$ = new Subject()
20
79
 
@@ -6,18 +6,85 @@ import {
6
6
  shareReplay,
7
7
  takeUntil
8
8
  } from 'rxjs'
9
+ import type { DefinePluginConfig } from '../../../lib/core-types'
9
10
  import {
10
- defineMultiGridPlugin } from '@orbcharts/core'
11
+ defineMultiGridPlugin } from '../../../lib/core'
11
12
  import { DEFAULT_MULTI_GROUP_AXIS_PARAMS } from '../defaults'
12
13
  import { createBaseGroupAxis } from '../../base/BaseGroupAxis'
13
14
  import { multiGridPluginDetailObservables } from '../multiGridObservables'
14
15
  import { getClassName, getUniID } from '../../utils/orbchartsUtils'
16
+ import { LAYER_INDEX_OF_AXIS } from '../../const'
15
17
 
16
18
  const pluginName = 'MultiGroupAxis'
17
19
 
18
20
  const gridClassName = getClassName(pluginName, 'grid')
19
21
 
20
- export const MultiGroupAxis = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_GROUP_AXIS_PARAMS)(({ selection, name, subject, observer }) => {
22
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_MULTI_GROUP_AXIS_PARAMS> = {
23
+ name: pluginName,
24
+ defaultParams: DEFAULT_MULTI_GROUP_AXIS_PARAMS,
25
+ layerIndex: LAYER_INDEX_OF_AXIS,
26
+ validator: (params, { validateColumns }) => {
27
+ const result = validateColumns(params, {
28
+ gridIndexes: {
29
+ toBe: 'number[] | "all"',
30
+ test: (value: any) => {
31
+ return value === 'all' || (Array.isArray(value) && value.every((v: any) => typeof v === 'number'))
32
+ }
33
+ },
34
+ labelOffset: {
35
+ toBe: '[number, number]',
36
+ test: (value: any) => {
37
+ return Array.isArray(value)
38
+ && value.length === 2
39
+ && typeof value[0] === 'number'
40
+ && typeof value[1] === 'number'
41
+ }
42
+ },
43
+ labelColorType: {
44
+ toBeOption: 'ColorType',
45
+ },
46
+ axisLineVisible: {
47
+ toBeTypes: ['boolean']
48
+ },
49
+ axisLineColorType: {
50
+ toBeOption: 'ColorType',
51
+ },
52
+ ticks: {
53
+ toBe: 'number | null | "all"',
54
+ test: (value: any) => {
55
+ return value === null || value === 'all' || typeof value === 'number'
56
+ }
57
+ },
58
+ tickFormat: {
59
+ toBeTypes: ['string', 'Function']
60
+ },
61
+ tickLineVisible: {
62
+ toBeTypes: ['boolean']
63
+ },
64
+ tickPadding: {
65
+ toBeTypes: ['number']
66
+ },
67
+ tickFullLine: {
68
+ toBeTypes: ['boolean']
69
+ },
70
+ tickFullLineDasharray: {
71
+ toBeTypes: ['string']
72
+ },
73
+ tickColorType: {
74
+ toBeOption: 'ColorType',
75
+ },
76
+ tickTextRotate: {
77
+ toBeTypes: ['number']
78
+ },
79
+ tickTextColorType: {
80
+ toBeOption: 'ColorType',
81
+ }
82
+ })
83
+ return result
84
+ }
85
+ }
86
+
87
+ export const MultiGroupAxis = defineMultiGridPlugin(pluginConfig)(({ selection, name, subject, observer }) => {
21
88
  const destroy$ = new Subject()
22
89
 
23
90
  const unsubscribeFnArr: (() => void)[] = []
@@ -3,19 +3,49 @@ import {
3
3
  map,
4
4
  takeUntil,
5
5
  Subject } from 'rxjs'
6
+ import type { DefinePluginConfig } from '../../../lib/core-types'
6
7
  import {
7
- defineMultiGridPlugin } from '@orbcharts/core'
8
-
8
+ defineMultiGridPlugin } from '../../../lib/core'
9
9
  import { DEFAULT_MULTI_LINE_AREAS_PARAMS } from '../defaults'
10
10
  import { createBaseLineAreas } from '../../base/BaseLineAreas'
11
11
  import { multiGridPluginDetailObservables } from '../multiGridObservables'
12
12
  import { getClassName, getUniID } from '../../utils/orbchartsUtils'
13
+ import { LAYER_INDEX_OF_GRAPHIC_GROUND } from '../../const'
13
14
 
14
15
  const pluginName = 'MultiLineAreas'
15
16
 
16
17
  const gridClassName = getClassName(pluginName, 'grid')
17
18
 
18
- export const MultiLineAreas = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_LINE_AREAS_PARAMS)(({ selection, name, subject, observer }) => {
19
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_MULTI_LINE_AREAS_PARAMS> = {
20
+ name: pluginName,
21
+ defaultParams: DEFAULT_MULTI_LINE_AREAS_PARAMS,
22
+ layerIndex: LAYER_INDEX_OF_GRAPHIC_GROUND,
23
+ validator: (params, { validateColumns }) => {
24
+ const result = validateColumns(params, {
25
+ gridIndexes: {
26
+ toBe: 'number[] | "all"',
27
+ test: (value: any) => {
28
+ return value === 'all' || (Array.isArray(value) && value.every((v: any) => typeof v === 'number'))
29
+ }
30
+ },
31
+ lineCurve: {
32
+ toBeTypes: ['string']
33
+ },
34
+ linearGradientOpacity: {
35
+ toBe: '[number, number]',
36
+ test: (value: any) => {
37
+ return Array.isArray(value)
38
+ && value.length === 2
39
+ && typeof value[0] === 'number'
40
+ && typeof value[1] === 'number'
41
+ }
42
+ },
43
+ })
44
+ return result
45
+ }
46
+ }
47
+
48
+ export const MultiLineAreas = defineMultiGridPlugin(pluginConfig)(({ selection, name, subject, observer }) => {
19
49
  const destroy$ = new Subject()
20
50
 
21
51
  const unsubscribeFnArr: (() => void)[] = []
@@ -3,19 +3,43 @@ import {
3
3
  map,
4
4
  takeUntil,
5
5
  Subject } from 'rxjs'
6
+ import type { DefinePluginConfig } from '../../../lib/core-types'
6
7
  import {
7
- defineMultiGridPlugin } from '@orbcharts/core'
8
-
8
+ defineMultiGridPlugin } from '../../../lib/core'
9
9
  import { DEFAULT_MULTI_LINES_PARAMS } from '../defaults'
10
10
  import { createBaseLines } from '../../base/BaseLines'
11
11
  import { multiGridPluginDetailObservables } from '../multiGridObservables'
12
12
  import { getClassName, getUniID } from '../../utils/orbchartsUtils'
13
+ import { LAYER_INDEX_OF_GRAPHIC } from '../../const'
13
14
 
14
15
  const pluginName = 'MultiLines'
15
16
 
16
17
  const gridClassName = getClassName(pluginName, 'grid')
17
18
 
18
- export const MultiLines = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_LINES_PARAMS)(({ selection, rootSelection, name, subject, observer }) => {
19
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_MULTI_LINES_PARAMS> = {
20
+ name: pluginName,
21
+ defaultParams: DEFAULT_MULTI_LINES_PARAMS,
22
+ layerIndex: LAYER_INDEX_OF_GRAPHIC,
23
+ validator: (params, { validateColumns }) => {
24
+ const result = validateColumns(params, {
25
+ gridIndexes: {
26
+ toBe: 'number[] | "all"',
27
+ test: (value: any) => {
28
+ return value === 'all' || (Array.isArray(value) && value.every((v: any) => typeof v === 'number'))
29
+ }
30
+ },
31
+ lineCurve: {
32
+ toBeTypes: ['string']
33
+ },
34
+ lineWidth: {
35
+ toBeTypes: ['number']
36
+ },
37
+ })
38
+ return result
39
+ }
40
+ }
41
+
42
+ export const MultiLines = defineMultiGridPlugin(pluginConfig)(({ selection, rootSelection, name, subject, observer }) => {
19
43
  const destroy$ = new Subject()
20
44
 
21
45
  const unsubscribeFnArr: (() => void)[] = []
@@ -6,18 +6,82 @@ import {
6
6
  shareReplay,
7
7
  takeUntil
8
8
  } from 'rxjs'
9
+ import type { DefinePluginConfig } from '../../../lib/core-types'
9
10
  import {
10
- defineMultiGridPlugin } from '@orbcharts/core'
11
+ defineMultiGridPlugin } from '../../../lib/core'
11
12
  import { DEFAULT_MULTI_VALUE_AXIS_PARAMS } from '../defaults'
12
13
  import { createBaseValueAxis } from '../../base/BaseValueAxis'
13
14
  import { multiGridPluginDetailObservables } from '../multiGridObservables'
14
15
  import { getClassName, getUniID } from '../../utils/orbchartsUtils'
16
+ import { LAYER_INDEX_OF_AXIS } from '../../const'
15
17
 
16
18
  const pluginName = 'MultiValueAxis'
17
19
 
18
20
  const gridClassName = getClassName(pluginName, 'grid')
19
21
 
20
- export const MultiValueAxis = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_VALUE_AXIS_PARAMS)(({ selection, name, subject, observer }) => {
22
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_MULTI_VALUE_AXIS_PARAMS> = {
23
+ name: pluginName,
24
+ defaultParams: DEFAULT_MULTI_VALUE_AXIS_PARAMS,
25
+ layerIndex: LAYER_INDEX_OF_AXIS,
26
+ validator: (params, { validateColumns }) => {
27
+ const result = validateColumns(params, {
28
+ gridIndexes: {
29
+ toBe: 'number[] | "all"',
30
+ test: (value: any) => {
31
+ return value === 'all' || (Array.isArray(value) && value.every((v: any) => typeof v === 'number'))
32
+ }
33
+ },
34
+ labelOffset: {
35
+ toBe: '[number, number]',
36
+ test: (value: any) => {
37
+ return Array.isArray(value)
38
+ && value.length === 2
39
+ && typeof value[0] === 'number'
40
+ && typeof value[1] === 'number'
41
+ }
42
+ },
43
+ labelColorType: {
44
+ toBeOption: 'ColorType',
45
+ },
46
+ axisLineVisible: {
47
+ toBeTypes: ['boolean']
48
+ },
49
+ axisLineColorType: {
50
+ toBeOption: 'ColorType',
51
+ },
52
+ ticks: {
53
+ toBeTypes: ['number', 'null']
54
+ },
55
+ tickFormat: {
56
+ toBeTypes: ['string', 'Function']
57
+ },
58
+ tickLineVisible: {
59
+ toBeTypes: ['boolean']
60
+ },
61
+ tickPadding: {
62
+ toBeTypes: ['number']
63
+ },
64
+ tickFullLine: {
65
+ toBeTypes: ['boolean']
66
+ },
67
+ tickFullLineDasharray: {
68
+ toBeTypes: ['string']
69
+ },
70
+ tickColorType: {
71
+ toBeOption: 'ColorType',
72
+ },
73
+ tickTextRotate: {
74
+ toBeTypes: ['number']
75
+ },
76
+ tickTextColorType: {
77
+ toBeOption: 'ColorType',
78
+ }
79
+ })
80
+ return result
81
+ }
82
+ }
83
+
84
+ export const MultiValueAxis = defineMultiGridPlugin(pluginConfig)(({ selection, name, subject, observer }) => {
21
85
  const destroy$ = new Subject()
22
86
 
23
87
  const unsubscribeFnArr: (() => void)[] = []
@@ -6,18 +6,82 @@ import {
6
6
  shareReplay,
7
7
  takeUntil
8
8
  } from 'rxjs'
9
+ import type { DefinePluginConfig } from '../../../lib/core-types'
9
10
  import {
10
- defineMultiGridPlugin } from '@orbcharts/core'
11
+ defineMultiGridPlugin } from '../../../lib/core'
11
12
  import { DEFAULT_MULTI_VALUE_AXIS_PARAMS } from '../defaults'
12
13
  import { createBaseValueAxis } from '../../base/BaseValueAxis'
13
14
  import { multiGridPluginDetailObservables } from '../multiGridObservables'
14
15
  import { getClassName, getUniID } from '../../utils/orbchartsUtils'
16
+ import { LAYER_INDEX_OF_AXIS } from '../../const'
15
17
 
16
18
  const pluginName = 'MultiValueStackAxis'
17
19
 
18
20
  const gridClassName = getClassName(pluginName, 'grid')
19
21
 
20
- export const MultiValueStackAxis = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_VALUE_AXIS_PARAMS)(({ selection, name, subject, observer }) => {
22
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_MULTI_VALUE_AXIS_PARAMS> = {
23
+ name: pluginName,
24
+ defaultParams: DEFAULT_MULTI_VALUE_AXIS_PARAMS,
25
+ layerIndex: LAYER_INDEX_OF_AXIS,
26
+ validator: (params, { validateColumns }) => {
27
+ const result = validateColumns(params, {
28
+ gridIndexes: {
29
+ toBe: 'number[] | "all"',
30
+ test: (value: any) => {
31
+ return value === 'all' || (Array.isArray(value) && value.every((v: any) => typeof v === 'number'))
32
+ }
33
+ },
34
+ labelOffset: {
35
+ toBe: '[number, number]',
36
+ test: (value: any) => {
37
+ return Array.isArray(value)
38
+ && value.length === 2
39
+ && typeof value[0] === 'number'
40
+ && typeof value[1] === 'number'
41
+ }
42
+ },
43
+ labelColorType: {
44
+ toBeOption: 'ColorType',
45
+ },
46
+ axisLineVisible: {
47
+ toBeTypes: ['boolean']
48
+ },
49
+ axisLineColorType: {
50
+ toBeOption: 'ColorType',
51
+ },
52
+ ticks: {
53
+ toBeTypes: ['number', 'null']
54
+ },
55
+ tickFormat: {
56
+ toBeTypes: ['string', 'Function']
57
+ },
58
+ tickLineVisible: {
59
+ toBeTypes: ['boolean']
60
+ },
61
+ tickPadding: {
62
+ toBeTypes: ['number']
63
+ },
64
+ tickFullLine: {
65
+ toBeTypes: ['boolean']
66
+ },
67
+ tickFullLineDasharray: {
68
+ toBeTypes: ['string']
69
+ },
70
+ tickColorType: {
71
+ toBeOption: 'ColorType',
72
+ },
73
+ tickTextRotate: {
74
+ toBeTypes: ['number']
75
+ },
76
+ tickTextColorType: {
77
+ toBeOption: 'ColorType',
78
+ }
79
+ })
80
+ return result
81
+ }
82
+ }
83
+
84
+ export const MultiValueStackAxis = defineMultiGridPlugin(pluginConfig)(({ selection, name, subject, observer }) => {
21
85
  const destroy$ = new Subject()
22
86
 
23
87
  const unsubscribeFnArr: (() => void)[] = []
@@ -10,20 +10,149 @@ import {
10
10
  iif,
11
11
  Observable,
12
12
  Subject } from 'rxjs'
13
- import type { ContextObserverMultiGrid, DataFormatterGrid, DataFormatterTypeMap, Layout } from '@orbcharts/core'
13
+ import type { DefinePluginConfig } from '../../../lib/core-types'
14
+ import type { ContextObserverMultiGrid, DataFormatterGrid, DataFormatterTypeMap, Layout } from '../../../lib/core-types'
14
15
  import {
15
- defineMultiGridPlugin } from '@orbcharts/core'
16
+ defineMultiGridPlugin } from '../../../lib/core'
16
17
  import { DEFAULT_OVERLAPPING_VALUE_AXES_PARAMS } from '../defaults'
17
18
  import { createBaseValueAxis } from '../../base/BaseValueAxis'
18
19
  import { multiGridPluginDetailObservables } from '../multiGridObservables'
19
20
  import { getClassName, getUniID } from '../../utils/orbchartsUtils'
20
- import { gridAxesTransformObservable, gridAxesReverseTransformObservable, gridContainerPositionObservable } from '@orbcharts/core/src/grid/gridObservables'
21
+ import { gridAxesTransformObservable, gridAxesReverseTransformObservable, gridContainerPositionObservable } from '../../../lib/core'
22
+ import { LAYER_INDEX_OF_AXIS } from '../../const'
21
23
 
22
24
  const pluginName = 'OverlappingValueAxes'
23
25
 
24
26
  const gridClassName = getClassName(pluginName, 'grid')
25
27
 
26
- export const OverlappingValueAxes = defineMultiGridPlugin(pluginName, DEFAULT_OVERLAPPING_VALUE_AXES_PARAMS)(({ selection, name, subject, observer }) => {
28
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_OVERLAPPING_VALUE_AXES_PARAMS> = {
29
+ name: pluginName,
30
+ defaultParams: DEFAULT_OVERLAPPING_VALUE_AXES_PARAMS,
31
+ layerIndex: LAYER_INDEX_OF_AXIS,
32
+ validator: (params, { validateColumns }) => {
33
+ const result = validateColumns(params, {
34
+ firstAxis: {
35
+ toBeTypes: ['object']
36
+ },
37
+ secondAxis: {
38
+ toBeTypes: ['object']
39
+ },
40
+ gridIndexes: {
41
+ toBe: '[number, number]',
42
+ test: (value: any) => {
43
+ return Array.isArray(value) && value.length === 2
44
+ }
45
+ }
46
+ })
47
+ if (params.firstAxis) {
48
+ const firstAxisResult = validateColumns(params.firstAxis, {
49
+ labelOffset: {
50
+ toBe: '[number, number]',
51
+ test: (value: any) => {
52
+ return Array.isArray(value)
53
+ && value.length === 2
54
+ && typeof value[0] === 'number'
55
+ && typeof value[1] === 'number'
56
+ }
57
+ },
58
+ labelColorType: {
59
+ toBeOption: 'ColorType',
60
+ },
61
+ axisLineVisible: {
62
+ toBeTypes: ['boolean']
63
+ },
64
+ axisLineColorType: {
65
+ toBeOption: 'ColorType',
66
+ },
67
+ ticks: {
68
+ toBeTypes: ['number']
69
+ },
70
+ tickFormat: {
71
+ toBeTypes: ['string', 'Function']
72
+ },
73
+ tickLineVisible: {
74
+ toBeTypes: ['boolean']
75
+ },
76
+ tickPadding: {
77
+ toBeTypes: ['number']
78
+ },
79
+ tickFullLine: {
80
+ toBeTypes: ['boolean']
81
+ },
82
+ tickFullLineDasharray: {
83
+ toBeTypes: ['string']
84
+ },
85
+ tickColorType: {
86
+ toBeOption: 'ColorType',
87
+ },
88
+ tickTextRotate: {
89
+ toBeTypes: ['number']
90
+ },
91
+ tickTextColorType: {
92
+ toBeOption: 'ColorType',
93
+ }
94
+ })
95
+ if (firstAxisResult.status === 'error') {
96
+ return firstAxisResult
97
+ }
98
+ }
99
+ if (params.secondAxis) {
100
+ const secondAxisResult = validateColumns(params.secondAxis, {
101
+ labelOffset: {
102
+ toBe: '[number, number]',
103
+ test: (value: any) => {
104
+ return Array.isArray(value)
105
+ && value.length === 2
106
+ && typeof value[0] === 'number'
107
+ && typeof value[1] === 'number'
108
+ }
109
+ },
110
+ labelColorType: {
111
+ toBeOption: 'ColorType',
112
+ },
113
+ axisLineVisible: {
114
+ toBeTypes: ['boolean']
115
+ },
116
+ axisLineColorType: {
117
+ toBeOption: 'ColorType',
118
+ },
119
+ ticks: {
120
+ toBeTypes: ['number']
121
+ },
122
+ tickFormat: {
123
+ toBeTypes: ['string', 'Function']
124
+ },
125
+ tickLineVisible: {
126
+ toBeTypes: ['boolean']
127
+ },
128
+ tickPadding: {
129
+ toBeTypes: ['number']
130
+ },
131
+ tickFullLine: {
132
+ toBeTypes: ['boolean']
133
+ },
134
+ tickFullLineDasharray: {
135
+ toBeTypes: ['string']
136
+ },
137
+ tickColorType: {
138
+ toBeOption: 'ColorType',
139
+ },
140
+ tickTextRotate: {
141
+ toBeTypes: ['number']
142
+ },
143
+ tickTextColorType: {
144
+ toBeOption: 'ColorType',
145
+ }
146
+ })
147
+ if (secondAxisResult.status === 'error') {
148
+ return secondAxisResult
149
+ }
150
+ }
151
+ return result
152
+ }
153
+ }
154
+
155
+ export const OverlappingValueAxes = defineMultiGridPlugin(pluginConfig)(({ selection, name, subject, observer }) => {
27
156
  const destroy$ = new Subject()
28
157
 
29
158
  const unsubscribeFnArr: (() => void)[] = []