@orbcharts/plugins-basic 3.0.0-alpha.48 → 3.0.0-alpha.50
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/orbcharts-plugins-basic.es.js +7956 -7491
- package/dist/orbcharts-plugins-basic.umd.js +9 -9
- package/dist/src/multiGrid/defaults.d.ts +2 -1
- package/dist/src/multiGrid/index.d.ts +2 -0
- package/dist/src/multiGrid/multiGridObservables.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiValueStackAxis.d.ts +1 -0
- package/dist/src/multiGrid/plugins/OverlappingValueStackAxes.d.ts +1 -0
- package/dist/src/multiGrid/types.d.ts +3 -0
- package/dist/src/series/defaults.d.ts +3 -1
- package/dist/src/series/index.d.ts +2 -0
- package/dist/src/series/plugins/Rose.d.ts +10 -0
- package/dist/src/series/plugins/RoseLabels.d.ts +3 -0
- package/dist/src/series/types.d.ts +17 -5
- package/package.json +2 -2
- package/src/grid/defaults.ts +3 -1
- package/src/grid/gridObservables.ts +1 -0
- package/src/grid/plugins/BarStack.ts +1 -8
- package/src/grid/plugins/Bars.ts +1 -8
- package/src/grid/plugins/BarsTriangle.ts +1 -9
- package/src/grid/plugins/GroupAxis.ts +1 -8
- package/src/grid/plugins/ValueAxis.ts +1 -8
- package/src/grid/plugins/ValueStackAxis.ts +4 -45
- package/src/multiGrid/defaults.ts +5 -0
- package/src/multiGrid/index.ts +3 -1
- package/src/multiGrid/multiGridObservables.ts +3 -2
- package/src/multiGrid/plugins/MultiBarStack.ts +3 -3
- package/src/multiGrid/plugins/MultiBars.ts +3 -3
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +3 -3
- package/src/multiGrid/plugins/MultiDots.ts +3 -3
- package/src/multiGrid/plugins/MultiGroupAxis.ts +3 -3
- package/src/multiGrid/plugins/MultiLineAreas.ts +3 -3
- package/src/multiGrid/plugins/MultiLines.ts +3 -3
- package/src/multiGrid/plugins/MultiValueAxis.ts +3 -3
- package/src/multiGrid/plugins/MultiValueStackAxis.ts +69 -0
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +5 -12
- package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +167 -0
- package/src/multiGrid/types.ts +4 -0
- package/src/series/defaults.ts +22 -5
- package/src/series/index.ts +3 -1
- package/src/series/plugins/Bubbles.ts +4 -4
- package/src/series/plugins/Pie.ts +18 -17
- package/src/series/plugins/PieLabels.ts +16 -51
- package/src/series/plugins/Rose.ts +473 -0
- package/src/series/plugins/RoseLabels.ts +362 -0
- package/src/series/seriesUtils.ts +2 -1
- package/src/series/types.ts +21 -5
@@ -1,8 +1,9 @@
|
|
1
|
-
import { MultiGridLegendParams, MultiBarsParams, MultiBarStackParams, MultiBarsTriangleParams, MultiLinesParams, MultiLineAreasParams, MultiDotsParams, MultiGroupAxisParams, MultiValueAxisParams, OverlappingValueAxesParams } from './types';
|
1
|
+
import { MultiGridLegendParams, MultiBarsParams, MultiBarStackParams, MultiBarsTriangleParams, MultiLinesParams, MultiLineAreasParams, MultiDotsParams, MultiGroupAxisParams, MultiValueAxisParams, MultiValueStackAxisParams, OverlappingValueAxesParams } from './types';
|
2
2
|
|
3
3
|
export declare const DEFAULT_MULTI_GRID_LEGEND_PARAMS: MultiGridLegendParams;
|
4
4
|
export declare const DEFAULT_MULTI_GROUP_AXIS_PARAMS: MultiGroupAxisParams;
|
5
5
|
export declare const DEFAULT_MULTI_VALUE_AXIS_PARAMS: MultiValueAxisParams;
|
6
|
+
export declare const DEFAULT_MULTI_VALUE_STACK_AXIS_PARAMS: MultiValueStackAxisParams;
|
6
7
|
export declare const DEFAULT_MULTI_BARS_PARAMS: MultiBarsParams;
|
7
8
|
export declare const DEFAULT_MULTI_BAR_STACK_PARAMS: MultiBarStackParams;
|
8
9
|
export declare const DEFAULT_MULTI_BARS_TRIANGLE_PARAMS: MultiBarsTriangleParams;
|
@@ -9,4 +9,6 @@ export { MultiLineAreas } from './plugins/MultiLineAreas';
|
|
9
9
|
export { MultiDots } from './plugins/MultiDots';
|
10
10
|
export { MultiGroupAxis } from './plugins/MultiGroupAxis';
|
11
11
|
export { MultiValueAxis } from './plugins/MultiValueAxis';
|
12
|
+
export { MultiValueStackAxis } from './plugins/MultiValueStackAxis';
|
12
13
|
export { OverlappingValueAxes } from './plugins/OverlappingValueAxes';
|
14
|
+
export { OverlappingValueStackAxes } from './plugins/OverlappingValueStackAxes';
|
@@ -4,5 +4,5 @@ import { ContextObserverMultiGrid, ContextObserverMultiGridDetail } from '@orbch
|
|
4
4
|
interface MultiGridPluginParams {
|
5
5
|
gridIndexes: number[];
|
6
6
|
}
|
7
|
-
export declare const
|
7
|
+
export declare const multiGridPluginDetailObservables: (observer: ContextObserverMultiGrid<MultiGridPluginParams>) => Observable<ContextObserverMultiGridDetail[]>;
|
8
8
|
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const MultiValueStackAxis: import('@orbcharts/core').PluginConstructor<"multiGrid", string, import('..').MultiValueAxisParams>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const OverlappingValueStackAxes: import('@orbcharts/core').PluginConstructor<"multiGrid", string, import('..').OverlappingValueAxesParams>;
|
@@ -31,6 +31,9 @@ export interface MultiGroupAxisParams extends BaseGroupAxisParams {
|
|
31
31
|
export interface MultiValueAxisParams extends BaseValueAxisParams {
|
32
32
|
gridIndexes: number[];
|
33
33
|
}
|
34
|
+
export interface MultiValueStackAxisParams extends BaseValueAxisParams {
|
35
|
+
gridIndexes: number[];
|
36
|
+
}
|
34
37
|
export interface MultiBarsParams extends BaseBarsParams {
|
35
38
|
gridIndexes: number[];
|
36
39
|
}
|
@@ -1,7 +1,9 @@
|
|
1
|
-
import { BubblesParams, PieParams, PieEventTextsParams, PieLabelsParams, SeriesLegendParams } from './types';
|
1
|
+
import { BubblesParams, PieParams, PieEventTextsParams, PieLabelsParams, RoseParams, RoseLabelsParams, SeriesLegendParams } from './types';
|
2
2
|
|
3
3
|
export declare const DEFAULT_BUBBLES_PARAMS: BubblesParams;
|
4
4
|
export declare const DEFAULT_PIE_PARAMS: PieParams;
|
5
5
|
export declare const DEFAULT_PIE_EVENT_TEXTS_PARAMS: PieEventTextsParams;
|
6
6
|
export declare const DEFAULT_PIE_LABELS_PARAMS: PieLabelsParams;
|
7
|
+
export declare const DEFAULT_ROSE_PARAMS: RoseParams;
|
8
|
+
export declare const DEFAULT_ROSE_LABELS_PARAMS: RoseLabelsParams;
|
7
9
|
export declare const DEFAULT_SERIES_LEGEND_PARAMS: SeriesLegendParams;
|
@@ -4,4 +4,6 @@ export { Bubbles } from './plugins/Bubbles';
|
|
4
4
|
export { Pie } from './plugins/Pie';
|
5
5
|
export { PieEventTexts } from './plugins/PieEventTexts';
|
6
6
|
export { PieLabels } from './plugins/PieLabels';
|
7
|
+
export { Rose } from './plugins/Rose';
|
8
|
+
export { RoseLabels } from './plugins/RoseLabels';
|
7
9
|
export { SeriesLegend } from './plugins/SeriesLegend';
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { ComputedDatumSeries } from '@orbcharts/core';
|
2
|
+
import { D3PieDatum } from '../seriesUtils';
|
3
|
+
import { RoseParams } from '../types';
|
4
|
+
|
5
|
+
export interface PieDatum extends D3PieDatum {
|
6
|
+
data: ComputedDatumSeries;
|
7
|
+
id: string;
|
8
|
+
prevValue: number;
|
9
|
+
}
|
10
|
+
export declare const Rose: import('@orbcharts/core').PluginConstructor<"series", string, RoseParams>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ComputedDatumSeries, EventSeries, EventName, ColorType } from '@orbcharts/core';
|
2
2
|
|
3
|
-
export type
|
3
|
+
export type ArcScaleType = 'area' | 'radius';
|
4
4
|
export interface BubblesParams {
|
5
5
|
force: {
|
6
6
|
strength: number;
|
@@ -13,13 +13,12 @@ export interface BubblesParams {
|
|
13
13
|
lineLengthMin: number;
|
14
14
|
};
|
15
15
|
highlightRIncrease: number;
|
16
|
-
|
16
|
+
arcScaleType: ArcScaleType;
|
17
17
|
}
|
18
18
|
export interface PieParams {
|
19
19
|
outerRadius: number;
|
20
20
|
innerRadius: number;
|
21
|
-
|
22
|
-
enterDuration: number;
|
21
|
+
mouseoverOuterRadius: number;
|
23
22
|
startAngle: number;
|
24
23
|
endAngle: number;
|
25
24
|
padAngle: number;
|
@@ -36,13 +35,26 @@ export interface PieEventTextsParams {
|
|
36
35
|
}
|
37
36
|
export interface PieLabelsParams {
|
38
37
|
outerRadius: number;
|
39
|
-
|
38
|
+
mouseoverOuterRadius: number;
|
40
39
|
startAngle: number;
|
41
40
|
endAngle: number;
|
42
41
|
labelCentroid: number;
|
43
42
|
labelFn: ((d: ComputedDatumSeries) => string);
|
44
43
|
labelColorType: ColorType;
|
45
44
|
}
|
45
|
+
export interface RoseParams {
|
46
|
+
outerRadius: number;
|
47
|
+
cornerRadius: number;
|
48
|
+
arcScaleType: ArcScaleType;
|
49
|
+
mouseoverAngleIncrease: number;
|
50
|
+
}
|
51
|
+
export interface RoseLabelsParams {
|
52
|
+
outerRadius: number;
|
53
|
+
labelCentroid: number;
|
54
|
+
labelFn: ((d: ComputedDatumSeries) => string);
|
55
|
+
labelColorType: ColorType;
|
56
|
+
arcScaleType: ArcScaleType;
|
57
|
+
}
|
46
58
|
export interface SeriesLegendParams {
|
47
59
|
position: 'top' | 'bottom' | 'left' | 'right';
|
48
60
|
justify: 'start' | 'center' | 'end';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orbcharts/plugins-basic",
|
3
|
-
"version": "3.0.0-alpha.
|
3
|
+
"version": "3.0.0-alpha.50",
|
4
4
|
"description": "plugins for OrbCharts",
|
5
5
|
"author": "Blue Planet Inc.",
|
6
6
|
"license": "Apache-2.0",
|
@@ -35,7 +35,7 @@
|
|
35
35
|
"vite-plugin-dts": "^3.7.3"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@orbcharts/core": "^3.0.0-alpha.
|
38
|
+
"@orbcharts/core": "^3.0.0-alpha.48",
|
39
39
|
"d3": "^7.8.5",
|
40
40
|
"rxjs": "^7.8.1"
|
41
41
|
}
|
package/src/grid/defaults.ts
CHANGED
@@ -99,7 +99,9 @@ export const DEFAULT_VALUE_AXIS_PARAMS: ValueAxisParams = {
|
|
99
99
|
tickTextColorType: 'primary'
|
100
100
|
}
|
101
101
|
|
102
|
-
export const DEFAULT_VALUE_STACK_AXIS_PARAMS: ValueStackAxisParams =
|
102
|
+
export const DEFAULT_VALUE_STACK_AXIS_PARAMS: ValueStackAxisParams = {
|
103
|
+
...DEFAULT_VALUE_AXIS_PARAMS
|
104
|
+
}
|
103
105
|
|
104
106
|
export const DEFAULT_SCALING_AREA_PARAMS: ScalingAreaParams = {
|
105
107
|
|
@@ -15,13 +15,6 @@ const pluginName = 'BarStack'
|
|
15
15
|
export const BarStack = defineGridPlugin(pluginName, DEFAULT_BAR_STACK_PARAMS)(({ selection, name, subject, observer }) => {
|
16
16
|
const destroy$ = new Subject()
|
17
17
|
|
18
|
-
const isSeriesSeprate$ = observer.fullDataFormatter$.pipe(
|
19
|
-
takeUntil(destroy$),
|
20
|
-
map(d => d.grid.separateSeries),
|
21
|
-
distinctUntilChanged(),
|
22
|
-
shareReplay(1)
|
23
|
-
)
|
24
|
-
|
25
18
|
const unsubscribeBaseBars = createBaseBarStack(pluginName, {
|
26
19
|
selection,
|
27
20
|
computedData$: observer.computedData$,
|
@@ -40,7 +33,7 @@ export const BarStack = defineGridPlugin(pluginName, DEFAULT_BAR_STACK_PARAMS)((
|
|
40
33
|
gridAxesSize$: observer.gridAxesSize$,
|
41
34
|
gridHighlight$: observer.gridHighlight$,
|
42
35
|
gridContainerPosition$: observer.gridContainerPosition$,
|
43
|
-
isSeriesSeprate$,
|
36
|
+
isSeriesSeprate$: observer.isSeriesSeprate$,
|
44
37
|
event$: subject.event$,
|
45
38
|
})
|
46
39
|
|
package/src/grid/plugins/Bars.ts
CHANGED
@@ -16,13 +16,6 @@ const pluginName = 'Bars'
|
|
16
16
|
export const Bars = defineGridPlugin(pluginName, DEFAULT_BARS_PARAMS)(({ selection, name, subject, observer }) => {
|
17
17
|
const destroy$ = new Subject()
|
18
18
|
|
19
|
-
const isSeriesSeprate$ = observer.fullDataFormatter$.pipe(
|
20
|
-
takeUntil(destroy$),
|
21
|
-
map(d => d.grid.separateSeries),
|
22
|
-
distinctUntilChanged(),
|
23
|
-
shareReplay(1)
|
24
|
-
)
|
25
|
-
|
26
19
|
const unsubscribeBaseBars = createBaseBars(pluginName, {
|
27
20
|
selection,
|
28
21
|
computedData$: observer.computedData$,
|
@@ -40,7 +33,7 @@ export const Bars = defineGridPlugin(pluginName, DEFAULT_BARS_PARAMS)(({ selecti
|
|
40
33
|
gridAxesSize$: observer.gridAxesSize$,
|
41
34
|
gridHighlight$: observer.gridHighlight$,
|
42
35
|
gridContainerPosition$: observer.gridContainerPosition$,
|
43
|
-
isSeriesSeprate$: isSeriesSeprate$,
|
36
|
+
isSeriesSeprate$: observer.isSeriesSeprate$,
|
44
37
|
event$: subject.event$,
|
45
38
|
})
|
46
39
|
|
@@ -15,14 +15,6 @@ const pluginName = 'BarsTriangle'
|
|
15
15
|
export const BarsTriangle = defineGridPlugin(pluginName, DEFAULT_BARS_TRIANGLE_PARAMS)(({ selection, name, subject, observer }) => {
|
16
16
|
const destroy$ = new Subject()
|
17
17
|
|
18
|
-
|
19
|
-
const isSeriesSeprate$ = observer.fullDataFormatter$.pipe(
|
20
|
-
takeUntil(destroy$),
|
21
|
-
map(d => d.grid.separateSeries),
|
22
|
-
distinctUntilChanged(),
|
23
|
-
shareReplay(1)
|
24
|
-
)
|
25
|
-
|
26
18
|
const unsubscribeBaseBars = createBaseBarsTriangle(pluginName, {
|
27
19
|
selection,
|
28
20
|
computedData$: observer.computedData$,
|
@@ -40,7 +32,7 @@ export const BarsTriangle = defineGridPlugin(pluginName, DEFAULT_BARS_TRIANGLE_P
|
|
40
32
|
gridAxesSize$: observer.gridAxesSize$,
|
41
33
|
gridHighlight$: observer.gridHighlight$,
|
42
34
|
gridContainerPosition$: observer.gridContainerPosition$,
|
43
|
-
isSeriesSeprate$,
|
35
|
+
isSeriesSeprate$: observer.isSeriesSeprate$,
|
44
36
|
event$: subject.event$,
|
45
37
|
})
|
46
38
|
|
@@ -16,13 +16,6 @@ export const GroupAxis = defineGridPlugin(pluginName, DEFAULT_GROUP_AXIS_PARAMS)
|
|
16
16
|
|
17
17
|
const destroy$ = new Subject()
|
18
18
|
|
19
|
-
const isSeriesSeprate$ = observer.fullDataFormatter$.pipe(
|
20
|
-
takeUntil(destroy$),
|
21
|
-
map(d => d.grid.separateSeries),
|
22
|
-
distinctUntilChanged(),
|
23
|
-
shareReplay(1)
|
24
|
-
)
|
25
|
-
|
26
19
|
const unsubscribeBaseGroupAxis = createBaseGroupAxis(pluginName, {
|
27
20
|
selection,
|
28
21
|
computedData$: observer.computedData$,
|
@@ -33,7 +26,7 @@ export const GroupAxis = defineGridPlugin(pluginName, DEFAULT_GROUP_AXIS_PARAMS)
|
|
33
26
|
gridAxesReverseTransform$: observer.gridAxesReverseTransform$,
|
34
27
|
gridAxesSize$: observer.gridAxesSize$,
|
35
28
|
gridContainerPosition$: observer.gridContainerPosition$,
|
36
|
-
isSeriesSeprate$,
|
29
|
+
isSeriesSeprate$: observer.isSeriesSeprate$,
|
37
30
|
})
|
38
31
|
|
39
32
|
return () => {
|
@@ -17,13 +17,6 @@ export const ValueAxis = defineGridPlugin(pluginName, DEFAULT_VALUE_AXIS_PARAMS)
|
|
17
17
|
|
18
18
|
const destroy$ = new Subject()
|
19
19
|
|
20
|
-
const isSeriesSeprate$ = observer.fullDataFormatter$.pipe(
|
21
|
-
takeUntil(destroy$),
|
22
|
-
map(d => d.grid.separateSeries),
|
23
|
-
distinctUntilChanged(),
|
24
|
-
shareReplay(1)
|
25
|
-
)
|
26
|
-
|
27
20
|
const unsubscribeBaseValueAxis = createBaseValueAxis(pluginName, {
|
28
21
|
selection,
|
29
22
|
computedData$: observer.computedData$,
|
@@ -34,7 +27,7 @@ export const ValueAxis = defineGridPlugin(pluginName, DEFAULT_VALUE_AXIS_PARAMS)
|
|
34
27
|
gridAxesReverseTransform$: observer.gridAxesReverseTransform$,
|
35
28
|
gridAxesSize$: observer.gridAxesSize$,
|
36
29
|
gridContainerPosition$: observer.gridContainerPosition$,
|
37
|
-
isSeriesSeprate$,
|
30
|
+
isSeriesSeprate$: observer.isSeriesSeprate$,
|
38
31
|
})
|
39
32
|
|
40
33
|
return () => {
|
@@ -5,11 +5,12 @@ import {
|
|
5
5
|
shareReplay,
|
6
6
|
switchMap,
|
7
7
|
iif,
|
8
|
+
Observable,
|
8
9
|
Subject } from 'rxjs'
|
10
|
+
import type { ComputedDataGrid } from '@orbcharts/core'
|
9
11
|
import {
|
10
12
|
defineGridPlugin } from '@orbcharts/core'
|
11
13
|
import { DEFAULT_VALUE_STACK_AXIS_PARAMS } from '../defaults'
|
12
|
-
|
13
14
|
import { createBaseValueAxis } from '../../base/BaseValueAxis'
|
14
15
|
|
15
16
|
const pluginName = 'ValueStackAxis'
|
@@ -18,51 +19,9 @@ export const ValueStackAxis = defineGridPlugin(pluginName, DEFAULT_VALUE_STACK_A
|
|
18
19
|
|
19
20
|
const destroy$ = new Subject()
|
20
21
|
|
21
|
-
// 將原本的value全部替換成加總後的value
|
22
|
-
const stackedData$ = observer.computedData$.pipe(
|
23
|
-
takeUntil(destroy$),
|
24
|
-
map(data => {
|
25
|
-
// 將同一group的value加總起來
|
26
|
-
const stackedValue = new Array(data[0] ? data[0].length : 0)
|
27
|
-
.fill(null)
|
28
|
-
.map((_, i) => {
|
29
|
-
return data.reduce((prev, current) => {
|
30
|
-
if (current && current[i]) {
|
31
|
-
const currentValue = current[i].value == null || current[i].visible == false
|
32
|
-
? 0
|
33
|
-
: current[i].value!
|
34
|
-
return prev + currentValue
|
35
|
-
}
|
36
|
-
return prev
|
37
|
-
}, 0)
|
38
|
-
})
|
39
|
-
// 將原本的value全部替換成加總後的value
|
40
|
-
const computedData = data.map((series, seriesIndex) => {
|
41
|
-
return series.map((d, i) => {
|
42
|
-
return {
|
43
|
-
...d,
|
44
|
-
value: stackedValue[i],
|
45
|
-
}
|
46
|
-
})
|
47
|
-
})
|
48
|
-
return computedData
|
49
|
-
}),
|
50
|
-
)
|
51
|
-
|
52
|
-
const isSeriesSeprate$ = observer.fullDataFormatter$.pipe(
|
53
|
-
takeUntil(destroy$),
|
54
|
-
map(d => d.grid.separateSeries),
|
55
|
-
distinctUntilChanged(),
|
56
|
-
shareReplay(1)
|
57
|
-
)
|
58
|
-
|
59
22
|
const unsubscribeBaseValueAxis = createBaseValueAxis(pluginName, {
|
60
23
|
selection,
|
61
|
-
computedData$:
|
62
|
-
switchMap(isSeriesSeprate => {
|
63
|
-
return iif(() => isSeriesSeprate, observer.computedData$, stackedData$)
|
64
|
-
})
|
65
|
-
),
|
24
|
+
computedData$: observer.computedStackedData$, // 計算疊加value的資料
|
66
25
|
fullParams$: observer.fullParams$,
|
67
26
|
fullDataFormatter$: observer.fullDataFormatter$,
|
68
27
|
fullChartParams$: observer.fullChartParams$,
|
@@ -70,7 +29,7 @@ export const ValueStackAxis = defineGridPlugin(pluginName, DEFAULT_VALUE_STACK_A
|
|
70
29
|
gridAxesReverseTransform$: observer.gridAxesReverseTransform$,
|
71
30
|
gridAxesSize$: observer.gridAxesSize$,
|
72
31
|
gridContainerPosition$: observer.gridContainerPosition$,
|
73
|
-
isSeriesSeprate$,
|
32
|
+
isSeriesSeprate$: observer.isSeriesSeprate$,
|
74
33
|
})
|
75
34
|
|
76
35
|
return () => {
|
@@ -8,6 +8,7 @@ import type {
|
|
8
8
|
MultiDotsParams,
|
9
9
|
MultiGroupAxisParams,
|
10
10
|
MultiValueAxisParams,
|
11
|
+
MultiValueStackAxisParams,
|
11
12
|
OverlappingValueAxesParams
|
12
13
|
} from './types'
|
13
14
|
|
@@ -66,6 +67,10 @@ export const DEFAULT_MULTI_VALUE_AXIS_PARAMS: MultiValueAxisParams = {
|
|
66
67
|
gridIndexes: [0]
|
67
68
|
}
|
68
69
|
|
70
|
+
export const DEFAULT_MULTI_VALUE_STACK_AXIS_PARAMS: MultiValueStackAxisParams = {
|
71
|
+
...DEFAULT_MULTI_VALUE_AXIS_PARAMS
|
72
|
+
}
|
73
|
+
|
69
74
|
export const DEFAULT_MULTI_BARS_PARAMS: MultiBarsParams = {
|
70
75
|
barWidth: 0,
|
71
76
|
barPadding: 1,
|
package/src/multiGrid/index.ts
CHANGED
@@ -9,4 +9,6 @@ export { MultiLineAreas } from './plugins/MultiLineAreas'
|
|
9
9
|
export { MultiDots } from './plugins/MultiDots'
|
10
10
|
export { MultiGroupAxis } from './plugins/MultiGroupAxis'
|
11
11
|
export { MultiValueAxis } from './plugins/MultiValueAxis'
|
12
|
-
export {
|
12
|
+
export { MultiValueStackAxis } from './plugins/MultiValueStackAxis'
|
13
|
+
export { OverlappingValueAxes } from './plugins/OverlappingValueAxes'
|
14
|
+
export { OverlappingValueStackAxes } from './plugins/OverlappingValueStackAxes'
|
@@ -23,7 +23,7 @@ interface MultiGridPluginParams {
|
|
23
23
|
}
|
24
24
|
|
25
25
|
// 對應grid資料的plugin所需Observable(必須有gridIndexes)
|
26
|
-
export const
|
26
|
+
export const multiGridPluginDetailObservables = (observer: ContextObserverMultiGrid<MultiGridPluginParams>): Observable<ContextObserverMultiGridDetail[]> => {
|
27
27
|
const gridIndexes$ = observer.fullParams$.pipe(
|
28
28
|
map(fullParams => fullParams.gridIndexes),
|
29
29
|
distinctUntilChanged(),
|
@@ -40,4 +40,5 @@ export const multiGridPluginObservables = (observer: ContextObserverMultiGrid<Mu
|
|
40
40
|
})
|
41
41
|
})
|
42
42
|
)
|
43
|
-
}
|
43
|
+
}
|
44
|
+
|
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
defineMultiGridPlugin } from '@orbcharts/core'
|
11
11
|
import { DEFAULT_MULTI_BAR_STACK_PARAMS } from '../defaults'
|
12
12
|
import { createBaseBarStack } from '../../base/BaseBarStack'
|
13
|
-
import {
|
13
|
+
import { multiGridPluginDetailObservables } from '../multiGridObservables'
|
14
14
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
15
15
|
|
16
16
|
const pluginName = 'MultiBarStack'
|
@@ -22,9 +22,9 @@ export const MultiBarStack = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BAR
|
|
22
22
|
|
23
23
|
const unsubscribeFnArr: (() => void)[] = []
|
24
24
|
|
25
|
-
const
|
25
|
+
const multiGridPluginDetail$ = multiGridPluginDetailObservables(observer)
|
26
26
|
|
27
|
-
|
27
|
+
multiGridPluginDetail$
|
28
28
|
.pipe(
|
29
29
|
takeUntil(destroy$)
|
30
30
|
)
|
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
defineMultiGridPlugin } from '@orbcharts/core'
|
11
11
|
import { DEFAULT_MULTI_BARS_PARAMS } from '../defaults'
|
12
12
|
import { createBaseBars } from '../../base/BaseBars'
|
13
|
-
import {
|
13
|
+
import { multiGridPluginDetailObservables } from '../multiGridObservables'
|
14
14
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
15
15
|
|
16
16
|
const pluginName = 'MultiBars'
|
@@ -22,9 +22,9 @@ export const MultiBars = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BARS_PA
|
|
22
22
|
|
23
23
|
const unsubscribeFnArr: (() => void)[] = []
|
24
24
|
|
25
|
-
const
|
25
|
+
const multiGridPluginDetail$ = multiGridPluginDetailObservables(observer)
|
26
26
|
|
27
|
-
|
27
|
+
multiGridPluginDetail$
|
28
28
|
.pipe(
|
29
29
|
takeUntil(destroy$)
|
30
30
|
)
|
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
defineMultiGridPlugin } from '@orbcharts/core'
|
11
11
|
import { DEFAULT_MULTI_BARS_TRIANGLE_PARAMS } from '../defaults'
|
12
12
|
import { createBaseBarsTriangle } from '../../base/BaseBarsTriangle'
|
13
|
-
import {
|
13
|
+
import { multiGridPluginDetailObservables } from '../multiGridObservables'
|
14
14
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
15
15
|
|
16
16
|
const pluginName = 'MultiBarsTriangle'
|
@@ -22,9 +22,9 @@ export const MultiBarsTriangle = defineMultiGridPlugin(pluginName, DEFAULT_MULTI
|
|
22
22
|
|
23
23
|
const unsubscribeFnArr: (() => void)[] = []
|
24
24
|
|
25
|
-
const
|
25
|
+
const multiGridPluginDetail$ = multiGridPluginDetailObservables(observer)
|
26
26
|
|
27
|
-
|
27
|
+
multiGridPluginDetail$
|
28
28
|
.pipe(
|
29
29
|
takeUntil(destroy$)
|
30
30
|
)
|
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
defineMultiGridPlugin } from '@orbcharts/core'
|
7
7
|
import { DEFAULT_MULTI_DOTS_PARAMS } from '../defaults'
|
8
8
|
import { createBaseDots } from '../../base/BaseDots'
|
9
|
-
import {
|
9
|
+
import { multiGridPluginDetailObservables } from '../multiGridObservables'
|
10
10
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
11
11
|
|
12
12
|
const pluginName = 'MultiDots'
|
@@ -18,9 +18,9 @@ export const MultiDots = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_DOTS_PA
|
|
18
18
|
|
19
19
|
const unsubscribeFnArr: (() => void)[] = []
|
20
20
|
|
21
|
-
const
|
21
|
+
const multiGridPluginDetail$ = multiGridPluginDetailObservables(observer)
|
22
22
|
|
23
|
-
|
23
|
+
multiGridPluginDetail$
|
24
24
|
.pipe(
|
25
25
|
takeUntil(destroy$)
|
26
26
|
)
|
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
defineMultiGridPlugin } from '@orbcharts/core'
|
11
11
|
import { DEFAULT_MULTI_GROUP_AXIS_PARAMS } from '../defaults'
|
12
12
|
import { createBaseGroupAxis } from '../../base/BaseGroupAxis'
|
13
|
-
import {
|
13
|
+
import { multiGridPluginDetailObservables } from '../multiGridObservables'
|
14
14
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
15
15
|
|
16
16
|
const pluginName = 'MultiGroupAxis'
|
@@ -22,9 +22,9 @@ export const MultiGroupAxis = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_GR
|
|
22
22
|
|
23
23
|
const unsubscribeFnArr: (() => void)[] = []
|
24
24
|
|
25
|
-
const
|
25
|
+
const multiGridPluginDetail$ = multiGridPluginDetailObservables(observer)
|
26
26
|
|
27
|
-
|
27
|
+
multiGridPluginDetail$
|
28
28
|
.pipe(
|
29
29
|
takeUntil(destroy$)
|
30
30
|
)
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
|
8
8
|
import { DEFAULT_MULTI_LINE_AREAS_PARAMS } from '../defaults'
|
9
9
|
import { createBaseLineAreas } from '../../base/BaseLineAreas'
|
10
|
-
import {
|
10
|
+
import { multiGridPluginDetailObservables } from '../multiGridObservables'
|
11
11
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
12
12
|
|
13
13
|
const pluginName = 'MultiLineAreas'
|
@@ -19,9 +19,9 @@ export const MultiLineAreas = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_LI
|
|
19
19
|
|
20
20
|
const unsubscribeFnArr: (() => void)[] = []
|
21
21
|
|
22
|
-
const
|
22
|
+
const multiGridPluginDetail$ = multiGridPluginDetailObservables(observer)
|
23
23
|
|
24
|
-
|
24
|
+
multiGridPluginDetail$
|
25
25
|
.pipe(
|
26
26
|
takeUntil(destroy$)
|
27
27
|
)
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
|
8
8
|
import { DEFAULT_MULTI_LINES_PARAMS } from '../defaults'
|
9
9
|
import { createBaseLines } from '../../base/BaseLines'
|
10
|
-
import {
|
10
|
+
import { multiGridPluginDetailObservables } from '../multiGridObservables'
|
11
11
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
12
12
|
|
13
13
|
const pluginName = 'MultiLines'
|
@@ -19,9 +19,9 @@ export const MultiLines = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_LINES_
|
|
19
19
|
|
20
20
|
const unsubscribeFnArr: (() => void)[] = []
|
21
21
|
|
22
|
-
const
|
22
|
+
const multiGridPluginDetail$ = multiGridPluginDetailObservables(observer)
|
23
23
|
|
24
|
-
|
24
|
+
multiGridPluginDetail$
|
25
25
|
.pipe(
|
26
26
|
takeUntil(destroy$)
|
27
27
|
)
|
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
defineMultiGridPlugin } from '@orbcharts/core'
|
11
11
|
import { DEFAULT_MULTI_VALUE_AXIS_PARAMS } from '../defaults'
|
12
12
|
import { createBaseValueAxis } from '../../base/BaseValueAxis'
|
13
|
-
import {
|
13
|
+
import { multiGridPluginDetailObservables } from '../multiGridObservables'
|
14
14
|
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
15
15
|
|
16
16
|
const pluginName = 'MultiValueAxis'
|
@@ -22,9 +22,9 @@ export const MultiValueAxis = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_VA
|
|
22
22
|
|
23
23
|
const unsubscribeFnArr: (() => void)[] = []
|
24
24
|
|
25
|
-
const
|
25
|
+
const multiGridPluginDetail$ = multiGridPluginDetailObservables(observer)
|
26
26
|
|
27
|
-
|
27
|
+
multiGridPluginDetail$
|
28
28
|
.pipe(
|
29
29
|
takeUntil(destroy$)
|
30
30
|
)
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import * as d3 from 'd3'
|
2
|
+
import {
|
3
|
+
Subject,
|
4
|
+
map,
|
5
|
+
distinctUntilChanged,
|
6
|
+
shareReplay,
|
7
|
+
takeUntil
|
8
|
+
} from 'rxjs'
|
9
|
+
import {
|
10
|
+
defineMultiGridPlugin } from '@orbcharts/core'
|
11
|
+
import { DEFAULT_MULTI_VALUE_AXIS_PARAMS } from '../defaults'
|
12
|
+
import { createBaseValueAxis } from '../../base/BaseValueAxis'
|
13
|
+
import { multiGridPluginDetailObservables } from '../multiGridObservables'
|
14
|
+
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
15
|
+
|
16
|
+
const pluginName = 'MultiValueStackAxis'
|
17
|
+
|
18
|
+
const gridClassName = getClassName(pluginName, 'grid')
|
19
|
+
|
20
|
+
export const MultiValueStackAxis = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_VALUE_AXIS_PARAMS)(({ selection, name, subject, observer }) => {
|
21
|
+
const destroy$ = new Subject()
|
22
|
+
|
23
|
+
const unsubscribeFnArr: (() => void)[] = []
|
24
|
+
|
25
|
+
const multiGridPluginDetail$ = multiGridPluginDetailObservables(observer)
|
26
|
+
|
27
|
+
multiGridPluginDetail$
|
28
|
+
.pipe(
|
29
|
+
takeUntil(destroy$)
|
30
|
+
)
|
31
|
+
.subscribe(data => {
|
32
|
+
// 每次重新計算時,清除之前的訂閱
|
33
|
+
unsubscribeFnArr.forEach(fn => fn())
|
34
|
+
|
35
|
+
selection.selectAll(`g.${gridClassName}`)
|
36
|
+
.data(data)
|
37
|
+
.join('g')
|
38
|
+
.attr('class', gridClassName)
|
39
|
+
.each((d, i, g) => {
|
40
|
+
|
41
|
+
const gridSelection = d3.select(g[i])
|
42
|
+
|
43
|
+
const isSeriesSeprate$ = d.dataFormatter$.pipe(
|
44
|
+
takeUntil(destroy$),
|
45
|
+
map(d => d.grid.separateSeries),
|
46
|
+
distinctUntilChanged(),
|
47
|
+
shareReplay(1)
|
48
|
+
)
|
49
|
+
|
50
|
+
unsubscribeFnArr[i] = createBaseValueAxis(pluginName, {
|
51
|
+
selection: gridSelection,
|
52
|
+
computedData$: d.computedStackedData$, // 計算疊加value的資料
|
53
|
+
fullParams$: observer.fullParams$,
|
54
|
+
fullDataFormatter$: d.dataFormatter$,
|
55
|
+
fullChartParams$: observer.fullChartParams$,
|
56
|
+
gridAxesTransform$: d.gridAxesTransform$,
|
57
|
+
gridAxesReverseTransform$: d.gridAxesReverseTransform$,
|
58
|
+
gridAxesSize$: d.gridAxesSize$,
|
59
|
+
gridContainerPosition$: d.gridContainerPosition$,
|
60
|
+
isSeriesSeprate$,
|
61
|
+
})
|
62
|
+
})
|
63
|
+
})
|
64
|
+
|
65
|
+
return () => {
|
66
|
+
destroy$.next(undefined)
|
67
|
+
unsubscribeFnArr.forEach(fn => fn())
|
68
|
+
}
|
69
|
+
})
|