@orbcharts/core 3.0.0-alpha.36 → 3.0.0-alpha.38
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.
- package/dist/orbcharts-core.es.js +1753 -1664
- package/dist/orbcharts-core.umd.js +2 -2
- package/dist/src/grid/gridObservables.d.ts +1 -1
- package/dist/src/series/seriesObservables.d.ts +1 -8
- package/dist/src/tree/treeObservables.d.ts +13 -0
- package/dist/src/types/ChartParams.d.ts +1 -1
- package/dist/src/types/ComputedData.d.ts +13 -0
- package/dist/src/types/ComputedDataGrid.d.ts +2 -5
- package/dist/src/types/ComputedDataMultiValue.d.ts +2 -2
- package/dist/src/types/ComputedDataRelationship.d.ts +2 -2
- package/dist/src/types/ComputedDataTree.d.ts +2 -2
- package/dist/src/types/ContextObserverGrid.d.ts +1 -1
- package/dist/src/types/ContextObserverTree.d.ts +6 -0
- package/dist/src/types/DataFormatterMultiGrid.d.ts +1 -3
- package/dist/src/types/DataFormatterMultiValue.d.ts +0 -1
- package/dist/src/types/DataFormatterSeries.d.ts +0 -2
- package/dist/src/types/DataFormatterTree.d.ts +1 -0
- package/dist/src/types/DataMultiValue.d.ts +1 -0
- package/dist/src/types/DataRelationship.d.ts +1 -0
- package/dist/src/types/DataTree.d.ts +2 -0
- package/dist/src/types/Event.d.ts +30 -38
- package/dist/src/utils/observables.d.ts +7 -4
- package/package.json +1 -1
- package/src/defaults.ts +5 -3
- package/src/grid/createGridContextObserver.ts +3 -3
- package/src/grid/gridObservables.ts +1 -1
- package/src/multiGrid/multiGridObservables.ts +3 -3
- package/src/multiValue/computeMultiValueData.ts +7 -2
- package/src/relationship/computeRelationshipData.ts +3 -0
- package/src/series/createSeriesContextObserver.ts +1 -1
- package/src/series/seriesObservables.ts +8 -7
- package/src/tree/computeTreeData.ts +31 -9
- package/src/tree/createTreeContextObserver.ts +44 -0
- package/src/tree/treeObservables.ts +95 -0
- package/src/types/ChartParams.ts +1 -1
- package/src/types/ComputedData.ts +18 -1
- package/src/types/ComputedDataGrid.ts +5 -5
- package/src/types/ComputedDataMultiValue.ts +2 -3
- package/src/types/ComputedDataRelationship.ts +2 -2
- package/src/types/ComputedDataTree.ts +2 -2
- package/src/types/ContextObserverGrid.ts +1 -1
- package/src/types/ContextObserverMultiGrid.ts +1 -1
- package/src/types/ContextObserverTree.ts +6 -1
- package/src/types/DataFormatterMultiGrid.ts +2 -2
- package/src/types/DataFormatterMultiValue.ts +1 -1
- package/src/types/DataFormatterSeries.ts +2 -2
- package/src/types/DataFormatterTree.ts +1 -0
- package/src/types/DataMultiValue.ts +1 -0
- package/src/types/DataRelationship.ts +1 -0
- package/src/types/DataTree.ts +2 -0
- package/src/types/Event.ts +85 -46
- package/src/utils/d3Utils.ts +0 -1
- package/src/utils/observables.ts +60 -77
|
@@ -21,7 +21,7 @@ export type ChartParamsPartial = Partial<ChartParams | {
|
|
|
21
21
|
}>;
|
|
22
22
|
styles: Partial<Styles>;
|
|
23
23
|
}>;
|
|
24
|
-
export type HighlightTarget = 'series' | 'group' | 'datum' | 'none';
|
|
24
|
+
export type HighlightTarget = 'series' | 'group' | 'category' | 'datum' | 'none';
|
|
25
25
|
export interface Styles {
|
|
26
26
|
textSize: number;
|
|
27
27
|
unhighlightedOpacity: number;
|
|
@@ -24,5 +24,18 @@ export interface ComputedDatumSeriesValue {
|
|
|
24
24
|
seriesIndex: number;
|
|
25
25
|
seriesLabel: string;
|
|
26
26
|
}
|
|
27
|
+
export interface ComputedDatumGridValue {
|
|
28
|
+
gridIndex: number;
|
|
29
|
+
color: string;
|
|
30
|
+
seriesIndex: number;
|
|
31
|
+
seriesLabel: string;
|
|
32
|
+
groupIndex: number;
|
|
33
|
+
groupLabel: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ComputedDatumCategoryValue {
|
|
36
|
+
color: string;
|
|
37
|
+
categoryIndex: number;
|
|
38
|
+
categoryLabel: string | null;
|
|
39
|
+
}
|
|
27
40
|
export type ComputedDataTypeMap<T extends ChartType> = T extends 'series' ? ComputedDataSeries : T extends 'grid' ? ComputedDataGrid : T extends 'multiGrid' ? ComputedDataMultiGrid : T extends 'multiValue' ? ComputedDataMultiValue : T extends 'relationship' ? ComputedDataRelationship : T extends 'tree' ? ComputedDataTree : ComputedDatumBase;
|
|
28
41
|
export type ComputedDatumTypeMap<T extends ChartType> = T extends 'series' ? ComputedDatumSeries : T extends 'grid' ? ComputedDatumGrid : T extends 'multiGrid' ? ComputedDatumGrid : T extends 'multiValue' ? ComputedDatumMultiValue : T extends 'relationship' ? ComputedNode : T extends 'tree' ? ComputedDataTree : unknown;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { ComputedDatumBase,
|
|
1
|
+
import { ComputedDatumBase, ComputedDatumGridValue } from './ComputedData';
|
|
2
2
|
|
|
3
|
-
export interface ComputedDatumGrid extends ComputedDatumBase,
|
|
4
|
-
gridIndex: number;
|
|
5
|
-
groupIndex: number;
|
|
6
|
-
groupLabel: string;
|
|
3
|
+
export interface ComputedDatumGrid extends ComputedDatumBase, ComputedDatumGridValue {
|
|
7
4
|
axisX: number;
|
|
8
5
|
axisY: number;
|
|
9
6
|
axisYFromZero: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComputedDatumBase } from './ComputedData';
|
|
1
|
+
import { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData';
|
|
2
2
|
|
|
3
3
|
export type ComputedDataMultiValue = ComputedDatumMultiValue[][];
|
|
4
|
-
export interface ComputedDatumMultiValue extends ComputedDatumBase {
|
|
4
|
+
export interface ComputedDatumMultiValue extends ComputedDatumBase, ComputedDatumCategoryValue {
|
|
5
5
|
axis: number;
|
|
6
6
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ComputedDatumBase } from './ComputedData';
|
|
1
|
+
import { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData';
|
|
2
2
|
|
|
3
3
|
export type ComputedDataRelationship = {
|
|
4
4
|
nodes: ComputedNode[];
|
|
5
5
|
edges: ComputedEdge[];
|
|
6
6
|
};
|
|
7
|
-
export interface ComputedNode extends ComputedDatumBase {
|
|
7
|
+
export interface ComputedNode extends ComputedDatumBase, ComputedDatumCategoryValue {
|
|
8
8
|
startNodes: ComputedNode[];
|
|
9
9
|
startNodeIds: string[];
|
|
10
10
|
endNodes: ComputedNode[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComputedDatumBase } from './ComputedData';
|
|
1
|
+
import { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData';
|
|
2
2
|
|
|
3
|
-
export interface ComputedDataTree extends ComputedDatumBase {
|
|
3
|
+
export interface ComputedDataTree extends ComputedDatumBase, ComputedDatumCategoryValue {
|
|
4
4
|
level: number;
|
|
5
5
|
seq: number;
|
|
6
6
|
children?: ComputedDataTree[];
|
|
@@ -16,7 +16,7 @@ export interface ContextObserverGridDetail {
|
|
|
16
16
|
height: number;
|
|
17
17
|
}>;
|
|
18
18
|
gridHighlight$: Observable<string[]>;
|
|
19
|
-
|
|
19
|
+
existSeriesLabels$: Observable<string[]>;
|
|
20
20
|
SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>;
|
|
21
21
|
GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>;
|
|
22
22
|
visibleComputedData$: Observable<ComputedDataGrid>;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
1
2
|
import { ContextObserverBase } from './ContextObserver';
|
|
3
|
+
import { ComputedDataTree } from './ComputedDataTree';
|
|
2
4
|
|
|
3
5
|
export interface ContextObserverTree<PluginParams> extends ContextObserverBase<'tree', PluginParams> {
|
|
6
|
+
treeHighlight$: Observable<string[]>;
|
|
7
|
+
existCategoryLabels$: Observable<string[]>;
|
|
8
|
+
CategoryDataMap$: Observable<Map<string, ComputedDataTree[]>>;
|
|
9
|
+
visibleComputedData$: Observable<ComputedDataTree>;
|
|
4
10
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { VisibleFilter, DataFormatterBase, DataFormatterBasePartial } from './DataFormatter';
|
|
2
1
|
import { DataFormatterGridGrid, DataFormatterGridGridPartial, DataFormatterGridContainer } from './DataFormatterGrid';
|
|
2
|
+
import { DataFormatterBase, DataFormatterBasePartial } from './DataFormatter';
|
|
3
3
|
|
|
4
4
|
export interface DataFormatterMultiGrid extends DataFormatterBase<'multiGrid'> {
|
|
5
|
-
visibleFilter: VisibleFilter<'multiGrid'>;
|
|
6
5
|
gridList: Array<DataFormatterGridGrid>;
|
|
7
6
|
container: DataFormatterMultiGridContainer;
|
|
8
7
|
}
|
|
9
8
|
export interface DataFormatterMultiGridPartial extends DataFormatterBasePartial<'multiGrid'> {
|
|
10
|
-
visibleFilter?: VisibleFilter<'multiGrid'>;
|
|
11
9
|
gridList?: Array<DataFormatterGridGridPartial>;
|
|
12
10
|
container?: Partial<DataFormatterMultiGridContainer>;
|
|
13
11
|
}
|
|
@@ -3,12 +3,10 @@ import { DataFormatterBase, DataFormatterBasePartial, VisibleFilter } from './Da
|
|
|
3
3
|
|
|
4
4
|
export interface DataFormatterSeries extends DataFormatterBase<'series'> {
|
|
5
5
|
visibleFilter: VisibleFilter<'series'>;
|
|
6
|
-
unitLabel: string;
|
|
7
6
|
seriesLabels: string[];
|
|
8
7
|
sort: ((a: DataSeriesDatum | DataSeriesValue, b: DataSeriesDatum | number) => number) | null;
|
|
9
8
|
}
|
|
10
9
|
export interface DataFormatterSeriesPartial extends DataFormatterBasePartial<'series'> {
|
|
11
|
-
unitLabel?: string;
|
|
12
10
|
seriesLabels?: string[];
|
|
13
11
|
sort?: ((a: DataSeriesDatum | DataSeriesValue, b: DataSeriesDatum | number) => number) | null;
|
|
14
12
|
}
|
|
@@ -2,5 +2,6 @@ import { DataFormatterBase, VisibleFilter } from './DataFormatter';
|
|
|
2
2
|
|
|
3
3
|
export interface DataFormatterTree extends DataFormatterBase<'tree'> {
|
|
4
4
|
visibleFilter: VisibleFilter<'tree'>;
|
|
5
|
+
categoryLabels: string[];
|
|
5
6
|
}
|
|
6
7
|
export type DataFormatterTreePartial = Partial<DataFormatterTree>;
|
|
@@ -5,9 +5,11 @@ export interface DataTreeObj extends DatumBase {
|
|
|
5
5
|
id: string;
|
|
6
6
|
value?: number;
|
|
7
7
|
children?: DataTreeObj[];
|
|
8
|
+
categoryLabel?: string;
|
|
8
9
|
}
|
|
9
10
|
export interface DataTreeDatum extends DatumBase {
|
|
10
11
|
id: string;
|
|
11
12
|
value?: number;
|
|
12
13
|
parent?: string;
|
|
14
|
+
categoryLabel?: string;
|
|
13
15
|
}
|
|
@@ -1,64 +1,56 @@
|
|
|
1
1
|
import { ChartType } from './Chart';
|
|
2
|
-
import { ComputedDatumBase } from './ComputedData';
|
|
3
2
|
import { ComputedDataSeries, ComputedDatumSeries } from './ComputedDataSeries';
|
|
4
3
|
import { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid';
|
|
5
4
|
import { ComputedDataMultiGrid } from './ComputedDataMultiGrid';
|
|
6
|
-
import { ComputedDatumMultiValue } from './ComputedDataMultiValue';
|
|
7
|
-
import { ComputedNode } from './ComputedDataRelationship';
|
|
5
|
+
import { ComputedDataMultiValue, ComputedDatumMultiValue } from './ComputedDataMultiValue';
|
|
6
|
+
import { ComputedDataRelationship, ComputedNode } from './ComputedDataRelationship';
|
|
8
7
|
import { ComputedDataTree } from './ComputedDataTree';
|
|
9
8
|
import { HighlightTarget } from './ChartParams';
|
|
10
9
|
|
|
11
10
|
export type EventName = 'click' | 'mouseover' | 'mousemove' | 'mouseout' | 'dragstart' | 'drag' | 'dragend' | 'resize' | 'transitionMove' | 'transitionEnd';
|
|
12
|
-
export type EventTypeMap<T extends ChartType> = T extends 'series' ? EventSeries : T extends 'grid' ? EventGrid : T extends 'multiGrid' ? EventMultiGrid : T extends 'multiValue' ? EventMultiValue : T extends 'relationship' ? EventRelationship : T extends 'tree' ? EventTree : EventBase
|
|
13
|
-
export interface EventBase {
|
|
11
|
+
export type EventTypeMap<T extends ChartType> = T extends 'series' ? EventSeries : T extends 'grid' ? EventGrid : T extends 'multiGrid' ? EventMultiGrid : T extends 'multiValue' ? EventMultiValue : T extends 'relationship' ? EventRelationship : T extends 'tree' ? EventTree : EventBase<any>;
|
|
12
|
+
export interface EventBase<T extends ChartType> {
|
|
13
|
+
type: T;
|
|
14
14
|
eventName: EventName;
|
|
15
15
|
pluginName: string;
|
|
16
|
-
type: ChartType;
|
|
17
16
|
event: MouseEvent | undefined;
|
|
18
17
|
highlightTarget: HighlightTarget;
|
|
19
|
-
datum: ComputedDatumBase | null;
|
|
20
18
|
tween?: number;
|
|
21
19
|
}
|
|
22
|
-
export interface
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
series: ComputedDatumSeries[];
|
|
20
|
+
export interface EventBaseSeriesValue<DatumType, DataType> {
|
|
21
|
+
data: DataType;
|
|
22
|
+
series: DatumType[];
|
|
26
23
|
seriesIndex: number;
|
|
27
24
|
seriesLabel: string;
|
|
28
|
-
datum:
|
|
25
|
+
datum: DatumType | null;
|
|
29
26
|
}
|
|
30
|
-
export interface
|
|
31
|
-
|
|
32
|
-
data: ComputedDataGrid;
|
|
33
|
-
series: ComputedDatumGrid[];
|
|
34
|
-
seriesIndex: number;
|
|
35
|
-
seriesLabel: string;
|
|
36
|
-
groups: ComputedDatumGrid[];
|
|
37
|
-
groupIndex: number;
|
|
38
|
-
groupLabel: string;
|
|
39
|
-
datum: ComputedDatumGrid | null;
|
|
40
|
-
}
|
|
41
|
-
export interface EventMultiGrid extends EventBase {
|
|
42
|
-
type: 'multiGrid';
|
|
43
|
-
data: ComputedDataMultiGrid;
|
|
27
|
+
export interface EventBaseGridValue<DatumType, DataType> {
|
|
28
|
+
data: DataType;
|
|
44
29
|
gridIndex: number;
|
|
45
|
-
series:
|
|
30
|
+
series: DatumType[];
|
|
46
31
|
seriesIndex: number;
|
|
47
32
|
seriesLabel: string;
|
|
48
|
-
|
|
33
|
+
groups: DatumType[];
|
|
49
34
|
groupIndex: number;
|
|
50
35
|
groupLabel: string;
|
|
51
|
-
datum:
|
|
36
|
+
datum: DatumType | null;
|
|
37
|
+
}
|
|
38
|
+
export interface EventBaseCategoryValue<DatumType, DataType> {
|
|
39
|
+
data: DataType;
|
|
40
|
+
category: DatumType[];
|
|
41
|
+
categoryIndex: number;
|
|
42
|
+
categoryLabel: string;
|
|
43
|
+
datum: DatumType | null;
|
|
44
|
+
}
|
|
45
|
+
export interface EventSeries extends EventBase<'series'>, EventBaseSeriesValue<ComputedDatumSeries, ComputedDataSeries> {
|
|
46
|
+
}
|
|
47
|
+
export interface EventGrid extends EventBase<'grid'>, EventBaseGridValue<ComputedDatumGrid, ComputedDataGrid> {
|
|
48
|
+
}
|
|
49
|
+
export interface EventMultiGrid extends EventBase<'multiGrid'>, EventBaseGridValue<ComputedDatumGrid, ComputedDataMultiGrid> {
|
|
52
50
|
}
|
|
53
|
-
export interface EventMultiValue extends EventBase {
|
|
54
|
-
type: 'multiValue';
|
|
55
|
-
datum: ComputedDatumMultiValue | null;
|
|
51
|
+
export interface EventMultiValue extends EventBase<'multiValue'>, EventBaseCategoryValue<ComputedDatumMultiValue, ComputedDataMultiValue> {
|
|
56
52
|
}
|
|
57
|
-
export interface EventRelationship extends EventBase {
|
|
58
|
-
type: 'relationship';
|
|
59
|
-
datum: ComputedNode | null;
|
|
53
|
+
export interface EventRelationship extends EventBase<'relationship'>, EventBaseCategoryValue<ComputedNode, ComputedDataRelationship> {
|
|
60
54
|
}
|
|
61
|
-
export interface EventTree extends EventBase {
|
|
62
|
-
type: 'tree';
|
|
63
|
-
datum: ComputedDataTree | null;
|
|
55
|
+
export interface EventTree extends EventBase<'tree'>, EventBaseCategoryValue<ComputedDataTree, ComputedDataTree> {
|
|
64
56
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { Subject, Observable } from 'rxjs';
|
|
2
|
-
import {
|
|
2
|
+
import { ChartParams, ComputedDatumTypeMap } from '../types';
|
|
3
3
|
|
|
4
4
|
export declare const highlightObservable: ({ datumList$, fullChartParams$, event$ }: {
|
|
5
|
-
datumList$: Observable<ComputedDatumTypeMap<"series" | "grid">[]>;
|
|
5
|
+
datumList$: Observable<ComputedDatumTypeMap<"series" | "grid" | "multiValue" | "relationship" | "tree">[]>;
|
|
6
6
|
fullChartParams$: Observable<ChartParams>;
|
|
7
7
|
event$: Subject<any>;
|
|
8
8
|
}) => Observable<string[]>;
|
|
9
|
-
export declare const seriesDataMapObservable: <DatumType extends ComputedDatumTypeMap<
|
|
9
|
+
export declare const seriesDataMapObservable: <DatumType extends ComputedDatumTypeMap<"series" | "grid">>({ datumList$ }: {
|
|
10
10
|
datumList$: Observable<DatumType[]>;
|
|
11
11
|
}) => Observable<Map<string, DatumType[]>>;
|
|
12
|
-
export declare const groupDataMapObservable: <DatumType extends ComputedDatumTypeMap<
|
|
12
|
+
export declare const groupDataMapObservable: <DatumType extends ComputedDatumTypeMap<"grid">>({ datumList$ }: {
|
|
13
|
+
datumList$: Observable<DatumType[]>;
|
|
14
|
+
}) => Observable<Map<string, DatumType[]>>;
|
|
15
|
+
export declare const categoryDataMapObservable: <DatumType extends ComputedDatumTypeMap<"multiValue" | "relationship" | "tree">>({ datumList$ }: {
|
|
13
16
|
datumList$: Observable<DatumType[]>;
|
|
14
17
|
}) => Observable<Map<string, DatumType[]>>;
|
package/package.json
CHANGED
package/src/defaults.ts
CHANGED
|
@@ -58,7 +58,8 @@ export const CHART_PARAMS_DEFAULT: ChartParams = {
|
|
|
58
58
|
colors: {
|
|
59
59
|
light: {
|
|
60
60
|
series: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
|
61
|
-
primary: '#454545',
|
|
61
|
+
// primary: '#454545',
|
|
62
|
+
primary: '#1b1e23',
|
|
62
63
|
secondary: '#e1e1e1',
|
|
63
64
|
white: '#ffffff',
|
|
64
65
|
background: '#ffffff'
|
|
@@ -139,7 +140,7 @@ export const DATA_FORMATTER_SERIES_DEFAULT: DataFormatterSeries = {
|
|
|
139
140
|
// ...DATA_FORMATTER_WITH_VALUE,
|
|
140
141
|
type: 'series',
|
|
141
142
|
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
|
142
|
-
unitLabel: '',
|
|
143
|
+
// unitLabel: '',
|
|
143
144
|
seriesLabels: [],
|
|
144
145
|
// mapSeries: (datum, rowIndex, columnIndex, { data, dataFormatter }) => {
|
|
145
146
|
// const seriesIndex = rowIndex >= dataFormatter.seriesLabels.length
|
|
@@ -200,7 +201,7 @@ export const DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT: DataFormatterMultiGridGrid
|
|
|
200
201
|
|
|
201
202
|
export const DATA_FORMATTER_MULTI_GRID_DEFAULT: DataFormatterMultiGrid = {
|
|
202
203
|
type: 'multiGrid',
|
|
203
|
-
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
|
204
|
+
// visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
|
204
205
|
gridList: [
|
|
205
206
|
{
|
|
206
207
|
...DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT
|
|
@@ -226,6 +227,7 @@ export const DATA_FORMATTER_TREE_DEFAULT: DataFormatterTree = {
|
|
|
226
227
|
type: 'tree',
|
|
227
228
|
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
|
228
229
|
// labelFormat: (datum: any) => (datum && datum.label) ?? '',
|
|
230
|
+
categoryLabels: []
|
|
229
231
|
}
|
|
230
232
|
|
|
231
233
|
export const DATA_FORMATTER_RELATIONAL_DEFAULT: DataFormatterRelationship = {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
gridGraphicTransformObservable,
|
|
11
11
|
gridGraphicReverseScaleObservable,
|
|
12
12
|
gridAxesSizeObservable,
|
|
13
|
-
|
|
13
|
+
existSeriesLabelsObservable,
|
|
14
14
|
gridVisibleComputedDataObservable,
|
|
15
15
|
isSeriesPositionSeprateObservable,
|
|
16
16
|
gridContainerObservable } from './gridObservables'
|
|
@@ -79,7 +79,7 @@ export const createGridContextObserver: ContextObserverFn<'grid'> = ({ subject,
|
|
|
79
79
|
shareReplay(1)
|
|
80
80
|
)
|
|
81
81
|
|
|
82
|
-
const
|
|
82
|
+
const existSeriesLabels$ = existSeriesLabelsObservable({
|
|
83
83
|
computedData$: observer.computedData$,
|
|
84
84
|
})
|
|
85
85
|
|
|
@@ -116,7 +116,7 @@ export const createGridContextObserver: ContextObserverFn<'grid'> = ({ subject,
|
|
|
116
116
|
gridGraphicReverseScale$,
|
|
117
117
|
gridAxesSize$,
|
|
118
118
|
gridHighlight$,
|
|
119
|
-
|
|
119
|
+
existSeriesLabels$,
|
|
120
120
|
SeriesDataMap$,
|
|
121
121
|
GroupDataMap$,
|
|
122
122
|
visibleComputedData$,
|
|
@@ -380,7 +380,7 @@ export const gridAxesSizeObservable = ({ fullDataFormatter$, layout$ }: {
|
|
|
380
380
|
// return highlightObservable ({ datumList$, fullChartParams$, event$ })
|
|
381
381
|
// }
|
|
382
382
|
|
|
383
|
-
export const
|
|
383
|
+
export const existSeriesLabelsObservable = ({ computedData$ }: { computedData$: Observable<ComputedDataTypeMap<'grid'>> }) => {
|
|
384
384
|
return computedData$.pipe(
|
|
385
385
|
map(data => {
|
|
386
386
|
return data
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
gridGraphicReverseScaleObservable,
|
|
37
37
|
gridAxesReverseTransformObservable,
|
|
38
38
|
gridAxesSizeObservable,
|
|
39
|
-
|
|
39
|
+
existSeriesLabelsObservable,
|
|
40
40
|
gridVisibleComputedDataObservable,
|
|
41
41
|
isSeriesPositionSeprateObservable,
|
|
42
42
|
gridContainerObservable } from '../grid/gridObservables'
|
|
@@ -128,7 +128,7 @@ export const multiGridEachDetailObservable = ({ fullDataFormatter$, computedData
|
|
|
128
128
|
shareReplay(1)
|
|
129
129
|
)
|
|
130
130
|
|
|
131
|
-
const
|
|
131
|
+
const existSeriesLabels$ = existSeriesLabelsObservable({
|
|
132
132
|
computedData$: gridComputedData$,
|
|
133
133
|
})
|
|
134
134
|
|
|
@@ -160,7 +160,7 @@ export const multiGridEachDetailObservable = ({ fullDataFormatter$, computedData
|
|
|
160
160
|
gridGraphicReverseScale$,
|
|
161
161
|
gridAxesSize$,
|
|
162
162
|
gridHighlight$,
|
|
163
|
-
|
|
163
|
+
existSeriesLabels$,
|
|
164
164
|
SeriesDataMap$,
|
|
165
165
|
GroupDataMap$,
|
|
166
166
|
visibleComputedData$,
|
|
@@ -24,6 +24,7 @@ export const computeMultiValueData: ComputedDataFn<'multiValue'> = (context) =>
|
|
|
24
24
|
description: '',
|
|
25
25
|
// tooltipContent: '',
|
|
26
26
|
data: {},
|
|
27
|
+
categoryLabel: '',
|
|
27
28
|
value: _d
|
|
28
29
|
}
|
|
29
30
|
: {
|
|
@@ -32,6 +33,7 @@ export const computeMultiValueData: ComputedDataFn<'multiValue'> = (context) =>
|
|
|
32
33
|
description: _d.description ?? '',
|
|
33
34
|
// tooltipContent: _d.tooltipContent ?? '',
|
|
34
35
|
data: _d.data ?? {},
|
|
36
|
+
categoryLabel: _d.categoryLabel ??'',
|
|
35
37
|
value: _d.value
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -82,7 +84,7 @@ export const computeMultiValueData: ComputedDataFn<'multiValue'> = (context) =>
|
|
|
82
84
|
dataFormatter.yAxis.scaleDomain[0] === 'auto' ? yMinValue : dataFormatter.yAxis.scaleDomain[0],
|
|
83
85
|
dataFormatter.yAxis.scaleDomain[1] === 'auto' ? yMaxValue : dataFormatter.yAxis.scaleDomain[1]
|
|
84
86
|
]
|
|
85
|
-
|
|
87
|
+
|
|
86
88
|
// 篩選顯示狀態
|
|
87
89
|
const visibleFilter = (datum: DataMultiValueDatum, rowIndex: number, columnIndex: number, context: DataFormatterContext<"multiValue">) => {
|
|
88
90
|
// 如果不在scale的範圍內則為false,不再做visibleFilter的判斷
|
|
@@ -115,9 +117,12 @@ export const computeMultiValueData: ComputedDataFn<'multiValue'> = (context) =>
|
|
|
115
117
|
// tooltipContent: _d.tooltipContent ? _d.tooltipContent : dataFormatter.tooltipContentFormat(_d, i, _i, context),
|
|
116
118
|
data: _d.data,
|
|
117
119
|
value: _d.value,
|
|
120
|
+
categoryIndex: 0, // @Q@ 未完成
|
|
121
|
+
categoryLabel: '', // @Q@ 未完成
|
|
118
122
|
// valueLabel: formatValueToLabel(_d.value, dataFormatter.multiValue[_i].valueFormat),
|
|
119
123
|
axis: _i == 0 ? xScale(_d.value) : yScale(_d.value),
|
|
120
|
-
visible
|
|
124
|
+
visible,
|
|
125
|
+
color: '' // @Q@ 未完成
|
|
121
126
|
}
|
|
122
127
|
return computedDatum
|
|
123
128
|
})
|
|
@@ -36,6 +36,9 @@ export const computeRelationshipData: ComputedDataFn<'relationship'> = (context)
|
|
|
36
36
|
// tooltipContent: node.tooltipContent ? node.tooltipContent : dataFormatter.tooltipContentFormat(node, 0, i, context), // 0代表node
|
|
37
37
|
data: node.data ?? {},
|
|
38
38
|
value: node.value ?? 0,
|
|
39
|
+
categoryIndex: 0, // @Q@ 未完成
|
|
40
|
+
categoryLabel: '', // @Q@ 未完成
|
|
41
|
+
color: '', // @Q@ 未完成
|
|
39
42
|
startNodes: [], // 後面再取得資料
|
|
40
43
|
startNodeIds: [], // 後面再取得資料
|
|
41
44
|
endNodes: [], // 後面再取得資料
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { shareReplay } from 'rxjs'
|
|
2
2
|
import type { ContextObserverFn } from '../types'
|
|
3
3
|
import {
|
|
4
|
-
highlightObservable,
|
|
5
4
|
seriesDataMapObservable,
|
|
6
5
|
groupDataMapObservable } from '../utils/observables'
|
|
6
|
+
import { highlightObservable } from '../utils/observables'
|
|
7
7
|
|
|
8
8
|
export const createSeriesContextObserver: ContextObserverFn<'series'> = ({ subject, observer }) => {
|
|
9
9
|
|
|
@@ -11,13 +11,14 @@ import {
|
|
|
11
11
|
Observable } from 'rxjs'
|
|
12
12
|
import type {
|
|
13
13
|
ChartParams,
|
|
14
|
+
ComputedDatumSeries,
|
|
14
15
|
ComputedDataTypeMap } from '../types'
|
|
15
16
|
import { highlightObservable } from '../utils/observables'
|
|
16
17
|
|
|
17
|
-
export const seriesHighlightObservable = ({ computedData$, fullChartParams$, event$ }: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}): Observable<string[]> => {
|
|
22
|
-
|
|
23
|
-
}
|
|
18
|
+
// export const seriesHighlightObservable = ({ computedData$, fullChartParams$, event$ }: {
|
|
19
|
+
// computedData$: Observable<ComputedDataTypeMap<'series'>>
|
|
20
|
+
// fullChartParams$: Observable<ChartParams>
|
|
21
|
+
// event$: Subject<any>
|
|
22
|
+
// }): Observable<string[]> => {
|
|
23
|
+
// return highlightObservable ({ datumList$: computedData$, fullChartParams$, event$ })
|
|
24
|
+
// }
|
|
@@ -2,15 +2,24 @@ import type { DataTree, DataTreeObj, DataTreeDatum } from '../types/DataTree'
|
|
|
2
2
|
import type { ComputedDataFn } from '../types/ComputedData'
|
|
3
3
|
import type { ComputedDataTree } from '../types/ComputedDataTree'
|
|
4
4
|
import { isPlainObject } from '../utils/commonUtils'
|
|
5
|
+
import { seriesColorPredicate } from '../utils/orbchartsUtils'
|
|
5
6
|
|
|
6
7
|
export const computeTreeData: ComputedDataFn<'tree'> = (context) => {
|
|
7
8
|
const { data = [], dataFormatter, chartParams } = context
|
|
8
9
|
|
|
10
|
+
// <categoryLabel, categoryIndex>
|
|
11
|
+
const CategoryIndexMap = new Map<string, number>(
|
|
12
|
+
dataFormatter.categoryLabels.map((label, index) => [label, index])
|
|
13
|
+
)
|
|
14
|
+
|
|
9
15
|
let computedBranchData: ComputedDataTree = {
|
|
10
16
|
id: '',
|
|
11
17
|
index: 0,
|
|
12
18
|
label: '',
|
|
13
19
|
description: '',
|
|
20
|
+
categoryIndex: 0,
|
|
21
|
+
categoryLabel: '',
|
|
22
|
+
color: '',
|
|
14
23
|
visible: true,
|
|
15
24
|
// tooltipContent: '',
|
|
16
25
|
data: {},
|
|
@@ -56,6 +65,7 @@ export const computeTreeData: ComputedDataFn<'tree'> = (context) => {
|
|
|
56
65
|
data: root.data,
|
|
57
66
|
// tooltipContent: root.tooltipContent,
|
|
58
67
|
value: root.value,
|
|
68
|
+
categoryLabel: root.categoryLabel,
|
|
59
69
|
children: (ChildrenMap.get(root.id) ?? []).map(d => {
|
|
60
70
|
// 遞迴
|
|
61
71
|
return createBranchData(d)
|
|
@@ -73,23 +83,35 @@ export const computeTreeData: ComputedDataFn<'tree'> = (context) => {
|
|
|
73
83
|
|
|
74
84
|
let index = 0
|
|
75
85
|
|
|
76
|
-
const formatBranchData = (
|
|
86
|
+
const formatBranchData = (branch: DataTreeObj, level: number, seq: number): ComputedDataTree => {
|
|
77
87
|
const childLayer = level + 1
|
|
78
|
-
const visible = dataFormatter.visibleFilter(
|
|
88
|
+
const visible = dataFormatter.visibleFilter(branch, level, seq, context)
|
|
89
|
+
const categoryLabel: string | null = branch.categoryLabel ?? null
|
|
90
|
+
let categoryIndex = 0
|
|
91
|
+
if (categoryLabel != null) {
|
|
92
|
+
if (!CategoryIndexMap.has(categoryLabel)) {
|
|
93
|
+
CategoryIndexMap.set(categoryLabel, CategoryIndexMap.size)
|
|
94
|
+
}
|
|
95
|
+
categoryIndex = CategoryIndexMap.get(categoryLabel) ?? 0
|
|
96
|
+
}
|
|
97
|
+
|
|
79
98
|
const currentIndex = index
|
|
80
99
|
index++
|
|
81
100
|
return {
|
|
82
|
-
id:
|
|
101
|
+
id: branch.id,
|
|
83
102
|
index: currentIndex,
|
|
84
103
|
level,
|
|
85
104
|
seq,
|
|
86
|
-
label:
|
|
87
|
-
description:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
105
|
+
label: branch.label ?? '',
|
|
106
|
+
description: branch.description ?? '',
|
|
107
|
+
categoryIndex,
|
|
108
|
+
categoryLabel,
|
|
109
|
+
color: seriesColorPredicate(categoryIndex, chartParams),
|
|
110
|
+
data: branch.data ?? {},
|
|
111
|
+
// tooltipContent: branch.tooltipContent ? branch.tooltipContent : dataFormatter.tooltipContentFormat(branch, level, seq, context),
|
|
112
|
+
value: branch.value,
|
|
91
113
|
visible,
|
|
92
|
-
children: (
|
|
114
|
+
children: (branch.children ?? []).map((d, i) => {
|
|
93
115
|
// 遞迴
|
|
94
116
|
return formatBranchData(d, childLayer, i)
|
|
95
117
|
})
|
|
@@ -1,12 +1,56 @@
|
|
|
1
|
+
import { map, shareReplay } from 'rxjs'
|
|
1
2
|
import type { ContextObserverFn } from '../types'
|
|
3
|
+
import { highlightObservable, categoryDataMapObservable } from '../utils/observables'
|
|
4
|
+
import {
|
|
5
|
+
nodeListObservable,
|
|
6
|
+
existCategoryLabelsObservable,
|
|
7
|
+
treeVisibleComputedDataObservable
|
|
8
|
+
} from './treeObservables'
|
|
2
9
|
|
|
3
10
|
export const createTreeContextObserver: ContextObserverFn<'tree'> = ({ subject, observer }) => {
|
|
4
11
|
|
|
12
|
+
const nodeList$ = nodeListObservable({
|
|
13
|
+
computedData$: observer.computedData$
|
|
14
|
+
}).pipe(
|
|
15
|
+
shareReplay(1)
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
const treeHighlight$ = highlightObservable({
|
|
19
|
+
datumList$: nodeList$,
|
|
20
|
+
fullChartParams$: observer.fullChartParams$,
|
|
21
|
+
event$: subject.event$
|
|
22
|
+
}).pipe(
|
|
23
|
+
shareReplay(1)
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
const existCategoryLabels$ = existCategoryLabelsObservable({
|
|
27
|
+
nodeList$,
|
|
28
|
+
fullDataFormatter$: observer.fullDataFormatter$
|
|
29
|
+
}).pipe(
|
|
30
|
+
shareReplay(1)
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const CategoryDataMap$ = categoryDataMapObservable({
|
|
34
|
+
datumList$: nodeList$
|
|
35
|
+
}).pipe(
|
|
36
|
+
shareReplay(1)
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
const visibleComputedData$ = treeVisibleComputedDataObservable({
|
|
40
|
+
computedData$: observer.computedData$
|
|
41
|
+
}).pipe(
|
|
42
|
+
shareReplay(1)
|
|
43
|
+
)
|
|
44
|
+
|
|
5
45
|
return {
|
|
6
46
|
fullParams$: observer.fullParams$,
|
|
7
47
|
fullChartParams$: observer.fullChartParams$,
|
|
8
48
|
fullDataFormatter$: observer.fullDataFormatter$,
|
|
9
49
|
computedData$: observer.computedData$,
|
|
10
50
|
layout$: observer.layout$,
|
|
51
|
+
treeHighlight$,
|
|
52
|
+
existCategoryLabels$,
|
|
53
|
+
CategoryDataMap$,
|
|
54
|
+
visibleComputedData$
|
|
11
55
|
}
|
|
12
56
|
}
|