@orbcharts/core 3.0.0-alpha.21
Sign up to get free protection for your applications and to get access to all the features.
- package/.gitignore +23 -0
- package/LICENSE +201 -0
- package/dist/orbcharts-core.es.js +5096 -0
- package/dist/orbcharts-core.umd.js +3 -0
- package/dist/src/AbstractChart.d.ts +17 -0
- package/dist/src/GridChart.d.ts +6 -0
- package/dist/src/MultiGridChart.d.ts +6 -0
- package/dist/src/MultiValueChart.d.ts +6 -0
- package/dist/src/RelationshipChart.d.ts +6 -0
- package/dist/src/SeriesChart.d.ts +6 -0
- package/dist/src/TreeChart.d.ts +6 -0
- package/dist/src/base/createBaseChart.d.ts +3 -0
- package/dist/src/base/createBasePlugin.d.ts +3 -0
- package/dist/src/defaults.d.ts +37 -0
- package/dist/src/defineGridPlugin.d.ts +1 -0
- package/dist/src/defineMultiGridPlugin.d.ts +1 -0
- package/dist/src/defineMultiValuePlugin.d.ts +1 -0
- package/dist/src/defineNoneDataPlugin.d.ts +1 -0
- package/dist/src/defineRelationshipPlugin.d.ts +1 -0
- package/dist/src/defineSeriesPlugin.d.ts +1 -0
- package/dist/src/defineTreePlugin.d.ts +1 -0
- package/dist/src/grid/computeGridData.d.ts +3 -0
- package/dist/src/grid/createGridContextObserver.d.ts +3 -0
- package/dist/src/grid/gridObservables.d.ts +25 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/multiGrid/computeMultiGridData.d.ts +3 -0
- package/dist/src/multiGrid/createMultiGridContextObserver.d.ts +3 -0
- package/dist/src/multiGrid/multiGridObservables.d.ts +0 -0
- package/dist/src/multiValue/computeMultiValueData.d.ts +3 -0
- package/dist/src/multiValue/createMultiValueContextObserver.d.ts +3 -0
- package/dist/src/multiValue/multiValueObservables.d.ts +0 -0
- package/dist/src/relationship/computeRelationshipData.d.ts +3 -0
- package/dist/src/relationship/createRelationshipContextObserver.d.ts +3 -0
- package/dist/src/relationship/relationshipObservables.d.ts +0 -0
- package/dist/src/series/computeSeriesData.d.ts +3 -0
- package/dist/src/series/createSeriesContextObserver.d.ts +3 -0
- package/dist/src/series/seriesObservables.d.ts +8 -0
- package/dist/src/tree/computeTreeData.d.ts +3 -0
- package/dist/src/tree/createTreeContextObserver.d.ts +3 -0
- package/dist/src/tree/treeObservables.d.ts +0 -0
- package/dist/src/types/Axis.d.ts +1 -0
- package/dist/src/types/Chart.d.ts +41 -0
- package/dist/src/types/ChartParams.d.ts +36 -0
- package/dist/src/types/ComputedData.d.ts +28 -0
- package/dist/src/types/ComputedDataGrid.d.ts +10 -0
- package/dist/src/types/ComputedDataMultiGrid.d.ts +3 -0
- package/dist/src/types/ComputedDataMultiValue.d.ts +6 -0
- package/dist/src/types/ComputedDataRelationship.d.ts +18 -0
- package/dist/src/types/ComputedDataSeries.d.ts +6 -0
- package/dist/src/types/ComputedDataTree.d.ts +7 -0
- package/dist/src/types/ContextObserver.d.ts +28 -0
- package/dist/src/types/ContextObserverGrid.d.ts +18 -0
- package/dist/src/types/ContextObserverMultiGrid.d.ts +4 -0
- package/dist/src/types/ContextObserverMultiValue.d.ts +4 -0
- package/dist/src/types/ContextObserverRelationship.d.ts +4 -0
- package/dist/src/types/ContextObserverSeries.d.ts +8 -0
- package/dist/src/types/ContextObserverTree.d.ts +4 -0
- package/dist/src/types/ContextSubject.d.ts +15 -0
- package/dist/src/types/Data.d.ts +19 -0
- package/dist/src/types/DataFormatter.d.ts +40 -0
- package/dist/src/types/DataFormatterGrid.d.ts +20 -0
- package/dist/src/types/DataFormatterMultiGrid.d.ts +16 -0
- package/dist/src/types/DataFormatterMultiValue.d.ts +13 -0
- package/dist/src/types/DataFormatterRelationship.d.ts +5 -0
- package/dist/src/types/DataFormatterSeries.d.ts +10 -0
- package/dist/src/types/DataFormatterTree.d.ts +5 -0
- package/dist/src/types/DataGrid.d.ts +6 -0
- package/dist/src/types/DataMultiGrid.d.ts +6 -0
- package/dist/src/types/DataMultiValue.d.ts +6 -0
- package/dist/src/types/DataRelationship.d.ts +20 -0
- package/dist/src/types/DataSeries.d.ts +6 -0
- package/dist/src/types/DataTree.d.ts +13 -0
- package/dist/src/types/Event.d.ts +64 -0
- package/dist/src/types/Layout.d.ts +8 -0
- package/dist/src/types/Padding.d.ts +6 -0
- package/dist/src/types/Plugin.d.ts +37 -0
- package/dist/src/types/TransformData.d.ts +8 -0
- package/dist/src/types/index.d.ts +37 -0
- package/dist/src/utils/commonUtils.d.ts +8 -0
- package/dist/src/utils/d3Utils.d.ts +25 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/observables.d.ts +14 -0
- package/dist/src/utils/orbchartsUtils.d.ts +20 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +40 -0
- package/src/AbstractChart.ts +48 -0
- package/src/GridChart.ts +21 -0
- package/src/MultiGridChart.ts +21 -0
- package/src/MultiValueChart.ts +21 -0
- package/src/RelationshipChart.ts +21 -0
- package/src/SeriesChart.ts +21 -0
- package/src/TreeChart.ts +21 -0
- package/src/base/createBaseChart.ts +329 -0
- package/src/base/createBasePlugin.ts +89 -0
- package/src/defaults.ts +229 -0
- package/src/defineGridPlugin.ts +3 -0
- package/src/defineMultiGridPlugin.ts +3 -0
- package/src/defineMultiValuePlugin.ts +3 -0
- package/src/defineNoneDataPlugin.ts +4 -0
- package/src/defineRelationshipPlugin.ts +3 -0
- package/src/defineSeriesPlugin.ts +3 -0
- package/src/defineTreePlugin.ts +3 -0
- package/src/grid/computeGridData.ts +192 -0
- package/src/grid/createGridContextObserver.ts +91 -0
- package/src/grid/gridObservables.ts +359 -0
- package/src/index.ts +21 -0
- package/src/multiGrid/computeMultiGridData.ts +48 -0
- package/src/multiGrid/createMultiGridContextObserver.ts +12 -0
- package/src/multiGrid/multiGridObservables.ts +0 -0
- package/src/multiValue/computeMultiValueData.ts +127 -0
- package/src/multiValue/createMultiValueContextObserver.ts +12 -0
- package/src/multiValue/multiValueObservables.ts +0 -0
- package/src/relationship/computeRelationshipData.ts +101 -0
- package/src/relationship/createRelationshipContextObserver.ts +12 -0
- package/src/relationship/relationshipObservables.ts +0 -0
- package/src/series/computeSeriesData.ts +154 -0
- package/src/series/createSeriesContextObserver.ts +33 -0
- package/src/series/seriesObservables.ts +23 -0
- package/src/tree/computeTreeData.ts +104 -0
- package/src/tree/createTreeContextObserver.ts +12 -0
- package/src/tree/treeObservables.ts +0 -0
- package/src/types/Axis.ts +1 -0
- package/src/types/Chart.ts +46 -0
- package/src/types/ChartParams.ts +50 -0
- package/src/types/ComputedData.ts +66 -0
- package/src/types/ComputedDataGrid.ts +12 -0
- package/src/types/ComputedDataMultiGrid.ts +3 -0
- package/src/types/ComputedDataMultiValue.ts +10 -0
- package/src/types/ComputedDataRelationship.ts +20 -0
- package/src/types/ComputedDataSeries.ts +8 -0
- package/src/types/ComputedDataTree.ts +20 -0
- package/src/types/ContextObserver.ts +38 -0
- package/src/types/ContextObserverGrid.ts +16 -0
- package/src/types/ContextObserverMultiGrid.ts +5 -0
- package/src/types/ContextObserverMultiValue.ts +5 -0
- package/src/types/ContextObserverRelationship.ts +5 -0
- package/src/types/ContextObserverSeries.ts +8 -0
- package/src/types/ContextObserverTree.ts +5 -0
- package/src/types/ContextSubject.ts +18 -0
- package/src/types/Data.ts +45 -0
- package/src/types/DataFormatter.ts +99 -0
- package/src/types/DataFormatterGrid.ts +40 -0
- package/src/types/DataFormatterMultiGrid.ts +23 -0
- package/src/types/DataFormatterMultiValue.ts +19 -0
- package/src/types/DataFormatterRelationship.ts +23 -0
- package/src/types/DataFormatterSeries.ts +26 -0
- package/src/types/DataFormatterTree.ts +10 -0
- package/src/types/DataGrid.ts +11 -0
- package/src/types/DataMultiGrid.ts +7 -0
- package/src/types/DataMultiValue.ts +11 -0
- package/src/types/DataRelationship.ts +27 -0
- package/src/types/DataSeries.ts +11 -0
- package/src/types/DataTree.ts +18 -0
- package/src/types/Event.ts +114 -0
- package/src/types/Layout.ts +12 -0
- package/src/types/Padding.ts +6 -0
- package/src/types/Plugin.ts +60 -0
- package/src/types/TransformData.ts +8 -0
- package/src/types/index.ts +37 -0
- package/src/utils/commonUtils.ts +50 -0
- package/src/utils/d3Utils.ts +87 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/observables.ts +198 -0
- package/src/utils/orbchartsUtils.ts +150 -0
- package/tsconfig.json +14 -0
- package/vite.config.js +45 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
import { ChartType } from './Chart';
|
2
|
+
import { ComputedDataSeries, ComputedDatumSeries } from './ComputedDataSeries';
|
3
|
+
import { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid';
|
4
|
+
import { ComputedDataMultiGrid } from './ComputedDataMultiGrid';
|
5
|
+
import { ComputedDataMultiValue, ComputedDatumMultiValue } from './ComputedDataMultiValue';
|
6
|
+
import { ComputedDataRelationship, ComputedNode } from './ComputedDataRelationship';
|
7
|
+
import { ComputedDataTree } from './ComputedDataTree';
|
8
|
+
import { DataFormatterContext } from './DataFormatter';
|
9
|
+
|
10
|
+
export interface ComputedDataFn<T extends ChartType> {
|
11
|
+
(dataFormatterContext: DataFormatterContext<T>): ComputedDataTypeMap<T>;
|
12
|
+
}
|
13
|
+
export interface ComputedDatumBase {
|
14
|
+
id: string;
|
15
|
+
index: number;
|
16
|
+
label: string;
|
17
|
+
value: number | null;
|
18
|
+
visible: boolean;
|
19
|
+
tooltipContent: string;
|
20
|
+
data: any;
|
21
|
+
}
|
22
|
+
export interface ComputedDatumSeriesValue {
|
23
|
+
color: string;
|
24
|
+
seriesIndex: number;
|
25
|
+
seriesLabel: string;
|
26
|
+
}
|
27
|
+
export type ComputedDataTypeMap<T extends ChartType> = T extends 'series' ? ComputedDataSeries : T extends 'grid' ? ComputedDataGrid : T extends 'multiGrid' ? ComputedDataMultiGrid : T extends 'multiValue' ? ComputedDataMultiValue : T extends 'relationship' ? ComputedDataRelationship : T extends 'tree' ? ComputedDataTree : ComputedDatumBase;
|
28
|
+
export type ComputedDatumTypeMap<T extends ChartType> = T extends 'series' ? ComputedDatumSeries : T extends 'grid' ? ComputedDatumGrid : T extends 'multiGrid' ? ComputedDatumGrid : T extends 'multiValue' ? ComputedDatumMultiValue : T extends 'relationship' ? ComputedNode : T extends 'tree' ? ComputedDataTree : unknown;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { ComputedDatumBase, ComputedDatumSeriesValue } from './ComputedData';
|
2
|
+
|
3
|
+
export interface ComputedDatumGrid extends ComputedDatumBase, ComputedDatumSeriesValue {
|
4
|
+
groupIndex: number;
|
5
|
+
groupLabel: string;
|
6
|
+
axisX: number;
|
7
|
+
axisY: number;
|
8
|
+
axisYFromZero: number;
|
9
|
+
}
|
10
|
+
export type ComputedDataGrid = ComputedDatumGrid[][];
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { ComputedDatumBase } from './ComputedData';
|
2
|
+
|
3
|
+
export type ComputedDataRelationship = {
|
4
|
+
nodes: ComputedNode[];
|
5
|
+
edges: ComputedEdge[];
|
6
|
+
};
|
7
|
+
export interface ComputedNode extends ComputedDatumBase {
|
8
|
+
startNodes: ComputedNode[];
|
9
|
+
startNodeIds: string[];
|
10
|
+
endNodes: ComputedNode[];
|
11
|
+
endNodeIds: string[];
|
12
|
+
}
|
13
|
+
export interface ComputedEdge extends ComputedDatumBase {
|
14
|
+
startNode: ComputedNode;
|
15
|
+
startNodeId: string;
|
16
|
+
endNode: ComputedNode;
|
17
|
+
endNodeId: string;
|
18
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { Observable } from 'rxjs';
|
2
|
+
import { ChartType } from './Chart';
|
3
|
+
import { ChartParams } from './ChartParams';
|
4
|
+
import { DataFormatterTypeMap } from './DataFormatter';
|
5
|
+
import { ComputedDataTypeMap } from './ComputedData';
|
6
|
+
import { Layout } from './Layout';
|
7
|
+
import { ContextObserverGrid } from './ContextObserverGrid';
|
8
|
+
import { ContextObserverMultiGrid } from './ContextObserverMultiGrid';
|
9
|
+
import { ContextObserverMultiValue } from './ContextObserverMultiValue';
|
10
|
+
import { ContextObserverRelationship } from './ContextObserverRelationship';
|
11
|
+
import { ContextObserverSeries } from './ContextObserverSeries';
|
12
|
+
import { ContextObserverTree } from './ContextObserverTree';
|
13
|
+
import { ContextSubject } from './ContextSubject';
|
14
|
+
|
15
|
+
export interface ContextObserverFn<T extends ChartType> {
|
16
|
+
({ subject, observer }: {
|
17
|
+
subject: ContextSubject<T>;
|
18
|
+
observer: ContextObserverBase<T, unknown>;
|
19
|
+
}): ContextObserverTypeMap<T, unknown>;
|
20
|
+
}
|
21
|
+
export type ContextObserverTypeMap<T extends ChartType, PluginParams> = T extends 'series' ? ContextObserverSeries<PluginParams> : T extends 'grid' ? ContextObserverGrid<PluginParams> : T extends 'multiGrid' ? ContextObserverMultiGrid<PluginParams> : T extends 'multiValue' ? ContextObserverMultiValue<PluginParams> : T extends 'relationship' ? ContextObserverRelationship<PluginParams> : T extends 'tree' ? ContextObserverTree<PluginParams> : ContextObserverBase<ChartType, PluginParams>;
|
22
|
+
export interface ContextObserverBase<T extends ChartType, PluginParams> {
|
23
|
+
fullParams$: Observable<PluginParams>;
|
24
|
+
fullChartParams$: Observable<ChartParams>;
|
25
|
+
fullDataFormatter$: Observable<DataFormatterTypeMap<T>>;
|
26
|
+
computedData$: Observable<ComputedDataTypeMap<T>>;
|
27
|
+
layout$: Observable<Layout>;
|
28
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Observable } from 'rxjs';
|
2
|
+
import { ContextObserverBase } from './ContextObserver';
|
3
|
+
import { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid';
|
4
|
+
import { TransformData } from './TransformData';
|
5
|
+
|
6
|
+
export interface ContextObserverGrid<PluginParams> extends ContextObserverBase<'grid', PluginParams> {
|
7
|
+
gridAxesTransform$: Observable<TransformData>;
|
8
|
+
gridGraphicTransform$: Observable<TransformData>;
|
9
|
+
gridAxesOppositeTransform$: Observable<TransformData>;
|
10
|
+
gridAxesSize$: Observable<{
|
11
|
+
width: number;
|
12
|
+
height: number;
|
13
|
+
}>;
|
14
|
+
gridHighlight$: Observable<string[]>;
|
15
|
+
SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>;
|
16
|
+
GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>;
|
17
|
+
visibleComputedData$: Observable<ComputedDataGrid>;
|
18
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { Observable } from 'rxjs';
|
2
|
+
import { ContextObserverBase } from './ContextObserver';
|
3
|
+
import { ComputedDatumSeries } from './ComputedDataSeries';
|
4
|
+
|
5
|
+
export interface ContextObserverSeries<PluginParams> extends ContextObserverBase<'series', PluginParams> {
|
6
|
+
seriesHighlight$: Observable<string[]>;
|
7
|
+
SeriesDataMap$: Observable<Map<string, ComputedDatumSeries[]>>;
|
8
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { Subject } from 'rxjs';
|
2
|
+
import { ChartType } from './Chart';
|
3
|
+
import { EventTypeMap } from './Event';
|
4
|
+
import { ChartParamsPartial } from './ChartParams';
|
5
|
+
import { DataFormatterPartialTypeMap } from './DataFormatter';
|
6
|
+
import { DataTypeMap } from './Data';
|
7
|
+
import { PluginEntity } from './Plugin';
|
8
|
+
|
9
|
+
export interface ContextSubject<T extends ChartType> {
|
10
|
+
data$: Subject<DataTypeMap<T>>;
|
11
|
+
dataFormatter$: Subject<DataFormatterPartialTypeMap<T>>;
|
12
|
+
plugins$: Subject<PluginEntity<T, any, any>[]>;
|
13
|
+
chartParams$: Subject<ChartParamsPartial>;
|
14
|
+
event$: Subject<EventTypeMap<T>>;
|
15
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { ChartType } from './Chart';
|
2
|
+
import { DataSeries, DataSeriesDatum, DataSeriesValue } from './DataSeries';
|
3
|
+
import { DataGrid, DataGridDatum, DataGridValue } from './DataGrid';
|
4
|
+
import { DataMultiGrid, DataMultiGridDatum, DataMultiGridValue } from './DataMultiGrid';
|
5
|
+
import { DataMultiValue, DataMultiValueDatum, DataMultiValueValue } from './DataMultiValue';
|
6
|
+
import { DataTree, DataTreeDatum, DataTreeObj } from './DataTree';
|
7
|
+
import { DataRelationship, Node, Edge } from './DataRelationship';
|
8
|
+
|
9
|
+
export interface DatumBase {
|
10
|
+
id?: string;
|
11
|
+
label?: string;
|
12
|
+
tooltipContent?: string;
|
13
|
+
data?: any;
|
14
|
+
}
|
15
|
+
export interface DatumValue {
|
16
|
+
value: number | null;
|
17
|
+
}
|
18
|
+
export type DataTypeMap<T extends ChartType> = T extends 'series' ? DataSeries : T extends 'grid' ? DataGrid : T extends 'multiGrid' ? DataMultiGrid : T extends 'multiValue' ? DataMultiValue : T extends 'relationship' ? DataRelationship : T extends 'tree' ? DataTree : unknown;
|
19
|
+
export type DatumTypeMap<T extends ChartType> = T extends 'series' ? DataSeriesDatum | DataSeriesValue : T extends 'grid' ? DataGridDatum | DataGridValue : T extends 'multiGrid' ? DataMultiGridDatum | DataMultiGridValue : T extends 'multiValue' ? DataMultiValueDatum | DataMultiValueValue : T extends 'relationship' ? Node | Edge : T extends 'tree' ? DataTreeDatum | DataTreeObj : unknown;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { ChartType } from './Chart';
|
2
|
+
import { ChartParams } from './ChartParams';
|
3
|
+
import { DataTypeMap, DatumTypeMap } from './Data';
|
4
|
+
import { DataFormatterSeries, DataFormatterSeriesPartial } from './DataFormatterSeries';
|
5
|
+
import { DataFormatterGrid, DataFormatterGridPartial } from './DataFormatterGrid';
|
6
|
+
import { DataFormatterMultiGrid, DataFormatterMultiGridPartial } from './DataFormatterMultiGrid';
|
7
|
+
import { DataFormatterMultiValue, DataFormatterMultiValuePartial } from './DataFormatterMultiValue';
|
8
|
+
import { DataFormatterTree, DataFormatterTreePartial } from './DataFormatterTree';
|
9
|
+
import { DataFormatterRelationship, DataFormatterRelationshipPartial } from './DataFormatterRelationship';
|
10
|
+
import { AxisPosition } from './Axis';
|
11
|
+
import { Layout } from './Layout';
|
12
|
+
|
13
|
+
export interface DataFormatterContext<T extends ChartType> {
|
14
|
+
data: DataTypeMap<T>;
|
15
|
+
dataFormatter: DataFormatterTypeMap<T>;
|
16
|
+
chartParams: ChartParams;
|
17
|
+
layout: Layout;
|
18
|
+
}
|
19
|
+
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
|
+
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>;
|
21
|
+
export interface DataFormatterBase<T extends ChartType> {
|
22
|
+
type: T;
|
23
|
+
visibleFilter: VisibleFilter<T>;
|
24
|
+
tooltipContentFormat: TooltipContentFormat<T>;
|
25
|
+
}
|
26
|
+
export type DataFormatterBasePartial<T extends ChartType> = Partial<DataFormatterBase<T>>;
|
27
|
+
export interface DataFormatterValueAxis {
|
28
|
+
position: AxisPosition;
|
29
|
+
scaleDomain: [number | 'auto', number | 'auto'];
|
30
|
+
scaleRange: [number, number];
|
31
|
+
label: string;
|
32
|
+
}
|
33
|
+
export interface DataFormatterGroupAxis {
|
34
|
+
position: AxisPosition;
|
35
|
+
scaleDomain: [number | 'auto', number | 'auto'];
|
36
|
+
scalePadding: number;
|
37
|
+
label: string;
|
38
|
+
}
|
39
|
+
export type VisibleFilter<T extends ChartType> = (datum: DatumTypeMap<T>, rowIndex: number, columnIndex: number, context: DataFormatterContext<T>) => boolean | null;
|
40
|
+
export type TooltipContentFormat<T extends ChartType> = (datum: DatumTypeMap<T>, rowIndex: number, columnIndex: number, context: DataFormatterContext<T>) => string | null;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { DataGridDatum, DataGridValue } from './DataGrid';
|
2
|
+
import { DataFormatterBase, DataFormatterValueAxis, DataFormatterGroupAxis, DataFormatterContext } from './DataFormatter';
|
3
|
+
|
4
|
+
export type SeriesType = 'row' | 'column';
|
5
|
+
export interface DataFormatterGrid extends DataFormatterBase<'grid'> {
|
6
|
+
grid: DataFormatterGridGrid;
|
7
|
+
valueAxis: DataFormatterValueAxis;
|
8
|
+
groupAxis: DataFormatterGroupAxis;
|
9
|
+
colorsPredicate: (datum: DataGridDatum | DataGridValue, rowIndex: number, columnIndex: number, context: DataFormatterContext<'grid'>) => string;
|
10
|
+
}
|
11
|
+
export type DataFormatterGridPartial = Partial<DataFormatterGrid> | Partial<{
|
12
|
+
grid: Partial<DataFormatterGridGrid>;
|
13
|
+
valueAxis: Partial<DataFormatterValueAxis>;
|
14
|
+
groupAxis: Partial<DataFormatterGroupAxis>;
|
15
|
+
}>;
|
16
|
+
export interface DataFormatterGridGrid {
|
17
|
+
rowLabels: string[];
|
18
|
+
columnLabels: string[];
|
19
|
+
seriesType: SeriesType;
|
20
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { DataGridDatum, DataGridValue } from './DataGrid';
|
2
|
+
import { DataFormatterGridGrid } from './DataFormatterGrid';
|
3
|
+
import { DataFormatterBase, DataFormatterValueAxis, DataFormatterGroupAxis, DataFormatterContext } from './DataFormatter';
|
4
|
+
|
5
|
+
export interface DataFormatterMultiGrid extends DataFormatterBase<'multiGrid'> {
|
6
|
+
multiGrid: Array<DataFormatterMultiGridMultiGrid>;
|
7
|
+
}
|
8
|
+
export type DataFormatterMultiGridPartial = Partial<DataFormatterMultiGrid> | Partial<{
|
9
|
+
multiGrid: Array<Partial<DataFormatterMultiGridMultiGrid>>;
|
10
|
+
}>;
|
11
|
+
export interface DataFormatterMultiGridMultiGrid {
|
12
|
+
grid: DataFormatterGridGrid;
|
13
|
+
valueAxis: DataFormatterValueAxis;
|
14
|
+
groupAxis: DataFormatterGroupAxis;
|
15
|
+
colorsPredicate: (datum: DataGridDatum | DataGridValue, rowIndex: number, columnIndex: number, context: DataFormatterContext<'grid'>) => string;
|
16
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { DataFormatterBase, DataFormatterValueAxis } from './DataFormatter';
|
2
|
+
|
3
|
+
export interface DataFormatterMultiValue extends DataFormatterBase<'multiValue'> {
|
4
|
+
multiValue: Array<DataFormatterMultiValueMultiValue>;
|
5
|
+
xAxis: DataFormatterValueAxis;
|
6
|
+
yAxis: DataFormatterValueAxis;
|
7
|
+
}
|
8
|
+
export type DataFormatterMultiValuePartial = Partial<DataFormatterMultiValue> | Partial<{
|
9
|
+
multiValue: Array<Partial<DataFormatterMultiValueMultiValue>>;
|
10
|
+
}>;
|
11
|
+
export interface DataFormatterMultiValueMultiValue {
|
12
|
+
unitLabel: string;
|
13
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { DataSeriesDatum, DataSeriesValue } from './DataSeries';
|
2
|
+
import { DataFormatterBase, DataFormatterContext } from './DataFormatter';
|
3
|
+
|
4
|
+
export interface DataFormatterSeries extends DataFormatterBase<'series'> {
|
5
|
+
unitLabel: string;
|
6
|
+
seriesLabels: string[];
|
7
|
+
colorsPredicate: (datum: DataSeriesDatum | DataSeriesValue, rowIndex: number, columnIndex: number, context: DataFormatterContext<'series'>) => string;
|
8
|
+
sort: ((a: DataSeriesDatum | DataSeriesValue, b: DataSeriesDatum | number) => number) | null;
|
9
|
+
}
|
10
|
+
export type DataFormatterSeriesPartial = Partial<DataFormatterSeries> | Partial<{}>;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { DatumBase } from './Data';
|
2
|
+
|
3
|
+
export type DataRelationship = DataRelationshipObj | DataRelationshipList;
|
4
|
+
export interface DataRelationshipObj {
|
5
|
+
nodes: Node[];
|
6
|
+
edges: Edge[];
|
7
|
+
}
|
8
|
+
export type DataRelationshipList = [
|
9
|
+
Node[],
|
10
|
+
Edge[]
|
11
|
+
];
|
12
|
+
export interface Node extends DatumBase {
|
13
|
+
id: string;
|
14
|
+
value?: number;
|
15
|
+
}
|
16
|
+
export interface Edge extends DatumBase {
|
17
|
+
start: string;
|
18
|
+
end: string;
|
19
|
+
value?: number;
|
20
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { DatumBase, DatumValue } from './Data';
|
2
|
+
|
3
|
+
export type DataSeries = (DataSeriesDatum | DataSeriesValue)[][] | (DataSeriesDatum | DataSeriesValue)[];
|
4
|
+
export type DataSeriesValue = number | null;
|
5
|
+
export interface DataSeriesDatum extends DatumBase, DatumValue {
|
6
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { DatumBase } from './Data';
|
2
|
+
|
3
|
+
export type DataTree = DataTreeObj | DataTreeDatum[];
|
4
|
+
export interface DataTreeObj extends DatumBase {
|
5
|
+
id: string;
|
6
|
+
value?: number;
|
7
|
+
children?: DataTreeObj[];
|
8
|
+
}
|
9
|
+
export interface DataTreeDatum extends DatumBase {
|
10
|
+
id: string;
|
11
|
+
value?: number;
|
12
|
+
parent?: string;
|
13
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import { ChartType } from './Chart';
|
2
|
+
import { ComputedDatumBase } from './ComputedData';
|
3
|
+
import { ComputedDataSeries, ComputedDatumSeries } from './ComputedDataSeries';
|
4
|
+
import { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid';
|
5
|
+
import { ComputedDataMultiGrid } from './ComputedDataMultiGrid';
|
6
|
+
import { ComputedDatumMultiValue } from './ComputedDataMultiValue';
|
7
|
+
import { ComputedNode } from './ComputedDataRelationship';
|
8
|
+
import { ComputedDataTree } from './ComputedDataTree';
|
9
|
+
import { HighlightTarget } from './ChartParams';
|
10
|
+
|
11
|
+
export type EventName = 'click' | 'mouseover' | 'mousemove' | 'mouseout' | 'dragstart' | 'drag' | 'dragend' | 'resize' | 'transitionMove' | 'transitionEnd';
|
12
|
+
export type EventTypeMap<T extends ChartType> = T extends 'series' ? EventSeries : T extends 'grid' ? EventGrid : T extends 'multiGrid' ? EventMultiGrid : T extends 'multiValue' ? EventMultiValue : T extends 'relationship' ? EventRelationship : T extends 'tree' ? EventTree : EventBase;
|
13
|
+
export interface EventBase {
|
14
|
+
eventName: EventName;
|
15
|
+
pluginName: string;
|
16
|
+
type: ChartType;
|
17
|
+
event: MouseEvent | undefined;
|
18
|
+
highlightTarget: HighlightTarget;
|
19
|
+
datum: ComputedDatumBase | null;
|
20
|
+
tween?: number;
|
21
|
+
}
|
22
|
+
export interface EventSeries extends EventBase {
|
23
|
+
type: 'series';
|
24
|
+
data: ComputedDataSeries;
|
25
|
+
series: ComputedDatumSeries[];
|
26
|
+
seriesIndex: number;
|
27
|
+
seriesLabel: string;
|
28
|
+
datum: ComputedDatumSeries | null;
|
29
|
+
}
|
30
|
+
export interface EventGrid extends EventBase {
|
31
|
+
type: 'grid';
|
32
|
+
data: ComputedDataGrid;
|
33
|
+
series: ComputedDatumGrid[];
|
34
|
+
seriesIndex: number;
|
35
|
+
seriesLabel: string;
|
36
|
+
groups: ComputedDatumGrid[];
|
37
|
+
groupIndex: number;
|
38
|
+
groupLabel: string;
|
39
|
+
datum: ComputedDatumGrid | null;
|
40
|
+
}
|
41
|
+
export interface EventMultiGrid extends EventBase {
|
42
|
+
type: 'multiGrid';
|
43
|
+
data: ComputedDataMultiGrid;
|
44
|
+
gridIndex: number;
|
45
|
+
series: ComputedDatumGrid[];
|
46
|
+
seriesIndex: number;
|
47
|
+
seriesLabel: string;
|
48
|
+
group: ComputedDatumGrid[];
|
49
|
+
groupIndex: number;
|
50
|
+
groupLabel: string;
|
51
|
+
datum: ComputedDatumGrid | null;
|
52
|
+
}
|
53
|
+
export interface EventMultiValue extends EventBase {
|
54
|
+
type: 'multiValue';
|
55
|
+
datum: ComputedDatumMultiValue | null;
|
56
|
+
}
|
57
|
+
export interface EventRelationship extends EventBase {
|
58
|
+
type: 'relationship';
|
59
|
+
datum: ComputedNode | null;
|
60
|
+
}
|
61
|
+
export interface EventTree extends EventBase {
|
62
|
+
type: 'tree';
|
63
|
+
datum: ComputedDataTree | null;
|
64
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { Subject } from 'rxjs';
|
2
|
+
import { ChartType } from './Chart';
|
3
|
+
import { ContextSubject } from './ContextSubject';
|
4
|
+
import { ContextObserverTypeMap } from './ContextObserver';
|
5
|
+
import * as d3 from 'd3';
|
6
|
+
export interface CreateBasePlugin {
|
7
|
+
<T extends ChartType>(): DefinePlugin<T>;
|
8
|
+
}
|
9
|
+
export interface DefinePlugin<T extends ChartType> {
|
10
|
+
<PluginName, PluginParams>(name: PluginName, defaultParams: PluginParams): DefinePluginInitFn<T, PluginName, PluginParams>;
|
11
|
+
}
|
12
|
+
export interface DefinePluginInitFn<T extends ChartType, PluginName, PluginParams> {
|
13
|
+
(initFn: PluginInitFn<T, PluginName, PluginParams>): PluginConstructor<T, PluginName, PluginParams>;
|
14
|
+
}
|
15
|
+
export interface PluginConstructor<T extends ChartType, PluginName, PluginParams> {
|
16
|
+
new (): PluginEntity<T, PluginName, PluginParams>;
|
17
|
+
}
|
18
|
+
export interface PluginEntity<T extends ChartType, PluginName, PluginParams> {
|
19
|
+
params$: Subject<Partial<PluginParams>>;
|
20
|
+
name: PluginName;
|
21
|
+
defaultParams: PluginParams;
|
22
|
+
init: () => void;
|
23
|
+
destroy: () => void;
|
24
|
+
setPresetParams: (presetParams: Partial<PluginParams>) => void;
|
25
|
+
setContext: (pluginContext: PluginContext<T, PluginName, PluginParams>) => void;
|
26
|
+
}
|
27
|
+
export interface PluginInitFn<T extends ChartType, PluginName, PluginParams> {
|
28
|
+
(pluginContext: PluginContext<T, PluginName, PluginParams>): () => void;
|
29
|
+
}
|
30
|
+
export interface PluginContext<T extends ChartType, PluginName, PluginParams> {
|
31
|
+
selection: d3.Selection<any, unknown, any, unknown>;
|
32
|
+
rootSelection: d3.Selection<any, unknown, any, unknown>;
|
33
|
+
name: PluginName;
|
34
|
+
chartType: ChartType;
|
35
|
+
subject: ContextSubject<T>;
|
36
|
+
observer: ContextObserverTypeMap<T, PluginParams>;
|
37
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
export * from './Axis';
|
2
|
+
export * from './Chart';
|
3
|
+
export * from './ChartParams';
|
4
|
+
export * from './ComputedData';
|
5
|
+
export * from './ComputedDataGrid';
|
6
|
+
export * from './ComputedDataMultiGrid';
|
7
|
+
export * from './ComputedDataMultiValue';
|
8
|
+
export * from './ComputedDataRelationship';
|
9
|
+
export * from './ComputedDataSeries';
|
10
|
+
export * from './ComputedDataTree';
|
11
|
+
export * from './ContextObserver';
|
12
|
+
export * from './ContextObserverGrid';
|
13
|
+
export * from './ContextObserverMultiGrid';
|
14
|
+
export * from './ContextObserverMultiValue';
|
15
|
+
export * from './ContextObserverRelationship';
|
16
|
+
export * from './ContextObserverSeries';
|
17
|
+
export * from './ContextObserverTree';
|
18
|
+
export * from './ContextSubject';
|
19
|
+
export * from './Data';
|
20
|
+
export * from './DataFormatter';
|
21
|
+
export * from './DataFormatterGrid';
|
22
|
+
export * from './DataFormatterMultiGrid';
|
23
|
+
export * from './DataFormatterMultiValue';
|
24
|
+
export * from './DataFormatterRelationship';
|
25
|
+
export * from './DataFormatterSeries';
|
26
|
+
export * from './DataFormatterTree';
|
27
|
+
export * from './DataGrid';
|
28
|
+
export * from './DataMultiGrid';
|
29
|
+
export * from './DataMultiValue';
|
30
|
+
export * from './DataRelationship';
|
31
|
+
export * from './DataSeries';
|
32
|
+
export * from './DataTree';
|
33
|
+
export * from './Event';
|
34
|
+
export * from './Layout';
|
35
|
+
export * from './Padding';
|
36
|
+
export * from './Plugin';
|
37
|
+
export * from './TransformData';
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare function isObject(variable: any): boolean;
|
2
|
+
export declare function isFunction(fn: any): boolean;
|
3
|
+
export declare function mergeOptionsWithDefault<Options extends {
|
4
|
+
[key: string]: any;
|
5
|
+
}>(options: {
|
6
|
+
[key: string]: any;
|
7
|
+
}, defaultOptions: Options): Options;
|
8
|
+
export declare function formatCommaNumber(num?: number): string;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import * as d3 from 'd3';
|
2
|
+
export declare const createAxisLinearScale: ({ maxValue, minValue, axisWidth, scaleDomain, scaleRange, }: {
|
3
|
+
maxValue: number;
|
4
|
+
minValue: number;
|
5
|
+
axisWidth: number;
|
6
|
+
scaleDomain: [
|
7
|
+
number | 'auto',
|
8
|
+
number | 'auto'
|
9
|
+
];
|
10
|
+
scaleRange: [
|
11
|
+
number,
|
12
|
+
number
|
13
|
+
];
|
14
|
+
}) => d3.ScaleLinear<number, number, never>;
|
15
|
+
export declare const createAxisPointScale: ({ axisLabels, axisWidth, padding }: {
|
16
|
+
axisLabels: string[];
|
17
|
+
axisWidth: number;
|
18
|
+
padding?: number;
|
19
|
+
}) => d3.ScalePoint<string>;
|
20
|
+
export declare const createAxisQuantizeScale: ({ axisLabels, axisWidth, padding, reverse }: {
|
21
|
+
axisLabels: string[] | Date[];
|
22
|
+
axisWidth: number;
|
23
|
+
padding?: number;
|
24
|
+
reverse?: boolean;
|
25
|
+
}) => d3.ScaleQuantize<number, never>;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Subject, Observable } from 'rxjs';
|
2
|
+
import { ChartType, ChartParams, ComputedDatumTypeMap } from '../types';
|
3
|
+
|
4
|
+
export declare const highlightObservable: ({ datumList$, fullChartParams$, event$ }: {
|
5
|
+
datumList$: Observable<ComputedDatumTypeMap<'series' | 'grid'>[]>;
|
6
|
+
fullChartParams$: Observable<ChartParams>;
|
7
|
+
event$: Subject<any>;
|
8
|
+
}) => Observable<string[]>;
|
9
|
+
export declare const seriesDataMapObservable: <DatumType extends ComputedDatumTypeMap<ChartType>>({ datumList$ }: {
|
10
|
+
datumList$: Observable<DatumType[]>;
|
11
|
+
}) => Observable<Map<string, DatumType[]>>;
|
12
|
+
export declare const groupDataMapObservable: <DatumType extends ComputedDatumTypeMap<ChartType>>({ datumList$ }: {
|
13
|
+
datumList$: Observable<DatumType[]>;
|
14
|
+
}) => Observable<Map<string, DatumType[]>>;
|