@orbcharts/core 3.0.0-alpha.61 → 3.0.0-alpha.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +200 -200
- package/dist/lib/core-types.d.ts +1 -0
- package/dist/orbcharts-core.es.js +3054 -2609
- package/dist/orbcharts-core.umd.js +6 -2
- package/dist/src/AbstractChart.d.ts +5 -3
- package/dist/src/GridChart.d.ts +1 -1
- package/dist/src/MultiGridChart.d.ts +1 -1
- package/dist/src/MultiValueChart.d.ts +1 -1
- package/dist/src/RelationshipChart.d.ts +1 -1
- package/dist/src/SeriesChart.d.ts +1 -1
- package/dist/src/TreeChart.d.ts +1 -1
- package/dist/src/base/createBaseChart.d.ts +1 -1
- package/dist/src/base/createBasePlugin.d.ts +1 -1
- package/dist/src/base/validators/chartOptionsValidator.d.ts +3 -0
- package/dist/src/base/validators/chartParamsValidator.d.ts +3 -0
- package/dist/src/base/validators/elementValidator.d.ts +3 -0
- package/dist/src/base/validators/pluginsValidator.d.ts +3 -0
- package/dist/src/defaults.d.ts +1 -16
- package/dist/src/defineGridPlugin.d.ts +1 -1
- package/dist/src/defineMultiGridPlugin.d.ts +1 -1
- package/dist/src/defineMultiValuePlugin.d.ts +1 -1
- package/dist/src/defineNoneDataPlugin.d.ts +1 -1
- package/dist/src/defineRelationshipPlugin.d.ts +1 -1
- package/dist/src/defineSeriesPlugin.d.ts +1 -1
- package/dist/src/defineTreePlugin.d.ts +1 -1
- package/dist/src/grid/computedDataFn.d.ts +4 -0
- package/dist/src/grid/contextObserverCallback.d.ts +3 -0
- package/dist/src/grid/dataFormatterValidator.d.ts +3 -0
- package/dist/src/grid/dataValidator.d.ts +3 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/multiGrid/computedDataFn.d.ts +3 -0
- package/dist/src/multiGrid/contextObserverCallback.d.ts +3 -0
- package/dist/src/multiGrid/dataFormatterValidator.d.ts +3 -0
- package/dist/src/multiGrid/dataValidator.d.ts +3 -0
- package/dist/src/multiValue/computedDataFn.d.ts +3 -0
- package/dist/src/multiValue/contextObserverCallback.d.ts +3 -0
- package/dist/src/multiValue/dataFormatterValidator.d.ts +3 -0
- package/dist/src/multiValue/dataValidator.d.ts +3 -0
- package/dist/src/relationship/computedDataFn.d.ts +3 -0
- package/dist/src/relationship/contextObserverCallback.d.ts +3 -0
- package/dist/src/relationship/dataFormatterValidator.d.ts +3 -0
- package/dist/src/relationship/dataValidator.d.ts +3 -0
- package/dist/src/series/computedDataFn.d.ts +3 -0
- package/dist/src/series/contextObserverCallback.d.ts +3 -0
- package/dist/src/series/dataFormatterValidator.d.ts +3 -0
- package/dist/src/series/dataValidator.d.ts +3 -0
- package/dist/src/tree/computedDataFn.d.ts +3 -0
- package/dist/src/tree/contextObserverCallback.d.ts +3 -0
- package/dist/src/tree/dataFormatterValidator.d.ts +3 -0
- package/dist/src/tree/dataValidator.d.ts +3 -0
- package/dist/src/utils/commonUtils.d.ts +1 -0
- package/dist/src/utils/errorMessage.d.ts +14 -0
- package/dist/src/{grid → utils}/gridObservables.d.ts +2 -2
- package/dist/src/utils/index.d.ts +7 -3
- package/dist/src/{multiGrid → utils}/multiGridObservables.d.ts +1 -1
- package/dist/src/utils/observables.d.ts +2 -1
- package/dist/src/utils/orbchartsUtils.d.ts +1 -12
- package/dist/src/{series → utils}/seriesObservables.d.ts +3 -3
- package/dist/src/{tree → utils}/treeObservables.d.ts +1 -1
- package/dist/src/utils/validator.d.ts +3 -0
- package/lib/core-types.ts +7 -0
- package/package.json +42 -41
- package/src/AbstractChart.ts +57 -48
- package/src/GridChart.ts +24 -20
- package/src/MultiGridChart.ts +24 -20
- package/src/MultiValueChart.ts +24 -20
- package/src/RelationshipChart.ts +24 -20
- package/src/SeriesChart.ts +24 -20
- package/src/TreeChart.ts +24 -20
- package/src/base/createBaseChart.ts +500 -388
- package/src/base/createBasePlugin.ts +152 -95
- package/src/base/validators/chartOptionsValidator.ts +24 -0
- package/src/base/validators/chartParamsValidator.ts +134 -0
- package/src/base/validators/elementValidator.ts +14 -0
- package/src/base/validators/pluginsValidator.ts +15 -0
- package/src/defaults.ts +232 -228
- 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 → computedDataFn.ts} +129 -134
- package/src/grid/{createGridContextObserver.ts → contextObserverCallback.ts} +155 -155
- package/src/grid/dataFormatterValidator.ts +9 -0
- package/src/grid/dataValidator.ts +9 -0
- package/src/index.ts +20 -21
- package/src/multiGrid/{computeMultiGridData.ts → computedDataFn.ts} +123 -130
- package/src/multiGrid/{createMultiGridContextObserver.ts → contextObserverCallback.ts} +41 -41
- package/src/multiGrid/dataFormatterValidator.ts +9 -0
- package/src/multiGrid/dataValidator.ts +9 -0
- package/src/multiValue/{computeMultiValueData.ts → computedDataFn.ts} +176 -179
- package/src/multiValue/{createMultiValueContextObserver.ts → contextObserverCallback.ts} +12 -12
- package/src/multiValue/dataFormatterValidator.ts +9 -0
- package/src/multiValue/dataValidator.ts +9 -0
- package/src/relationship/{computeRelationshipData.ts → computedDataFn.ts} +125 -118
- package/src/relationship/{createRelationshipContextObserver.ts → contextObserverCallback.ts} +12 -12
- package/src/relationship/dataFormatterValidator.ts +9 -0
- package/src/relationship/dataValidator.ts +9 -0
- package/src/series/{computeSeriesData.ts → computedDataFn.ts} +88 -90
- package/src/series/{createSeriesContextObserver.ts → contextObserverCallback.ts} +100 -93
- package/src/series/dataFormatterValidator.ts +9 -0
- package/src/series/dataValidator.ts +9 -0
- package/src/tree/{computeTreeData.ts → computedDataFn.ts} +130 -132
- package/src/tree/{createTreeContextObserver.ts → contextObserverCallback.ts} +61 -61
- package/src/tree/dataFormatterValidator.ts +9 -0
- package/src/tree/dataValidator.ts +9 -0
- package/src/utils/commonUtils.ts +54 -50
- package/src/utils/d3Utils.ts +108 -108
- package/src/utils/errorMessage.ts +43 -0
- package/src/{grid → utils}/gridObservables.ts +611 -614
- package/src/utils/index.ts +10 -4
- package/src/{multiGrid → utils}/multiGridObservables.ts +366 -365
- package/src/utils/observables.ts +218 -202
- package/src/utils/orbchartsUtils.ts +352 -349
- package/src/{series → utils}/seriesObservables.ts +175 -175
- package/src/{tree → utils}/treeObservables.ts +94 -94
- package/src/utils/validator.ts +126 -0
- package/tsconfig.base.json +13 -13
- package/tsconfig.json +2 -2
- package/vite-env.d.ts +7 -0
- package/vite.config.js +22 -22
- package/dist/src/grid/computeGridData.d.ts +0 -6
- package/dist/src/grid/createGridContextObserver.d.ts +0 -3
- package/dist/src/multiGrid/computeMultiGridData.d.ts +0 -3
- package/dist/src/multiGrid/createMultiGridContextObserver.d.ts +0 -3
- package/dist/src/multiValue/computeMultiValueData.d.ts +0 -3
- package/dist/src/multiValue/createMultiValueContextObserver.d.ts +0 -3
- package/dist/src/relationship/computeRelationshipData.d.ts +0 -3
- package/dist/src/relationship/createRelationshipContextObserver.d.ts +0 -3
- package/dist/src/series/computeSeriesData.d.ts +0 -3
- package/dist/src/series/createSeriesContextObserver.d.ts +0 -3
- package/dist/src/tree/computeTreeData.d.ts +0 -3
- package/dist/src/tree/createTreeContextObserver.d.ts +0 -3
- package/dist/src/types/Axis.d.ts +0 -1
- package/dist/src/types/Chart.d.ts +0 -45
- package/dist/src/types/ChartParams.d.ts +0 -36
- package/dist/src/types/ComputedData.d.ts +0 -42
- package/dist/src/types/ComputedDataGrid.d.ts +0 -5
- package/dist/src/types/ComputedDataMultiGrid.d.ts +0 -3
- package/dist/src/types/ComputedDataMultiValue.d.ts +0 -6
- package/dist/src/types/ComputedDataRelationship.d.ts +0 -18
- package/dist/src/types/ComputedDataSeries.d.ts +0 -5
- package/dist/src/types/ComputedDataTree.d.ts +0 -7
- package/dist/src/types/ContextObserver.d.ts +0 -28
- package/dist/src/types/ContextObserverGrid.d.ts +0 -41
- package/dist/src/types/ContextObserverMultiGrid.d.ts +0 -15
- package/dist/src/types/ContextObserverMultiValue.d.ts +0 -4
- package/dist/src/types/ContextObserverRelationship.d.ts +0 -4
- package/dist/src/types/ContextObserverSeries.d.ts +0 -27
- package/dist/src/types/ContextObserverTree.d.ts +0 -11
- package/dist/src/types/ContextSubject.d.ts +0 -15
- package/dist/src/types/Data.d.ts +0 -19
- package/dist/src/types/DataFormatter.d.ts +0 -41
- package/dist/src/types/DataFormatterGrid.d.ts +0 -34
- package/dist/src/types/DataFormatterMultiGrid.d.ts +0 -20
- package/dist/src/types/DataFormatterMultiValue.d.ts +0 -18
- package/dist/src/types/DataFormatterRelationship.d.ts +0 -10
- package/dist/src/types/DataFormatterSeries.d.ts +0 -19
- package/dist/src/types/DataFormatterTree.d.ts +0 -7
- package/dist/src/types/DataGrid.d.ts +0 -6
- package/dist/src/types/DataMultiGrid.d.ts +0 -6
- package/dist/src/types/DataMultiValue.d.ts +0 -7
- package/dist/src/types/DataRelationship.d.ts +0 -21
- package/dist/src/types/DataSeries.d.ts +0 -6
- package/dist/src/types/DataTree.d.ts +0 -15
- package/dist/src/types/Event.d.ts +0 -56
- package/dist/src/types/Layout.d.ts +0 -8
- package/dist/src/types/Padding.d.ts +0 -6
- package/dist/src/types/Plugin.d.ts +0 -37
- package/dist/src/types/TransformData.d.ts +0 -8
- package/dist/src/types/index.d.ts +0 -37
- package/src/types/Axis.ts +0 -1
- package/src/types/Chart.ts +0 -54
- package/src/types/ChartParams.ts +0 -51
- package/src/types/ComputedData.ts +0 -84
- package/src/types/ComputedDataGrid.ts +0 -14
- package/src/types/ComputedDataMultiGrid.ts +0 -3
- package/src/types/ComputedDataMultiValue.ts +0 -9
- package/src/types/ComputedDataRelationship.ts +0 -20
- package/src/types/ComputedDataSeries.ts +0 -8
- package/src/types/ComputedDataTree.ts +0 -20
- package/src/types/ContextObserver.ts +0 -38
- package/src/types/ContextObserverGrid.ts +0 -43
- package/src/types/ContextObserverMultiGrid.ts +0 -17
- package/src/types/ContextObserverMultiValue.ts +0 -5
- package/src/types/ContextObserverRelationship.ts +0 -5
- package/src/types/ContextObserverSeries.ts +0 -29
- package/src/types/ContextObserverTree.ts +0 -11
- package/src/types/ContextSubject.ts +0 -18
- package/src/types/Data.ts +0 -45
- package/src/types/DataFormatter.ts +0 -74
- package/src/types/DataFormatterGrid.ts +0 -68
- package/src/types/DataFormatterMultiGrid.ts +0 -45
- package/src/types/DataFormatterMultiValue.ts +0 -24
- package/src/types/DataFormatterRelationship.ts +0 -26
- package/src/types/DataFormatterSeries.ts +0 -20
- package/src/types/DataFormatterTree.ts +0 -12
- package/src/types/DataGrid.ts +0 -11
- package/src/types/DataMultiGrid.ts +0 -7
- package/src/types/DataMultiValue.ts +0 -12
- package/src/types/DataRelationship.ts +0 -28
- package/src/types/DataSeries.ts +0 -11
- package/src/types/DataTree.ts +0 -20
- package/src/types/Event.ts +0 -153
- package/src/types/Layout.ts +0 -12
- package/src/types/Padding.ts +0 -6
- package/src/types/Plugin.ts +0 -60
- package/src/types/TransformData.ts +0 -8
- package/src/types/index.ts +0 -37
- /package/dist/src/{multiValue → utils}/multiValueObservables.d.ts +0 -0
- /package/dist/src/{relationship → utils}/relationshipObservables.d.ts +0 -0
- /package/src/{multiValue → utils}/multiValueObservables.ts +0 -0
- /package/src/{relationship → utils}/relationshipObservables.ts +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DataFormatterBase, DataFormatterBasePartial, VisibleFilter } from './DataFormatter';
|
|
2
|
-
|
|
3
|
-
export interface DataFormatterRelationship extends DataFormatterBase<'relationship'> {
|
|
4
|
-
visibleFilter: VisibleFilter<'relationship'>;
|
|
5
|
-
categoryLabels: string[];
|
|
6
|
-
}
|
|
7
|
-
export interface DataFormatterRelationshipPartial extends DataFormatterBasePartial<'relationship'> {
|
|
8
|
-
visibleFilter?: VisibleFilter<'relationship'>;
|
|
9
|
-
categoryLabels?: string[];
|
|
10
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ComputedDatumSeries } from './ComputedDataSeries';
|
|
2
|
-
import { DataFormatterBase, DataFormatterBasePartial, VisibleFilter, DataFormatterContainer } from './DataFormatter';
|
|
3
|
-
|
|
4
|
-
export interface DataFormatterSeries extends DataFormatterBase<'series'> {
|
|
5
|
-
visibleFilter: VisibleFilter<'series'>;
|
|
6
|
-
sort: ((a: ComputedDatumSeries, b: ComputedDatumSeries) => number) | null;
|
|
7
|
-
seriesLabels: string[];
|
|
8
|
-
container: DataFormatterContainer;
|
|
9
|
-
separateSeries: boolean;
|
|
10
|
-
sumSeries: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface DataFormatterSeriesPartial extends DataFormatterBasePartial<'series'> {
|
|
13
|
-
visibleFilter?: VisibleFilter<'series'>;
|
|
14
|
-
sort?: ((a: ComputedDatumSeries, b: ComputedDatumSeries) => number) | null;
|
|
15
|
-
seriesLabels?: string[];
|
|
16
|
-
container?: Partial<DataFormatterContainer>;
|
|
17
|
-
separateSeries?: boolean;
|
|
18
|
-
sumSeries?: boolean;
|
|
19
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DataFormatterBase, VisibleFilter } from './DataFormatter';
|
|
2
|
-
|
|
3
|
-
export interface DataFormatterTree extends DataFormatterBase<'tree'> {
|
|
4
|
-
visibleFilter: VisibleFilter<'tree'>;
|
|
5
|
-
categoryLabels: string[];
|
|
6
|
-
}
|
|
7
|
-
export type DataFormatterTreePartial = Partial<DataFormatterTree>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DatumBase, DatumValue } from './Data';
|
|
2
|
-
|
|
3
|
-
export type DataMultiValue = (DataMultiValueDatum | DataMultiValueValue)[][];
|
|
4
|
-
export type DataMultiValueValue = number;
|
|
5
|
-
export interface DataMultiValueDatum extends DatumBase, DatumValue {
|
|
6
|
-
categoryLabel?: string;
|
|
7
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
categoryLabel?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface Edge extends DatumBase {
|
|
18
|
-
start: string;
|
|
19
|
-
end: string;
|
|
20
|
-
value?: number;
|
|
21
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
categoryLabel?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface DataTreeDatum extends DatumBase {
|
|
11
|
-
id: string;
|
|
12
|
-
value?: number;
|
|
13
|
-
parent?: string;
|
|
14
|
-
categoryLabel?: string;
|
|
15
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
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 { HighlightTarget } from './ChartParams';
|
|
9
|
-
|
|
10
|
-
export type EventName = 'click' | 'mouseover' | 'mousemove' | 'mouseout' | 'dragstart' | 'drag' | 'dragend' | 'resize' | 'transitionMove' | 'transitionEnd';
|
|
11
|
-
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<any>;
|
|
12
|
-
export interface EventBase<T extends ChartType> {
|
|
13
|
-
type: T;
|
|
14
|
-
eventName: EventName;
|
|
15
|
-
pluginName: string;
|
|
16
|
-
event: MouseEvent | undefined;
|
|
17
|
-
highlightTarget: HighlightTarget;
|
|
18
|
-
tween?: number;
|
|
19
|
-
}
|
|
20
|
-
export interface EventBaseSeriesValue<DatumType, DataType> {
|
|
21
|
-
data: DataType;
|
|
22
|
-
series: DatumType[];
|
|
23
|
-
seriesIndex: number;
|
|
24
|
-
seriesLabel: string;
|
|
25
|
-
datum: DatumType | null;
|
|
26
|
-
}
|
|
27
|
-
export interface EventBaseGridValue<DatumType, DataType> {
|
|
28
|
-
data: DataType;
|
|
29
|
-
gridIndex: number;
|
|
30
|
-
series: DatumType[];
|
|
31
|
-
seriesIndex: number;
|
|
32
|
-
seriesLabel: string;
|
|
33
|
-
groups: DatumType[];
|
|
34
|
-
groupIndex: number;
|
|
35
|
-
groupLabel: string;
|
|
36
|
-
datum: DatumType | null;
|
|
37
|
-
}
|
|
38
|
-
export interface EventBaseCategoryValue<DatumType, DataType> {
|
|
39
|
-
data: DataType;
|
|
40
|
-
category: DatumType[];
|
|
41
|
-
categoryIndex: number;
|
|
42
|
-
categoryLabel: string;
|
|
43
|
-
datum: DatumType | null;
|
|
44
|
-
}
|
|
45
|
-
export interface EventSeries extends EventBase<'series'>, EventBaseSeriesValue<ComputedDatumSeries, ComputedDataSeries> {
|
|
46
|
-
}
|
|
47
|
-
export interface EventGrid extends EventBase<'grid'>, EventBaseGridValue<ComputedDatumGrid, ComputedDataGrid> {
|
|
48
|
-
}
|
|
49
|
-
export interface EventMultiGrid extends EventBase<'multiGrid'>, EventBaseGridValue<ComputedDatumGrid, ComputedDataMultiGrid> {
|
|
50
|
-
}
|
|
51
|
-
export interface EventMultiValue extends EventBase<'multiValue'>, EventBaseCategoryValue<ComputedDatumMultiValue, ComputedDataMultiValue> {
|
|
52
|
-
}
|
|
53
|
-
export interface EventRelationship extends EventBase<'relationship'>, EventBaseCategoryValue<ComputedNode, ComputedDataRelationship> {
|
|
54
|
-
}
|
|
55
|
-
export interface EventTree extends EventBase<'tree'>, EventBaseCategoryValue<ComputedDataTree, ComputedDataTree> {
|
|
56
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
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';
|
package/src/types/Axis.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type AxisPosition = 'top' | 'bottom' | 'left' | 'right'
|
package/src/types/Chart.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { ChartParams, ChartParamsPartial } from './ChartParams'
|
|
2
|
-
import type { ContextSubject } from './ContextSubject'
|
|
3
|
-
import type { ContextObserverFn } from './ContextObserver'
|
|
4
|
-
import type { ComputedDataFn } from './ComputedData'
|
|
5
|
-
import type { DataFormatterTypeMap, DataFormatterPartialTypeMap } from './DataFormatter'
|
|
6
|
-
|
|
7
|
-
export type ChartType = 'series' | 'grid' | 'multiGrid' | 'multiValue' | 'tree' | 'relationship'
|
|
8
|
-
|
|
9
|
-
export interface CreateBaseChart {
|
|
10
|
-
<T extends ChartType>({ defaultDataFormatter, computedDataFn, contextObserverFn }: {
|
|
11
|
-
defaultDataFormatter: DataFormatterTypeMap<T>
|
|
12
|
-
computedDataFn: ComputedDataFn<T>
|
|
13
|
-
contextObserverFn: ContextObserverFn<T>
|
|
14
|
-
}): CreateChart<T>
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export interface CreateChart<T extends ChartType> {
|
|
19
|
-
// (element: HTMLElement | Element, pluginParams: any[], chartParams?: Partial<ChartParams>): Chart<T>
|
|
20
|
-
(element: HTMLElement | Element, options?: ChartOptionsPartial<T>): ChartEntity<T>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface ChartEntity<T extends ChartType> extends ContextSubject<T> {
|
|
24
|
-
selection: d3.Selection<SVGGElement, unknown, HTMLElement, unknown>
|
|
25
|
-
destroy: () => void
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface ChartOptions<T extends ChartType> {
|
|
29
|
-
preset: Preset<T, unknown>
|
|
30
|
-
width: number | 'auto'
|
|
31
|
-
height: number | 'auto'
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface ChartOptionsPartial<T extends ChartType> {
|
|
35
|
-
preset?: Preset<T, unknown>
|
|
36
|
-
width?: number | 'auto'
|
|
37
|
-
height?: number | 'auto'
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface Preset<T extends ChartType, AllPluginParams> {
|
|
41
|
-
name: string
|
|
42
|
-
description: string
|
|
43
|
-
chartParams: ChartParams
|
|
44
|
-
dataFormatter: DataFormatterTypeMap<T>
|
|
45
|
-
allPluginParams: AllPluginParams
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface PresetPartial<T extends ChartType, AllPluginParams> {
|
|
49
|
-
name?: string
|
|
50
|
-
description?: string
|
|
51
|
-
chartParams?: ChartParamsPartial
|
|
52
|
-
dataFormatter?: DataFormatterPartialTypeMap<T>
|
|
53
|
-
allPluginParams?: AllPluginParams
|
|
54
|
-
}
|
package/src/types/ChartParams.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { Padding } from './Padding'
|
|
2
|
-
|
|
3
|
-
export interface ChartParams {
|
|
4
|
-
padding: Padding,
|
|
5
|
-
highlightTarget: HighlightTarget
|
|
6
|
-
highlightDefault: string | null
|
|
7
|
-
colorScheme: 'dark' | 'light'
|
|
8
|
-
colors: {
|
|
9
|
-
light: ColorScheme
|
|
10
|
-
dark: ColorScheme
|
|
11
|
-
}
|
|
12
|
-
styles: Styles
|
|
13
|
-
transitionDuration: number
|
|
14
|
-
transitionEase: string
|
|
15
|
-
// [key: string]: any
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type ChartParamsPartial = Partial<ChartParams | {
|
|
19
|
-
padding: Partial<Padding>,
|
|
20
|
-
colors: Partial<{
|
|
21
|
-
light: Partial<ColorScheme>
|
|
22
|
-
dark: Partial<ColorScheme>
|
|
23
|
-
}>
|
|
24
|
-
styles: Partial<Styles>
|
|
25
|
-
}>
|
|
26
|
-
|
|
27
|
-
function test (): ChartParamsPartial {
|
|
28
|
-
return {
|
|
29
|
-
colorScheme: 'dark',
|
|
30
|
-
padding: {
|
|
31
|
-
top: 10
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type HighlightTarget = 'series' | 'group' | 'category' | 'datum' | 'none'
|
|
37
|
-
|
|
38
|
-
export interface Styles {
|
|
39
|
-
textSize: string | number
|
|
40
|
-
unhighlightedOpacity: number
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface ColorScheme {
|
|
44
|
-
series: string[]
|
|
45
|
-
primary: string
|
|
46
|
-
secondary: string
|
|
47
|
-
white: string
|
|
48
|
-
background: string
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export type ColorType = 'none' | keyof ColorScheme
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { ChartType } from './Chart'
|
|
2
|
-
import type { ComputedDataSeries, ComputedDatumSeries } from './ComputedDataSeries'
|
|
3
|
-
import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
|
|
4
|
-
import type { ComputedDataMultiGrid } from './ComputedDataMultiGrid'
|
|
5
|
-
import type { ComputedDataMultiValue, ComputedDatumMultiValue } from './ComputedDataMultiValue'
|
|
6
|
-
import type { ComputedDataRelationship, ComputedNode } from './ComputedDataRelationship'
|
|
7
|
-
import type { ComputedDataTree } from './ComputedDataTree'
|
|
8
|
-
import type { DataFormatterContext } from './DataFormatter'
|
|
9
|
-
|
|
10
|
-
export interface ComputedDataFn<T extends ChartType> {
|
|
11
|
-
(dataFormatterContext: DataFormatterContext<T>): ComputedDataTypeMap<T>
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// datum - 基本型本
|
|
15
|
-
export interface ComputedDatumBase {
|
|
16
|
-
id: string
|
|
17
|
-
index: number
|
|
18
|
-
label: string
|
|
19
|
-
value: number | null
|
|
20
|
-
visible: boolean
|
|
21
|
-
description: string
|
|
22
|
-
data: any // 使用者注入的資料
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// datum - 單值
|
|
26
|
-
// export interface ComputedDatumValue {
|
|
27
|
-
// value: number | null
|
|
28
|
-
// // valueLabel: string
|
|
29
|
-
// }
|
|
30
|
-
|
|
31
|
-
// datum - 多值
|
|
32
|
-
// export interface ComputedDatumMultiValue {
|
|
33
|
-
// value: number[]
|
|
34
|
-
// valueLabels: string[]
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
// datum - 圖軸
|
|
38
|
-
// export interface ComputedDatumWithAxis {
|
|
39
|
-
// axisX: number
|
|
40
|
-
// axisY: number
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
// datum - 序列資料
|
|
44
|
-
export interface ComputedDatumSeriesValue {
|
|
45
|
-
color: string
|
|
46
|
-
seriesIndex: number
|
|
47
|
-
seriesLabel: string
|
|
48
|
-
seq: number
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// datum - 矩陣資料
|
|
52
|
-
export interface ComputedDatumGridValue {
|
|
53
|
-
gridIndex: number
|
|
54
|
-
color: string
|
|
55
|
-
seriesIndex: number
|
|
56
|
-
seriesLabel: string
|
|
57
|
-
groupIndex: number
|
|
58
|
-
groupLabel: string
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// datum - 類別資料
|
|
62
|
-
export interface ComputedDatumCategoryValue {
|
|
63
|
-
color: string
|
|
64
|
-
categoryIndex: number
|
|
65
|
-
categoryLabel: string | null
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// 透過類型選擇ComputedData
|
|
69
|
-
export type ComputedDataTypeMap<T extends ChartType> = T extends 'series' ? ComputedDataSeries
|
|
70
|
-
: T extends 'grid' ? ComputedDataGrid
|
|
71
|
-
: T extends 'multiGrid' ? ComputedDataMultiGrid
|
|
72
|
-
: T extends 'multiValue' ? ComputedDataMultiValue
|
|
73
|
-
: T extends 'relationship' ? ComputedDataRelationship
|
|
74
|
-
: T extends 'tree' ? ComputedDataTree
|
|
75
|
-
: ComputedDatumBase
|
|
76
|
-
|
|
77
|
-
// 透過類型選擇ComputedDatum
|
|
78
|
-
export type ComputedDatumTypeMap<T extends ChartType> = T extends 'series' ? ComputedDatumSeries
|
|
79
|
-
: T extends 'grid' ? ComputedDatumGrid
|
|
80
|
-
: T extends 'multiGrid' ? ComputedDatumGrid
|
|
81
|
-
: T extends 'multiValue' ? ComputedDatumMultiValue
|
|
82
|
-
: T extends 'relationship' ? ComputedNode
|
|
83
|
-
: T extends 'tree' ? ComputedDataTree
|
|
84
|
-
: unknown
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ComputedDatumBase, ComputedDatumGridValue } from './ComputedData'
|
|
2
|
-
|
|
3
|
-
export interface ComputedDatumGrid
|
|
4
|
-
extends ComputedDatumBase, ComputedDatumGridValue {
|
|
5
|
-
// accSeriesIndex: number // 每一個grid累加的seriesIndex
|
|
6
|
-
// gridIndex: number
|
|
7
|
-
// groupIndex: number
|
|
8
|
-
// groupLabel: string
|
|
9
|
-
// axisX: number
|
|
10
|
-
// axisY: number
|
|
11
|
-
// axisYFromZero: number
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type ComputedDataGrid = ComputedDatumGrid[][]
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
|
|
2
|
-
|
|
3
|
-
export type ComputedDataMultiValue = ComputedDatumMultiValue[][]
|
|
4
|
-
|
|
5
|
-
export interface ComputedDatumMultiValue extends ComputedDatumBase, ComputedDatumCategoryValue {
|
|
6
|
-
axis: number
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
|
|
2
|
-
|
|
3
|
-
export type ComputedDataRelationship = {
|
|
4
|
-
nodes: ComputedNode[]
|
|
5
|
-
edges: ComputedEdge[]
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface ComputedNode extends ComputedDatumBase, ComputedDatumCategoryValue {
|
|
9
|
-
startNodes: ComputedNode[]
|
|
10
|
-
startNodeIds: string[]
|
|
11
|
-
endNodes: ComputedNode[]
|
|
12
|
-
endNodeIds: string[]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ComputedEdge extends ComputedDatumBase {
|
|
16
|
-
startNode: ComputedNode
|
|
17
|
-
startNodeId: string
|
|
18
|
-
endNode: ComputedNode
|
|
19
|
-
endNodeId: string
|
|
20
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
|
|
2
|
-
|
|
3
|
-
// export type ComputedDataTree = ComputedDataTreeDatum[]
|
|
4
|
-
|
|
5
|
-
// export interface ComputedDataTreeDatum extends ComputedDatum {
|
|
6
|
-
// // id: string
|
|
7
|
-
// children: ComputedDataTreeDatum[]
|
|
8
|
-
// childrenIds: string[]
|
|
9
|
-
// // ChildrenMap: Map<string, ComputedDataTreeDatum>
|
|
10
|
-
// parent: ComputedDataTreeDatum
|
|
11
|
-
// parentId: string
|
|
12
|
-
// value?: number
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
|
-
// 樹狀結構
|
|
16
|
-
export interface ComputedDataTree extends ComputedDatumBase, ComputedDatumCategoryValue {
|
|
17
|
-
level: number
|
|
18
|
-
seq: number
|
|
19
|
-
children?: ComputedDataTree[]
|
|
20
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Observable, Subject, BehaviorSubject } from 'rxjs'
|
|
2
|
-
import type { ChartType } from './Chart'
|
|
3
|
-
import type { ChartParams } from './ChartParams'
|
|
4
|
-
import type { DataFormatterTypeMap } from './DataFormatter'
|
|
5
|
-
import type { ComputedDataTypeMap } from './ComputedData'
|
|
6
|
-
import type { Layout } from './Layout'
|
|
7
|
-
import type { ContextObserverGrid } from './ContextObserverGrid'
|
|
8
|
-
import type { ContextObserverMultiGrid } from './ContextObserverMultiGrid'
|
|
9
|
-
import type { ContextObserverMultiValue } from './ContextObserverMultiValue'
|
|
10
|
-
import type { ContextObserverRelationship } from './ContextObserverRelationship'
|
|
11
|
-
import type { ContextObserverSeries } from './ContextObserverSeries'
|
|
12
|
-
import type { ContextObserverTree } from './ContextObserverTree'
|
|
13
|
-
import type { 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
|
-
|
|
22
|
-
// ContextObserver
|
|
23
|
-
export type ContextObserverTypeMap<T extends ChartType, PluginParams> = T extends 'series' ? ContextObserverSeries<PluginParams>
|
|
24
|
-
: T extends 'grid' ? ContextObserverGrid<PluginParams>
|
|
25
|
-
: T extends 'multiGrid' ? ContextObserverMultiGrid<PluginParams>
|
|
26
|
-
: T extends 'multiValue' ? ContextObserverMultiValue<PluginParams>
|
|
27
|
-
: T extends 'relationship' ? ContextObserverRelationship<PluginParams>
|
|
28
|
-
: T extends 'tree' ? ContextObserverTree<PluginParams>
|
|
29
|
-
: ContextObserverBase<ChartType, PluginParams>
|
|
30
|
-
|
|
31
|
-
export interface ContextObserverBase<T extends ChartType, PluginParams> {
|
|
32
|
-
fullParams$: Observable<PluginParams>
|
|
33
|
-
fullChartParams$: Observable<ChartParams>
|
|
34
|
-
fullDataFormatter$: Observable<DataFormatterTypeMap<T>>
|
|
35
|
-
computedData$: Observable<ComputedDataTypeMap<T>>
|
|
36
|
-
layout$: Observable<Layout>
|
|
37
|
-
}
|
|
38
|
-
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs'
|
|
2
|
-
import type { ContextObserverBase } from './ContextObserver'
|
|
3
|
-
import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
|
|
4
|
-
import type { TransformData } from './TransformData'
|
|
5
|
-
|
|
6
|
-
export interface ContextObserverGrid<PluginParams> extends
|
|
7
|
-
ContextObserverBase<'grid', PluginParams>, ContextObserverGridDetail {
|
|
8
|
-
textSizePx$: Observable<number>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ContextObserverGridDetail {
|
|
12
|
-
isSeriesSeprate$: Observable<boolean>
|
|
13
|
-
gridContainerPosition$: Observable<GridContainerPosition[]>
|
|
14
|
-
gridAxesTransform$: Observable<TransformData>
|
|
15
|
-
gridAxesReverseTransform$: Observable<TransformData>
|
|
16
|
-
gridGraphicTransform$: Observable<TransformData>
|
|
17
|
-
gridGraphicReverseScale$: Observable<[number, number][]>
|
|
18
|
-
gridAxesSize$: Observable<{ width: number; height: number; }>
|
|
19
|
-
gridHighlight$: Observable<ComputedDatumGrid[]>
|
|
20
|
-
seriesLabels$: Observable<string[]>
|
|
21
|
-
SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
|
|
22
|
-
GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
|
|
23
|
-
computedLayoutData$: Observable<ComputedLayoutDataGrid>
|
|
24
|
-
visibleComputedData$: Observable<ComputedDataGrid>
|
|
25
|
-
visibleComputedLayoutData$: Observable<ComputedLayoutDataGrid>
|
|
26
|
-
computedStackedData$: Observable<ComputedDataGrid>
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type ComputedLayoutDataGrid = ComputedLayoutDatumGrid[][]
|
|
30
|
-
|
|
31
|
-
export interface ComputedLayoutDatumGrid extends ComputedDatumGrid {
|
|
32
|
-
axisX: number
|
|
33
|
-
axisY: number
|
|
34
|
-
axisYFromZero: number
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface GridContainerPosition {
|
|
38
|
-
slotIndex: number
|
|
39
|
-
rowIndex: number
|
|
40
|
-
columnIndex: number
|
|
41
|
-
translate: [number, number]
|
|
42
|
-
scale: [number, number]
|
|
43
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs'
|
|
2
|
-
import type { ContextObserverBase } from './ContextObserver'
|
|
3
|
-
import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
|
|
4
|
-
import type { DataFormatterGrid } from './DataFormatterGrid'
|
|
5
|
-
import type { GridContainerPosition, ContextObserverGridDetail } from './ContextObserverGrid'
|
|
6
|
-
|
|
7
|
-
export interface ContextObserverMultiGrid<PluginParams> extends ContextObserverBase<'multiGrid', PluginParams> {
|
|
8
|
-
textSizePx$: Observable<number>
|
|
9
|
-
multiGridContainerPosition$: Observable<GridContainerPosition[][]>
|
|
10
|
-
multiGridEachDetail$: Observable<ContextObserverMultiGridDetail[]>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export interface ContextObserverMultiGridDetail extends ContextObserverGridDetail {
|
|
15
|
-
computedData$: Observable<ComputedDataGrid>
|
|
16
|
-
dataFormatter$: Observable<DataFormatterGrid>
|
|
17
|
-
}
|