@orbcharts/core 3.0.0-alpha.42 → 3.0.0-alpha.44
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/orbcharts-core.es.js +1905 -1896
- package/dist/orbcharts-core.umd.js +2 -2
- package/dist/src/defaults.d.ts +4 -3
- package/dist/src/grid/computeGridData.d.ts +4 -11
- package/dist/src/grid/gridObservables.d.ts +15 -18
- package/dist/src/multiGrid/multiGridObservables.d.ts +4 -11
- package/dist/src/series/seriesObservables.d.ts +26 -1
- package/dist/src/types/ComputedData.d.ts +1 -0
- package/dist/src/types/ComputedDataGrid.d.ts +0 -3
- package/dist/src/types/ComputedDataSeries.d.ts +1 -2
- package/dist/src/types/ContextObserverGrid.d.ts +11 -4
- package/dist/src/types/ContextObserverMultiGrid.d.ts +8 -3
- package/dist/src/types/ContextObserverSeries.d.ts +18 -0
- package/dist/src/types/DataFormatter.d.ts +8 -5
- package/dist/src/types/DataFormatterGrid.d.ts +13 -16
- package/dist/src/types/DataFormatterMultiGrid.d.ts +6 -3
- package/dist/src/types/DataFormatterMultiValue.d.ts +3 -0
- package/dist/src/types/DataFormatterRelationship.d.ts +3 -0
- package/dist/src/types/DataFormatterSeries.d.ts +11 -4
- package/dist/src/utils/orbchartsUtils.d.ts +14 -13
- package/package.json +1 -1
- package/src/base/createBaseChart.ts +10 -10
- package/src/defaults.ts +36 -64
- package/src/grid/computeGridData.ts +15 -86
- package/src/grid/createGridContextObserver.ts +33 -16
- package/src/grid/gridObservables.ts +157 -70
- package/src/multiGrid/computeMultiGridData.ts +77 -120
- package/src/multiGrid/createMultiGridContextObserver.ts +8 -8
- package/src/multiGrid/multiGridObservables.ts +236 -171
- package/src/multiValue/computeMultiValueData.ts +22 -15
- package/src/relationship/computeRelationshipData.ts +16 -4
- package/src/series/computeSeriesData.ts +51 -114
- package/src/series/createSeriesContextObserver.ts +59 -4
- package/src/series/seriesObservables.ts +162 -10
- package/src/tree/computeTreeData.ts +6 -3
- package/src/types/ComputedData.ts +1 -0
- package/src/types/ComputedDataGrid.ts +3 -3
- package/src/types/ComputedDataSeries.ts +2 -2
- package/src/types/ContextObserverGrid.ts +18 -10
- package/src/types/ContextObserverMultiGrid.ts +6 -18
- package/src/types/ContextObserverSeries.ts +21 -1
- package/src/types/DataFormatter.ts +11 -32
- package/src/types/DataFormatterGrid.ts +32 -20
- package/src/types/DataFormatterMultiGrid.ts +6 -4
- package/src/types/DataFormatterMultiValue.ts +3 -0
- package/src/types/DataFormatterRelationship.ts +3 -0
- package/src/types/DataFormatterSeries.ts +11 -21
- package/src/utils/d3Utils.ts +7 -7
- package/src/utils/orbchartsUtils.ts +128 -32
@@ -1,13 +1,6 @@
|
|
1
1
|
import { ComputedDataFn } from '../types/ComputedData';
|
2
|
-
import { DataGridDatum } from '../types/DataGrid';
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
import * as d3 from 'd3';
|
7
|
-
export interface DataGridDatumTemp extends DataGridDatum {
|
8
|
-
_visible: boolean;
|
9
|
-
}
|
10
|
-
export declare function createTransposedDataGrid(context: DataFormatterContext<'grid'>): DataGridDatumTemp[][];
|
11
|
-
export declare function createGroupScale(transposedDataGrid: DataGridDatumTemp[][], dataFormatter: DataFormatterGrid, layout: Layout): d3.ScaleLinear<number, number, never>;
|
12
|
-
export declare function createSeriesValueScaleArr(transposedDataGrid: DataGridDatumTemp[][], dataFormatter: DataFormatterGrid, layout: Layout): d3.ScaleLinear<number, number, never>[];
|
2
|
+
import { DataGrid, DataGridDatum } from '../types/DataGrid';
|
3
|
+
import { DataFormatterGridGrid } from '../types/DataFormatterGrid';
|
4
|
+
|
5
|
+
export declare function createTransposedDataGrid(data: DataGrid, dataFormatterGrid: DataFormatterGridGrid): DataGridDatum[][];
|
13
6
|
export declare const computeGridData: ComputedDataFn<'grid'>;
|
@@ -1,6 +1,11 @@
|
|
1
1
|
import { Observable } from 'rxjs';
|
2
|
-
import {
|
2
|
+
import { ComputedDataTypeMap, ComputedDatumGrid, DataFormatterTypeMap, DataFormatterGrid, ComputedLayoutDatumGrid, ComputedLayoutDataGrid, GridContainerPosition, Layout, TransformData } from '../types';
|
3
3
|
|
4
|
+
export declare const gridComputedLayoutDataObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
5
|
+
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
6
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
7
|
+
layout$: Observable<Layout>;
|
8
|
+
}) => Observable<ComputedLayoutDatumGrid[][]>;
|
4
9
|
export declare const gridAxesTransformObservable: ({ fullDataFormatter$, layout$ }: {
|
5
10
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
6
11
|
layout$: Observable<Layout>;
|
@@ -13,8 +18,8 @@ export declare const gridGraphicTransformObservable: ({ computedData$, fullDataF
|
|
13
18
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
14
19
|
layout$: Observable<Layout>;
|
15
20
|
}) => Observable<TransformData>;
|
16
|
-
export declare const gridGraphicReverseScaleObservable: ({
|
17
|
-
|
21
|
+
export declare const gridGraphicReverseScaleObservable: ({ gridContainerPosition$, gridAxesTransform$, gridGraphicTransform$ }: {
|
22
|
+
gridContainerPosition$: Observable<GridContainerPosition[]>;
|
18
23
|
gridAxesTransform$: Observable<TransformData>;
|
19
24
|
gridGraphicTransform$: Observable<TransformData>;
|
20
25
|
}) => Observable<[number, number][]>;
|
@@ -25,25 +30,17 @@ export declare const gridAxesSizeObservable: ({ fullDataFormatter$, layout$ }: {
|
|
25
30
|
width: number;
|
26
31
|
height: number;
|
27
32
|
}>;
|
28
|
-
export declare const
|
33
|
+
export declare const seriesLabelsObservable: ({ computedData$ }: {
|
29
34
|
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
30
35
|
}) => Observable<string[]>;
|
31
36
|
export declare const gridVisibleComputedDataObservable: ({ computedData$ }: {
|
32
37
|
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
33
|
-
}) => Observable<
|
34
|
-
export declare const
|
38
|
+
}) => Observable<ComputedDatumGrid[][]>;
|
39
|
+
export declare const gridVisibleComputedLayoutDataObservable: ({ computedLayoutData$ }: {
|
40
|
+
computedLayoutData$: Observable<ComputedLayoutDataGrid>;
|
41
|
+
}) => Observable<ComputedLayoutDatumGrid[][]>;
|
42
|
+
export declare const gridContainerPositionObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
35
43
|
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
36
44
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
37
|
-
}) => Observable<boolean>;
|
38
|
-
export declare const gridContainerObservable: ({ computedData$, fullDataFormatter$, fullChartParams$, layout$ }: {
|
39
|
-
computedData$: Observable<ComputedDataTypeMap<"grid">>;
|
40
|
-
fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
|
41
|
-
fullChartParams$: Observable<ChartParams>;
|
42
45
|
layout$: Observable<Layout>;
|
43
|
-
}) => Observable<
|
44
|
-
slotIndex: number;
|
45
|
-
rowIndex: number;
|
46
|
-
columnIndex: number;
|
47
|
-
translate: [number, number];
|
48
|
-
scale: [number, number];
|
49
|
-
}[]>;
|
46
|
+
}) => Observable<GridContainerPosition[]>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Subject, Observable } from 'rxjs';
|
2
|
-
import { ChartParams, ComputedDataTypeMap, DataFormatterTypeMap, EventMultiGrid, Layout,
|
2
|
+
import { ChartParams, ComputedDataTypeMap, DataFormatterTypeMap, EventMultiGrid, Layout, ContextObserverMultiGridDetail, GridContainerPosition } from '../types';
|
3
3
|
|
4
4
|
export declare const multiGridEachDetailObservable: ({ fullDataFormatter$, computedData$, layout$, fullChartParams$, event$ }: {
|
5
5
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiGrid">>;
|
@@ -7,16 +7,9 @@ export declare const multiGridEachDetailObservable: ({ fullDataFormatter$, compu
|
|
7
7
|
layout$: Observable<Layout>;
|
8
8
|
fullChartParams$: Observable<ChartParams>;
|
9
9
|
event$: Subject<EventMultiGrid>;
|
10
|
-
}) => Observable<
|
11
|
-
export declare const multiGridContainerObservable: ({ computedData$, fullDataFormatter$,
|
10
|
+
}) => Observable<ContextObserverMultiGridDetail[]>;
|
11
|
+
export declare const multiGridContainerObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
12
12
|
computedData$: Observable<ComputedDataTypeMap<"multiGrid">>;
|
13
13
|
fullDataFormatter$: Observable<DataFormatterTypeMap<"multiGrid">>;
|
14
|
-
fullChartParams$: Observable<ChartParams>;
|
15
14
|
layout$: Observable<Layout>;
|
16
|
-
}) => Observable<
|
17
|
-
slotIndex: number;
|
18
|
-
rowIndex: number;
|
19
|
-
columnIndex: number;
|
20
|
-
translate: [number, number];
|
21
|
-
scale: [number, number];
|
22
|
-
}[][]>;
|
15
|
+
}) => Observable<GridContainerPosition[][]>;
|
@@ -1 +1,26 @@
|
|
1
|
-
|
1
|
+
import { Observable } from 'rxjs';
|
2
|
+
import { ComputedDatumSeries, ComputedDataTypeMap, DataFormatterTypeMap, SeriesContainerPosition, Layout } from '../types';
|
3
|
+
|
4
|
+
export declare const separateSeriesObservable: ({ fullDataFormatter$ }: {
|
5
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"series">>;
|
6
|
+
}) => Observable<boolean>;
|
7
|
+
export declare const seriesLabelsObservable: ({ computedData$ }: {
|
8
|
+
computedData$: Observable<ComputedDataTypeMap<"series">>;
|
9
|
+
}) => Observable<string[]>;
|
10
|
+
export declare const visibleComputedDataObservable: ({ computedData$ }: {
|
11
|
+
computedData$: Observable<ComputedDataTypeMap<"series">>;
|
12
|
+
}) => Observable<ComputedDatumSeries[][]>;
|
13
|
+
export declare const computedLayoutDataObservable: ({ computedData$, fullDataFormatter$ }: {
|
14
|
+
computedData$: Observable<ComputedDataTypeMap<"series">>;
|
15
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"series">>;
|
16
|
+
}) => Observable<ComputedDatumSeries[][]>;
|
17
|
+
export declare const seriesContainerPositionObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
|
18
|
+
computedData$: Observable<ComputedDataTypeMap<"series">>;
|
19
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<"series">>;
|
20
|
+
layout$: Observable<Layout>;
|
21
|
+
}) => Observable<SeriesContainerPosition[]>;
|
22
|
+
export declare const seriesContainerPositionMapObservable: ({ seriesContainerPosition$, seriesLabels$, separateSeries$ }: {
|
23
|
+
seriesContainerPosition$: Observable<SeriesContainerPosition[]>;
|
24
|
+
seriesLabels$: Observable<string[]>;
|
25
|
+
separateSeries$: Observable<boolean>;
|
26
|
+
}) => Observable<Map<string, SeriesContainerPosition>>;
|
@@ -1,8 +1,5 @@
|
|
1
1
|
import { ComputedDatumBase, ComputedDatumGridValue } from './ComputedData';
|
2
2
|
|
3
3
|
export interface ComputedDatumGrid extends ComputedDatumBase, ComputedDatumGridValue {
|
4
|
-
axisX: number;
|
5
|
-
axisY: number;
|
6
|
-
axisYFromZero: number;
|
7
4
|
}
|
8
5
|
export type ComputedDataGrid = ComputedDatumGrid[][];
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { ComputedDatumBase, ComputedDatumSeriesValue } from './ComputedData';
|
2
2
|
|
3
3
|
export interface ComputedDatumSeries extends ComputedDatumBase, ComputedDatumSeriesValue {
|
4
|
-
sortedIndex: number;
|
5
4
|
}
|
6
|
-
export type ComputedDataSeries = ComputedDatumSeries[];
|
5
|
+
export type ComputedDataSeries = ComputedDatumSeries[][];
|
@@ -7,7 +7,7 @@ export interface ContextObserverGrid<PluginParams> extends ContextObserverBase<'
|
|
7
7
|
textSizePx$: Observable<number>;
|
8
8
|
}
|
9
9
|
export interface ContextObserverGridDetail {
|
10
|
-
|
10
|
+
gridContainerPosition$: Observable<GridContainerPosition[]>;
|
11
11
|
gridAxesTransform$: Observable<TransformData>;
|
12
12
|
gridAxesReverseTransform$: Observable<TransformData>;
|
13
13
|
gridGraphicTransform$: Observable<TransformData>;
|
@@ -17,13 +17,20 @@ export interface ContextObserverGridDetail {
|
|
17
17
|
height: number;
|
18
18
|
}>;
|
19
19
|
gridHighlight$: Observable<ComputedDatumGrid[]>;
|
20
|
-
|
20
|
+
seriesLabels$: Observable<string[]>;
|
21
21
|
SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>;
|
22
22
|
GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>;
|
23
|
+
computedLayoutData$: Observable<ComputedLayoutDataGrid>;
|
23
24
|
visibleComputedData$: Observable<ComputedDataGrid>;
|
24
|
-
|
25
|
+
visibleComputedLayoutData$: Observable<ComputedLayoutDataGrid>;
|
25
26
|
}
|
26
|
-
export
|
27
|
+
export type ComputedLayoutDataGrid = ComputedLayoutDatumGrid[][];
|
28
|
+
export interface ComputedLayoutDatumGrid extends ComputedDatumGrid {
|
29
|
+
axisX: number;
|
30
|
+
axisY: number;
|
31
|
+
axisYFromZero: number;
|
32
|
+
}
|
33
|
+
export interface GridContainerPosition {
|
27
34
|
slotIndex: number;
|
28
35
|
rowIndex: number;
|
29
36
|
columnIndex: number;
|
@@ -1,9 +1,14 @@
|
|
1
1
|
import { Observable } from 'rxjs';
|
2
2
|
import { ContextObserverBase } from './ContextObserver';
|
3
|
-
import {
|
3
|
+
import { ComputedDataGrid } from './ComputedDataGrid';
|
4
|
+
import { DataFormatterGrid } from './DataFormatterGrid';
|
5
|
+
import { ContextObserverGridDetail } from './ContextObserverGrid';
|
4
6
|
|
5
7
|
export interface ContextObserverMultiGrid<PluginParams> extends ContextObserverBase<'multiGrid', PluginParams> {
|
6
8
|
textSizePx$: Observable<number>;
|
7
|
-
multiGridEachDetail$: Observable<
|
8
|
-
|
9
|
+
multiGridEachDetail$: Observable<ContextObserverMultiGridDetail[]>;
|
10
|
+
}
|
11
|
+
export interface ContextObserverMultiGridDetail extends ContextObserverGridDetail {
|
12
|
+
computedData$: Observable<ComputedDataGrid>;
|
13
|
+
dataFormatter$: Observable<DataFormatterGrid>;
|
9
14
|
}
|
@@ -4,6 +4,24 @@ import { ComputedDatumSeries } from './ComputedDataSeries';
|
|
4
4
|
|
5
5
|
export interface ContextObserverSeries<PluginParams> extends ContextObserverBase<'series', PluginParams> {
|
6
6
|
textSizePx$: Observable<number>;
|
7
|
+
separateSeries$: Observable<boolean>;
|
8
|
+
visibleComputedData$: Observable<ComputedDatumSeries[][]>;
|
9
|
+
computedLayoutData$: Observable<ComputedDatumSeries[][]>;
|
10
|
+
visibleComputedLayoutData$: Observable<ComputedDatumSeries[][]>;
|
7
11
|
seriesHighlight$: Observable<ComputedDatumSeries[]>;
|
12
|
+
seriesLabels$: Observable<string[]>;
|
8
13
|
SeriesDataMap$: Observable<Map<string, ComputedDatumSeries[]>>;
|
14
|
+
seriesContainerPosition$: Observable<SeriesContainerPosition[]>;
|
15
|
+
SeriesContainerPositionMap$: Observable<Map<string, SeriesContainerPosition>>;
|
16
|
+
}
|
17
|
+
export interface SeriesContainerPosition {
|
18
|
+
slotIndex: number;
|
19
|
+
rowIndex: number;
|
20
|
+
columnIndex: number;
|
21
|
+
startX: number;
|
22
|
+
startY: number;
|
23
|
+
centerX: number;
|
24
|
+
centerY: number;
|
25
|
+
width: number;
|
26
|
+
height: number;
|
9
27
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { ChartType } from './Chart';
|
2
2
|
import { ChartParams } from './ChartParams';
|
3
|
-
import { DataTypeMap
|
3
|
+
import { DataTypeMap } from './Data';
|
4
|
+
import { ComputedDatumTypeMap } from './ComputedData';
|
4
5
|
import { DataFormatterSeries, DataFormatterSeriesPartial } from './DataFormatterSeries';
|
5
6
|
import { DataFormatterGrid, DataFormatterGridPartial } from './DataFormatterGrid';
|
6
7
|
import { DataFormatterMultiGrid, DataFormatterMultiGridPartial } from './DataFormatterMultiGrid';
|
@@ -8,13 +9,11 @@ import { DataFormatterMultiValue, DataFormatterMultiValuePartial } from './DataF
|
|
8
9
|
import { DataFormatterTree, DataFormatterTreePartial } from './DataFormatterTree';
|
9
10
|
import { DataFormatterRelationship, DataFormatterRelationshipPartial } from './DataFormatterRelationship';
|
10
11
|
import { AxisPosition } from './Axis';
|
11
|
-
import { Layout } from './Layout';
|
12
12
|
|
13
13
|
export interface DataFormatterContext<T extends ChartType> {
|
14
14
|
data: DataTypeMap<T>;
|
15
15
|
dataFormatter: DataFormatterTypeMap<T>;
|
16
16
|
chartParams: ChartParams;
|
17
|
-
layout: Layout;
|
18
17
|
}
|
19
18
|
export type DataFormatterTypeMap<T extends ChartType> = T extends 'series' ? DataFormatterSeries : T extends 'grid' ? DataFormatterGrid : T extends 'multiGrid' ? DataFormatterMultiGrid : T extends 'multiValue' ? DataFormatterMultiValue : T extends 'relationship' ? DataFormatterRelationship : T extends 'tree' ? DataFormatterTree : DataFormatterBase<T>;
|
20
19
|
export type DataFormatterPartialTypeMap<T extends ChartType> = T extends 'series' ? DataFormatterSeriesPartial : T extends 'grid' ? DataFormatterGridPartial : T extends 'multiGrid' ? DataFormatterMultiGridPartial : T extends 'multiValue' ? DataFormatterMultiValuePartial : T extends 'relationship' ? DataFormatterRelationshipPartial : T extends 'tree' ? DataFormatterTreePartial : DataFormatterBasePartial<T>;
|
@@ -34,5 +33,9 @@ export interface DataFormatterGroupAxis {
|
|
34
33
|
scalePadding: number;
|
35
34
|
label: string;
|
36
35
|
}
|
37
|
-
export type VisibleFilter<T extends ChartType> = (datum:
|
38
|
-
export
|
36
|
+
export type VisibleFilter<T extends ChartType> = (datum: ComputedDatumTypeMap<T>, context: DataFormatterContext<T>) => boolean | null;
|
37
|
+
export interface DataFormatterContainer {
|
38
|
+
gap: number;
|
39
|
+
rowAmount: number;
|
40
|
+
columnAmount: number;
|
41
|
+
}
|
@@ -1,37 +1,34 @@
|
|
1
|
-
import { DataFormatterBase, DataFormatterBasePartial, DataFormatterValueAxis, DataFormatterGroupAxis, VisibleFilter } from './DataFormatter';
|
1
|
+
import { DataFormatterBase, DataFormatterBasePartial, DataFormatterValueAxis, DataFormatterGroupAxis, VisibleFilter, DataFormatterContainer } from './DataFormatter';
|
2
2
|
|
3
3
|
export type SeriesDirection = 'row' | 'column';
|
4
4
|
export interface DataFormatterGrid extends DataFormatterBase<'grid'> {
|
5
|
+
visibleFilter: VisibleFilter<'grid'>;
|
5
6
|
grid: DataFormatterGridGrid;
|
6
|
-
container:
|
7
|
+
container: DataFormatterContainer;
|
7
8
|
}
|
8
9
|
export interface DataFormatterGridPartial extends DataFormatterBasePartial<'grid'> {
|
10
|
+
visibleFilter?: VisibleFilter<'grid'>;
|
9
11
|
grid?: DataFormatterGridGridPartial;
|
10
|
-
container?: Partial<
|
12
|
+
container?: Partial<DataFormatterContainer>;
|
11
13
|
}
|
12
14
|
export interface DataFormatterGridGrid {
|
13
|
-
|
14
|
-
|
15
|
+
seriesDirection: SeriesDirection;
|
16
|
+
rowLabels: string[];
|
17
|
+
columnLabels: string[];
|
15
18
|
valueAxis: DataFormatterValueAxis;
|
16
19
|
groupAxis: DataFormatterGroupAxis;
|
17
|
-
|
18
|
-
seriesSlotIndexes: number[] | null;
|
20
|
+
separateSeries: boolean;
|
19
21
|
}
|
20
22
|
export interface DataFormatterGridGridPartial {
|
21
|
-
|
22
|
-
|
23
|
+
seriesDirection?: SeriesDirection;
|
24
|
+
rowLabels?: string[];
|
25
|
+
columnLabels?: string[];
|
23
26
|
valueAxis?: Partial<DataFormatterValueAxis>;
|
24
27
|
groupAxis?: Partial<DataFormatterGroupAxis>;
|
25
|
-
|
26
|
-
seriesSlotIndexes?: number[] | null;
|
28
|
+
separateSeries?: boolean;
|
27
29
|
}
|
28
30
|
export interface DataFormatterGridContainer {
|
29
31
|
gap: number;
|
30
32
|
rowAmount: number;
|
31
33
|
columnAmount: number;
|
32
34
|
}
|
33
|
-
export interface DataFormatterGridGridData {
|
34
|
-
seriesDirection: SeriesDirection;
|
35
|
-
rowLabels: string[];
|
36
|
-
columnLabels: string[];
|
37
|
-
}
|
@@ -1,17 +1,20 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { VisibleFilter, DataFormatterContainer, DataFormatterBase, DataFormatterBasePartial } from './DataFormatter';
|
2
|
+
import { DataFormatterGridGrid, DataFormatterGridGridPartial } from './DataFormatterGrid';
|
3
3
|
|
4
4
|
export interface DataFormatterMultiGrid extends DataFormatterBase<'multiGrid'> {
|
5
|
+
visibleFilter: VisibleFilter<'multiGrid'>;
|
5
6
|
gridList: Array<DataFormatterGridGrid>;
|
6
7
|
container: DataFormatterMultiGridContainer;
|
8
|
+
separateGrid: boolean;
|
7
9
|
}
|
8
10
|
export interface DataFormatterMultiGridPartial extends DataFormatterBasePartial<'multiGrid'> {
|
9
11
|
gridList?: Array<DataFormatterGridGridPartial>;
|
10
12
|
container?: Partial<DataFormatterMultiGridContainer>;
|
13
|
+
separateGrid?: boolean;
|
11
14
|
}
|
12
15
|
export interface DataFormatterMultiGridGrid extends DataFormatterGridGrid {
|
13
16
|
}
|
14
17
|
export interface DataFormatterMultiGridGridPartial extends DataFormatterGridGridPartial {
|
15
18
|
}
|
16
|
-
export interface DataFormatterMultiGridContainer extends
|
19
|
+
export interface DataFormatterMultiGridContainer extends DataFormatterContainer {
|
17
20
|
}
|
@@ -2,11 +2,14 @@ import { DataFormatterBase, DataFormatterBasePartial, DataFormatterValueAxis, Vi
|
|
2
2
|
|
3
3
|
export interface DataFormatterMultiValue extends DataFormatterBase<'multiValue'> {
|
4
4
|
visibleFilter: VisibleFilter<'multiValue'>;
|
5
|
+
categoryLabels: string[];
|
5
6
|
multiValue: Array<DataFormatterMultiValueMultiValue>;
|
6
7
|
xAxis: DataFormatterValueAxis;
|
7
8
|
yAxis: DataFormatterValueAxis;
|
8
9
|
}
|
9
10
|
export interface DataFormatterMultiValuePartial extends DataFormatterBasePartial<'multiValue'> {
|
11
|
+
visibleFilter?: VisibleFilter<'multiValue'>;
|
12
|
+
categoryLabels?: string[];
|
10
13
|
multiValue?: Array<Partial<DataFormatterMultiValueMultiValue>>;
|
11
14
|
xAxis?: Partial<DataFormatterValueAxis>;
|
12
15
|
yAxis?: Partial<DataFormatterValueAxis>;
|
@@ -2,6 +2,9 @@ import { DataFormatterBase, DataFormatterBasePartial, VisibleFilter } from './Da
|
|
2
2
|
|
3
3
|
export interface DataFormatterRelationship extends DataFormatterBase<'relationship'> {
|
4
4
|
visibleFilter: VisibleFilter<'relationship'>;
|
5
|
+
categoryLabels: string[];
|
5
6
|
}
|
6
7
|
export interface DataFormatterRelationshipPartial extends DataFormatterBasePartial<'relationship'> {
|
8
|
+
visibleFilter?: VisibleFilter<'relationship'>;
|
9
|
+
categoryLabels?: string[];
|
7
10
|
}
|
@@ -1,12 +1,19 @@
|
|
1
|
-
import {
|
2
|
-
import { DataFormatterBase, DataFormatterBasePartial, VisibleFilter } from './DataFormatter';
|
1
|
+
import { ComputedDatumSeries } from './ComputedDataSeries';
|
2
|
+
import { DataFormatterBase, DataFormatterBasePartial, VisibleFilter, DataFormatterContainer } from './DataFormatter';
|
3
3
|
|
4
4
|
export interface DataFormatterSeries extends DataFormatterBase<'series'> {
|
5
5
|
visibleFilter: VisibleFilter<'series'>;
|
6
|
+
sort: ((a: ComputedDatumSeries, b: ComputedDatumSeries) => number) | null;
|
6
7
|
seriesLabels: string[];
|
7
|
-
|
8
|
+
container: DataFormatterContainer;
|
9
|
+
separateSeries: boolean;
|
10
|
+
sumSeries: boolean;
|
8
11
|
}
|
9
12
|
export interface DataFormatterSeriesPartial extends DataFormatterBasePartial<'series'> {
|
13
|
+
visibleFilter?: VisibleFilter<'series'>;
|
14
|
+
sort?: ((a: ComputedDatumSeries, b: ComputedDatumSeries) => number) | null;
|
10
15
|
seriesLabels?: string[];
|
11
|
-
|
16
|
+
container?: Partial<DataFormatterContainer>;
|
17
|
+
separateSeries?: boolean;
|
18
|
+
sumSeries?: boolean;
|
12
19
|
}
|
@@ -5,32 +5,35 @@ import { DataSeries } from '../types/DataSeries';
|
|
5
5
|
import { DataGrid, DataGridDatum } from '../types/DataGrid';
|
6
6
|
import { DataMultiGrid } from '../types/DataMultiGrid';
|
7
7
|
import { DataMultiValue } from '../types/DataMultiValue';
|
8
|
-
import {
|
8
|
+
import { DataFormatterContainer } from '../types/DataFormatter';
|
9
|
+
import { SeriesDirection, DataFormatterGridGrid } from '../types/DataFormatterGrid';
|
10
|
+
import { SeriesContainerPosition } from '../types/ContextObserverSeries';
|
11
|
+
import { GridContainerPosition } from '../types/ContextObserverGrid';
|
9
12
|
import { Layout } from '../types/Layout';
|
10
13
|
import * as d3 from 'd3';
|
11
14
|
export declare function formatValueToLabel(value: any, valueFormatter: string | ((text: d3.NumberValue) => string)): string;
|
12
15
|
export declare function createDefaultDatumId(chartTypeOrPrefix: string, levelOneIndex: number, levelTwoIndex: number, levelThreeIndex?: number): string;
|
13
16
|
export declare function createDefaultSeriesLabel(chartTypeOrPrefix: string, seriesIndex: number): string;
|
14
17
|
export declare function createDefaultGroupLabel(chartTypeOrPrefix: string, groupIndex: number): string;
|
15
|
-
export declare function createGridSeriesLabels({ transposedDataGrid,
|
18
|
+
export declare function createGridSeriesLabels({ transposedDataGrid, dataFormatterGrid, chartType }: {
|
16
19
|
transposedDataGrid: DataGridDatum[][];
|
17
|
-
|
20
|
+
dataFormatterGrid: DataFormatterGridGrid;
|
18
21
|
chartType?: ChartType;
|
19
22
|
}): string[];
|
20
|
-
export declare function createMultiGridSeriesLabels({ transposedDataGrid,
|
23
|
+
export declare function createMultiGridSeriesLabels({ transposedDataGrid, dataFormatterGrid, chartType, gridIndex }: {
|
21
24
|
transposedDataGrid: DataGridDatum[][];
|
22
|
-
|
25
|
+
dataFormatterGrid: DataFormatterGridGrid;
|
23
26
|
chartType?: ChartType;
|
24
27
|
gridIndex?: number;
|
25
28
|
}): string[];
|
26
|
-
export declare function createGridGroupLabels({ transposedDataGrid,
|
29
|
+
export declare function createGridGroupLabels({ transposedDataGrid, dataFormatterGrid, chartType }: {
|
27
30
|
transposedDataGrid: DataGridDatum[][];
|
28
|
-
|
31
|
+
dataFormatterGrid: DataFormatterGridGrid;
|
29
32
|
chartType?: ChartType;
|
30
33
|
}): string[];
|
31
|
-
export declare function createMultiGridGroupLabels({ transposedDataGrid,
|
34
|
+
export declare function createMultiGridGroupLabels({ transposedDataGrid, dataFormatterGrid, chartType, gridIndex }: {
|
32
35
|
transposedDataGrid: DataGridDatum[][];
|
33
|
-
|
36
|
+
dataFormatterGrid: DataFormatterGridGrid;
|
34
37
|
chartType?: ChartType;
|
35
38
|
gridIndex?: number;
|
36
39
|
}): string[];
|
@@ -42,7 +45,5 @@ export declare function getMinAndMaxMultiGrid(data: DataMultiGrid): [number, num
|
|
42
45
|
export declare function getMinAndMaxMultiValue(data: DataMultiValue, valueIndex?: number): [number, number];
|
43
46
|
export declare function transposeData<T>(seriesDirection: SeriesDirection, data: T[][]): T[][];
|
44
47
|
export declare function seriesColorPredicate(seriesIndex: number, chartParams: ChartParams): string;
|
45
|
-
export declare function
|
46
|
-
|
47
|
-
scale: [number, number];
|
48
|
-
};
|
48
|
+
export declare function calcSeriesContainerLayout(layout: Layout, container: DataFormatterContainer, amount: number): SeriesContainerPosition[];
|
49
|
+
export declare function calcGridContainerLayout(layout: Layout, container: DataFormatterContainer, amount: number): GridContainerPosition[];
|
package/package.json
CHANGED
@@ -59,14 +59,14 @@ import {
|
|
59
59
|
CHART_HEIGHT_DEFAULT } from '../defaults'
|
60
60
|
|
61
61
|
// 判斷dataFormatter是否需要size參數
|
62
|
-
const isAxesTypeMap: {[key in ChartType]: Boolean} = {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
}
|
62
|
+
// const isAxesTypeMap: {[key in ChartType]: Boolean} = {
|
63
|
+
// series: false,
|
64
|
+
// grid: true,
|
65
|
+
// multiGrid: true,
|
66
|
+
// multiValue: true,
|
67
|
+
// tree: false,
|
68
|
+
// relationship: false
|
69
|
+
// }
|
70
70
|
|
71
71
|
function resizeObservable(elem: HTMLElement | Element): Observable<DOMRectReadOnly> {
|
72
72
|
return new Observable(subscriber => {
|
@@ -267,7 +267,7 @@ export const createBaseChart: CreateBaseChart = <T extends ChartType>({ defaultD
|
|
267
267
|
data: sharedData$,
|
268
268
|
dataFormatter: shareAndMergedDataFormatter$,
|
269
269
|
chartParams: shareAndMergedChartParams$,
|
270
|
-
layout: iif(() => isAxesTypeMap[chartType] === true, layout$, of(undefined))
|
270
|
+
// layout: iif(() => isAxesTypeMap[chartType] === true, layout$, of(undefined))
|
271
271
|
}).pipe(
|
272
272
|
takeUntil(destroy$),
|
273
273
|
switchMap(async d => d),
|
@@ -276,7 +276,7 @@ export const createBaseChart: CreateBaseChart = <T extends ChartType>({ defaultD
|
|
276
276
|
.pipe(
|
277
277
|
map(_d => {
|
278
278
|
try {
|
279
|
-
return computedDataFn({ data: _d.data, dataFormatter: _d.dataFormatter, chartParams: _d.chartParams
|
279
|
+
return computedDataFn({ data: _d.data, dataFormatter: _d.dataFormatter, chartParams: _d.chartParams })
|
280
280
|
} catch (e) {
|
281
281
|
console.error(e)
|
282
282
|
throw new Error(e)
|