@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,226 +1,226 @@
1
- import * as d3 from 'd3'
2
- import {
3
- takeUntil,
4
- combineLatest,
5
- of,
6
- iif,
7
- interval,
8
- map,
9
- distinctUntilChanged,
10
- shareReplay,
11
- switchMap,
12
- EMPTY,
13
- Subject,
14
- } from 'rxjs'
15
- import type { Observable } from 'rxjs'
16
- import type {
17
- ChartParams,
18
- ComputedDatumMultiValue,
19
- DefinePluginConfig,
20
- } from '../../../lib/core-types'
21
- import type { BaseRacingLabelsParams, OrdinalBubblesParams } from '../../../lib/plugins-basic-types'
22
- import { defineMultiValuePlugin } from '../../../lib/core'
23
- import { createBaseRacingLabels } from '../../base/BaseRacingLabels'
24
- import { createBaseOrdinalBubbles } from '../../base/BaseOrdinalBubbles'
25
- import { DEFAULT_ORDINAL_BUBBLES_PARAMS } from '../defaults'
26
- import { LAYER_INDEX_OF_GRAPHIC } from '../../const'
27
- import {
28
- // visibleComputedSumDataObservable,
29
- // visibleComputedRankingBySumDataObservable,
30
- // rankingAmountLimitObservable,
31
- computedRankingAmountObservable,
32
- rankingItemHeightObservable,
33
- rankingScaleListObservable,
34
- // computedRankingWithXYDataObservable
35
- } from '../multiValueObservables'
36
- import { renderCircleText } from '../../utils/d3Graphics'
37
- import { getDatumColor } from '../../utils/orbchartsUtils'
38
-
39
- const pluginName = 'OrdinalBubbles'
40
-
41
- const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_ORDINAL_BUBBLES_PARAMS> = {
42
- name: pluginName,
43
- defaultParams: DEFAULT_ORDINAL_BUBBLES_PARAMS,
44
- layerIndex: LAYER_INDEX_OF_GRAPHIC,
45
- validator: (params, { validateColumns }) => {
46
- const result = validateColumns(params, {
47
- bubble: {
48
- toBeTypes: ['object']
49
- },
50
- itemLabel: {
51
- toBeTypes: ['object']
52
- },
53
- axisLabel: {
54
- toBeTypes: ['object']
55
- },
56
- rankingAmount: {
57
- toBe: 'number | "auto"',
58
- test: (value: any) => {
59
- return typeof value === 'number' || value === 'auto'
60
- }
61
- },
62
- })
63
- if (params.bubble) {
64
- const bubbleResult = validateColumns(params.bubble, {
65
- sizeAdjust: {
66
- toBeTypes: ['number']
67
- },
68
- arcScaleType: {
69
- toBe: '"area" | "radius"',
70
- test: (value: any) => {
71
- return value === 'area' || value === 'radius'
72
- }
73
- },
74
- valueLinearOpacity: {
75
- toBe: '[number, number]',
76
- test: (value) => Array.isArray(value) && value.length === 2 && typeof value[0] === 'number' && typeof value[1] === 'number'
77
- },
78
- })
79
- if (bubbleResult.status === 'error') {
80
- return bubbleResult
81
- }
82
- }
83
- if (params.itemLabel) {
84
- const itemLabelResult = validateColumns(params.itemLabel, {
85
- padding: {
86
- toBeTypes: ['number']
87
- },
88
- colorType: {
89
- toBeOption: 'ColorType',
90
- },
91
- })
92
- if (itemLabelResult.status === 'error') {
93
- return itemLabelResult
94
- }
95
- }
96
- if (params.axisLabel) {
97
- const axisLabelResult = validateColumns(params.axisLabel, {
98
- offset: {
99
- toBe: '[number, number]',
100
- test: (value) => Array.isArray(value) && value.length === 2 && typeof value[0] === 'number' && typeof value[1] === 'number'
101
- },
102
- colorType: {
103
- toBeOption: 'ColorType',
104
- },
105
- })
106
- if (axisLabelResult.status === 'error') {
107
- return axisLabelResult
108
- }
109
- }
110
- return result
111
- }
112
- }
113
-
114
-
115
-
116
- export const OrdinalBubbles = defineMultiValuePlugin(pluginConfig)(({ selection, name, observer, subject }) => {
117
-
118
- const baseOrdinalBubblesSelection = selection.append('g').attr('class', `${pluginName}-bubbles`)
119
- const baseRacingLabelsSelection = selection.append('g').attr('class', `${pluginName}-labels`)
120
-
121
- const destroy$ = new Subject()
122
-
123
- const baseRacingLabelsParams$: Observable<BaseRacingLabelsParams> = observer.fullParams$.pipe(
124
- takeUntil(destroy$),
125
- map(params => {
126
- return {
127
- barLabel: {
128
- ...params.itemLabel,
129
- position: 'outside'
130
- },
131
- axisLabel: {
132
- ...params.axisLabel
133
- }
134
- }
135
- })
136
- )
137
-
138
- const rankingAmount$ = observer.fullParams$.pipe(
139
- takeUntil(destroy$),
140
- map(p => p.rankingAmount),
141
- distinctUntilChanged(),
142
- )
143
-
144
- const computedRankingAmount$ = computedRankingAmountObservable({
145
- containerSize$: observer.containerSize$,
146
- visibleComputedData$: observer.visibleComputedData$,
147
- textSizePx$: observer.textSizePx$,
148
- rankingAmount$
149
- }).pipe(
150
- takeUntil(destroy$),
151
- shareReplay(1)
152
- )
153
-
154
- const rankingItemHeight$ = rankingItemHeightObservable({
155
- containerSize$: observer.containerSize$,
156
- // visibleComputedRankingData$: observer.visibleComputedRankingBySumData$,
157
- textSizePx$: observer.textSizePx$,
158
- computedRankingAmount$
159
- }).pipe(
160
- takeUntil(destroy$),
161
- shareReplay(1)
162
- )
163
-
164
- const rankingScaleList$ = rankingScaleListObservable({
165
- visibleComputedRankingData$: observer.visibleComputedRankingBySumData$,
166
- rankingItemHeight$
167
- }).pipe(
168
- takeUntil(destroy$),
169
- shareReplay(1)
170
- )
171
-
172
- const unsubscribeBaseRacingLabels = createBaseRacingLabels(`${pluginName}-labels`, {
173
- selection: baseRacingLabelsSelection,
174
- computedData$: observer.computedData$,
175
- visibleComputedRankingData$: observer.visibleComputedRankingBySumData$,
176
- rankingScaleList$,
177
- xScale$: observer.xScale$, // 不會用到
178
- fullParams$: baseRacingLabelsParams$,
179
- fullDataFormatter$: observer.fullDataFormatter$,
180
- fullChartParams$: observer.fullChartParams$,
181
- transitionEase$: observer.fullChartParams$.pipe(
182
- map(p => p.transitionEase),
183
- distinctUntilChanged()
184
- ),
185
- // layout$: observer.layout$,
186
- containerPosition$: observer.containerPosition$,
187
- containerSize$: observer.containerSize$,
188
- isCategorySeprate$: observer.isCategorySeprate$,
189
- // xyValueIndex$: observer.xyValueIndex$,
190
- })
191
-
192
- const unsubscribeBaseOrdinalBubbles = createBaseOrdinalBubbles(`${pluginName}-bubbles`, {
193
- selection: baseOrdinalBubblesSelection,
194
- computedData$: observer.computedData$,
195
- visibleComputedRankingData$: observer.visibleComputedRankingBySumData$,
196
- CategoryDataMap$: observer.CategoryDataMap$,
197
- valueLabels$: observer.valueLabels$,
198
- fullParams$: observer.fullParams$,
199
- fullDataFormatter$: observer.fullDataFormatter$,
200
- fullChartParams$: observer.fullChartParams$,
201
- highlight$: observer.highlight$,
202
- rankingItemHeight$,
203
- rankingScaleList$,
204
- containerPosition$: observer.containerPosition$,
205
- containerSize$: observer.containerSize$,
206
- ordinalPadding$: observer.ordinalPadding$,
207
- ordinalScale$: observer.ordinalScale$,
208
- isCategorySeprate$: observer.isCategorySeprate$,
209
- event$: subject.event$,
210
- // xyValueIndex$: observer.xyValueIndex$,
211
- })
212
-
213
- // const valueAmount$ = observer.visibleComputedRankingBySumData$.pipe(
214
- // takeUntil(destroy$),
215
- // map(d => (d[0] && d[0][0] && d[0][0].value.length) ?? 0),
216
- // distinctUntilChanged()
217
- // )
218
-
219
-
220
-
221
- return () => {
222
- destroy$.next(undefined)
223
- unsubscribeBaseRacingLabels()
224
- unsubscribeBaseOrdinalBubbles()
225
- }
226
- })
1
+ import * as d3 from 'd3'
2
+ import {
3
+ takeUntil,
4
+ combineLatest,
5
+ of,
6
+ iif,
7
+ interval,
8
+ map,
9
+ distinctUntilChanged,
10
+ shareReplay,
11
+ switchMap,
12
+ EMPTY,
13
+ Subject,
14
+ } from 'rxjs'
15
+ import type { Observable } from 'rxjs'
16
+ import type {
17
+ ChartParams,
18
+ ComputedDatumMultiValue,
19
+ DefinePluginConfig,
20
+ } from '../../../lib/core-types'
21
+ import type { BaseRacingLabelsParams, OrdinalBubblesParams } from '../../../lib/plugins-basic-types'
22
+ import { defineMultiValuePlugin } from '../../../lib/core'
23
+ import { createBaseRacingLabels } from '../../base/BaseRacingLabels'
24
+ import { createBaseOrdinalBubbles } from '../../base/BaseOrdinalBubbles'
25
+ import { DEFAULT_ORDINAL_BUBBLES_PARAMS } from '../defaults'
26
+ import { LAYER_INDEX_OF_GRAPHIC } from '../../const'
27
+ import {
28
+ // visibleComputedSumDataObservable,
29
+ // visibleComputedRankingBySumDataObservable,
30
+ // rankingAmountLimitObservable,
31
+ computedRankingAmountObservable,
32
+ rankingItemHeightObservable,
33
+ rankingScaleListObservable,
34
+ // computedRankingWithXYDataObservable
35
+ } from '../multiValueObservables'
36
+ import { renderCircleText } from '../../utils/d3Graphics'
37
+ import { getDatumColor } from '../../utils/orbchartsUtils'
38
+
39
+ const pluginName = 'OrdinalBubbles'
40
+
41
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_ORDINAL_BUBBLES_PARAMS> = {
42
+ name: pluginName,
43
+ defaultParams: DEFAULT_ORDINAL_BUBBLES_PARAMS,
44
+ layerIndex: LAYER_INDEX_OF_GRAPHIC,
45
+ validator: (params, { validateColumns }) => {
46
+ const result = validateColumns(params, {
47
+ bubble: {
48
+ toBeTypes: ['object']
49
+ },
50
+ itemLabel: {
51
+ toBeTypes: ['object']
52
+ },
53
+ axisLabel: {
54
+ toBeTypes: ['object']
55
+ },
56
+ rankingAmount: {
57
+ toBe: 'number | "auto"',
58
+ test: (value: any) => {
59
+ return typeof value === 'number' || value === 'auto'
60
+ }
61
+ },
62
+ })
63
+ if (params.bubble) {
64
+ const bubbleResult = validateColumns(params.bubble, {
65
+ sizeAdjust: {
66
+ toBeTypes: ['number']
67
+ },
68
+ arcScaleType: {
69
+ toBe: '"area" | "radius"',
70
+ test: (value: any) => {
71
+ return value === 'area' || value === 'radius'
72
+ }
73
+ },
74
+ valueLinearOpacity: {
75
+ toBe: '[number, number]',
76
+ test: (value) => Array.isArray(value) && value.length === 2 && typeof value[0] === 'number' && typeof value[1] === 'number'
77
+ },
78
+ })
79
+ if (bubbleResult.status === 'error') {
80
+ return bubbleResult
81
+ }
82
+ }
83
+ if (params.itemLabel) {
84
+ const itemLabelResult = validateColumns(params.itemLabel, {
85
+ padding: {
86
+ toBeTypes: ['number']
87
+ },
88
+ colorType: {
89
+ toBeOption: 'ColorType',
90
+ },
91
+ })
92
+ if (itemLabelResult.status === 'error') {
93
+ return itemLabelResult
94
+ }
95
+ }
96
+ if (params.axisLabel) {
97
+ const axisLabelResult = validateColumns(params.axisLabel, {
98
+ offset: {
99
+ toBe: '[number, number]',
100
+ test: (value) => Array.isArray(value) && value.length === 2 && typeof value[0] === 'number' && typeof value[1] === 'number'
101
+ },
102
+ colorType: {
103
+ toBeOption: 'ColorType',
104
+ },
105
+ })
106
+ if (axisLabelResult.status === 'error') {
107
+ return axisLabelResult
108
+ }
109
+ }
110
+ return result
111
+ }
112
+ }
113
+
114
+
115
+
116
+ export const OrdinalBubbles = defineMultiValuePlugin(pluginConfig)(({ selection, name, observer, subject }) => {
117
+
118
+ const baseOrdinalBubblesSelection = selection.append('g').attr('class', `${pluginName}-bubbles`)
119
+ const baseRacingLabelsSelection = selection.append('g').attr('class', `${pluginName}-labels`)
120
+
121
+ const destroy$ = new Subject()
122
+
123
+ const baseRacingLabelsParams$: Observable<BaseRacingLabelsParams> = observer.fullParams$.pipe(
124
+ takeUntil(destroy$),
125
+ map(params => {
126
+ return {
127
+ barLabel: {
128
+ ...params.itemLabel,
129
+ position: 'outside'
130
+ },
131
+ axisLabel: {
132
+ ...params.axisLabel
133
+ }
134
+ }
135
+ })
136
+ )
137
+
138
+ const rankingAmount$ = observer.fullParams$.pipe(
139
+ takeUntil(destroy$),
140
+ map(p => p.rankingAmount),
141
+ distinctUntilChanged(),
142
+ )
143
+
144
+ const computedRankingAmount$ = computedRankingAmountObservable({
145
+ containerSize$: observer.containerSize$,
146
+ visibleComputedData$: observer.visibleComputedData$,
147
+ textSizePx$: observer.textSizePx$,
148
+ rankingAmount$
149
+ }).pipe(
150
+ takeUntil(destroy$),
151
+ shareReplay(1)
152
+ )
153
+
154
+ const rankingItemHeight$ = rankingItemHeightObservable({
155
+ containerSize$: observer.containerSize$,
156
+ // visibleComputedRankingData$: observer.visibleComputedRankingBySumData$,
157
+ textSizePx$: observer.textSizePx$,
158
+ computedRankingAmount$
159
+ }).pipe(
160
+ takeUntil(destroy$),
161
+ shareReplay(1)
162
+ )
163
+
164
+ const rankingScaleList$ = rankingScaleListObservable({
165
+ visibleComputedRankingData$: observer.visibleComputedRankingBySumData$,
166
+ rankingItemHeight$
167
+ }).pipe(
168
+ takeUntil(destroy$),
169
+ shareReplay(1)
170
+ )
171
+
172
+ const unsubscribeBaseRacingLabels = createBaseRacingLabels(`${pluginName}-labels`, {
173
+ selection: baseRacingLabelsSelection,
174
+ computedData$: observer.computedData$,
175
+ visibleComputedRankingData$: observer.visibleComputedRankingBySumData$,
176
+ rankingScaleList$,
177
+ xScale$: observer.xScale$, // 不會用到
178
+ fullParams$: baseRacingLabelsParams$,
179
+ fullDataFormatter$: observer.fullDataFormatter$,
180
+ fullChartParams$: observer.fullChartParams$,
181
+ transitionEase$: observer.fullChartParams$.pipe(
182
+ map(p => p.transitionEase),
183
+ distinctUntilChanged()
184
+ ),
185
+ // layout$: observer.layout$,
186
+ containerPosition$: observer.containerPosition$,
187
+ containerSize$: observer.containerSize$,
188
+ isCategorySeprate$: observer.isCategorySeprate$,
189
+ // xyValueIndex$: observer.xyValueIndex$,
190
+ })
191
+
192
+ const unsubscribeBaseOrdinalBubbles = createBaseOrdinalBubbles(`${pluginName}-bubbles`, {
193
+ selection: baseOrdinalBubblesSelection,
194
+ computedData$: observer.computedData$,
195
+ visibleComputedRankingData$: observer.visibleComputedRankingBySumData$,
196
+ CategoryDataMap$: observer.CategoryDataMap$,
197
+ valueLabels$: observer.valueLabels$,
198
+ fullParams$: observer.fullParams$,
199
+ fullDataFormatter$: observer.fullDataFormatter$,
200
+ fullChartParams$: observer.fullChartParams$,
201
+ highlight$: observer.highlight$,
202
+ rankingItemHeight$,
203
+ rankingScaleList$,
204
+ containerPosition$: observer.containerPosition$,
205
+ containerSize$: observer.containerSize$,
206
+ ordinalPadding$: observer.ordinalPadding$,
207
+ ordinalScale$: observer.ordinalScale$,
208
+ isCategorySeprate$: observer.isCategorySeprate$,
209
+ event$: subject.event$,
210
+ // xyValueIndex$: observer.xyValueIndex$,
211
+ })
212
+
213
+ // const valueAmount$ = observer.visibleComputedRankingBySumData$.pipe(
214
+ // takeUntil(destroy$),
215
+ // map(d => (d[0] && d[0][0] && d[0][0].value.length) ?? 0),
216
+ // distinctUntilChanged()
217
+ // )
218
+
219
+
220
+
221
+ return () => {
222
+ destroy$.next(undefined)
223
+ unsubscribeBaseRacingLabels()
224
+ unsubscribeBaseOrdinalBubbles()
225
+ }
226
+ })
@@ -1,57 +1,57 @@
1
- import {
2
- takeUntil,
3
- map,
4
- Subject } from 'rxjs'
5
- import type { DefinePluginConfig } from '../../../lib/core-types'
6
- import {
7
- defineMultiValuePlugin, createValueToAxisScale } from '../../../lib/core'
8
- import { DEFAULT_X_ZOOM_PARAMS } from '../defaults'
9
- import { LAYER_INDEX_OF_ROOT } from '../../const'
10
- import { createBaseXZoom } from '../../base/BaseXZoom'
11
-
12
- const pluginName = 'OrdinalZoom'
13
-
14
- const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_X_ZOOM_PARAMS> = {
15
- name: pluginName,
16
- defaultParams: DEFAULT_X_ZOOM_PARAMS,
17
- layerIndex: LAYER_INDEX_OF_ROOT,
18
- validator: (params, { validateColumns }) => {
19
- return {
20
- status: 'success',
21
- columnName: '',
22
- expectToBe: ''
23
- }
24
- }
25
- }
26
-
27
- export const OrdinalZoom = defineMultiValuePlugin(pluginConfig)(({ selection, rootSelection, name, observer, subject }) => {
28
-
29
- const destroy$ = new Subject()
30
-
31
- const ordinalXYMinMax$ = observer.computedData$.pipe(
32
- takeUntil(destroy$),
33
- map(computedData => {
34
- return {
35
- minX: 0,//-0.5,
36
- maxX: computedData[0] && computedData[0][0]
37
- ? computedData[0][0].value.length - 1//0.5
38
- : 0,//0.5,
39
- minY: 0, // 沒用到
40
- maxY: 0 // 沒用到
41
- }
42
- })
43
- )
44
-
45
- const unsubscribeBaseOrdinalBubbles = createBaseXZoom(pluginName, {
46
- rootSelection,
47
- fullDataFormatter$: observer.fullDataFormatter$,
48
- xyMinMax$: ordinalXYMinMax$,
49
- layout$: observer.layout$,
50
- dataFormatter$: subject.dataFormatter$,
51
- })
52
-
53
- return () => {
54
- destroy$.next(undefined)
55
- unsubscribeBaseOrdinalBubbles()
56
- }
57
- })
1
+ import {
2
+ takeUntil,
3
+ map,
4
+ Subject } from 'rxjs'
5
+ import type { DefinePluginConfig } from '../../../lib/core-types'
6
+ import {
7
+ defineMultiValuePlugin, createValueToAxisScale } from '../../../lib/core'
8
+ import { DEFAULT_X_ZOOM_PARAMS } from '../defaults'
9
+ import { LAYER_INDEX_OF_ROOT } from '../../const'
10
+ import { createBaseXZoom } from '../../base/BaseXZoom'
11
+
12
+ const pluginName = 'OrdinalZoom'
13
+
14
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_X_ZOOM_PARAMS> = {
15
+ name: pluginName,
16
+ defaultParams: DEFAULT_X_ZOOM_PARAMS,
17
+ layerIndex: LAYER_INDEX_OF_ROOT,
18
+ validator: (params, { validateColumns }) => {
19
+ return {
20
+ status: 'success',
21
+ columnName: '',
22
+ expectToBe: ''
23
+ }
24
+ }
25
+ }
26
+
27
+ export const OrdinalZoom = defineMultiValuePlugin(pluginConfig)(({ selection, rootSelection, name, observer, subject }) => {
28
+
29
+ const destroy$ = new Subject()
30
+
31
+ const ordinalXYMinMax$ = observer.computedData$.pipe(
32
+ takeUntil(destroy$),
33
+ map(computedData => {
34
+ return {
35
+ minX: 0,//-0.5,
36
+ maxX: computedData[0] && computedData[0][0]
37
+ ? computedData[0][0].value.length - 1//0.5
38
+ : 0,//0.5,
39
+ minY: 0, // 沒用到
40
+ maxY: 0 // 沒用到
41
+ }
42
+ })
43
+ )
44
+
45
+ const unsubscribeBaseOrdinalBubbles = createBaseXZoom(pluginName, {
46
+ rootSelection,
47
+ fullDataFormatter$: observer.fullDataFormatter$,
48
+ xyMinMax$: ordinalXYMinMax$,
49
+ layout$: observer.layout$,
50
+ dataFormatter$: subject.dataFormatter$,
51
+ })
52
+
53
+ return () => {
54
+ destroy$.next(undefined)
55
+ unsubscribeBaseOrdinalBubbles()
56
+ }
57
+ })