@orbcharts/core 3.0.0-alpha.41 → 3.0.0-alpha.43
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +200 -200
- package/dist/orbcharts-core.es.js +1906 -1897
- 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 +10 -3
- package/dist/src/utils/orbchartsUtils.d.ts +14 -13
- package/package.json +41 -41
- package/src/AbstractChart.ts +48 -48
- package/src/GridChart.ts +20 -20
- package/src/MultiGridChart.ts +20 -20
- package/src/MultiValueChart.ts +20 -20
- package/src/RelationshipChart.ts +20 -20
- package/src/SeriesChart.ts +20 -20
- package/src/TreeChart.ts +20 -20
- package/src/base/createBaseChart.ts +367 -367
- package/src/base/createBasePlugin.ts +89 -89
- package/src/defaults.ts +220 -248
- package/src/defineGridPlugin.ts +3 -3
- package/src/defineMultiGridPlugin.ts +3 -3
- package/src/defineMultiValuePlugin.ts +3 -3
- package/src/defineNoneDataPlugin.ts +4 -4
- package/src/defineRelationshipPlugin.ts +3 -3
- package/src/defineSeriesPlugin.ts +3 -3
- package/src/defineTreePlugin.ts +3 -3
- package/src/grid/computeGridData.ts +134 -205
- package/src/grid/createGridContextObserver.ts +147 -130
- package/src/grid/gridObservables.ts +573 -486
- package/src/index.ts +21 -21
- package/src/multiGrid/computeMultiGridData.ts +130 -173
- package/src/multiGrid/createMultiGridContextObserver.ts +40 -40
- package/src/multiGrid/multiGridObservables.ts +350 -285
- package/src/multiValue/computeMultiValueData.ts +143 -136
- package/src/multiValue/createMultiValueContextObserver.ts +12 -12
- package/src/relationship/computeRelationshipData.ts +118 -106
- package/src/relationship/createRelationshipContextObserver.ts +12 -12
- package/src/series/computeSeriesData.ts +90 -153
- package/src/series/createSeriesContextObserver.ts +93 -38
- package/src/series/seriesObservables.ts +176 -24
- package/src/tree/computeTreeData.ts +131 -128
- package/src/tree/createTreeContextObserver.ts +61 -61
- package/src/tree/treeObservables.ts +94 -94
- package/src/types/Chart.ts +48 -48
- package/src/types/ChartParams.ts +51 -51
- package/src/types/ComputedData.ts +83 -82
- package/src/types/ComputedDataGrid.ts +13 -13
- package/src/types/ComputedDataMultiGrid.ts +2 -2
- package/src/types/ComputedDataMultiValue.ts +9 -9
- package/src/types/ComputedDataRelationship.ts +19 -19
- package/src/types/ComputedDataSeries.ts +8 -8
- package/src/types/ComputedDataTree.ts +19 -19
- package/src/types/ContextObserver.ts +38 -38
- package/src/types/ContextObserverGrid.ts +41 -33
- package/src/types/ContextObserverMultiGrid.ts +16 -28
- package/src/types/ContextObserverMultiValue.ts +4 -4
- package/src/types/ContextObserverRelationship.ts +4 -4
- package/src/types/ContextObserverSeries.ts +29 -9
- package/src/types/ContextObserverTree.ts +11 -11
- package/src/types/ContextSubject.ts +18 -18
- package/src/types/Data.ts +45 -45
- package/src/types/DataFormatter.ts +74 -95
- package/src/types/DataFormatterGrid.ts +67 -55
- package/src/types/DataFormatterMultiGrid.ts +44 -42
- package/src/types/DataFormatterMultiValue.ts +23 -20
- package/src/types/DataFormatterRelationship.ts +25 -22
- package/src/types/DataFormatterSeries.ts +20 -30
- package/src/types/DataFormatterTree.ts +12 -12
- package/src/types/DataGrid.ts +11 -11
- package/src/types/DataMultiGrid.ts +6 -6
- package/src/types/DataMultiValue.ts +12 -12
- package/src/types/DataRelationship.ts +27 -27
- package/src/types/DataSeries.ts +11 -11
- package/src/types/DataTree.ts +20 -20
- package/src/types/Event.ts +153 -153
- package/src/types/Layout.ts +11 -11
- package/src/types/Padding.ts +5 -5
- package/src/types/Plugin.ts +60 -60
- package/src/types/TransformData.ts +7 -7
- package/src/types/index.ts +37 -37
- package/src/utils/commonUtils.ts +50 -50
- package/src/utils/d3Utils.ts +89 -89
- package/src/utils/index.ts +4 -4
- package/src/utils/observables.ts +201 -201
- package/src/utils/orbchartsUtils.ts +349 -253
- package/tsconfig.json +13 -13
- package/vite.config.js +44 -44
@@ -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 seriesSeparateObservable: ({ 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$, seriesSeparate$ }: {
|
23
|
+
seriesContainerPosition$: Observable<SeriesContainerPosition[]>;
|
24
|
+
seriesLabels$: Observable<string[]>;
|
25
|
+
seriesSeparate$: 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
|
+
seriesSeparate$: 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
1
|
import { DataSeriesDatum, DataSeriesValue } from './DataSeries';
|
2
|
-
import { DataFormatterBase, DataFormatterBasePartial, VisibleFilter } from './DataFormatter';
|
2
|
+
import { DataFormatterBase, DataFormatterBasePartial, VisibleFilter, DataFormatterContainer } from './DataFormatter';
|
3
3
|
|
4
4
|
export interface DataFormatterSeries extends DataFormatterBase<'series'> {
|
5
5
|
visibleFilter: VisibleFilter<'series'>;
|
6
|
-
seriesLabels: string[];
|
7
6
|
sort: ((a: DataSeriesDatum | DataSeriesValue, b: DataSeriesDatum | number) => number) | null;
|
7
|
+
seriesLabels: string[];
|
8
|
+
container: DataFormatterContainer;
|
9
|
+
separateSeries: boolean;
|
10
|
+
sumSeries: boolean;
|
8
11
|
}
|
9
12
|
export interface DataFormatterSeriesPartial extends DataFormatterBasePartial<'series'> {
|
10
|
-
|
13
|
+
visibleFilter?: VisibleFilter<'series'>;
|
11
14
|
sort?: ((a: DataSeriesDatum | DataSeriesValue, b: DataSeriesDatum | number) => number) | null;
|
15
|
+
seriesLabels?: string[];
|
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
@@ -1,41 +1,41 @@
|
|
1
|
-
{
|
2
|
-
"name": "@orbcharts/core",
|
3
|
-
"version": "3.0.0-alpha.
|
4
|
-
"description": "OrbCharts is an open source chart library based on d3.js and rx.js",
|
5
|
-
"author": "Blue Planet Inc.",
|
6
|
-
"license": "Apache-2.0",
|
7
|
-
"keywords": [
|
8
|
-
"d3",
|
9
|
-
"rxjs",
|
10
|
-
"svg",
|
11
|
-
"visualization",
|
12
|
-
"infographic",
|
13
|
-
"graph",
|
14
|
-
"chart"
|
15
|
-
],
|
16
|
-
"private": false,
|
17
|
-
"publishConfig": {
|
18
|
-
"access": "public",
|
19
|
-
"registry": "https://registry.npmjs.org/"
|
20
|
-
},
|
21
|
-
"files": [
|
22
|
-
"*"
|
23
|
-
],
|
24
|
-
"module": "./dist/orbcharts-core.es.js",
|
25
|
-
"types": "./dist/src/index.d.ts",
|
26
|
-
"scripts": {
|
27
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
28
|
-
"build": "vite build --mode release"
|
29
|
-
},
|
30
|
-
"devDependencies": {
|
31
|
-
"@types/d3": "^7.4.0",
|
32
|
-
"ts-loader": "^9.4.2",
|
33
|
-
"typescript": "^5.0.4",
|
34
|
-
"vite": "^5.3.5",
|
35
|
-
"vite-plugin-dts": "^3.7.3"
|
36
|
-
},
|
37
|
-
"dependencies": {
|
38
|
-
"d3": "^7.8.5",
|
39
|
-
"rxjs": "^7.8.1"
|
40
|
-
}
|
41
|
-
}
|
1
|
+
{
|
2
|
+
"name": "@orbcharts/core",
|
3
|
+
"version": "3.0.0-alpha.43",
|
4
|
+
"description": "OrbCharts is an open source chart library based on d3.js and rx.js",
|
5
|
+
"author": "Blue Planet Inc.",
|
6
|
+
"license": "Apache-2.0",
|
7
|
+
"keywords": [
|
8
|
+
"d3",
|
9
|
+
"rxjs",
|
10
|
+
"svg",
|
11
|
+
"visualization",
|
12
|
+
"infographic",
|
13
|
+
"graph",
|
14
|
+
"chart"
|
15
|
+
],
|
16
|
+
"private": false,
|
17
|
+
"publishConfig": {
|
18
|
+
"access": "public",
|
19
|
+
"registry": "https://registry.npmjs.org/"
|
20
|
+
},
|
21
|
+
"files": [
|
22
|
+
"*"
|
23
|
+
],
|
24
|
+
"module": "./dist/orbcharts-core.es.js",
|
25
|
+
"types": "./dist/src/index.d.ts",
|
26
|
+
"scripts": {
|
27
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
28
|
+
"build": "vite build --mode release"
|
29
|
+
},
|
30
|
+
"devDependencies": {
|
31
|
+
"@types/d3": "^7.4.0",
|
32
|
+
"ts-loader": "^9.4.2",
|
33
|
+
"typescript": "^5.0.4",
|
34
|
+
"vite": "^5.3.5",
|
35
|
+
"vite-plugin-dts": "^3.7.3"
|
36
|
+
},
|
37
|
+
"dependencies": {
|
38
|
+
"d3": "^7.8.5",
|
39
|
+
"rxjs": "^7.8.1"
|
40
|
+
}
|
41
|
+
}
|
package/src/AbstractChart.ts
CHANGED
@@ -1,48 +1,48 @@
|
|
1
|
-
import * as d3 from 'd3'
|
2
|
-
import {
|
3
|
-
Subject } from 'rxjs'
|
4
|
-
import type {
|
5
|
-
ComputedDataFn,
|
6
|
-
ChartEntity,
|
7
|
-
ChartType,
|
8
|
-
ChartParamsPartial,
|
9
|
-
ContextObserverFn,
|
10
|
-
ChartOptionsPartial,
|
11
|
-
DataTypeMap,
|
12
|
-
DataFormatterTypeMap,
|
13
|
-
DataFormatterPartialTypeMap,
|
14
|
-
EventTypeMap,
|
15
|
-
PluginEntity } from './types'
|
16
|
-
import { createBaseChart } from './base/createBaseChart'
|
17
|
-
|
18
|
-
export abstract class AbstractChart<T extends ChartType> implements ChartEntity<T> {
|
19
|
-
selection: d3.Selection<SVGGElement, unknown, HTMLElement, unknown>
|
20
|
-
destroy: () => void
|
21
|
-
data$: Subject<DataTypeMap<T>> = new Subject()
|
22
|
-
dataFormatter$: Subject<DataFormatterPartialTypeMap<T>> = new Subject()
|
23
|
-
plugins$: Subject<PluginEntity<T, any, any>[]> = new Subject()
|
24
|
-
chartParams$: Subject<ChartParamsPartial> = new Subject()
|
25
|
-
event$: Subject<EventTypeMap<T>> = new Subject()
|
26
|
-
|
27
|
-
constructor (
|
28
|
-
{ defaultDataFormatter, computedDataFn, contextObserverFn }: {
|
29
|
-
defaultDataFormatter: DataFormatterTypeMap<T>
|
30
|
-
computedDataFn: ComputedDataFn<T>
|
31
|
-
contextObserverFn: ContextObserverFn<T>
|
32
|
-
},
|
33
|
-
element: HTMLElement | Element,
|
34
|
-
options?: ChartOptionsPartial<T>
|
35
|
-
) {
|
36
|
-
const baseChart = createBaseChart({ defaultDataFormatter, computedDataFn, contextObserverFn })
|
37
|
-
const chartEntity = baseChart(element, options)
|
38
|
-
|
39
|
-
this.selection = chartEntity.selection
|
40
|
-
this.destroy = chartEntity.destroy
|
41
|
-
this.data$ = chartEntity.data$
|
42
|
-
this.dataFormatter$ = chartEntity.dataFormatter$
|
43
|
-
this.plugins$ = chartEntity.plugins$
|
44
|
-
this.chartParams$ = chartEntity.chartParams$
|
45
|
-
this.event$ = chartEntity.event$
|
46
|
-
}
|
47
|
-
|
48
|
-
}
|
1
|
+
import * as d3 from 'd3'
|
2
|
+
import {
|
3
|
+
Subject } from 'rxjs'
|
4
|
+
import type {
|
5
|
+
ComputedDataFn,
|
6
|
+
ChartEntity,
|
7
|
+
ChartType,
|
8
|
+
ChartParamsPartial,
|
9
|
+
ContextObserverFn,
|
10
|
+
ChartOptionsPartial,
|
11
|
+
DataTypeMap,
|
12
|
+
DataFormatterTypeMap,
|
13
|
+
DataFormatterPartialTypeMap,
|
14
|
+
EventTypeMap,
|
15
|
+
PluginEntity } from './types'
|
16
|
+
import { createBaseChart } from './base/createBaseChart'
|
17
|
+
|
18
|
+
export abstract class AbstractChart<T extends ChartType> implements ChartEntity<T> {
|
19
|
+
selection: d3.Selection<SVGGElement, unknown, HTMLElement, unknown>
|
20
|
+
destroy: () => void
|
21
|
+
data$: Subject<DataTypeMap<T>> = new Subject()
|
22
|
+
dataFormatter$: Subject<DataFormatterPartialTypeMap<T>> = new Subject()
|
23
|
+
plugins$: Subject<PluginEntity<T, any, any>[]> = new Subject()
|
24
|
+
chartParams$: Subject<ChartParamsPartial> = new Subject()
|
25
|
+
event$: Subject<EventTypeMap<T>> = new Subject()
|
26
|
+
|
27
|
+
constructor (
|
28
|
+
{ defaultDataFormatter, computedDataFn, contextObserverFn }: {
|
29
|
+
defaultDataFormatter: DataFormatterTypeMap<T>
|
30
|
+
computedDataFn: ComputedDataFn<T>
|
31
|
+
contextObserverFn: ContextObserverFn<T>
|
32
|
+
},
|
33
|
+
element: HTMLElement | Element,
|
34
|
+
options?: ChartOptionsPartial<T>
|
35
|
+
) {
|
36
|
+
const baseChart = createBaseChart({ defaultDataFormatter, computedDataFn, contextObserverFn })
|
37
|
+
const chartEntity = baseChart(element, options)
|
38
|
+
|
39
|
+
this.selection = chartEntity.selection
|
40
|
+
this.destroy = chartEntity.destroy
|
41
|
+
this.data$ = chartEntity.data$
|
42
|
+
this.dataFormatter$ = chartEntity.dataFormatter$
|
43
|
+
this.plugins$ = chartEntity.plugins$
|
44
|
+
this.chartParams$ = chartEntity.chartParams$
|
45
|
+
this.event$ = chartEntity.event$
|
46
|
+
}
|
47
|
+
|
48
|
+
}
|