@orbcharts/core 3.0.0-beta.9 → 3.0.0
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 +2779 -2398
- package/dist/orbcharts-core.umd.js +4 -4
- package/dist/src/defaults.d.ts +2 -1
- package/dist/src/utils/gridObservables.d.ts +8 -4
- package/dist/src/utils/index.d.ts +0 -3
- package/dist/src/utils/multiGridObservables.d.ts +3 -2
- package/dist/src/utils/multiValueObservables.d.ts +76 -29
- package/dist/src/utils/observables.d.ts +8 -1
- package/dist/src/utils/orbchartsUtils.d.ts +9 -9
- package/dist/src/utils/seriesObservables.d.ts +1 -1
- package/package.json +2 -2
- package/src/base/createBaseChart.ts +4 -3
- package/src/base/createBasePlugin.ts +5 -4
- package/src/base/validators/chartParamsValidator.ts +4 -4
- package/src/defaults.ts +54 -10
- package/src/grid/contextObserverCallback.ts +31 -9
- package/src/grid/dataFormatterValidator.ts +42 -23
- package/src/multiGrid/contextObserverCallback.ts +38 -7
- package/src/multiValue/computedDataFn.ts +4 -1
- package/src/multiValue/contextObserverCallback.ts +159 -43
- package/src/multiValue/dataFormatterValidator.ts +85 -5
- package/src/multiValue/dataValidator.ts +9 -6
- package/src/relationship/computedDataFn.ts +37 -22
- package/src/relationship/dataFormatterValidator.ts +10 -6
- package/src/relationship/dataValidator.ts +10 -6
- package/src/series/contextObserverCallback.ts +18 -11
- package/src/tree/dataValidator.ts +1 -1
- package/src/utils/gridObservables.ts +32 -10
- package/src/utils/index.ts +3 -3
- package/src/utils/multiGridObservables.ts +34 -25
- package/src/utils/multiValueObservables.ts +479 -97
- package/src/utils/observables.ts +77 -15
- package/src/utils/orbchartsUtils.ts +9 -9
- package/src/utils/seriesObservables.ts +4 -4
- package/src/utils/validator.ts +1 -1
package/dist/src/defaults.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ChartOptionsPartial, DataSeries, DataGrid, DataMultiGrid, DataMultiValue, DataTree, DataRelationship, DataFormatterValueAxis, DataFormatterGroupAxis, DataFormatterContainer, DataFormatterSeries, DataFormatterGrid, DataFormatterGridGrid, DataFormatterMultiGrid, DataFormatterMultiGridGrid, DataFormatterMultiValue, DataFormatterTree, DataFormatterRelationship, ChartParams, Padding } from '../lib/core-types';
|
1
|
+
import { ChartOptionsPartial, DataSeries, DataGrid, DataMultiGrid, DataMultiValue, DataTree, DataRelationship, DataFormatterValueAxis, DataFormatterGroupAxis, DataFormatterXYAxis, DataFormatterContainer, DataFormatterSeries, DataFormatterGrid, DataFormatterGridGrid, DataFormatterMultiGrid, DataFormatterMultiGridGrid, DataFormatterMultiValue, DataFormatterTree, DataFormatterRelationship, ChartParams, Padding } from '../lib/core-types';
|
2
2
|
|
3
3
|
export declare const DEFAULT_CHART_OPTIONS: ChartOptionsPartial<any>;
|
4
4
|
export declare const DEFAULT_PADDING: Padding;
|
@@ -13,6 +13,7 @@ export declare const DEFAULT_DATA_TREE: DataTree;
|
|
13
13
|
export declare const DEFAULTL_DATA_RELATIONA: DataRelationship;
|
14
14
|
export declare const DEFAULT_DATA_FORMATTER_VALUE_AXIS: DataFormatterValueAxis;
|
15
15
|
export declare const DEFAULT_DATA_FORMATTER_GROUP_AXIS: DataFormatterGroupAxis;
|
16
|
+
export declare const DEFAULT_DATA_FORMATTER_X_Y_AXIS: DataFormatterXYAxis;
|
16
17
|
export declare const DEFAULT_DATA_FORMATTER_CONTAINER: DataFormatterContainer;
|
17
18
|
export declare const DEFAULT_DATA_FORMATTER_SERIES: DataFormatterSeries;
|
18
19
|
export declare const DEFAULT_DATA_FORMATTER_GRID_GRID: DataFormatterGridGrid;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Observable } from 'rxjs';
|
2
|
-
import { ComputedDataTypeMap, ComputedDataGrid, ComputedDatumGrid, DataFormatterTypeMap, DataFormatterGrid, ComputedLayoutDatumGrid,
|
2
|
+
import { ComputedDataTypeMap, ComputedDataGrid, ContainerSize, ComputedDatumGrid, DataFormatterTypeMap, DataFormatterGrid, ComputedLayoutDatumGrid, ComputedAxesDataGrid, ContainerPositionScaled, Layout, TransformData } from '../../lib/core-types';
|
3
3
|
|
4
|
-
export declare const
|
4
|
+
export declare const gridComputedAxesDataObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
5
5
|
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
6
6
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
7
7
|
layout$: Observable<Layout>;
|
@@ -13,14 +13,18 @@ export declare const gridAxesSizeObservable: ({ fullDataFormatter$, layout$ }: {
|
|
13
13
|
width: number;
|
14
14
|
height: number;
|
15
15
|
}>;
|
16
|
+
export declare const gridAxesContainerSizeObservable: ({ fullDataFormatter$, containerSize$ }: {
|
17
|
+
containerSize$: Observable<ContainerSize>;
|
18
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
19
|
+
}) => Observable<ContainerSize>;
|
16
20
|
export declare const gridSeriesLabelsObservable: ({ computedData$ }: {
|
17
21
|
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
18
22
|
}) => Observable<string[]>;
|
19
23
|
export declare const gridVisibleComputedDataObservable: ({ computedData$ }: {
|
20
24
|
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
21
25
|
}) => Observable<ComputedDatumGrid[][]>;
|
22
|
-
export declare const
|
23
|
-
|
26
|
+
export declare const gridVisibleComputedAxesDataObservable: ({ computedAxesData$ }: {
|
27
|
+
computedAxesData$: Observable<ComputedAxesDataGrid>;
|
24
28
|
}) => Observable<ComputedLayoutDatumGrid[][]>;
|
25
29
|
export declare const gridContainerPositionObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
26
30
|
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
@@ -1,8 +1,5 @@
|
|
1
1
|
export * from './commonUtils';
|
2
2
|
export * from './d3Scale';
|
3
3
|
export * from './gridObservables';
|
4
|
-
export * from './multiGridObservables';
|
5
4
|
export * from './observables';
|
6
5
|
export * from './orbchartsUtils';
|
7
|
-
export * from './seriesObservables';
|
8
|
-
export * from './treeObservables';
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { Subject, Observable } from 'rxjs';
|
2
|
-
import { ChartParams, ComputedDataTypeMap, ContextObserverMultiGridDetail, DataFormatterTypeMap, EventMultiGrid, ContainerPositionScaled, Layout } from '../../lib/core-types';
|
2
|
+
import { ChartParams, ComputedDataTypeMap, ContextObserverMultiGridDetail, ContainerSize, DataFormatterTypeMap, EventMultiGrid, ContainerPositionScaled, Layout } from '../../lib/core-types';
|
3
3
|
|
4
|
-
export declare const multiGridEachDetailObservable: ({ fullDataFormatter$, computedData$, layout$, fullChartParams$, event$ }: {
|
4
|
+
export declare const multiGridEachDetailObservable: ({ fullDataFormatter$, computedData$, layout$, fullChartParams$, event$, containerSize$ }: {
|
5
5
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiGrid">>;
|
6
6
|
computedData$: Observable<ComputedDataTypeMap<"multiGrid">>;
|
7
7
|
layout$: Observable<Layout>;
|
8
8
|
fullChartParams$: Observable<ChartParams>;
|
9
9
|
event$: Subject<EventMultiGrid>;
|
10
|
+
containerSize$: Observable<ContainerSize>;
|
10
11
|
}) => Observable<ContextObserverMultiGridDetail[]>;
|
11
12
|
export declare const multiGridContainerObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
12
13
|
computedData$: Observable<ComputedDataTypeMap<"multiGrid">>;
|
@@ -1,73 +1,120 @@
|
|
1
1
|
import { Observable } from 'rxjs';
|
2
|
-
import { ComputedDataTypeMap, ComputedDatumMultiValue, DataFormatterTypeMap,
|
2
|
+
import { ComputedDataTypeMap, ComputedDataMultiValue, ComputedDatumMultiValue, ComputedDatumWithSumMultiValue, ContainerSize, DataFormatterTypeMap, DataFormatterMultiValue, ComputedXYDatumMultiValue, ComputedXYDataMultiValue, ContainerPositionScaled, Layout, TransformData } from '../../lib/core-types';
|
3
3
|
|
4
|
-
export declare const
|
4
|
+
export declare const xyMinMaxObservable: ({ computedData$, xyValueIndex$ }: {
|
5
5
|
computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
|
6
|
+
xyValueIndex$: Observable<[number, number]>;
|
6
7
|
}) => Observable<{
|
7
8
|
minX: number;
|
8
9
|
maxX: number;
|
9
10
|
minY: number;
|
10
11
|
maxY: number;
|
11
12
|
}>;
|
12
|
-
export declare const
|
13
|
+
export declare const computedXYDataObservable: ({ computedData$, xyMinMax$, xyValueIndex$, fullDataFormatter$, layout$ }: {
|
13
14
|
computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
|
14
|
-
|
15
|
+
xyMinMax$: Observable<{
|
15
16
|
minX: number;
|
16
17
|
maxX: number;
|
17
18
|
minY: number;
|
18
19
|
maxY: number;
|
19
20
|
}>;
|
21
|
+
xyValueIndex$: Observable<[number, number]>;
|
20
22
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
|
21
23
|
layout$: Observable<Layout>;
|
22
|
-
}) => Observable<
|
23
|
-
export declare const
|
24
|
+
}) => Observable<ComputedXYDataMultiValue>;
|
25
|
+
export declare const categoryLabelsObservable: ({ computedData$, fullDataFormatter$ }: {
|
24
26
|
computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
|
25
27
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
|
26
28
|
}) => Observable<string[]>;
|
27
|
-
export declare const
|
29
|
+
export declare const visibleComputedDataObservable: ({ computedData$ }: {
|
28
30
|
computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
|
29
31
|
}) => Observable<ComputedDatumMultiValue[][]>;
|
30
|
-
export declare const
|
31
|
-
|
32
|
-
}) => Observable<
|
33
|
-
export declare const
|
32
|
+
export declare const visibleComputedSumDataObservable: ({ visibleComputedData$ }: {
|
33
|
+
visibleComputedData$: Observable<ComputedDataMultiValue>;
|
34
|
+
}) => Observable<ComputedDatumWithSumMultiValue[][]>;
|
35
|
+
export declare const visibleComputedRankingByIndexDataObservable: ({ xyValueIndex$, isCategorySeprate$, visibleComputedData$ }: {
|
36
|
+
xyValueIndex$: Observable<[number, number]>;
|
37
|
+
isCategorySeprate$: Observable<boolean>;
|
38
|
+
visibleComputedData$: Observable<ComputedDatumMultiValue[][]>;
|
39
|
+
}) => Observable<ComputedDatumMultiValue[][]>;
|
40
|
+
export declare const visibleComputedRankingBySumDataObservable: ({ isCategorySeprate$, visibleComputedSumData$ }: {
|
41
|
+
isCategorySeprate$: Observable<boolean>;
|
42
|
+
visibleComputedSumData$: Observable<ComputedDatumWithSumMultiValue[][]>;
|
43
|
+
}) => Observable<ComputedDatumWithSumMultiValue[][]>;
|
44
|
+
export declare const visibleComputedXYDataObservable: ({ computedXYData$ }: {
|
45
|
+
computedXYData$: Observable<ComputedXYDataMultiValue>;
|
46
|
+
}) => Observable<ComputedXYDatumMultiValue[][]>;
|
47
|
+
export declare const containerPositionObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
34
48
|
computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
|
35
49
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
|
36
50
|
layout$: Observable<Layout>;
|
37
51
|
}) => Observable<ContainerPositionScaled[]>;
|
38
|
-
export declare const
|
39
|
-
|
40
|
-
|
52
|
+
export declare const filteredXYMinMaxDataObservable: ({ visibleComputedXYData$, xyMinMax$, xyValueIndex$, fullDataFormatter$ }: {
|
53
|
+
visibleComputedXYData$: Observable<ComputedXYDataMultiValue>;
|
54
|
+
xyMinMax$: Observable<{
|
41
55
|
minX: number;
|
42
56
|
maxX: number;
|
43
57
|
minY: number;
|
44
58
|
maxY: number;
|
45
59
|
}>;
|
60
|
+
xyValueIndex$: Observable<[number, number]>;
|
46
61
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
|
47
62
|
}) => Observable<{
|
48
|
-
datumList:
|
49
|
-
minXDatum:
|
50
|
-
maxXDatum:
|
51
|
-
minYDatum:
|
52
|
-
maxYDatum:
|
63
|
+
datumList: ComputedXYDatumMultiValue[];
|
64
|
+
minXDatum: ComputedXYDatumMultiValue;
|
65
|
+
maxXDatum: ComputedXYDatumMultiValue;
|
66
|
+
minYDatum: ComputedXYDatumMultiValue;
|
67
|
+
maxYDatum: ComputedXYDatumMultiValue;
|
53
68
|
}>;
|
54
|
-
export declare const
|
55
|
-
|
69
|
+
export declare const graphicTransformObservable: ({ xyMinMax$, xyValueIndex$, filteredXYMinMaxData$, fullDataFormatter$, layout$ }: {
|
70
|
+
xyMinMax$: Observable<{
|
56
71
|
minX: number;
|
57
72
|
maxX: number;
|
58
73
|
minY: number;
|
59
74
|
maxY: number;
|
60
75
|
}>;
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
76
|
+
xyValueIndex$: Observable<[number, number]>;
|
77
|
+
filteredXYMinMaxData$: Observable<{
|
78
|
+
minXDatum: ComputedXYDatumMultiValue;
|
79
|
+
maxXDatum: ComputedXYDatumMultiValue;
|
80
|
+
minYDatum: ComputedXYDatumMultiValue;
|
81
|
+
maxYDatum: ComputedXYDatumMultiValue;
|
66
82
|
}>;
|
67
83
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
|
68
84
|
layout$: Observable<Layout>;
|
69
85
|
}) => Observable<TransformData>;
|
70
|
-
export declare const
|
71
|
-
|
72
|
-
|
86
|
+
export declare const graphicReverseScaleObservable: ({ containerPosition$, graphicTransform$ }: {
|
87
|
+
containerPosition$: Observable<ContainerPositionScaled[]>;
|
88
|
+
graphicTransform$: Observable<TransformData>;
|
73
89
|
}) => Observable<[number, number][]>;
|
90
|
+
export declare const xScaleObservable: ({ visibleComputedSumData$, fullDataFormatter$, filteredXYMinMaxData$, containerSize$ }: {
|
91
|
+
visibleComputedSumData$: Observable<ComputedDatumMultiValue[][]>;
|
92
|
+
fullDataFormatter$: Observable<DataFormatterMultiValue>;
|
93
|
+
filteredXYMinMaxData$: Observable<{
|
94
|
+
minXDatum: ComputedXYDatumMultiValue;
|
95
|
+
maxXDatum: ComputedXYDatumMultiValue;
|
96
|
+
minYDatum: ComputedXYDatumMultiValue;
|
97
|
+
maxYDatum: ComputedXYDatumMultiValue;
|
98
|
+
}>;
|
99
|
+
containerSize$: Observable<ContainerSize>;
|
100
|
+
}) => Observable<import('d3-scale').ScaleLinear<number, number, never>>;
|
101
|
+
export declare const xSumScaleObservable: ({ fullDataFormatter$, filteredXYMinMaxData$, containerSize$ }: {
|
102
|
+
fullDataFormatter$: Observable<DataFormatterMultiValue>;
|
103
|
+
filteredXYMinMaxData$: Observable<{
|
104
|
+
minXDatum: ComputedXYDatumMultiValue;
|
105
|
+
maxXDatum: ComputedXYDatumMultiValue;
|
106
|
+
minYDatum: ComputedXYDatumMultiValue;
|
107
|
+
maxYDatum: ComputedXYDatumMultiValue;
|
108
|
+
}>;
|
109
|
+
containerSize$: Observable<ContainerSize>;
|
110
|
+
}) => Observable<import('d3-scale').ScaleLinear<number, number, never>>;
|
111
|
+
export declare const yScaleObservable: ({ fullDataFormatter$, filteredXYMinMaxData$, containerSize$ }: {
|
112
|
+
fullDataFormatter$: Observable<DataFormatterMultiValue>;
|
113
|
+
filteredXYMinMaxData$: Observable<{
|
114
|
+
minXDatum: ComputedXYDatumMultiValue;
|
115
|
+
maxXDatum: ComputedXYDatumMultiValue;
|
116
|
+
minYDatum: ComputedXYDatumMultiValue;
|
117
|
+
maxYDatum: ComputedXYDatumMultiValue;
|
118
|
+
}>;
|
119
|
+
containerSize$: Observable<ContainerSize>;
|
120
|
+
}) => Observable<import('d3-scale').ScaleLinear<number, number, never>>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Subject, Observable } from 'rxjs';
|
2
|
-
import { ChartType, ChartParams, ComputedDatumTypeMap, EventTypeMap } from '../../lib/core-types';
|
2
|
+
import { ChartType, ChartParams, ComputedDatumTypeMap, ContainerPositionScaled, EventTypeMap, Layout } from '../../lib/core-types';
|
3
3
|
|
4
4
|
export declare function resizeObservable(elem: HTMLElement | Element): Observable<DOMRectReadOnly>;
|
5
5
|
export declare const highlightObservable: <T extends ChartType, D>({ datumList$, fullChartParams$, event$ }: {
|
@@ -17,3 +17,10 @@ export declare const categoryDataMapObservable: <DatumType extends ComputedDatum
|
|
17
17
|
datumList$: Observable<DatumType[]>;
|
18
18
|
}) => Observable<Map<string, DatumType[]>>;
|
19
19
|
export declare const textSizePxObservable: (chartParams$: Observable<ChartParams>) => Observable<number>;
|
20
|
+
export declare const containerSizeObservable: ({ layout$, containerPosition$ }: {
|
21
|
+
layout$: Observable<Layout>;
|
22
|
+
containerPosition$: Observable<ContainerPositionScaled[]>;
|
23
|
+
}) => Observable<{
|
24
|
+
width: number;
|
25
|
+
height: number;
|
26
|
+
}>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ChartType, ChartParams, DatumValue, DataSeries, DataGrid, DataGridDatum, DataMultiGrid, DataMultiValue,
|
1
|
+
import { ChartType, ChartParams, DatumValue, DataSeries, DataGrid, DataGridDatum, DataMultiGrid, DataMultiValue, ComputedXYDatumMultiValue, DataFormatterContainer, SeriesDirection, DataFormatterGridGrid, ContainerPosition, ContainerPositionScaled, Layout } from '../../lib/core-types';
|
2
2
|
import * as d3 from 'd3';
|
3
3
|
export declare function formatValueToLabel(value: any, valueFormatter: string | ((text: d3.NumberValue) => string)): string;
|
4
4
|
export declare function createDefaultDatumId(chartTypeOrPrefix: string, levelOneIndex: number, levelTwoIndex?: number, levelThreeIndex?: number): string;
|
@@ -34,19 +34,19 @@ export declare function getMinMaxGrid(data: DataGrid): [number, number];
|
|
34
34
|
export declare function getMinMaxMultiGrid(data: DataMultiGrid): [number, number];
|
35
35
|
export declare function getMinMaxMultiValue(data: DataMultiValue, valueIndex: number): [number, number];
|
36
36
|
export declare function getMinMaxMultiValueXY({ data, minX, maxX, minY, maxY }: {
|
37
|
-
data:
|
37
|
+
data: ComputedXYDatumMultiValue[][];
|
38
38
|
minX: number;
|
39
39
|
maxX: number;
|
40
40
|
minY: number;
|
41
41
|
maxY: number;
|
42
42
|
}): {
|
43
|
-
minXDatum:
|
44
|
-
maxXDatum:
|
45
|
-
minYDatum:
|
46
|
-
maxYDatum:
|
47
|
-
filteredData:
|
43
|
+
minXDatum: ComputedXYDatumMultiValue;
|
44
|
+
maxXDatum: ComputedXYDatumMultiValue;
|
45
|
+
minYDatum: ComputedXYDatumMultiValue;
|
46
|
+
maxYDatum: ComputedXYDatumMultiValue;
|
47
|
+
filteredData: ComputedXYDatumMultiValue[][];
|
48
48
|
};
|
49
49
|
export declare function transposeData<T>(seriesDirection: SeriesDirection, data: T[][]): T[][];
|
50
50
|
export declare function seriesColorPredicate(seriesIndex: number, chartParams: ChartParams): string;
|
51
|
-
export declare function
|
52
|
-
export declare function
|
51
|
+
export declare function calcContainerPosition(layout: Layout, container: DataFormatterContainer, amount: number): ContainerPosition[];
|
52
|
+
export declare function calcContainerPositionScaled(layout: Layout, container: DataFormatterContainer, amount: number): ContainerPositionScaled[];
|
@@ -10,7 +10,7 @@ export declare const seriesLabelsObservable: ({ computedData$ }: {
|
|
10
10
|
export declare const seriesVisibleComputedDataObservable: ({ computedData$ }: {
|
11
11
|
computedData$: Observable<ComputedDataTypeMap<"series">>;
|
12
12
|
}) => Observable<ComputedDatumSeries[][]>;
|
13
|
-
export declare const
|
13
|
+
export declare const seriesComputedSortedDataObservable: ({ computedData$, fullDataFormatter$ }: {
|
14
14
|
computedData$: Observable<ComputedDataTypeMap<"series">>;
|
15
15
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"series">>;
|
16
16
|
}) => Observable<ComputedDatumSeries[][]>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orbcharts/core",
|
3
|
-
"version": "3.0.0
|
3
|
+
"version": "3.0.0",
|
4
4
|
"description": "OrbCharts is an open source chart library based on d3.js and rx.js",
|
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-types": "^3.0.0
|
38
|
+
"@orbcharts/core-types": "^3.0.0",
|
39
39
|
"d3": "^7.8.5",
|
40
40
|
"rxjs": "^7.8.1"
|
41
41
|
}
|
@@ -180,6 +180,7 @@ export const createBaseChart: CreateBaseChart = <T extends ChartType>({
|
|
180
180
|
return {
|
181
181
|
name: preset.name ?? '',
|
182
182
|
description: preset.description ?? '',
|
183
|
+
descriptionZh: preset.descriptionZh ?? '',
|
183
184
|
chartParams: preset.chartParams
|
184
185
|
? mergeOptionsWithDefault(preset.chartParams, DEFAULT_CHART_PARAMS)
|
185
186
|
: DEFAULT_CHART_PARAMS,
|
@@ -187,8 +188,8 @@ export const createBaseChart: CreateBaseChart = <T extends ChartType>({
|
|
187
188
|
// ? mergeOptionsWithDefault(preset.dataFormatter, defaultDataFormatter)
|
188
189
|
? mergeDataFormatter(preset.dataFormatter, defaultDataFormatter, chartType)
|
189
190
|
: defaultDataFormatter,
|
190
|
-
|
191
|
-
? preset.
|
191
|
+
pluginParams: preset.pluginParams
|
192
|
+
? preset.pluginParams
|
192
193
|
: {}
|
193
194
|
}
|
194
195
|
})(options)
|
@@ -464,7 +465,7 @@ export const createBaseChart: CreateBaseChart = <T extends ChartType>({
|
|
464
465
|
observer: pluginObserver
|
465
466
|
}
|
466
467
|
|
467
|
-
plugin.setPresetParams(mergedPresetWithDefault.
|
468
|
+
plugin.setPresetParams(mergedPresetWithDefault.pluginParams[plugin.name] ?? {})
|
468
469
|
// 傳入context
|
469
470
|
plugin.setContext(pluginContext)
|
470
471
|
|
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
import type {
|
15
15
|
ChartType,
|
16
16
|
CreateBasePlugin,
|
17
|
+
DeepPartial,
|
17
18
|
DefinePluginConfig,
|
18
19
|
PluginInitFn,
|
19
20
|
PluginContext,
|
@@ -34,7 +35,7 @@ function createPluginEntity <T extends ChartType, PluginName, PluginParams>({ ch
|
|
34
35
|
let pluginDestroyFn = () => {}
|
35
36
|
let pluginContext: PluginContext<T, PluginName, PluginParams> | undefined
|
36
37
|
const mergedDefaultParams$ = new BehaviorSubject(config.defaultParams)
|
37
|
-
const params$: Subject<
|
38
|
+
const params$: Subject<DeepPartial<typeof config.defaultParams>> = new BehaviorSubject({})
|
38
39
|
const fullParams$ = mergedDefaultParams$.pipe(
|
39
40
|
switchMap(mergedDefaultParams => {
|
40
41
|
return params$
|
@@ -98,7 +99,7 @@ function createPluginEntity <T extends ChartType, PluginName, PluginParams>({ ch
|
|
98
99
|
}
|
99
100
|
destroy$.next(undefined)
|
100
101
|
},
|
101
|
-
setPresetParams: (presetParams:
|
102
|
+
setPresetParams: (presetParams: DeepPartial<PluginParams>) => {
|
102
103
|
mergedDefaultParams$.next(mergeOptionsWithDefault(presetParams, config.defaultParams))
|
103
104
|
|
104
105
|
},
|
@@ -119,7 +120,7 @@ export const createBasePlugin: CreateBasePlugin = <T extends ChartType>(chartTyp
|
|
119
120
|
return function definePluginInitFn (initFn: PluginInitFn<T, PluginName, PluginParams>) {
|
120
121
|
|
121
122
|
return class Plugin {
|
122
|
-
params$: Subject<
|
123
|
+
params$: Subject<DeepPartial<PluginParams>>
|
123
124
|
name: PluginName
|
124
125
|
chartType: T
|
125
126
|
defaultParams: PluginParams
|
@@ -127,7 +128,7 @@ export const createBasePlugin: CreateBasePlugin = <T extends ChartType>(chartTyp
|
|
127
128
|
// presetParams: Partial<PluginParams>
|
128
129
|
init: () => void
|
129
130
|
destroy: () => void
|
130
|
-
setPresetParams: (presetParams:
|
131
|
+
setPresetParams: (presetParams: DeepPartial<PluginParams>) => void
|
131
132
|
setContext: (pluginContext: PluginContext<T, PluginName, PluginParams>) => void
|
132
133
|
constructor () {
|
133
134
|
const pluginEntity = createPluginEntity<T, PluginName, PluginParams>({
|
@@ -92,8 +92,8 @@ export function chartParamsValidator (chartType: ChartType, chartParamsPartial:
|
|
92
92
|
secondary: {
|
93
93
|
toBeTypes: ['string'],
|
94
94
|
},
|
95
|
-
|
96
|
-
toBeTypes: ['string'],
|
95
|
+
labelContrast: {
|
96
|
+
toBeTypes: ['string[]'],
|
97
97
|
},
|
98
98
|
background: {
|
99
99
|
toBeTypes: ['string'],
|
@@ -116,8 +116,8 @@ export function chartParamsValidator (chartType: ChartType, chartParamsPartial:
|
|
116
116
|
secondary: {
|
117
117
|
toBeTypes: ['string'],
|
118
118
|
},
|
119
|
-
|
120
|
-
toBeTypes: ['string'],
|
119
|
+
labelContrast: {
|
120
|
+
toBeTypes: ['string[]'],
|
121
121
|
},
|
122
122
|
background: {
|
123
123
|
toBeTypes: ['string'],
|
package/src/defaults.ts
CHANGED
@@ -8,6 +8,7 @@ import type {
|
|
8
8
|
DataRelationship,
|
9
9
|
DataFormatterValueAxis,
|
10
10
|
DataFormatterGroupAxis,
|
11
|
+
DataFormatterXYAxis,
|
11
12
|
DataFormatterContainer,
|
12
13
|
DataFormatterSeries,
|
13
14
|
DataFormatterGrid,
|
@@ -56,21 +57,50 @@ export const DEFAULT_CHART_PARAMS: ChartParams = {
|
|
56
57
|
colorScheme: 'light',
|
57
58
|
colors: {
|
58
59
|
light: {
|
59
|
-
label: [
|
60
|
+
label: [
|
61
|
+
"#6CBAFF",
|
62
|
+
"#FF6C6C",
|
63
|
+
"#F9B052",
|
64
|
+
"#7DD3C4",
|
65
|
+
"#AA93D2",
|
66
|
+
"#0088FF",
|
67
|
+
"#FFBABA",
|
68
|
+
"#86DC72",
|
69
|
+
"#EF76FF",
|
70
|
+
"#C4C4C4"
|
71
|
+
],
|
72
|
+
// label: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
60
73
|
// label: ['#F3A356', '#7A60F0', '#38B1AF', '#60A2F0', '#F06062', '#FF383C', '#6580EA', '#079F9C', '#9F65EA', '#EA7465', '#EA7465', '#8657D2', '#59B757', '#2797FF', '#D25786', '#F54BA6', '#4BECF5', '#74FD72', '#CA4BF5', '#EFE26E'],
|
61
74
|
// label: ['#60A2F0', '#F3A356', '#7A60F0', '#38B1AF', '#F06062', '#FF383C', '#6580EA', '#079F9C', '#9F65EA', '#EA7465', '#EA7465', '#8657D2', '#59B757', '#2797FF', '#D25786', '#F54BA6', '#4BECF5', '#74FD72', '#CA4BF5', '#EFE26E'],
|
62
75
|
// primary: '#454545',
|
63
|
-
primary: '#1b1e23',
|
64
|
-
|
65
|
-
|
76
|
+
// primary: '#1b1e23',
|
77
|
+
primary: '#000000',
|
78
|
+
secondary: '#e0e0e0',
|
79
|
+
// white: '#ffffff',
|
80
|
+
labelContrast: ['#ffffff', '#000000'],
|
66
81
|
background: '#ffffff'
|
67
82
|
},
|
68
83
|
dark: {
|
69
|
-
label: [
|
84
|
+
label: [
|
85
|
+
"#6CBAFF",
|
86
|
+
"#FF6C6C",
|
87
|
+
"#F9B052",
|
88
|
+
"#7DD3C4",
|
89
|
+
"#AA93D2",
|
90
|
+
"#0088FF",
|
91
|
+
"#FFBABA",
|
92
|
+
"#86DC72",
|
93
|
+
"#EF76FF",
|
94
|
+
"#C4C4C4"
|
95
|
+
],
|
96
|
+
// label: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
97
|
+
// label: ['#67B7DC', '#6794DC', '#38B1AF', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
70
98
|
// label: ['#60A2F0', '#F3A356', '#7A60F0', '#38B1AF', '#F06062', '#FF383C', '#6580EA', '#079F9C', '#9F65EA', '#EA7465', '#EA7465', '#8657D2', '#59B757', '#2797FF', '#D25786', '#F54BA6', '#4BECF5', '#74FD72', '#CA4BF5', '#EFE26E'],
|
71
|
-
primary: '#f0f0f0',
|
72
|
-
|
73
|
-
|
99
|
+
// primary: '#f0f0f0',
|
100
|
+
primary: '#ffffff',
|
101
|
+
secondary: '#e0e0e0',
|
102
|
+
// white: '#ffffff',
|
103
|
+
labelContrast: ['#ffffff', '#000000'],
|
74
104
|
background: '#000000'
|
75
105
|
}
|
76
106
|
},
|
@@ -120,6 +150,13 @@ export const DEFAULT_DATA_FORMATTER_GROUP_AXIS: DataFormatterGroupAxis = {
|
|
120
150
|
label: ''
|
121
151
|
}
|
122
152
|
|
153
|
+
export const DEFAULT_DATA_FORMATTER_X_Y_AXIS: DataFormatterXYAxis = {
|
154
|
+
scaleDomain: ['auto', 'auto'],
|
155
|
+
scaleRange: [0, 0.9],
|
156
|
+
label: '',
|
157
|
+
valueIndex: 0
|
158
|
+
}
|
159
|
+
|
123
160
|
export const DEFAULT_DATA_FORMATTER_CONTAINER: DataFormatterContainer = {
|
124
161
|
gap: 120,
|
125
162
|
rowAmount: 1,
|
@@ -204,8 +241,15 @@ export const DEFAULT_DATA_FORMATTER_MULTI_VALUE: DataFormatterMultiValue = {
|
|
204
241
|
type: 'multiValue',
|
205
242
|
visibleFilter: (datum, context) => true,
|
206
243
|
categoryLabels: [],
|
207
|
-
|
208
|
-
|
244
|
+
valueLabels: [],
|
245
|
+
xAxis: {
|
246
|
+
...DEFAULT_DATA_FORMATTER_X_Y_AXIS,
|
247
|
+
valueIndex: 0
|
248
|
+
},
|
249
|
+
yAxis: {
|
250
|
+
...DEFAULT_DATA_FORMATTER_X_Y_AXIS,
|
251
|
+
valueIndex: 1
|
252
|
+
},
|
209
253
|
container: {
|
210
254
|
...DEFAULT_DATA_FORMATTER_CONTAINER
|
211
255
|
},
|
@@ -6,11 +6,12 @@ import {
|
|
6
6
|
groupDataMapObservable,
|
7
7
|
textSizePxObservable } from '../utils/observables'
|
8
8
|
import {
|
9
|
-
|
9
|
+
gridComputedAxesDataObservable,
|
10
10
|
gridAxesSizeObservable,
|
11
|
+
gridAxesContainerSizeObservable,
|
11
12
|
gridSeriesLabelsObservable,
|
12
13
|
gridVisibleComputedDataObservable,
|
13
|
-
|
14
|
+
gridVisibleComputedAxesDataObservable,
|
14
15
|
// isSeriesSeprateObservable,
|
15
16
|
gridContainerPositionObservable,
|
16
17
|
computedStackedDataObservables,
|
@@ -21,6 +22,7 @@ import {
|
|
21
22
|
gridGraphicTransformObservable,
|
22
23
|
gridGraphicReverseScaleObservable,
|
23
24
|
} from '../utils/gridObservables'
|
25
|
+
import { containerSizeObservable } from '../utils/observables'
|
24
26
|
|
25
27
|
export const contextObserverCallback: ContextObserverCallback<'grid'> = ({ subject, observer }) => {
|
26
28
|
|
@@ -38,7 +40,16 @@ export const contextObserverCallback: ContextObserverCallback<'grid'> = ({ subje
|
|
38
40
|
computedData$: observer.computedData$,
|
39
41
|
fullDataFormatter$: observer.fullDataFormatter$,
|
40
42
|
layout$: observer.layout$,
|
41
|
-
})
|
43
|
+
}).pipe(
|
44
|
+
shareReplay(1)
|
45
|
+
)
|
46
|
+
|
47
|
+
const containerSize$ = containerSizeObservable({
|
48
|
+
layout$: observer.layout$,
|
49
|
+
containerPosition$: gridContainerPosition$
|
50
|
+
}).pipe(
|
51
|
+
shareReplay(1)
|
52
|
+
)
|
42
53
|
|
43
54
|
const gridAxesSize$ = gridAxesSizeObservable({
|
44
55
|
fullDataFormatter$: observer.fullDataFormatter$,
|
@@ -47,6 +58,13 @@ export const contextObserverCallback: ContextObserverCallback<'grid'> = ({ subje
|
|
47
58
|
shareReplay(1)
|
48
59
|
)
|
49
60
|
|
61
|
+
const gridAxesContainerSize$ = gridAxesContainerSizeObservable({
|
62
|
+
fullDataFormatter$: observer.fullDataFormatter$,
|
63
|
+
containerSize$: containerSize$
|
64
|
+
}).pipe(
|
65
|
+
shareReplay(1)
|
66
|
+
)
|
67
|
+
|
50
68
|
const datumList$ = observer.computedData$.pipe(
|
51
69
|
map(d => d.flat())
|
52
70
|
).pipe(
|
@@ -77,7 +95,7 @@ export const contextObserverCallback: ContextObserverCallback<'grid'> = ({ subje
|
|
77
95
|
shareReplay(1)
|
78
96
|
)
|
79
97
|
|
80
|
-
const
|
98
|
+
const computedAxesData$ = gridComputedAxesDataObservable({
|
81
99
|
computedData$: observer.computedData$,
|
82
100
|
fullDataFormatter$: observer.fullDataFormatter$,
|
83
101
|
layout$: observer.layout$,
|
@@ -91,8 +109,8 @@ export const contextObserverCallback: ContextObserverCallback<'grid'> = ({ subje
|
|
91
109
|
shareReplay(1)
|
92
110
|
)
|
93
111
|
|
94
|
-
const
|
95
|
-
|
112
|
+
const visibleComputedAxesData$ = gridVisibleComputedAxesDataObservable({
|
113
|
+
computedAxesData$: computedAxesData$,
|
96
114
|
}).pipe(
|
97
115
|
shareReplay(1)
|
98
116
|
)
|
@@ -145,7 +163,9 @@ export const contextObserverCallback: ContextObserverCallback<'grid'> = ({ subje
|
|
145
163
|
gridContainerPosition$: gridContainerPosition$,
|
146
164
|
gridAxesTransform$: gridAxesTransform$,
|
147
165
|
gridGraphicTransform$: gridGraphicTransform$,
|
148
|
-
})
|
166
|
+
}).pipe(
|
167
|
+
shareReplay(1)
|
168
|
+
)
|
149
169
|
|
150
170
|
|
151
171
|
return {
|
@@ -157,14 +177,16 @@ export const contextObserverCallback: ContextObserverCallback<'grid'> = ({ subje
|
|
157
177
|
textSizePx$,
|
158
178
|
isSeriesSeprate$,
|
159
179
|
gridContainerPosition$,
|
180
|
+
containerSize$,
|
160
181
|
gridAxesSize$,
|
182
|
+
gridAxesContainerSize$,
|
161
183
|
gridHighlight$,
|
162
184
|
seriesLabels$,
|
163
185
|
SeriesDataMap$,
|
164
186
|
GroupDataMap$,
|
165
|
-
|
187
|
+
computedAxesData$,
|
166
188
|
visibleComputedData$,
|
167
|
-
|
189
|
+
visibleComputedAxesData$,
|
168
190
|
computedStackedData$,
|
169
191
|
groupScaleDomainValue$,
|
170
192
|
filteredMinMaxValue$,
|