@orbcharts/core 3.0.0-beta.1 → 3.0.0-beta.11
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 +3271 -2862
- package/dist/orbcharts-core.umd.js +4 -4
- package/dist/src/defaults.d.ts +24 -23
- package/dist/src/utils/d3Scale.d.ts +28 -0
- package/dist/src/utils/gridObservables.d.ts +29 -19
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/multiGridObservables.d.ts +2 -2
- package/dist/src/utils/multiValueObservables.d.ts +73 -0
- package/dist/src/utils/orbchartsUtils.d.ts +24 -10
- package/dist/src/utils/relationshipObservables.d.ts +13 -0
- package/dist/src/utils/seriesObservables.d.ts +4 -4
- package/dist/src/utils/treeObservables.d.ts +2 -5
- package/package.json +2 -2
- package/src/GridChart.ts +2 -2
- package/src/MultiGridChart.ts +2 -2
- package/src/MultiValueChart.ts +2 -2
- package/src/RelationshipChart.ts +2 -2
- package/src/SeriesChart.ts +2 -2
- package/src/TreeChart.ts +2 -2
- package/src/base/createBaseChart.ts +13 -13
- package/src/base/validators/chartParamsValidator.ts +6 -6
- package/src/defaults.ts +87 -47
- package/src/grid/computedDataFn.ts +4 -4
- package/src/grid/contextObserverCallback.ts +58 -37
- package/src/grid/dataFormatterValidator.ts +14 -14
- package/src/multiGrid/computedDataFn.ts +2 -2
- package/src/multiValue/computedDataFn.ts +81 -147
- package/src/multiValue/contextObserverCallback.ts +150 -2
- package/src/relationship/computedDataFn.ts +94 -60
- package/src/relationship/contextObserverCallback.ts +68 -0
- package/src/tree/computedDataFn.ts +9 -10
- package/src/tree/contextObserverCallback.ts +6 -9
- package/src/utils/d3Scale.ts +198 -0
- package/src/utils/gridObservables.ts +320 -248
- package/src/utils/index.ts +1 -1
- package/src/utils/multiGridObservables.ts +75 -49
- package/src/utils/multiValueObservables.ts +662 -0
- package/src/utils/observables.ts +30 -12
- package/src/utils/orbchartsUtils.ts +90 -65
- package/src/utils/relationshipObservables.ts +85 -0
- package/src/utils/seriesObservables.ts +7 -7
- package/src/utils/treeObservables.ts +44 -33
- package/src/utils/validator.ts +5 -4
- package/dist/src/utils/d3Utils.d.ts +0 -19
- package/src/utils/d3Utils.ts +0 -108
package/dist/src/defaults.d.ts
CHANGED
@@ -1,24 +1,25 @@
|
|
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, DataFormatterAxis, DataFormatterContainer, DataFormatterSeries, DataFormatterGrid, DataFormatterGridGrid, DataFormatterMultiGrid, DataFormatterMultiGridGrid, DataFormatterMultiValue, DataFormatterTree, DataFormatterRelationship, ChartParams, Padding } from '../lib/core-types';
|
2
2
|
|
3
|
-
export declare const
|
4
|
-
export declare const
|
5
|
-
export declare const
|
6
|
-
export declare const
|
7
|
-
export declare const
|
8
|
-
export declare const
|
9
|
-
export declare const
|
10
|
-
export declare const
|
11
|
-
export declare const
|
12
|
-
export declare const
|
13
|
-
export declare const
|
14
|
-
export declare const
|
15
|
-
export declare const
|
16
|
-
export declare const
|
17
|
-
export declare const
|
18
|
-
export declare const
|
19
|
-
export declare const
|
20
|
-
export declare const
|
21
|
-
export declare const
|
22
|
-
export declare const
|
23
|
-
export declare const
|
24
|
-
export declare const
|
3
|
+
export declare const DEFAULT_CHART_OPTIONS: ChartOptionsPartial<any>;
|
4
|
+
export declare const DEFAULT_PADDING: Padding;
|
5
|
+
export declare const DEFAULT_CHART_PARAMS: ChartParams;
|
6
|
+
export declare const DEFAULT_CHART_WIDTH = 800;
|
7
|
+
export declare const DEFAULT_CHART_HEIGHT = 500;
|
8
|
+
export declare const DEFAULT_DATA_SERIES: DataSeries;
|
9
|
+
export declare const DEFAULT_DATA_GRID: DataGrid;
|
10
|
+
export declare const DEFAULT_DATA_MULTI_GRID: DataMultiGrid;
|
11
|
+
export declare const DEFAULT_DATA_MULTI_VALUE: DataMultiValue;
|
12
|
+
export declare const DEFAULT_DATA_TREE: DataTree;
|
13
|
+
export declare const DEFAULTL_DATA_RELATIONA: DataRelationship;
|
14
|
+
export declare const DEFAULT_DATA_FORMATTER_VALUE_AXIS: DataFormatterValueAxis;
|
15
|
+
export declare const DEFAULT_DATA_FORMATTER_GROUP_AXIS: DataFormatterGroupAxis;
|
16
|
+
export declare const DEFAULT_DATA_FORMATTER_AXIS: DataFormatterAxis;
|
17
|
+
export declare const DEFAULT_DATA_FORMATTER_CONTAINER: DataFormatterContainer;
|
18
|
+
export declare const DEFAULT_DATA_FORMATTER_SERIES: DataFormatterSeries;
|
19
|
+
export declare const DEFAULT_DATA_FORMATTER_GRID_GRID: DataFormatterGridGrid;
|
20
|
+
export declare const DEFAULT_DATA_FORMATTER_GRID: DataFormatterGrid;
|
21
|
+
export declare const DEFAULT_DATA_FORMATTER_MULTI_GRID_GRID: DataFormatterMultiGridGrid;
|
22
|
+
export declare const DEFAULT_DATA_FORMATTER_MULTI_GRID: DataFormatterMultiGrid;
|
23
|
+
export declare const DEFAULT_DATA_FORMATTER_MULTI_VALUE: DataFormatterMultiValue;
|
24
|
+
export declare const DEFAULT_DATA_FORMATTER_TREE: DataFormatterTree;
|
25
|
+
export declare const DEFAULT_DATA_FORMATTER_RELATIONSHIP: DataFormatterRelationship;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import * as d3 from 'd3';
|
2
|
+
export declare const createValueToAxisScale: ({ maxValue, minValue, axisWidth, scaleDomain, scaleRange, reverse }: {
|
3
|
+
maxValue: number;
|
4
|
+
minValue: number;
|
5
|
+
axisWidth: number;
|
6
|
+
scaleDomain: [number | "min" | "auto", number | "max" | "auto"];
|
7
|
+
scaleRange: [number, number];
|
8
|
+
reverse?: boolean;
|
9
|
+
}) => d3.ScaleLinear<number, number, never>;
|
10
|
+
export declare const createAxisToValueScale: ({ maxValue, minValue, axisWidth, scaleDomain, scaleRange, reverse }: {
|
11
|
+
maxValue: number;
|
12
|
+
minValue: number;
|
13
|
+
axisWidth: number;
|
14
|
+
scaleDomain: [number | "min" | "auto", number | "max" | "auto"];
|
15
|
+
scaleRange: [number, number];
|
16
|
+
reverse?: boolean;
|
17
|
+
}) => d3.ScaleLinear<number, number, never>;
|
18
|
+
export declare const createLabelToAxisScale: ({ axisLabels, axisWidth, padding }: {
|
19
|
+
axisLabels: string[];
|
20
|
+
axisWidth: number;
|
21
|
+
padding?: number;
|
22
|
+
}) => d3.ScalePoint<string>;
|
23
|
+
export declare const createAxisToLabelIndexScale: ({ axisLabels, axisWidth, padding, reverse }: {
|
24
|
+
axisLabels: string[] | Date[];
|
25
|
+
axisWidth: number;
|
26
|
+
padding?: number;
|
27
|
+
reverse?: boolean;
|
28
|
+
}) => d3.ScaleQuantize<number, never>;
|
@@ -1,28 +1,11 @@
|
|
1
1
|
import { Observable } from 'rxjs';
|
2
|
-
import { ComputedDataTypeMap, ComputedDataGrid, ComputedDatumGrid, DataFormatterTypeMap, DataFormatterGrid, ComputedLayoutDatumGrid, ComputedLayoutDataGrid,
|
2
|
+
import { ComputedDataTypeMap, ComputedDataGrid, ComputedDatumGrid, DataFormatterTypeMap, DataFormatterGrid, ComputedLayoutDatumGrid, ComputedLayoutDataGrid, ContainerPositionScaled, Layout, TransformData } from '../../lib/core-types';
|
3
3
|
|
4
4
|
export declare const gridComputedLayoutDataObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
5
5
|
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
6
6
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
7
7
|
layout$: Observable<Layout>;
|
8
8
|
}) => Observable<ComputedLayoutDatumGrid[][]>;
|
9
|
-
export declare const gridAxesTransformObservable: ({ fullDataFormatter$, layout$ }: {
|
10
|
-
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
11
|
-
layout$: Observable<Layout>;
|
12
|
-
}) => Observable<TransformData>;
|
13
|
-
export declare const gridAxesReverseTransformObservable: ({ gridAxesTransform$ }: {
|
14
|
-
gridAxesTransform$: Observable<TransformData>;
|
15
|
-
}) => Observable<TransformData>;
|
16
|
-
export declare const gridGraphicTransformObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
17
|
-
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
18
|
-
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
19
|
-
layout$: Observable<Layout>;
|
20
|
-
}) => Observable<TransformData>;
|
21
|
-
export declare const gridGraphicReverseScaleObservable: ({ gridContainerPosition$, gridAxesTransform$, gridGraphicTransform$ }: {
|
22
|
-
gridContainerPosition$: Observable<GridContainerPosition[]>;
|
23
|
-
gridAxesTransform$: Observable<TransformData>;
|
24
|
-
gridGraphicTransform$: Observable<TransformData>;
|
25
|
-
}) => Observable<[number, number][]>;
|
26
9
|
export declare const gridAxesSizeObservable: ({ fullDataFormatter$, layout$ }: {
|
27
10
|
fullDataFormatter$: Observable<DataFormatterGrid>;
|
28
11
|
layout$: Observable<Layout>;
|
@@ -43,8 +26,35 @@ export declare const gridContainerPositionObservable: ({ computedData$, fullData
|
|
43
26
|
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
44
27
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
45
28
|
layout$: Observable<Layout>;
|
46
|
-
}) => Observable<
|
29
|
+
}) => Observable<ContainerPositionScaled[]>;
|
47
30
|
export declare const computedStackedDataObservables: ({ isSeriesSeprate$, computedData$ }: {
|
48
31
|
isSeriesSeprate$: Observable<boolean>;
|
49
32
|
computedData$: Observable<ComputedDataGrid>;
|
50
33
|
}) => Observable<ComputedDataGrid>;
|
34
|
+
export declare const groupScaleDomainValueObservable: ({ computedData$, fullDataFormatter$ }: {
|
35
|
+
computedData$: Observable<ComputedDataGrid>;
|
36
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
37
|
+
}) => Observable<[number, number]>;
|
38
|
+
export declare const filteredMinMaxValueObservable: ({ computedData$, groupScaleDomainValue$ }: {
|
39
|
+
computedData$: Observable<ComputedDataGrid>;
|
40
|
+
groupScaleDomainValue$: Observable<[number, number]>;
|
41
|
+
}) => Observable<[number, number]>;
|
42
|
+
export declare const gridAxesTransformObservable: ({ fullDataFormatter$, layout$ }: {
|
43
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
44
|
+
layout$: Observable<Layout>;
|
45
|
+
}) => Observable<TransformData>;
|
46
|
+
export declare const gridAxesReverseTransformObservable: ({ gridAxesTransform$ }: {
|
47
|
+
gridAxesTransform$: Observable<TransformData>;
|
48
|
+
}) => Observable<TransformData>;
|
49
|
+
export declare const gridGraphicTransformObservable: ({ computedData$, groupScaleDomainValue$, filteredMinMaxValue$, fullDataFormatter$, layout$ }: {
|
50
|
+
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
51
|
+
groupScaleDomainValue$: Observable<[number, number]>;
|
52
|
+
filteredMinMaxValue$: Observable<[number, number]>;
|
53
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
54
|
+
layout$: Observable<Layout>;
|
55
|
+
}) => Observable<TransformData>;
|
56
|
+
export declare const gridGraphicReverseScaleObservable: ({ gridContainerPosition$, gridAxesTransform$, gridGraphicTransform$ }: {
|
57
|
+
gridContainerPosition$: Observable<ContainerPositionScaled[]>;
|
58
|
+
gridAxesTransform$: Observable<TransformData>;
|
59
|
+
gridGraphicTransform$: Observable<TransformData>;
|
60
|
+
}) => Observable<[number, number][]>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Subject, Observable } from 'rxjs';
|
2
|
-
import { ChartParams, ComputedDataTypeMap, ContextObserverMultiGridDetail, DataFormatterTypeMap, EventMultiGrid,
|
2
|
+
import { ChartParams, ComputedDataTypeMap, ContextObserverMultiGridDetail, DataFormatterTypeMap, EventMultiGrid, ContainerPositionScaled, Layout } from '../../lib/core-types';
|
3
3
|
|
4
4
|
export declare const multiGridEachDetailObservable: ({ fullDataFormatter$, computedData$, layout$, fullChartParams$, event$ }: {
|
5
5
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiGrid">>;
|
@@ -12,4 +12,4 @@ export declare const multiGridContainerObservable: ({ computedData$, fullDataFor
|
|
12
12
|
computedData$: Observable<ComputedDataTypeMap<"multiGrid">>;
|
13
13
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiGrid">>;
|
14
14
|
layout$: Observable<Layout>;
|
15
|
-
}) => Observable<
|
15
|
+
}) => Observable<ContainerPositionScaled[][]>;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import { Observable } from 'rxjs';
|
2
|
+
import { ComputedDataTypeMap, ComputedDatumMultiValue, DataFormatterTypeMap, ComputedLayoutDatumMultiValue, ComputedLayoutDataMultiValue, ContainerPositionScaled, Layout, TransformData } from '../../lib/core-types';
|
3
|
+
|
4
|
+
export declare const minMaxXYObservable: ({ computedData$ }: {
|
5
|
+
computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
|
6
|
+
}) => Observable<{
|
7
|
+
minX: number;
|
8
|
+
maxX: number;
|
9
|
+
minY: number;
|
10
|
+
maxY: number;
|
11
|
+
}>;
|
12
|
+
export declare const multiValueComputedLayoutDataObservable: ({ computedData$, minMaxXY$, fullDataFormatter$, layout$ }: {
|
13
|
+
computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
|
14
|
+
minMaxXY$: Observable<{
|
15
|
+
minX: number;
|
16
|
+
maxX: number;
|
17
|
+
minY: number;
|
18
|
+
maxY: number;
|
19
|
+
}>;
|
20
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
|
21
|
+
layout$: Observable<Layout>;
|
22
|
+
}) => Observable<ComputedLayoutDataMultiValue>;
|
23
|
+
export declare const multiValueCategoryLabelsObservable: ({ computedData$, fullDataFormatter$ }: {
|
24
|
+
computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
|
25
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
|
26
|
+
}) => Observable<string[]>;
|
27
|
+
export declare const multiValueVisibleComputedDataObservable: ({ computedData$ }: {
|
28
|
+
computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
|
29
|
+
}) => Observable<ComputedDatumMultiValue[][]>;
|
30
|
+
export declare const multiValueVisibleComputedLayoutDataObservable: ({ computedLayoutData$ }: {
|
31
|
+
computedLayoutData$: Observable<ComputedLayoutDataMultiValue>;
|
32
|
+
}) => Observable<ComputedLayoutDatumMultiValue[][]>;
|
33
|
+
export declare const multiValueContainerPositionObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
34
|
+
computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
|
35
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
|
36
|
+
layout$: Observable<Layout>;
|
37
|
+
}) => Observable<ContainerPositionScaled[]>;
|
38
|
+
export declare const filteredMinMaxXYDataObservable: ({ visibleComputedLayoutData$, minMaxXY$, fullDataFormatter$ }: {
|
39
|
+
visibleComputedLayoutData$: Observable<ComputedLayoutDataMultiValue>;
|
40
|
+
minMaxXY$: Observable<{
|
41
|
+
minX: number;
|
42
|
+
maxX: number;
|
43
|
+
minY: number;
|
44
|
+
maxY: number;
|
45
|
+
}>;
|
46
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
|
47
|
+
}) => Observable<{
|
48
|
+
datumList: ComputedLayoutDatumMultiValue[];
|
49
|
+
minXDatum: ComputedLayoutDatumMultiValue;
|
50
|
+
maxXDatum: ComputedLayoutDatumMultiValue;
|
51
|
+
minYDatum: ComputedLayoutDatumMultiValue;
|
52
|
+
maxYDatum: ComputedLayoutDatumMultiValue;
|
53
|
+
}>;
|
54
|
+
export declare const multiValueGraphicTransformObservable: ({ minMaxXY$, filteredMinMaxXYData$, fullDataFormatter$, layout$ }: {
|
55
|
+
minMaxXY$: Observable<{
|
56
|
+
minX: number;
|
57
|
+
maxX: number;
|
58
|
+
minY: number;
|
59
|
+
maxY: number;
|
60
|
+
}>;
|
61
|
+
filteredMinMaxXYData$: Observable<{
|
62
|
+
minXDatum: ComputedLayoutDatumMultiValue;
|
63
|
+
maxXDatum: ComputedLayoutDatumMultiValue;
|
64
|
+
minYDatum: ComputedLayoutDatumMultiValue;
|
65
|
+
maxYDatum: ComputedLayoutDatumMultiValue;
|
66
|
+
}>;
|
67
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
|
68
|
+
layout$: Observable<Layout>;
|
69
|
+
}) => Observable<TransformData>;
|
70
|
+
export declare const multiValueGraphicReverseScaleObservable: ({ multiValueContainerPosition$, multiValueGraphicTransform$ }: {
|
71
|
+
multiValueContainerPosition$: Observable<ContainerPositionScaled[]>;
|
72
|
+
multiValueGraphicTransform$: Observable<TransformData>;
|
73
|
+
}) => Observable<[number, number][]>;
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import { ChartType, ChartParams, DatumValue, DataSeries, DataGrid, DataGridDatum, DataMultiGrid, DataMultiValue, DataFormatterContainer, SeriesDirection, DataFormatterGridGrid,
|
1
|
+
import { ChartType, ChartParams, DatumValue, DataSeries, DataGrid, DataGridDatum, DataMultiGrid, DataMultiValue, ComputedLayoutDatumMultiValue, 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
|
-
export declare function createDefaultDatumId(chartTypeOrPrefix: string, levelOneIndex: number, levelTwoIndex
|
4
|
+
export declare function createDefaultDatumId(chartTypeOrPrefix: string, levelOneIndex: number, levelTwoIndex?: number, levelThreeIndex?: number): string;
|
5
5
|
export declare function createDefaultSeriesLabel(chartTypeOrPrefix: string, seriesIndex: number): string;
|
6
6
|
export declare function createDefaultGroupLabel(chartTypeOrPrefix: string, groupIndex: number): string;
|
7
|
+
export declare function createDefaultCategoryLabel(): string;
|
7
8
|
export declare function createGridSeriesLabels({ transposedDataGrid, dataFormatterGrid, chartType }: {
|
8
9
|
transposedDataGrid: DataGridDatum[][];
|
9
10
|
dataFormatterGrid: DataFormatterGridGrid;
|
@@ -26,13 +27,26 @@ export declare function createMultiGridGroupLabels({ transposedDataGrid, dataFor
|
|
26
27
|
chartType?: ChartType;
|
27
28
|
gridIndex?: number;
|
28
29
|
}): string[];
|
29
|
-
export declare function
|
30
|
-
export declare function
|
31
|
-
export declare function
|
32
|
-
export declare function
|
33
|
-
export declare function
|
34
|
-
export declare function
|
30
|
+
export declare function getMinMax(data: number[]): [number, number];
|
31
|
+
export declare function getMinMaxValue(data: DatumValue[]): [number, number];
|
32
|
+
export declare function getMinMaxSeries(data: DataSeries): [number, number];
|
33
|
+
export declare function getMinMaxGrid(data: DataGrid): [number, number];
|
34
|
+
export declare function getMinMaxMultiGrid(data: DataMultiGrid): [number, number];
|
35
|
+
export declare function getMinMaxMultiValue(data: DataMultiValue, valueIndex: number): [number, number];
|
36
|
+
export declare function getMinMaxMultiValueXY({ data, minX, maxX, minY, maxY }: {
|
37
|
+
data: ComputedLayoutDatumMultiValue[][];
|
38
|
+
minX: number;
|
39
|
+
maxX: number;
|
40
|
+
minY: number;
|
41
|
+
maxY: number;
|
42
|
+
}): {
|
43
|
+
minXDatum: ComputedLayoutDatumMultiValue;
|
44
|
+
maxXDatum: ComputedLayoutDatumMultiValue;
|
45
|
+
minYDatum: ComputedLayoutDatumMultiValue;
|
46
|
+
maxYDatum: ComputedLayoutDatumMultiValue;
|
47
|
+
filteredData: ComputedLayoutDatumMultiValue[][];
|
48
|
+
};
|
35
49
|
export declare function transposeData<T>(seriesDirection: SeriesDirection, data: T[][]): T[][];
|
36
50
|
export declare function seriesColorPredicate(seriesIndex: number, chartParams: ChartParams): string;
|
37
|
-
export declare function calcSeriesContainerLayout(layout: Layout, container: DataFormatterContainer, amount: number):
|
38
|
-
export declare function calcGridContainerLayout(layout: Layout, container: DataFormatterContainer, amount: number):
|
51
|
+
export declare function calcSeriesContainerLayout(layout: Layout, container: DataFormatterContainer, amount: number): ContainerPosition[];
|
52
|
+
export declare function calcGridContainerLayout(layout: Layout, container: DataFormatterContainer, amount: number): ContainerPositionScaled[];
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Observable } from 'rxjs';
|
2
|
+
import { ComputedDataRelationship, ComputedNode, ComputedEdge } from '../../lib/core-types';
|
3
|
+
|
4
|
+
export declare const categoryLabelsObservable: (CategoryNodeMap$: Observable<Map<string, ComputedNode[]>>, CategoryEdgeMap$: Observable<Map<string, ComputedEdge[]>>) => Observable<string[]>;
|
5
|
+
export declare const NodeMapObservable: (computedData$: Observable<ComputedDataRelationship>) => Observable<Map<string, ComputedNode>>;
|
6
|
+
export declare const EdgeMapObservable: (computedData$: Observable<ComputedDataRelationship>) => Observable<Map<string, ComputedEdge>>;
|
7
|
+
export declare const relationshipVisibleComputedDataObservable: ({ computedData$, NodeMap$ }: {
|
8
|
+
computedData$: Observable<ComputedDataRelationship>;
|
9
|
+
NodeMap$: Observable<Map<string, ComputedNode>>;
|
10
|
+
}) => Observable<{
|
11
|
+
nodes: ComputedNode[];
|
12
|
+
edges: ComputedEdge[];
|
13
|
+
}>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Observable } from 'rxjs';
|
2
|
-
import { ComputedDatumSeries, ComputedDataTypeMap, DataFormatterTypeMap,
|
2
|
+
import { ComputedDatumSeries, ComputedDataTypeMap, DataFormatterTypeMap, ContainerPosition, Layout } from '../../lib/core-types';
|
3
3
|
|
4
4
|
export declare const separateSeriesObservable: ({ fullDataFormatter$ }: {
|
5
5
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"series">>;
|
@@ -18,9 +18,9 @@ export declare const seriesContainerPositionObservable: ({ computedData$, fullDa
|
|
18
18
|
computedData$: Observable<ComputedDataTypeMap<"series">>;
|
19
19
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"series">>;
|
20
20
|
layout$: Observable<Layout>;
|
21
|
-
}) => Observable<
|
21
|
+
}) => Observable<ContainerPosition[]>;
|
22
22
|
export declare const seriesContainerPositionMapObservable: ({ seriesContainerPosition$, seriesLabels$, separateSeries$ }: {
|
23
|
-
seriesContainerPosition$: Observable<
|
23
|
+
seriesContainerPosition$: Observable<ContainerPosition[]>;
|
24
24
|
seriesLabels$: Observable<string[]>;
|
25
25
|
separateSeries$: Observable<boolean>;
|
26
|
-
}) => Observable<Map<string,
|
26
|
+
}) => Observable<Map<string, ContainerPosition>>;
|
@@ -1,13 +1,10 @@
|
|
1
1
|
import { Observable } from 'rxjs';
|
2
|
-
import { ComputedDataTree
|
2
|
+
import { ComputedDataTree } from '../../lib/core-types';
|
3
3
|
|
4
4
|
export declare const nodeListObservable: ({ computedData$ }: {
|
5
5
|
computedData$: Observable<ComputedDataTree>;
|
6
6
|
}) => Observable<ComputedDataTree[]>;
|
7
|
-
export declare const
|
8
|
-
nodeList$: Observable<ComputedDataTree[]>;
|
9
|
-
fullDataFormatter$: Observable<DataFormatterTree>;
|
10
|
-
}) => Observable<string[]>;
|
7
|
+
export declare const categoryLabelsObservable: (CategoryDataMap$: Observable<Map<string, ComputedDataTree[]>>) => Observable<string[]>;
|
11
8
|
export declare const treeVisibleComputedDataObservable: ({ computedData$ }: {
|
12
9
|
computedData$: Observable<ComputedDataTree>;
|
13
10
|
}) => Observable<ComputedDataTree>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orbcharts/core",
|
3
|
-
"version": "3.0.0-beta.
|
3
|
+
"version": "3.0.0-beta.11",
|
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-beta.
|
38
|
+
"@orbcharts/core-types": "^3.0.0-beta.7",
|
39
39
|
"d3": "^7.8.5",
|
40
40
|
"rxjs": "^7.8.1"
|
41
41
|
}
|
package/src/GridChart.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type {
|
2
2
|
ChartEntity,
|
3
3
|
ChartOptionsPartial } from '../lib/core-types'
|
4
|
-
import {
|
4
|
+
import { DEFAULT_DATA_FORMATTER_GRID } from './defaults'
|
5
5
|
import { dataFormatterValidator } from './grid/dataFormatterValidator'
|
6
6
|
import { computedDataFn } from './grid/computedDataFn'
|
7
7
|
import { dataValidator } from './grid/dataValidator'
|
@@ -12,7 +12,7 @@ export class GridChart extends AbstractChart<'grid'> implements ChartEntity<'gri
|
|
12
12
|
constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'grid'>) {
|
13
13
|
super(
|
14
14
|
{
|
15
|
-
defaultDataFormatter:
|
15
|
+
defaultDataFormatter: DEFAULT_DATA_FORMATTER_GRID,
|
16
16
|
dataFormatterValidator,
|
17
17
|
computedDataFn,
|
18
18
|
dataValidator,
|
package/src/MultiGridChart.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type {
|
2
2
|
ChartEntity,
|
3
3
|
ChartOptionsPartial } from '../lib/core-types'
|
4
|
-
import {
|
4
|
+
import { DEFAULT_DATA_FORMATTER_MULTI_GRID } from './defaults'
|
5
5
|
import { dataFormatterValidator } from './multiGrid/dataFormatterValidator'
|
6
6
|
import { computedDataFn } from './multiGrid/computedDataFn'
|
7
7
|
import { dataValidator } from './multiGrid/dataValidator'
|
@@ -12,7 +12,7 @@ export class MultiGridChart extends AbstractChart<'multiGrid'> implements ChartE
|
|
12
12
|
constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'multiGrid'>) {
|
13
13
|
super(
|
14
14
|
{
|
15
|
-
defaultDataFormatter:
|
15
|
+
defaultDataFormatter: DEFAULT_DATA_FORMATTER_MULTI_GRID,
|
16
16
|
dataFormatterValidator,
|
17
17
|
computedDataFn,
|
18
18
|
dataValidator,
|
package/src/MultiValueChart.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type {
|
2
2
|
ChartEntity,
|
3
3
|
ChartOptionsPartial } from '../lib/core-types'
|
4
|
-
import {
|
4
|
+
import { DEFAULT_DATA_FORMATTER_MULTI_VALUE } from './defaults'
|
5
5
|
import { dataFormatterValidator } from './multiValue/dataFormatterValidator'
|
6
6
|
import { computedDataFn } from './multiValue/computedDataFn'
|
7
7
|
import { dataValidator } from './multiValue/dataValidator'
|
@@ -12,7 +12,7 @@ export class MultiValueChart extends AbstractChart<'multiValue'> implements Char
|
|
12
12
|
constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'multiValue'>) {
|
13
13
|
super(
|
14
14
|
{
|
15
|
-
defaultDataFormatter:
|
15
|
+
defaultDataFormatter: DEFAULT_DATA_FORMATTER_MULTI_VALUE,
|
16
16
|
dataFormatterValidator,
|
17
17
|
computedDataFn,
|
18
18
|
dataValidator,
|
package/src/RelationshipChart.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type {
|
2
2
|
ChartEntity,
|
3
3
|
ChartOptionsPartial } from '../lib/core-types'
|
4
|
-
import {
|
4
|
+
import { DEFAULT_DATA_FORMATTER_RELATIONSHIP} from './defaults'
|
5
5
|
import { dataFormatterValidator } from './relationship/dataFormatterValidator'
|
6
6
|
import { computedDataFn } from './relationship/computedDataFn'
|
7
7
|
import { dataValidator } from './relationship/dataValidator'
|
@@ -12,7 +12,7 @@ export class RelationshipChart extends AbstractChart<'relationship'> implements
|
|
12
12
|
constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'relationship'>) {
|
13
13
|
super(
|
14
14
|
{
|
15
|
-
defaultDataFormatter:
|
15
|
+
defaultDataFormatter: DEFAULT_DATA_FORMATTER_RELATIONSHIP,
|
16
16
|
dataFormatterValidator,
|
17
17
|
computedDataFn,
|
18
18
|
dataValidator,
|
package/src/SeriesChart.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type {
|
2
2
|
ChartEntity,
|
3
3
|
ChartOptionsPartial } from '../lib/core-types'
|
4
|
-
import {
|
4
|
+
import { DEFAULT_DATA_FORMATTER_SERIES } from './defaults'
|
5
5
|
import { dataFormatterValidator } from './series/dataFormatterValidator'
|
6
6
|
import { computedDataFn } from './series/computedDataFn'
|
7
7
|
import { dataValidator } from './series/dataValidator'
|
@@ -12,7 +12,7 @@ export class SeriesChart extends AbstractChart<'series'> implements ChartEntity<
|
|
12
12
|
constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'series'>) {
|
13
13
|
super(
|
14
14
|
{
|
15
|
-
defaultDataFormatter:
|
15
|
+
defaultDataFormatter: DEFAULT_DATA_FORMATTER_SERIES,
|
16
16
|
dataFormatterValidator,
|
17
17
|
computedDataFn,
|
18
18
|
dataValidator,
|
package/src/TreeChart.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type {
|
2
2
|
ChartEntity,
|
3
3
|
ChartOptionsPartial } from '../lib/core-types'
|
4
|
-
import {
|
4
|
+
import { DEFAULT_DATA_FORMATTER_TREE } from './defaults'
|
5
5
|
import { dataFormatterValidator } from './tree/dataFormatterValidator'
|
6
6
|
import { computedDataFn } from './tree/computedDataFn'
|
7
7
|
import { dataValidator } from './tree/dataValidator'
|
@@ -12,7 +12,7 @@ export class TreeChart extends AbstractChart<'tree'> implements ChartEntity<'tre
|
|
12
12
|
constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'tree'>) {
|
13
13
|
super(
|
14
14
|
{
|
15
|
-
defaultDataFormatter:
|
15
|
+
defaultDataFormatter: DEFAULT_DATA_FORMATTER_TREE,
|
16
16
|
dataFormatterValidator,
|
17
17
|
computedDataFn,
|
18
18
|
dataValidator,
|
@@ -61,11 +61,11 @@ import { elementValidator } from './validators/elementValidator'
|
|
61
61
|
import { chartParamsValidator } from './validators/chartParamsValidator'
|
62
62
|
import { pluginsValidator } from './validators/pluginsValidator'
|
63
63
|
import {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
DEFAULT_CHART_OPTIONS,
|
65
|
+
DEFAULT_PADDING,
|
66
|
+
DEFAULT_CHART_PARAMS,
|
67
|
+
DEFAULT_CHART_WIDTH,
|
68
|
+
DEFAULT_CHART_HEIGHT } from '../defaults'
|
69
69
|
|
70
70
|
// 判斷dataFormatter是否需要size參數
|
71
71
|
// const isAxesTypeMap: {[key in ChartType]: Boolean} = {
|
@@ -174,15 +174,15 @@ export const createBaseChart: CreateBaseChart = <T extends ChartType>({
|
|
174
174
|
|
175
175
|
// options
|
176
176
|
const mergedPresetWithDefault: Preset<T, any> = ((options) => {
|
177
|
-
const _options = options ? options :
|
177
|
+
const _options = options ? options : DEFAULT_CHART_OPTIONS as ChartOptionsPartial<T>
|
178
178
|
const preset = _options.preset ? _options.preset : {} as PresetPartial<T, any>
|
179
179
|
|
180
180
|
return {
|
181
181
|
name: preset.name ?? '',
|
182
182
|
description: preset.description ?? '',
|
183
183
|
chartParams: preset.chartParams
|
184
|
-
? mergeOptionsWithDefault(preset.chartParams,
|
185
|
-
:
|
184
|
+
? mergeOptionsWithDefault(preset.chartParams, DEFAULT_CHART_PARAMS)
|
185
|
+
: DEFAULT_CHART_PARAMS,
|
186
186
|
dataFormatter: preset.dataFormatter
|
187
187
|
// ? mergeOptionsWithDefault(preset.dataFormatter, defaultDataFormatter)
|
188
188
|
? mergeDataFormatter(preset.dataFormatter, defaultDataFormatter, chartType)
|
@@ -270,7 +270,7 @@ export const createBaseChart: CreateBaseChart = <T extends ChartType>({
|
|
270
270
|
takeUntil(destroy$),
|
271
271
|
startWith({}),
|
272
272
|
map((d: any) => {
|
273
|
-
return mergeOptionsWithDefault(d.padding ?? {},
|
273
|
+
return mergeOptionsWithDefault(d.padding ?? {}, DEFAULT_PADDING)
|
274
274
|
})
|
275
275
|
)
|
276
276
|
mergedPadding$
|
@@ -290,8 +290,8 @@ export const createBaseChart: CreateBaseChart = <T extends ChartType>({
|
|
290
290
|
|
291
291
|
// 監聽外層的element尺寸
|
292
292
|
const rootSize$: Observable<{ width: number; height: number }> = of({
|
293
|
-
width: options?.width ??
|
294
|
-
height: options?.height ??
|
293
|
+
width: options?.width ?? DEFAULT_CHART_OPTIONS.width,
|
294
|
+
height: options?.height ?? DEFAULT_CHART_OPTIONS.height
|
295
295
|
}).pipe(
|
296
296
|
switchMap(size => {
|
297
297
|
return iif(
|
@@ -334,10 +334,10 @@ export const createBaseChart: CreateBaseChart = <T extends ChartType>({
|
|
334
334
|
switchMap(async (d) => {
|
335
335
|
const rootWidth = d.rootSize.width > 0
|
336
336
|
? d.rootSize.width
|
337
|
-
:
|
337
|
+
: DEFAULT_CHART_WIDTH
|
338
338
|
const rootHeight = d.rootSize.height > 0
|
339
339
|
? d.rootSize.height
|
340
|
-
:
|
340
|
+
: DEFAULT_CHART_HEIGHT
|
341
341
|
return {
|
342
342
|
width: rootWidth - d.mergedPadding.left - d.mergedPadding.right,
|
343
343
|
height: rootHeight - d.mergedPadding.top - d.mergedPadding.bottom,
|
@@ -83,7 +83,7 @@ export function chartParamsValidator (chartType: ChartType, chartParamsPartial:
|
|
83
83
|
|
84
84
|
if (chartParamsPartial.colors.light) {
|
85
85
|
const lightResult = validateColumns(chartParamsPartial.colors.light, {
|
86
|
-
|
86
|
+
label: {
|
87
87
|
toBeTypes: ['string[]'],
|
88
88
|
},
|
89
89
|
primary: {
|
@@ -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'],
|
@@ -107,7 +107,7 @@ export function chartParamsValidator (chartType: ChartType, chartParamsPartial:
|
|
107
107
|
|
108
108
|
if (chartParamsPartial.colors.dark) {
|
109
109
|
const darkResult = validateColumns(chartParamsPartial.colors.dark, {
|
110
|
-
|
110
|
+
label: {
|
111
111
|
toBeTypes: ['string[]'],
|
112
112
|
},
|
113
113
|
primary: {
|
@@ -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'],
|