@orbcharts/plugins-basic 3.0.0-alpha.44 → 3.0.0-alpha.46
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/orbcharts-plugins-basic.es.js +7770 -7580
- package/dist/orbcharts-plugins-basic.umd.js +8 -8
- package/dist/src/base/BaseBarStack.d.ts +6 -4
- package/dist/src/base/BaseBars.d.ts +6 -4
- package/dist/src/base/BaseBarsTriangle.d.ts +7 -4
- package/dist/src/base/BaseDots.d.ts +5 -3
- package/dist/src/base/BaseGroupAxis.d.ts +3 -3
- package/dist/src/base/BaseLineAreas.d.ts +6 -3
- package/dist/src/base/BaseLines.d.ts +6 -3
- package/dist/src/base/BaseValueAxis.d.ts +3 -3
- package/dist/src/grid/gridObservables.d.ts +4 -4
- package/dist/src/multiGrid/multiGridObservables.d.ts +2 -6
- package/dist/src/series/plugins/PieEventTexts.d.ts +3 -1
- package/dist/src/series/seriesObservables.d.ts +21 -0
- package/dist/src/series/seriesUtils.d.ts +3 -3
- package/package.json +2 -2
- package/src/base/BaseBarStack.ts +105 -208
- package/src/base/BaseBars.ts +78 -64
- package/src/base/BaseBarsTriangle.ts +76 -63
- package/src/base/BaseDots.ts +41 -178
- package/src/base/BaseGroupAxis.ts +13 -13
- package/src/base/BaseLineAreas.ts +85 -81
- package/src/base/BaseLines.ts +82 -75
- package/src/base/BaseValueAxis.ts +14 -15
- package/src/grid/gridObservables.ts +22 -38
- package/src/grid/plugins/BarStack.ts +16 -3
- package/src/grid/plugins/Bars.ts +18 -4
- package/src/grid/plugins/BarsDiverging.ts +6 -4
- package/src/grid/plugins/BarsTriangle.ts +20 -4
- package/src/grid/plugins/Dots.ts +4 -2
- package/src/grid/plugins/GroupAux.ts +1 -2
- package/src/grid/plugins/GroupAxis.ts +15 -3
- package/src/grid/plugins/LineAreas.ts +5 -2
- package/src/grid/plugins/Lines.ts +5 -2
- package/src/grid/plugins/ScalingArea.ts +0 -1
- package/src/grid/plugins/ValueAxis.ts +15 -3
- package/src/grid/plugins/ValueStackAxis.ts +14 -5
- package/src/multiGrid/multiGridObservables.ts +14 -261
- package/src/multiGrid/plugins/MultiBarStack.ts +22 -8
- package/src/multiGrid/plugins/MultiBars.ts +21 -7
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +22 -7
- package/src/multiGrid/plugins/MultiDots.ts +7 -5
- package/src/multiGrid/plugins/MultiGridLegend.ts +1 -1
- package/src/multiGrid/plugins/MultiGroupAxis.ts +19 -7
- package/src/multiGrid/plugins/MultiLineAreas.ts +9 -6
- package/src/multiGrid/plugins/MultiLines.ts +9 -6
- package/src/multiGrid/plugins/MultiValueAxis.ts +19 -7
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +52 -47
- package/src/noneData/defaults.ts +3 -0
- package/src/series/defaults.ts +13 -3
- package/src/series/plugins/Bubbles.ts +139 -88
- package/src/series/plugins/Pie.ts +307 -352
- package/src/series/plugins/PieEventTexts.ts +102 -38
- package/src/series/plugins/PieLabels.ts +95 -48
- package/src/series/seriesObservables.ts +145 -0
- package/src/series/seriesUtils.ts +4 -4
- package/tsconfig.json +1 -1
@@ -336,7 +336,7 @@ export const GroupAux = defineGridPlugin(pluginName, DEFAULT_GROUP_AREA_PARAMS)(
|
|
336
336
|
? data.computedData[0].length
|
337
337
|
: 0
|
338
338
|
|
339
|
-
let _labels = data.fullDataFormatter.grid.
|
339
|
+
let _labels = data.fullDataFormatter.grid.seriesDirection === 'row'
|
340
340
|
// ? data.fullDataFormatter.grid.columnLabels
|
341
341
|
// : data.fullDataFormatter.grid.rowLabels
|
342
342
|
? (data.computedData[0] ?? []).map(d => d.groupLabel)
|
@@ -391,7 +391,6 @@ export const GroupAux = defineGridPlugin(pluginName, DEFAULT_GROUP_AREA_PARAMS)(
|
|
391
391
|
groupScale: groupScale$,
|
392
392
|
}).pipe(
|
393
393
|
takeUntil(destroy$),
|
394
|
-
// 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
|
395
394
|
switchMap(async (d) => d),
|
396
395
|
).subscribe(data => {
|
397
396
|
|
@@ -1,5 +1,10 @@
|
|
1
1
|
import {
|
2
|
-
Subject
|
2
|
+
Subject,
|
3
|
+
takeUntil,
|
4
|
+
map,
|
5
|
+
distinctUntilChanged,
|
6
|
+
shareReplay
|
7
|
+
} from 'rxjs'
|
3
8
|
import {
|
4
9
|
defineGridPlugin } from '@orbcharts/core'
|
5
10
|
import { DEFAULT_GROUP_AXIS_PARAMS } from '../defaults'
|
@@ -11,6 +16,13 @@ export const GroupAxis = defineGridPlugin(pluginName, DEFAULT_GROUP_AXIS_PARAMS)
|
|
11
16
|
|
12
17
|
const destroy$ = new Subject()
|
13
18
|
|
19
|
+
const isSeriesSeprate$ = observer.fullDataFormatter$.pipe(
|
20
|
+
takeUntil(destroy$),
|
21
|
+
map(d => d.grid.separateSeries),
|
22
|
+
distinctUntilChanged(),
|
23
|
+
shareReplay(1)
|
24
|
+
)
|
25
|
+
|
14
26
|
const unsubscribeBaseGroupAxis = createBaseGroupAxis(pluginName, {
|
15
27
|
selection,
|
16
28
|
computedData$: observer.computedData$,
|
@@ -20,8 +32,8 @@ export const GroupAxis = defineGridPlugin(pluginName, DEFAULT_GROUP_AXIS_PARAMS)
|
|
20
32
|
gridAxesTransform$: observer.gridAxesTransform$,
|
21
33
|
gridAxesReverseTransform$: observer.gridAxesReverseTransform$,
|
22
34
|
gridAxesSize$: observer.gridAxesSize$,
|
23
|
-
|
24
|
-
|
35
|
+
gridContainerPosition$: observer.gridContainerPosition$,
|
36
|
+
isSeriesSeprate$,
|
25
37
|
})
|
26
38
|
|
27
39
|
return () => {
|
@@ -14,7 +14,10 @@ export const LineAreas = defineGridPlugin(pluginName, DEFAULT_LINE_AREAS_PARAMS)
|
|
14
14
|
const unsubscribeBaseBars = createBaseLineAreas(pluginName, {
|
15
15
|
selection,
|
16
16
|
computedData$: observer.computedData$,
|
17
|
-
|
17
|
+
visibleComputedData$: observer.visibleComputedData$,
|
18
|
+
computedLayoutData$: observer.computedLayoutData$,
|
19
|
+
visibleComputedLayoutData$: observer.visibleComputedLayoutData$,
|
20
|
+
seriesLabels$: observer.seriesLabels$,
|
18
21
|
SeriesDataMap$: observer.SeriesDataMap$,
|
19
22
|
GroupDataMap$: observer.GroupDataMap$,
|
20
23
|
fullParams$: observer.fullParams$,
|
@@ -24,7 +27,7 @@ export const LineAreas = defineGridPlugin(pluginName, DEFAULT_LINE_AREAS_PARAMS)
|
|
24
27
|
gridGraphicTransform$: observer.gridGraphicTransform$,
|
25
28
|
gridAxesSize$: observer.gridAxesSize$,
|
26
29
|
gridHighlight$: observer.gridHighlight$,
|
27
|
-
|
30
|
+
gridContainerPosition$: observer.gridContainerPosition$,
|
28
31
|
layout$: observer.layout$,
|
29
32
|
event$: subject.event$,
|
30
33
|
})
|
@@ -14,7 +14,10 @@ export const Lines = defineGridPlugin(pluginName, DEFAULT_LINES_PARAMS)(({ selec
|
|
14
14
|
const unsubscribeBaseBars = createBaseLines(pluginName, {
|
15
15
|
selection,
|
16
16
|
computedData$: observer.computedData$,
|
17
|
-
|
17
|
+
computedLayoutData$: observer.computedLayoutData$,
|
18
|
+
visibleComputedData$: observer.visibleComputedData$,
|
19
|
+
visibleComputedLayoutData$: observer.visibleComputedLayoutData$,
|
20
|
+
seriesLabels$: observer.seriesLabels$,
|
18
21
|
SeriesDataMap$: observer.SeriesDataMap$,
|
19
22
|
GroupDataMap$: observer.GroupDataMap$,
|
20
23
|
fullParams$: observer.fullParams$,
|
@@ -24,7 +27,7 @@ export const Lines = defineGridPlugin(pluginName, DEFAULT_LINES_PARAMS)(({ selec
|
|
24
27
|
gridGraphicTransform$: observer.gridGraphicTransform$,
|
25
28
|
gridAxesSize$: observer.gridAxesSize$,
|
26
29
|
gridHighlight$: observer.gridHighlight$,
|
27
|
-
|
30
|
+
gridContainerPosition$: observer.gridContainerPosition$,
|
28
31
|
event$: subject.event$,
|
29
32
|
})
|
30
33
|
|
@@ -76,7 +76,6 @@ export const ScalingArea = defineGridPlugin(pluginName, DEFAULT_SCALING_AREA_PAR
|
|
76
76
|
axisSize: observer.gridAxesSize$
|
77
77
|
}).pipe(
|
78
78
|
takeUntil(destroy$),
|
79
|
-
// 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
|
80
79
|
switchMap(async (d) => d),
|
81
80
|
).subscribe(data => {
|
82
81
|
const groupMin = 0
|
@@ -1,5 +1,10 @@
|
|
1
1
|
import {
|
2
|
-
Subject
|
2
|
+
Subject,
|
3
|
+
takeUntil,
|
4
|
+
map,
|
5
|
+
distinctUntilChanged,
|
6
|
+
shareReplay
|
7
|
+
} from 'rxjs'
|
3
8
|
import {
|
4
9
|
defineGridPlugin } from '@orbcharts/core'
|
5
10
|
import { DEFAULT_VALUE_AXIS_PARAMS } from '../defaults'
|
@@ -12,6 +17,13 @@ export const ValueAxis = defineGridPlugin(pluginName, DEFAULT_VALUE_AXIS_PARAMS)
|
|
12
17
|
|
13
18
|
const destroy$ = new Subject()
|
14
19
|
|
20
|
+
const isSeriesSeprate$ = observer.fullDataFormatter$.pipe(
|
21
|
+
takeUntil(destroy$),
|
22
|
+
map(d => d.grid.separateSeries),
|
23
|
+
distinctUntilChanged(),
|
24
|
+
shareReplay(1)
|
25
|
+
)
|
26
|
+
|
15
27
|
const unsubscribeBaseValueAxis = createBaseValueAxis(pluginName, {
|
16
28
|
selection,
|
17
29
|
computedData$: observer.computedData$,
|
@@ -21,8 +33,8 @@ export const ValueAxis = defineGridPlugin(pluginName, DEFAULT_VALUE_AXIS_PARAMS)
|
|
21
33
|
gridAxesTransform$: observer.gridAxesTransform$,
|
22
34
|
gridAxesReverseTransform$: observer.gridAxesReverseTransform$,
|
23
35
|
gridAxesSize$: observer.gridAxesSize$,
|
24
|
-
|
25
|
-
|
36
|
+
gridContainerPosition$: observer.gridContainerPosition$,
|
37
|
+
isSeriesSeprate$,
|
26
38
|
})
|
27
39
|
|
28
40
|
return () => {
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import {
|
2
2
|
takeUntil,
|
3
3
|
map,
|
4
|
+
distinctUntilChanged,
|
5
|
+
shareReplay,
|
4
6
|
switchMap,
|
5
7
|
iif,
|
6
8
|
Subject } from 'rxjs'
|
@@ -47,11 +49,18 @@ export const ValueStackAxis = defineGridPlugin(pluginName, DEFAULT_VALUE_STACK_A
|
|
47
49
|
}),
|
48
50
|
)
|
49
51
|
|
52
|
+
const isSeriesSeprate$ = observer.fullDataFormatter$.pipe(
|
53
|
+
takeUntil(destroy$),
|
54
|
+
map(d => d.grid.separateSeries),
|
55
|
+
distinctUntilChanged(),
|
56
|
+
shareReplay(1)
|
57
|
+
)
|
58
|
+
|
50
59
|
const unsubscribeBaseValueAxis = createBaseValueAxis(pluginName, {
|
51
60
|
selection,
|
52
|
-
computedData$:
|
53
|
-
switchMap(
|
54
|
-
return iif(() =>
|
61
|
+
computedData$: isSeriesSeprate$.pipe(
|
62
|
+
switchMap(isSeriesSeprate => {
|
63
|
+
return iif(() => isSeriesSeprate, observer.computedData$, stackedData$)
|
55
64
|
})
|
56
65
|
),
|
57
66
|
fullParams$: observer.fullParams$,
|
@@ -60,8 +69,8 @@ export const ValueStackAxis = defineGridPlugin(pluginName, DEFAULT_VALUE_STACK_A
|
|
60
69
|
gridAxesTransform$: observer.gridAxesTransform$,
|
61
70
|
gridAxesReverseTransform$: observer.gridAxesReverseTransform$,
|
62
71
|
gridAxesSize$: observer.gridAxesSize$,
|
63
|
-
|
64
|
-
|
72
|
+
gridContainerPosition$: observer.gridContainerPosition$,
|
73
|
+
isSeriesSeprate$,
|
65
74
|
})
|
66
75
|
|
67
76
|
return () => {
|
@@ -10,280 +10,33 @@ import {
|
|
10
10
|
distinctUntilChanged,
|
11
11
|
shareReplay
|
12
12
|
} from 'rxjs'
|
13
|
-
import type {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
// interface GridPluginObservables extends ContextObserverGridDetail {
|
21
|
-
// gridComputedData$: Observable<ComputedDataGrid>
|
22
|
-
// gridDataFormatter$: Observable<DataFormatterGrid>
|
23
|
-
// }
|
24
|
-
|
25
|
-
// // 對應grid資料的plugin所需Observable(必須有gridIndex)
|
26
|
-
// export const gridPluginObservables = (observer: ContextObserverMultiGrid<GridPluginParams>): GridPluginObservables => {
|
27
|
-
// const gridIndex$ = observer.fullParams$.pipe(
|
28
|
-
// map(fullParams => fullParams.gridIndex),
|
29
|
-
// distinctUntilChanged(),
|
30
|
-
// shareReplay(1)
|
31
|
-
// )
|
32
|
-
|
33
|
-
// const gridComputedData$: Observable<ComputedDataGrid> = combineLatest({
|
34
|
-
// computedData: observer.computedData$,
|
35
|
-
// gridIndex: gridIndex$,
|
36
|
-
// }).pipe(
|
37
|
-
// map((data) => {
|
38
|
-
// return data.computedData[data.gridIndex] ?? data.computedData[0]
|
39
|
-
// })
|
40
|
-
// )
|
41
|
-
|
42
|
-
// const gridDataFormatter$: Observable<DataFormatterGrid> = combineLatest({
|
43
|
-
// fullDataFormatter: observer.fullDataFormatter$,
|
44
|
-
// gridIndex: gridIndex$,
|
45
|
-
// }).pipe(
|
46
|
-
// map((data) => {
|
47
|
-
// const defaultGrid = data.fullDataFormatter.gridList[0] // ?? DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT
|
48
|
-
|
49
|
-
// return {
|
50
|
-
// type: 'grid',
|
51
|
-
// grid: {
|
52
|
-
// ...data.fullDataFormatter.gridList[data.gridIndex] ?? defaultGrid
|
53
|
-
// },
|
54
|
-
// container: {
|
55
|
-
// ...data.fullDataFormatter.container
|
56
|
-
// }
|
57
|
-
// }
|
58
|
-
// })
|
59
|
-
// )
|
60
|
-
|
61
|
-
// const gridDetail$ = combineLatest({
|
62
|
-
// multiGridEachDetail: observer.multiGridEachDetail$,
|
63
|
-
// gridIndex: gridIndex$,
|
64
|
-
// }).pipe(
|
65
|
-
// switchMap(async d => d),
|
66
|
-
// map(data => {
|
67
|
-
// return data.multiGridEachDetail[data.gridIndex] ?? data.multiGridEachDetail[0]
|
68
|
-
// }),
|
69
|
-
// shareReplay(1)
|
70
|
-
// )
|
71
|
-
|
72
|
-
// const isSeriesPositionSeprate$ = gridDetail$.pipe(
|
73
|
-
// switchMap(d => d.isSeriesPositionSeprate$)
|
74
|
-
// )
|
75
|
-
|
76
|
-
// const gridContainer$ = gridDetail$.pipe(
|
77
|
-
// switchMap(d => d.gridContainer$)
|
78
|
-
// )
|
79
|
-
|
80
|
-
// const gridAxesTransform$ = gridDetail$.pipe(
|
81
|
-
// switchMap(d => d.gridAxesTransform$)
|
82
|
-
// )
|
83
|
-
|
84
|
-
// const gridAxesReverseTransform$ = gridDetail$.pipe(
|
85
|
-
// switchMap(d => d.gridAxesReverseTransform$)
|
86
|
-
// )
|
87
|
-
|
88
|
-
// const gridAxesSize$ = gridDetail$.pipe(
|
89
|
-
// switchMap(d => d.gridAxesSize$)
|
90
|
-
// )
|
91
|
-
|
92
|
-
// const gridGraphicTransform$ = gridDetail$.pipe(
|
93
|
-
// switchMap(d => d.gridGraphicTransform$)
|
94
|
-
// )
|
95
|
-
|
96
|
-
// const gridGraphicReverseScale$ = gridDetail$.pipe(
|
97
|
-
// switchMap(d => d.gridGraphicReverseScale$)
|
98
|
-
// )
|
99
|
-
|
100
|
-
// const gridHighlight$ = gridDetail$.pipe(
|
101
|
-
// switchMap(d => d.gridHighlight$)
|
102
|
-
// )
|
103
|
-
|
104
|
-
// const existSeriesLabels$ = gridDetail$.pipe(
|
105
|
-
// switchMap(d => d.existSeriesLabels$)
|
106
|
-
// )
|
107
|
-
|
108
|
-
// const SeriesDataMap$ = gridDetail$.pipe(
|
109
|
-
// switchMap(d => d.SeriesDataMap$)
|
110
|
-
// )
|
111
|
-
|
112
|
-
// const GroupDataMap$ = gridDetail$.pipe(
|
113
|
-
// switchMap(d => d.GroupDataMap$)
|
114
|
-
// )
|
115
|
-
|
116
|
-
// const visibleComputedData$ = gridDetail$.pipe(
|
117
|
-
// switchMap(d => d.visibleComputedData$)
|
118
|
-
// )
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
// return {
|
123
|
-
// gridComputedData$,
|
124
|
-
// gridDataFormatter$,
|
125
|
-
// gridAxesTransform$,
|
126
|
-
// gridGraphicTransform$,
|
127
|
-
// gridGraphicReverseScale$,
|
128
|
-
// gridAxesReverseTransform$,
|
129
|
-
// gridAxesSize$,
|
130
|
-
// gridHighlight$,
|
131
|
-
// existSeriesLabels$,
|
132
|
-
// SeriesDataMap$,
|
133
|
-
// GroupDataMap$,
|
134
|
-
// visibleComputedData$,
|
135
|
-
// isSeriesPositionSeprate$,
|
136
|
-
// gridContainer$
|
137
|
-
// }
|
138
|
-
// }
|
13
|
+
import type {
|
14
|
+
ContextObserverMultiGrid,
|
15
|
+
ComputedDataGrid,
|
16
|
+
DataFormatterGrid,
|
17
|
+
ContextObserverGridDetail,
|
18
|
+
ContextObserverMultiGridDetail } from '@orbcharts/core'
|
139
19
|
|
140
20
|
// 可設定多個gridIndex的params
|
141
21
|
interface MultiGridPluginParams {
|
142
22
|
gridIndexes: number[]
|
143
23
|
}
|
144
24
|
|
145
|
-
interface MultiGridDetailObservables extends ContextObserverGridDetail {
|
146
|
-
gridComputedData$: Observable<ComputedDataGrid>
|
147
|
-
gridDataFormatter$: Observable<DataFormatterGrid>
|
148
|
-
}
|
149
|
-
|
150
|
-
|
151
25
|
// 對應grid資料的plugin所需Observable(必須有gridIndexes)
|
152
|
-
export const
|
26
|
+
export const multiGridPluginObservables = (observer: ContextObserverMultiGrid<MultiGridPluginParams>): Observable<ContextObserverMultiGridDetail[]> => {
|
153
27
|
const gridIndexes$ = observer.fullParams$.pipe(
|
154
28
|
map(fullParams => fullParams.gridIndexes),
|
155
29
|
distinctUntilChanged(),
|
156
30
|
shareReplay(1)
|
157
31
|
)
|
158
|
-
const destroy$ = new Subject()
|
159
|
-
|
160
|
-
// 合併所有gridHighlight$
|
161
|
-
const gridHighlight$ = observer.multiGridEachDetail$.pipe(
|
162
|
-
// switchMap(data => concat(...data.map(d => d.gridHighlight$))),
|
163
|
-
switchMap(data => {
|
164
|
-
return combineLatest(data.map(d => d.gridHighlight$))
|
165
|
-
}),
|
166
|
-
map(d => d.flat()),
|
167
|
-
shareReplay(1)
|
168
|
-
)
|
169
|
-
|
170
|
-
return gridIndexes$.pipe(
|
171
|
-
map(gridIndexes => {
|
172
|
-
return gridIndexes.map(gridIndex => {
|
173
|
-
// 每次重新計算時,清除之前的訂閱
|
174
|
-
destroy$.next(undefined)
|
175
|
-
|
176
|
-
const gridIndex$ = of(gridIndex).pipe(
|
177
|
-
takeUntil(destroy$),
|
178
|
-
shareReplay(1)
|
179
|
-
)
|
180
32
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
})
|
189
|
-
)
|
190
|
-
|
191
|
-
const gridDataFormatter$: Observable<DataFormatterGrid> = combineLatest({
|
192
|
-
fullDataFormatter: observer.fullDataFormatter$,
|
193
|
-
gridIndex: gridIndex$,
|
194
|
-
}).pipe(
|
195
|
-
takeUntil(destroy$),
|
196
|
-
map((data) => {
|
197
|
-
const defaultGrid = data.fullDataFormatter.gridList[0] // ?? DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT
|
198
|
-
|
199
|
-
return {
|
200
|
-
type: 'grid',
|
201
|
-
grid: {
|
202
|
-
...data.fullDataFormatter.gridList[data.gridIndex] ?? defaultGrid
|
203
|
-
},
|
204
|
-
container: {
|
205
|
-
...data.fullDataFormatter.container
|
206
|
-
}
|
207
|
-
}
|
208
|
-
})
|
209
|
-
)
|
210
|
-
|
211
|
-
const gridDetail$ = combineLatest({
|
212
|
-
multiGridEachDetail: observer.multiGridEachDetail$,
|
213
|
-
gridIndex: gridIndex$,
|
214
|
-
}).pipe(
|
215
|
-
takeUntil(destroy$),
|
216
|
-
switchMap(async d => d),
|
217
|
-
map(data => {
|
218
|
-
return data.multiGridEachDetail[data.gridIndex] ?? data.multiGridEachDetail[0]
|
219
|
-
}),
|
220
|
-
shareReplay(1)
|
221
|
-
)
|
222
|
-
|
223
|
-
const isSeriesPositionSeprate$ = gridDetail$.pipe(
|
224
|
-
switchMap(d => d.isSeriesPositionSeprate$)
|
225
|
-
)
|
226
|
-
|
227
|
-
const gridContainer$ = gridDetail$.pipe(
|
228
|
-
switchMap(d => d.gridContainer$)
|
229
|
-
)
|
230
|
-
|
231
|
-
const gridAxesTransform$ = gridDetail$.pipe(
|
232
|
-
switchMap(d => d.gridAxesTransform$)
|
233
|
-
)
|
234
|
-
|
235
|
-
const gridAxesReverseTransform$ = gridDetail$.pipe(
|
236
|
-
switchMap(d => d.gridAxesReverseTransform$)
|
237
|
-
)
|
238
|
-
|
239
|
-
const gridAxesSize$ = gridDetail$.pipe(
|
240
|
-
switchMap(d => d.gridAxesSize$)
|
241
|
-
)
|
242
|
-
|
243
|
-
const gridGraphicTransform$ = gridDetail$.pipe(
|
244
|
-
switchMap(d => d.gridGraphicTransform$)
|
245
|
-
)
|
246
|
-
|
247
|
-
const gridGraphicReverseScale$ = gridDetail$.pipe(
|
248
|
-
switchMap(d => d.gridGraphicReverseScale$)
|
249
|
-
)
|
250
|
-
|
251
|
-
// const gridHighlight$ = gridDetail$.pipe(
|
252
|
-
// switchMap(d => d.gridHighlight$)
|
253
|
-
// )
|
254
|
-
|
255
|
-
const existSeriesLabels$ = gridDetail$.pipe(
|
256
|
-
switchMap(d => d.existSeriesLabels$)
|
257
|
-
)
|
258
|
-
|
259
|
-
const SeriesDataMap$ = gridDetail$.pipe(
|
260
|
-
switchMap(d => d.SeriesDataMap$)
|
261
|
-
)
|
262
|
-
|
263
|
-
const GroupDataMap$ = gridDetail$.pipe(
|
264
|
-
switchMap(d => d.GroupDataMap$)
|
265
|
-
)
|
266
|
-
|
267
|
-
const visibleComputedData$ = gridDetail$.pipe(
|
268
|
-
switchMap(d => d.visibleComputedData$)
|
269
|
-
)
|
270
|
-
|
271
|
-
return {
|
272
|
-
gridComputedData$,
|
273
|
-
gridDataFormatter$,
|
274
|
-
gridAxesTransform$,
|
275
|
-
gridGraphicTransform$,
|
276
|
-
gridGraphicReverseScale$,
|
277
|
-
gridAxesReverseTransform$,
|
278
|
-
gridAxesSize$,
|
279
|
-
gridHighlight$,
|
280
|
-
existSeriesLabels$,
|
281
|
-
SeriesDataMap$,
|
282
|
-
GroupDataMap$,
|
283
|
-
visibleComputedData$,
|
284
|
-
isSeriesPositionSeprate$,
|
285
|
-
gridContainer$
|
286
|
-
}
|
33
|
+
return combineLatest({
|
34
|
+
multiGridEachDetail: observer.multiGridEachDetail$,
|
35
|
+
gridIndexes: gridIndexes$,
|
36
|
+
}).pipe(
|
37
|
+
map(data => {
|
38
|
+
return data.gridIndexes.map(gridIndex => {
|
39
|
+
return data.multiGridEachDetail[gridIndex] ?? data.multiGridEachDetail[0]
|
287
40
|
})
|
288
41
|
})
|
289
42
|
)
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import * as d3 from 'd3'
|
2
2
|
import {
|
3
|
-
Subject
|
3
|
+
Subject,
|
4
|
+
map,
|
5
|
+
distinctUntilChanged,
|
6
|
+
shareReplay,
|
7
|
+
takeUntil
|
8
|
+
} from 'rxjs'
|
4
9
|
import {
|
5
10
|
defineMultiGridPlugin } from '@orbcharts/core'
|
6
11
|
import { DEFAULT_MULTI_BAR_STACK_PARAMS } from '../defaults'
|
7
12
|
import { createBaseBarStack } from '../../base/BaseBarStack'
|
8
|
-
import {
|
13
|
+
import { multiGridPluginObservables } from '../multiGridObservables'
|
9
14
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
15
|
|
11
16
|
const pluginName = 'MultiBarStack'
|
@@ -17,7 +22,7 @@ export const MultiBarStack = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BAR
|
|
17
22
|
|
18
23
|
const unsubscribeFnArr: (() => void)[] = []
|
19
24
|
|
20
|
-
const multiGridPlugin$ =
|
25
|
+
const multiGridPlugin$ = multiGridPluginObservables(observer)
|
21
26
|
|
22
27
|
multiGridPlugin$.subscribe(data => {
|
23
28
|
// 每次重新計算時,清除之前的訂閱
|
@@ -31,23 +36,32 @@ export const MultiBarStack = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BAR
|
|
31
36
|
|
32
37
|
const gridSelection = d3.select(g[i])
|
33
38
|
|
39
|
+
const isSeriesSeprate$ = d.dataFormatter$.pipe(
|
40
|
+
takeUntil(destroy$),
|
41
|
+
map(d => d.grid.separateSeries),
|
42
|
+
distinctUntilChanged(),
|
43
|
+
shareReplay(1)
|
44
|
+
)
|
45
|
+
|
34
46
|
unsubscribeFnArr[i] = createBaseBarStack(pluginName, {
|
35
47
|
selection: gridSelection,
|
36
|
-
computedData$: d.
|
48
|
+
computedData$: d.computedData$,
|
37
49
|
visibleComputedData$: d.visibleComputedData$,
|
38
|
-
|
50
|
+
computedLayoutData$: d.computedLayoutData$,
|
51
|
+
visibleComputedLayoutData$: d.visibleComputedLayoutData$,
|
52
|
+
seriesLabels$: d.seriesLabels$,
|
39
53
|
SeriesDataMap$: d.SeriesDataMap$,
|
40
54
|
GroupDataMap$: d.GroupDataMap$,
|
41
55
|
fullParams$: observer.fullParams$,
|
42
|
-
fullDataFormatter$: d.
|
56
|
+
fullDataFormatter$: d.dataFormatter$,
|
43
57
|
fullChartParams$: observer.fullChartParams$,
|
44
58
|
gridAxesTransform$: d.gridAxesTransform$,
|
45
59
|
gridGraphicTransform$: d.gridGraphicTransform$,
|
46
60
|
gridGraphicReverseScale$: d.gridGraphicReverseScale$,
|
47
61
|
gridAxesSize$: d.gridAxesSize$,
|
48
62
|
gridHighlight$: d.gridHighlight$,
|
49
|
-
|
50
|
-
|
63
|
+
gridContainerPosition$: d.gridContainerPosition$,
|
64
|
+
isSeriesSeprate$,
|
51
65
|
event$: subject.event$ as Subject<any>,
|
52
66
|
})
|
53
67
|
})
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import * as d3 from 'd3'
|
2
2
|
import {
|
3
|
-
Subject
|
3
|
+
Subject,
|
4
|
+
map,
|
5
|
+
distinctUntilChanged,
|
6
|
+
shareReplay,
|
7
|
+
takeUntil
|
8
|
+
} from 'rxjs'
|
4
9
|
import {
|
5
10
|
defineMultiGridPlugin } from '@orbcharts/core'
|
6
11
|
import { DEFAULT_MULTI_BARS_PARAMS } from '../defaults'
|
7
12
|
import { createBaseBars } from '../../base/BaseBars'
|
8
|
-
import {
|
13
|
+
import { multiGridPluginObservables } from '../multiGridObservables'
|
9
14
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
15
|
|
11
16
|
const pluginName = 'MultiBars'
|
@@ -17,7 +22,7 @@ export const MultiBars = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BARS_PA
|
|
17
22
|
|
18
23
|
const unsubscribeFnArr: (() => void)[] = []
|
19
24
|
|
20
|
-
const multiGridPlugin$ =
|
25
|
+
const multiGridPlugin$ = multiGridPluginObservables(observer)
|
21
26
|
|
22
27
|
multiGridPlugin$.subscribe(data => {
|
23
28
|
// 每次重新計算時,清除之前的訂閱
|
@@ -31,11 +36,20 @@ export const MultiBars = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BARS_PA
|
|
31
36
|
|
32
37
|
const gridSelection = d3.select(g[i])
|
33
38
|
|
39
|
+
const isSeriesSeprate$ = d.dataFormatter$.pipe(
|
40
|
+
takeUntil(destroy$),
|
41
|
+
map(d => d.grid.separateSeries),
|
42
|
+
distinctUntilChanged(),
|
43
|
+
shareReplay(1)
|
44
|
+
)
|
45
|
+
|
34
46
|
unsubscribeFnArr[i] = createBaseBars(pluginName, {
|
35
47
|
selection: gridSelection,
|
36
|
-
computedData$: d.
|
48
|
+
computedData$: d.computedData$,
|
37
49
|
visibleComputedData$: d.visibleComputedData$,
|
38
|
-
|
50
|
+
computedLayoutData$: d.computedLayoutData$,
|
51
|
+
visibleComputedLayoutData$: d.visibleComputedLayoutData$,
|
52
|
+
seriesLabels$: d.seriesLabels$,
|
39
53
|
SeriesDataMap$: d.SeriesDataMap$,
|
40
54
|
GroupDataMap$: d.GroupDataMap$,
|
41
55
|
fullParams$: observer.fullParams$,
|
@@ -45,8 +59,8 @@ export const MultiBars = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BARS_PA
|
|
45
59
|
gridGraphicReverseScale$: d.gridGraphicReverseScale$,
|
46
60
|
gridAxesSize$: d.gridAxesSize$,
|
47
61
|
gridHighlight$: d.gridHighlight$,
|
48
|
-
|
49
|
-
|
62
|
+
gridContainerPosition$: d.gridContainerPosition$,
|
63
|
+
isSeriesSeprate$,
|
50
64
|
event$: subject.event$ as Subject<any>,
|
51
65
|
})
|
52
66
|
})
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import * as d3 from 'd3'
|
2
2
|
import {
|
3
|
-
Subject
|
3
|
+
Subject,
|
4
|
+
map,
|
5
|
+
distinctUntilChanged,
|
6
|
+
shareReplay,
|
7
|
+
takeUntil
|
8
|
+
} from 'rxjs'
|
4
9
|
import {
|
5
10
|
defineMultiGridPlugin } from '@orbcharts/core'
|
6
11
|
import { DEFAULT_MULTI_BARS_TRIANGLE_PARAMS } from '../defaults'
|
7
12
|
import { createBaseBarsTriangle } from '../../base/BaseBarsTriangle'
|
8
|
-
import {
|
13
|
+
import { multiGridPluginObservables } from '../multiGridObservables'
|
9
14
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
15
|
|
11
16
|
const pluginName = 'MultiBarsTriangle'
|
@@ -17,7 +22,7 @@ export const MultiBarsTriangle = defineMultiGridPlugin(pluginName, DEFAULT_MULTI
|
|
17
22
|
|
18
23
|
const unsubscribeFnArr: (() => void)[] = []
|
19
24
|
|
20
|
-
const multiGridPlugin$ =
|
25
|
+
const multiGridPlugin$ = multiGridPluginObservables(observer)
|
21
26
|
|
22
27
|
multiGridPlugin$.subscribe(data => {
|
23
28
|
// 每次重新計算時,清除之前的訂閱
|
@@ -31,21 +36,31 @@ export const MultiBarsTriangle = defineMultiGridPlugin(pluginName, DEFAULT_MULTI
|
|
31
36
|
|
32
37
|
const gridSelection = d3.select(g[i])
|
33
38
|
|
39
|
+
const isSeriesSeprate$ = d.dataFormatter$.pipe(
|
40
|
+
takeUntil(destroy$),
|
41
|
+
map(d => d.grid.separateSeries),
|
42
|
+
distinctUntilChanged(),
|
43
|
+
shareReplay(1)
|
44
|
+
)
|
45
|
+
|
34
46
|
unsubscribeFnArr[i] = createBaseBarsTriangle(pluginName, {
|
35
47
|
selection: gridSelection,
|
36
|
-
computedData$: d.
|
48
|
+
computedData$: d.computedData$,
|
37
49
|
visibleComputedData$: d.visibleComputedData$,
|
38
|
-
|
50
|
+
computedLayoutData$: d.computedLayoutData$,
|
51
|
+
visibleComputedLayoutData$: d.visibleComputedLayoutData$,
|
52
|
+
seriesLabels$: d.seriesLabels$,
|
39
53
|
SeriesDataMap$: d.SeriesDataMap$,
|
40
54
|
GroupDataMap$: d.GroupDataMap$,
|
41
55
|
fullParams$: observer.fullParams$,
|
42
56
|
fullChartParams$: observer.fullChartParams$,
|
57
|
+
fullDataFormatter$: d.dataFormatter$,
|
43
58
|
gridAxesTransform$: d.gridAxesTransform$,
|
44
59
|
gridGraphicTransform$: d.gridGraphicTransform$,
|
45
60
|
gridAxesSize$: d.gridAxesSize$,
|
46
61
|
gridHighlight$: d.gridHighlight$,
|
47
|
-
|
48
|
-
|
62
|
+
gridContainerPosition$: d.gridContainerPosition$,
|
63
|
+
isSeriesSeprate$: isSeriesSeprate$,
|
49
64
|
event$: subject.event$ as Subject<any>,
|
50
65
|
})
|
51
66
|
})
|