@orbcharts/plugins-basic 3.0.7 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/LICENSE +200 -200
  2. package/dist/orbcharts-plugins-basic.es.js +6837 -6656
  3. package/dist/orbcharts-plugins-basic.umd.js +45 -45
  4. package/dist/src/base/BaseStackedBars.d.ts +2 -0
  5. package/dist/src/series/defaults.d.ts +2 -1
  6. package/dist/src/series/index.d.ts +1 -0
  7. package/dist/src/series/plugins/Indicator.d.ts +3 -0
  8. package/lib/core-types.ts +7 -7
  9. package/lib/core.ts +6 -6
  10. package/lib/gridObservables.ts +6 -6
  11. package/lib/plugins-basic-types.ts +6 -6
  12. package/package.json +48 -48
  13. package/src/base/BaseBars.ts +765 -765
  14. package/src/base/BaseBarsTriangle.ts +676 -676
  15. package/src/base/BaseDots.ts +464 -464
  16. package/src/base/BaseGroupAxis.ts +691 -691
  17. package/src/base/BaseLegend.ts +684 -684
  18. package/src/base/BaseLineAreas.ts +629 -629
  19. package/src/base/BaseLines.ts +706 -706
  20. package/src/base/BaseOrdinalBubbles.ts +729 -729
  21. package/src/base/BaseRacingBars.ts +582 -582
  22. package/src/base/BaseRacingLabels.ts +404 -404
  23. package/src/base/BaseRacingValueLabels.ts +403 -403
  24. package/src/base/BaseStackedBars.ts +793 -782
  25. package/src/base/BaseTooltip.ts +408 -408
  26. package/src/base/BaseValueAxis.ts +600 -600
  27. package/src/base/BaseXAxis.ts +427 -427
  28. package/src/base/BaseXZoom.ts +241 -241
  29. package/src/base/BaseYAxis.ts +389 -389
  30. package/src/base/types.ts +2 -2
  31. package/src/const.ts +30 -30
  32. package/src/grid/defaults.ts +213 -213
  33. package/src/grid/gridObservables.ts +635 -635
  34. package/src/grid/index.ts +16 -16
  35. package/src/grid/plugins/Bars.ts +69 -69
  36. package/src/grid/plugins/BarsPN.ts +66 -66
  37. package/src/grid/plugins/BarsTriangle.ts +73 -73
  38. package/src/grid/plugins/Dots.ts +68 -68
  39. package/src/grid/plugins/GridLegend.ts +107 -107
  40. package/src/grid/plugins/GridTooltip.ts +66 -66
  41. package/src/grid/plugins/GroupAux.ts +1095 -1095
  42. package/src/grid/plugins/GroupAxis.ts +73 -73
  43. package/src/grid/plugins/GroupZoom.ts +218 -218
  44. package/src/grid/plugins/LineAreas.ts +65 -65
  45. package/src/grid/plugins/Lines.ts +59 -59
  46. package/src/grid/plugins/StackedBars.ts +66 -64
  47. package/src/grid/plugins/StackedValueAxis.ts +97 -96
  48. package/src/grid/plugins/ValueAxis.ts +94 -94
  49. package/src/index.ts +6 -6
  50. package/src/multiGrid/defaults.ts +244 -244
  51. package/src/multiGrid/index.ts +14 -14
  52. package/src/multiGrid/multiGridObservables.ts +50 -50
  53. package/src/multiGrid/plugins/MultiBars.ts +108 -108
  54. package/src/multiGrid/plugins/MultiBarsTriangle.ts +114 -114
  55. package/src/multiGrid/plugins/MultiDots.ts +102 -102
  56. package/src/multiGrid/plugins/MultiGridLegend.ts +169 -169
  57. package/src/multiGrid/plugins/MultiGridTooltip.ts +66 -66
  58. package/src/multiGrid/plugins/MultiGroupAxis.ts +137 -137
  59. package/src/multiGrid/plugins/MultiLineAreas.ts +107 -107
  60. package/src/multiGrid/plugins/MultiLines.ts +101 -101
  61. package/src/multiGrid/plugins/MultiStackedBars.ts +109 -106
  62. package/src/multiGrid/plugins/MultiStackedValueAxis.ts +135 -134
  63. package/src/multiGrid/plugins/MultiValueAxis.ts +134 -134
  64. package/src/multiGrid/plugins/OverlappingStackedValueAxes.ts +300 -300
  65. package/src/multiGrid/plugins/OverlappingValueAxes.ts +300 -300
  66. package/src/multiValue/defaults.ts +523 -523
  67. package/src/multiValue/index.ts +16 -16
  68. package/src/multiValue/multiValueObservables.ts +781 -781
  69. package/src/multiValue/plugins/MultiValueLegend.ts +107 -107
  70. package/src/multiValue/plugins/MultiValueTooltip.ts +66 -66
  71. package/src/multiValue/plugins/OrdinalAux.ts +660 -660
  72. package/src/multiValue/plugins/OrdinalAxis.ts +524 -524
  73. package/src/multiValue/plugins/OrdinalBubbles.ts +226 -226
  74. package/src/multiValue/plugins/OrdinalZoom.ts +57 -57
  75. package/src/multiValue/plugins/RacingBars.ts +375 -375
  76. package/src/multiValue/plugins/RacingCounterTexts.ts +300 -300
  77. package/src/multiValue/plugins/RacingValueAxis.ts +114 -114
  78. package/src/multiValue/plugins/Scatter.ts +486 -486
  79. package/src/multiValue/plugins/ScatterBubbles.ts +635 -635
  80. package/src/multiValue/plugins/XAxis.ts +107 -107
  81. package/src/multiValue/plugins/XYAux.ts +683 -683
  82. package/src/multiValue/plugins/XYAxes.ts +194 -194
  83. package/src/multiValue/plugins/XYAxes_legacy.ts +683 -683
  84. package/src/multiValue/plugins/XZoom.ts +40 -40
  85. package/src/noneData/defaults.ts +102 -102
  86. package/src/noneData/index.ts +3 -3
  87. package/src/noneData/plugins/Container.ts +27 -27
  88. package/src/noneData/plugins/Tooltip.ts +373 -373
  89. package/src/relationship/defaults.ts +221 -221
  90. package/src/relationship/index.ts +5 -5
  91. package/src/relationship/plugins/ForceDirected.ts +1056 -1056
  92. package/src/relationship/plugins/ForceDirectedBubbles.ts +1294 -1294
  93. package/src/relationship/plugins/RelationshipLegend.ts +100 -100
  94. package/src/relationship/plugins/RelationshipTooltip.ts +66 -66
  95. package/src/relationship/relationshipObservables.ts +49 -49
  96. package/src/series/defaults.ts +236 -224
  97. package/src/series/index.ts +10 -9
  98. package/src/series/plugins/Bubbles.ts +784 -784
  99. package/src/series/plugins/Indicator.ts +292 -0
  100. package/src/series/plugins/Pie.ts +622 -622
  101. package/src/series/plugins/PieEventTexts.ts +283 -283
  102. package/src/series/plugins/PieLabels.ts +639 -639
  103. package/src/series/plugins/Rose.ts +515 -515
  104. package/src/series/plugins/RoseLabels.ts +599 -599
  105. package/src/series/plugins/SeriesLegend.ts +107 -107
  106. package/src/series/plugins/SeriesTooltip.ts +66 -66
  107. package/src/series/seriesObservables.ts +168 -168
  108. package/src/series/seriesUtils.ts +51 -51
  109. package/src/tree/defaults.ts +102 -102
  110. package/src/tree/index.ts +4 -4
  111. package/src/tree/plugins/TreeLegend.ts +100 -100
  112. package/src/tree/plugins/TreeMap.ts +341 -341
  113. package/src/tree/plugins/TreeTooltip.ts +66 -66
  114. package/src/utils/commonUtils.ts +31 -31
  115. package/src/utils/d3Graphics.ts +176 -176
  116. package/src/utils/d3Utils.ts +92 -92
  117. package/src/utils/observables.ts +14 -14
  118. package/src/utils/orbchartsUtils.ts +129 -129
  119. package/tsconfig.base.json +13 -13
  120. package/tsconfig.json +2 -2
  121. package/vite.config.js +22 -22
@@ -1,195 +1,195 @@
1
- import {
2
- Observable,
3
- Subject,
4
- combineLatest,
5
- takeUntil,
6
- map,
7
- distinctUntilChanged,
8
- of,
9
- switchMap,
10
- shareReplay
11
- } from 'rxjs'
12
- import type {
13
- DefinePluginConfig,
14
- } from '../../../lib/core-types'
15
- import {
16
- defineMultiValuePlugin,
17
- } from '../../../lib/core'
18
- import { DEFAULT_X_Y_AXES_PARAMS } from '../defaults'
19
- import { LAYER_INDEX_OF_AXIS } from '../../const'
20
- import { createBaseXAxis } from '../../base/BaseXAxis'
21
- import { createBaseYAxis } from '../../base/BaseYAxis'
22
-
23
- const pluginName = 'XYAxes'
24
-
25
-
26
- const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_X_Y_AXES_PARAMS> = {
27
- name: pluginName,
28
- defaultParams: DEFAULT_X_Y_AXES_PARAMS,
29
- layerIndex: LAYER_INDEX_OF_AXIS,
30
- validator: (params, { validateColumns }) => {
31
- const result = validateColumns(params, {
32
- xAxis: {
33
- toBeTypes: ['object']
34
- },
35
- yAxis: {
36
- toBeTypes: ['object']
37
- }
38
- })
39
- if (params.xAxis) {
40
- const forceResult = validateColumns(params.xAxis, {
41
- labelOffset: {
42
- toBe: '[number, number]',
43
- test: (value: any) => {
44
- return Array.isArray(value)
45
- && value.length === 2
46
- && typeof value[0] === 'number'
47
- && typeof value[1] === 'number'
48
- }
49
- },
50
- labelColorType: {
51
- toBeOption: 'ColorType',
52
- },
53
- axisLineVisible: {
54
- toBeTypes: ['boolean']
55
- },
56
- axisLineColorType: {
57
- toBeOption: 'ColorType',
58
- },
59
- ticks: {
60
- toBeTypes: ['number', 'null']
61
- },
62
- tickFormat: {
63
- toBeTypes: ['string', 'Function']
64
- },
65
- tickLineVisible: {
66
- toBeTypes: ['boolean']
67
- },
68
- tickPadding: {
69
- toBeTypes: ['number']
70
- },
71
- tickFullLine: {
72
- toBeTypes: ['boolean']
73
- },
74
- tickFullLineDasharray: {
75
- toBeTypes: ['string']
76
- },
77
- tickColorType: {
78
- toBeOption: 'ColorType',
79
- },
80
- tickTextColorType: {
81
- toBeOption: 'ColorType',
82
- }
83
- })
84
- if (forceResult.status === 'error') {
85
- return forceResult
86
- }
87
- }
88
- if (params.yAxis) {
89
- const forceResult = validateColumns(params.yAxis, {
90
- labelOffset: {
91
- toBe: '[number, number]',
92
- test: (value: any) => {
93
- return Array.isArray(value)
94
- && value.length === 2
95
- && typeof value[0] === 'number'
96
- && typeof value[1] === 'number'
97
- }
98
- },
99
- labelColorType: {
100
- toBeOption: 'ColorType',
101
- },
102
- axisLineVisible: {
103
- toBeTypes: ['boolean']
104
- },
105
- axisLineColorType: {
106
- toBeOption: 'ColorType',
107
- },
108
- ticks: {
109
- toBeTypes: ['number', 'null']
110
- },
111
- tickFormat: {
112
- toBeTypes: ['string', 'Function']
113
- },
114
- tickLineVisible: {
115
- toBeTypes: ['boolean']
116
- },
117
- tickPadding: {
118
- toBeTypes: ['number']
119
- },
120
- tickFullLine: {
121
- toBeTypes: ['boolean']
122
- },
123
- tickFullLineDasharray: {
124
- toBeTypes: ['string']
125
- },
126
- tickColorType: {
127
- toBeOption: 'ColorType',
128
- },
129
- tickTextColorType: {
130
- toBeOption: 'ColorType',
131
- }
132
- })
133
- if (forceResult.status === 'error') {
134
- return forceResult
135
- }
136
- }
137
- return result
138
- }
139
- }
140
-
141
-
142
-
143
- export const XYAxes = defineMultiValuePlugin(pluginConfig)(({ selection, name, observer, subject }) => {
144
-
145
- const destroy$ = new Subject()
146
-
147
- const xAxisFullParams$ = observer.fullParams$.pipe(
148
- takeUntil(destroy$),
149
- map(fullParams => fullParams.xAxis),
150
- distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),
151
- )
152
-
153
- const yAxisFullParams$ = observer.fullParams$.pipe(
154
- takeUntil(destroy$),
155
- map(fullParams => fullParams.xAxis),
156
- distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),
157
- )
158
-
159
- const unsubscribeBaseXAxis = createBaseXAxis(`${pluginName}-x`, {
160
- selection,
161
- position$: of('bottom'),
162
- transitionDuration$: of(100),
163
- computedData$: observer.computedData$,
164
- fullParams$: xAxisFullParams$,
165
- fullDataFormatter$: observer.fullDataFormatter$,
166
- fullChartParams$: observer.fullChartParams$,
167
- isCategorySeprate$: observer.isCategorySeprate$,
168
- containerPosition$: observer.containerPosition$,
169
- // layout$: observer.layout$,
170
- containerSize$: observer.containerSize$,
171
- xScale$: observer.xScale$,
172
- // filteredXYMinMaxData$: observer.filteredXYMinMaxData$,
173
- // xyMinMax$: observer.xyMinMax$,
174
- })
175
-
176
- const unsubscribeBaseYAxis = createBaseYAxis(`${pluginName}-y`, {
177
- selection,
178
- computedData$: observer.computedData$,
179
- fullParams$: yAxisFullParams$,
180
- fullDataFormatter$: observer.fullDataFormatter$,
181
- fullChartParams$: observer.fullChartParams$,
182
- isCategorySeprate$: observer.isCategorySeprate$,
183
- containerPosition$: observer.containerPosition$,
184
- containerSize$: observer.containerSize$,
185
- yScale$: observer.yScale$,
186
- // filteredXYMinMaxData$: observer.filteredXYMinMaxData$,
187
- // xyMinMax$: observer.xyMinMax$,
188
- })
189
-
190
- return () => {
191
- destroy$.next(undefined)
192
- unsubscribeBaseXAxis()
193
- unsubscribeBaseYAxis()
194
- }
1
+ import {
2
+ Observable,
3
+ Subject,
4
+ combineLatest,
5
+ takeUntil,
6
+ map,
7
+ distinctUntilChanged,
8
+ of,
9
+ switchMap,
10
+ shareReplay
11
+ } from 'rxjs'
12
+ import type {
13
+ DefinePluginConfig,
14
+ } from '../../../lib/core-types'
15
+ import {
16
+ defineMultiValuePlugin,
17
+ } from '../../../lib/core'
18
+ import { DEFAULT_X_Y_AXES_PARAMS } from '../defaults'
19
+ import { LAYER_INDEX_OF_AXIS } from '../../const'
20
+ import { createBaseXAxis } from '../../base/BaseXAxis'
21
+ import { createBaseYAxis } from '../../base/BaseYAxis'
22
+
23
+ const pluginName = 'XYAxes'
24
+
25
+
26
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_X_Y_AXES_PARAMS> = {
27
+ name: pluginName,
28
+ defaultParams: DEFAULT_X_Y_AXES_PARAMS,
29
+ layerIndex: LAYER_INDEX_OF_AXIS,
30
+ validator: (params, { validateColumns }) => {
31
+ const result = validateColumns(params, {
32
+ xAxis: {
33
+ toBeTypes: ['object']
34
+ },
35
+ yAxis: {
36
+ toBeTypes: ['object']
37
+ }
38
+ })
39
+ if (params.xAxis) {
40
+ const forceResult = validateColumns(params.xAxis, {
41
+ labelOffset: {
42
+ toBe: '[number, number]',
43
+ test: (value: any) => {
44
+ return Array.isArray(value)
45
+ && value.length === 2
46
+ && typeof value[0] === 'number'
47
+ && typeof value[1] === 'number'
48
+ }
49
+ },
50
+ labelColorType: {
51
+ toBeOption: 'ColorType',
52
+ },
53
+ axisLineVisible: {
54
+ toBeTypes: ['boolean']
55
+ },
56
+ axisLineColorType: {
57
+ toBeOption: 'ColorType',
58
+ },
59
+ ticks: {
60
+ toBeTypes: ['number', 'null']
61
+ },
62
+ tickFormat: {
63
+ toBeTypes: ['string', 'Function']
64
+ },
65
+ tickLineVisible: {
66
+ toBeTypes: ['boolean']
67
+ },
68
+ tickPadding: {
69
+ toBeTypes: ['number']
70
+ },
71
+ tickFullLine: {
72
+ toBeTypes: ['boolean']
73
+ },
74
+ tickFullLineDasharray: {
75
+ toBeTypes: ['string']
76
+ },
77
+ tickColorType: {
78
+ toBeOption: 'ColorType',
79
+ },
80
+ tickTextColorType: {
81
+ toBeOption: 'ColorType',
82
+ }
83
+ })
84
+ if (forceResult.status === 'error') {
85
+ return forceResult
86
+ }
87
+ }
88
+ if (params.yAxis) {
89
+ const forceResult = validateColumns(params.yAxis, {
90
+ labelOffset: {
91
+ toBe: '[number, number]',
92
+ test: (value: any) => {
93
+ return Array.isArray(value)
94
+ && value.length === 2
95
+ && typeof value[0] === 'number'
96
+ && typeof value[1] === 'number'
97
+ }
98
+ },
99
+ labelColorType: {
100
+ toBeOption: 'ColorType',
101
+ },
102
+ axisLineVisible: {
103
+ toBeTypes: ['boolean']
104
+ },
105
+ axisLineColorType: {
106
+ toBeOption: 'ColorType',
107
+ },
108
+ ticks: {
109
+ toBeTypes: ['number', 'null']
110
+ },
111
+ tickFormat: {
112
+ toBeTypes: ['string', 'Function']
113
+ },
114
+ tickLineVisible: {
115
+ toBeTypes: ['boolean']
116
+ },
117
+ tickPadding: {
118
+ toBeTypes: ['number']
119
+ },
120
+ tickFullLine: {
121
+ toBeTypes: ['boolean']
122
+ },
123
+ tickFullLineDasharray: {
124
+ toBeTypes: ['string']
125
+ },
126
+ tickColorType: {
127
+ toBeOption: 'ColorType',
128
+ },
129
+ tickTextColorType: {
130
+ toBeOption: 'ColorType',
131
+ }
132
+ })
133
+ if (forceResult.status === 'error') {
134
+ return forceResult
135
+ }
136
+ }
137
+ return result
138
+ }
139
+ }
140
+
141
+
142
+
143
+ export const XYAxes = defineMultiValuePlugin(pluginConfig)(({ selection, name, observer, subject }) => {
144
+
145
+ const destroy$ = new Subject()
146
+
147
+ const xAxisFullParams$ = observer.fullParams$.pipe(
148
+ takeUntil(destroy$),
149
+ map(fullParams => fullParams.xAxis),
150
+ distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),
151
+ )
152
+
153
+ const yAxisFullParams$ = observer.fullParams$.pipe(
154
+ takeUntil(destroy$),
155
+ map(fullParams => fullParams.xAxis),
156
+ distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),
157
+ )
158
+
159
+ const unsubscribeBaseXAxis = createBaseXAxis(`${pluginName}-x`, {
160
+ selection,
161
+ position$: of('bottom'),
162
+ transitionDuration$: of(100),
163
+ computedData$: observer.computedData$,
164
+ fullParams$: xAxisFullParams$,
165
+ fullDataFormatter$: observer.fullDataFormatter$,
166
+ fullChartParams$: observer.fullChartParams$,
167
+ isCategorySeprate$: observer.isCategorySeprate$,
168
+ containerPosition$: observer.containerPosition$,
169
+ // layout$: observer.layout$,
170
+ containerSize$: observer.containerSize$,
171
+ xScale$: observer.xScale$,
172
+ // filteredXYMinMaxData$: observer.filteredXYMinMaxData$,
173
+ // xyMinMax$: observer.xyMinMax$,
174
+ })
175
+
176
+ const unsubscribeBaseYAxis = createBaseYAxis(`${pluginName}-y`, {
177
+ selection,
178
+ computedData$: observer.computedData$,
179
+ fullParams$: yAxisFullParams$,
180
+ fullDataFormatter$: observer.fullDataFormatter$,
181
+ fullChartParams$: observer.fullChartParams$,
182
+ isCategorySeprate$: observer.isCategorySeprate$,
183
+ containerPosition$: observer.containerPosition$,
184
+ containerSize$: observer.containerSize$,
185
+ yScale$: observer.yScale$,
186
+ // filteredXYMinMaxData$: observer.filteredXYMinMaxData$,
187
+ // xyMinMax$: observer.xyMinMax$,
188
+ })
189
+
190
+ return () => {
191
+ destroy$.next(undefined)
192
+ unsubscribeBaseXAxis()
193
+ unsubscribeBaseYAxis()
194
+ }
195
195
  })