@orbcharts/core 3.0.7 → 4.0.0-pre-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/orbcharts-core.es.js +2795 -6591
- package/dist/orbcharts-core.umd.js +6 -6
- package/dist/src/OrbCharts.d.ts +18 -0
- package/dist/src/chart/createChart.d.ts +3 -0
- package/dist/src/chart/createGraphData.d.ts +3 -0
- package/dist/src/chart/createGridData.d.ts +3 -0
- package/dist/src/chart/createMultivariateData.d.ts +3 -0
- package/dist/src/chart/createSeriesData.d.ts +3 -0
- package/dist/src/chart/createTreeData.d.ts +3 -0
- package/dist/src/chart/defaults.d.ts +5 -0
- package/dist/src/defineCanvasLayer.d.ts +16 -0
- package/dist/src/defineCanvasPlugin.d.ts +22 -0
- package/dist/src/defineSVGLayer.d.ts +16 -0
- package/dist/src/defineSVGPlugin.d.ts +22 -0
- package/dist/src/index.d.ts +6 -14
- package/dist/src/layer/createLayer.d.ts +3 -0
- package/dist/src/plugin/createPlugin.d.ts +3 -0
- package/dist/src/test/createGraphData.test.d.ts +1 -0
- package/dist/src/test/createTreeData.test.d.ts +1 -0
- package/dist/src/test/simple-graph-test.d.ts +74 -0
- package/dist/src/test/simple-tree-test.d.ts +13 -0
- package/dist/src/types/Chart.d.ts +39 -0
- package/dist/src/types/ChartContext.d.ts +27 -0
- package/dist/src/types/Common.d.ts +3 -0
- package/dist/src/types/Encoding.d.ts +33 -0
- package/dist/src/types/Event.d.ts +12 -0
- package/dist/src/types/Layers.d.ts +55 -0
- package/dist/src/types/ModelData.d.ts +70 -0
- package/dist/src/types/Plugin.d.ts +39 -0
- package/dist/src/types/RawData.d.ts +18 -0
- package/dist/src/types/RenderData.d.ts +4 -0
- package/dist/src/types/Theme.d.ts +17 -0
- package/dist/src/types/Validator.d.ts +20 -0
- package/dist/src/types/index.d.ts +12 -0
- package/dist/src/utils/aggregateUtils.d.ts +37 -0
- package/dist/src/utils/colorUtils.d.ts +22 -0
- package/dist/src/utils/commonUtils.d.ts +3 -5
- package/dist/src/utils/dom-lifecycle.d.ts +37 -0
- package/dist/src/utils/dom.d.ts +6 -0
- package/dist/src/utils/index.d.ts +5 -1
- package/dist/src/utils/observables.d.ts +1 -25
- package/dist/src/utils/orbchartsUtils.d.ts +2 -53
- package/dist/src/utils/validator.d.ts +2 -2
- package/dist/test/aggregateTest.d.ts +1 -0
- package/package.json +21 -8
- package/src/OrbCharts.ts +35 -0
- package/src/chart/createChart.ts +997 -0
- package/src/chart/createGraphData.ts +391 -0
- package/src/chart/createGridData.ts +247 -0
- package/src/chart/createMultivariateData.ts +181 -0
- package/src/chart/createSeriesData.ts +297 -0
- package/src/chart/createTreeData.ts +344 -0
- package/src/chart/defaults.ts +100 -0
- package/src/defineCanvasLayer.ts +24 -0
- package/src/defineCanvasPlugin.ts +39 -0
- package/src/defineSVGLayer.ts +24 -0
- package/src/defineSVGPlugin.ts +39 -0
- package/src/index.ts +6 -18
- package/src/layer/createLayer.ts +138 -0
- package/src/plugin/createPlugin.ts +470 -0
- package/src/test/createGraphData.test.ts +103 -0
- package/src/test/createTreeData.test.ts +97 -0
- package/src/test/simple-graph-test.js +51 -0
- package/src/test/simple-tree-test.js +58 -0
- package/src/types/Chart.ts +62 -0
- package/src/types/ChartContext.ts +42 -0
- package/src/types/Common.ts +5 -0
- package/src/types/Encoding.ts +43 -0
- package/src/types/Event.ts +26 -0
- package/src/types/Layers.ts +93 -0
- package/src/types/ModelData.ts +95 -0
- package/src/types/Plugin.ts +98 -0
- package/src/types/RawData.ts +67 -0
- package/src/types/RenderData.ts +16 -0
- package/src/types/Theme.ts +21 -0
- package/src/types/Validator.ts +36 -0
- package/src/types/index.ts +12 -0
- package/src/utils/aggregateUtils.ts +99 -0
- package/src/utils/colorUtils.ts +63 -0
- package/src/utils/commonUtils.ts +12 -11
- package/src/utils/dom-lifecycle.ts +164 -0
- package/src/utils/dom.ts +55 -0
- package/src/utils/index.ts +6 -2
- package/src/utils/observables.ts +1 -292
- package/src/utils/orbchartsUtils.ts +6 -393
- package/src/utils/validator.ts +15 -14
- package/dist/lib/core-types.d.ts +0 -1
- package/dist/src/AbstractChart.d.ts +0 -19
- package/dist/src/GridChart.d.ts +0 -6
- package/dist/src/MultiGridChart.d.ts +0 -6
- package/dist/src/MultiValueChart.d.ts +0 -6
- package/dist/src/RelationshipChart.d.ts +0 -6
- package/dist/src/SeriesChart.d.ts +0 -6
- package/dist/src/TreeChart.d.ts +0 -6
- package/dist/src/base/createBaseChart.d.ts +0 -3
- package/dist/src/base/createBasePlugin.d.ts +0 -3
- package/dist/src/base/validators/chartOptionsValidator.d.ts +0 -3
- package/dist/src/base/validators/chartParamsValidator.d.ts +0 -3
- package/dist/src/base/validators/elementValidator.d.ts +0 -3
- package/dist/src/base/validators/pluginsValidator.d.ts +0 -3
- package/dist/src/defaults.d.ts +0 -25
- package/dist/src/defineGridPlugin.d.ts +0 -1
- package/dist/src/defineMultiGridPlugin.d.ts +0 -1
- package/dist/src/defineMultiValuePlugin.d.ts +0 -1
- package/dist/src/defineNoneDataPlugin.d.ts +0 -1
- package/dist/src/defineRelationshipPlugin.d.ts +0 -1
- package/dist/src/defineSeriesPlugin.d.ts +0 -1
- package/dist/src/defineTreePlugin.d.ts +0 -1
- package/dist/src/grid/computedDataFn.d.ts +0 -4
- package/dist/src/grid/contextObserverCallback.d.ts +0 -3
- package/dist/src/grid/dataFormatterValidator.d.ts +0 -3
- package/dist/src/grid/dataValidator.d.ts +0 -3
- package/dist/src/grid/gridObservables.d.ts +0 -64
- package/dist/src/multiGrid/computedDataFn.d.ts +0 -3
- package/dist/src/multiGrid/contextObserverCallback.d.ts +0 -3
- package/dist/src/multiGrid/dataFormatterValidator.d.ts +0 -3
- package/dist/src/multiGrid/dataValidator.d.ts +0 -3
- package/dist/src/multiGrid/multiGridObservables.d.ts +0 -16
- package/dist/src/multiValue/computedDataFn.d.ts +0 -3
- package/dist/src/multiValue/contextObserverCallback.d.ts +0 -3
- package/dist/src/multiValue/dataFormatterValidator.d.ts +0 -3
- package/dist/src/multiValue/dataValidator.d.ts +0 -3
- package/dist/src/multiValue/multiValueObservables.d.ts +0 -130
- package/dist/src/relationship/computedDataFn.d.ts +0 -3
- package/dist/src/relationship/contextObserverCallback.d.ts +0 -3
- package/dist/src/relationship/dataFormatterValidator.d.ts +0 -3
- package/dist/src/relationship/dataValidator.d.ts +0 -3
- package/dist/src/relationship/relationshipObservables.d.ts +0 -13
- package/dist/src/series/computedDataFn.d.ts +0 -3
- package/dist/src/series/contextObserverCallback.d.ts +0 -3
- package/dist/src/series/dataFormatterValidator.d.ts +0 -3
- package/dist/src/series/dataValidator.d.ts +0 -3
- package/dist/src/series/seriesObservables.d.ts +0 -37
- package/dist/src/tree/computedDataFn.d.ts +0 -3
- package/dist/src/tree/contextObserverCallback.d.ts +0 -3
- package/dist/src/tree/dataFormatterValidator.d.ts +0 -3
- package/dist/src/tree/dataValidator.d.ts +0 -3
- package/dist/src/tree/treeObservables.d.ts +0 -10
- package/dist/src/utils/d3Scale.d.ts +0 -28
- package/lib/core-types.ts +0 -7
- package/src/AbstractChart.ts +0 -57
- package/src/GridChart.ts +0 -25
- package/src/MultiGridChart.ts +0 -25
- package/src/MultiValueChart.ts +0 -25
- package/src/RelationshipChart.ts +0 -25
- package/src/SeriesChart.ts +0 -25
- package/src/TreeChart.ts +0 -25
- package/src/base/createBaseChart.ts +0 -524
- package/src/base/createBasePlugin.ts +0 -154
- package/src/base/validators/chartOptionsValidator.ts +0 -24
- package/src/base/validators/chartParamsValidator.ts +0 -134
- package/src/base/validators/elementValidator.ts +0 -14
- package/src/base/validators/pluginsValidator.ts +0 -15
- package/src/defaults.ts +0 -284
- package/src/defineGridPlugin.ts +0 -3
- package/src/defineMultiGridPlugin.ts +0 -3
- package/src/defineMultiValuePlugin.ts +0 -3
- package/src/defineNoneDataPlugin.ts +0 -4
- package/src/defineRelationshipPlugin.ts +0 -3
- package/src/defineSeriesPlugin.ts +0 -3
- package/src/defineTreePlugin.ts +0 -3
- package/src/grid/computedDataFn.ts +0 -129
- package/src/grid/contextObserverCallback.ts +0 -209
- package/src/grid/dataFormatterValidator.ts +0 -126
- package/src/grid/dataValidator.ts +0 -13
- package/src/grid/gridObservables.ts +0 -699
- package/src/multiGrid/computedDataFn.ts +0 -123
- package/src/multiGrid/contextObserverCallback.ts +0 -109
- package/src/multiGrid/dataFormatterValidator.ts +0 -121
- package/src/multiGrid/dataValidator.ts +0 -13
- package/src/multiGrid/multiGridObservables.ts +0 -367
- package/src/multiValue/computedDataFn.ts +0 -113
- package/src/multiValue/contextObserverCallback.ts +0 -328
- package/src/multiValue/dataFormatterValidator.ts +0 -95
- package/src/multiValue/dataValidator.ts +0 -13
- package/src/multiValue/multiValueObservables.ts +0 -865
- package/src/relationship/computedDataFn.ts +0 -159
- package/src/relationship/contextObserverCallback.ts +0 -80
- package/src/relationship/dataFormatterValidator.ts +0 -14
- package/src/relationship/dataValidator.ts +0 -14
- package/src/relationship/relationshipObservables.ts +0 -85
- package/src/series/computedDataFn.ts +0 -88
- package/src/series/contextObserverCallback.ts +0 -132
- package/src/series/dataFormatterValidator.ts +0 -47
- package/src/series/dataValidator.ts +0 -13
- package/src/series/seriesObservables.ts +0 -210
- package/src/tree/computedDataFn.ts +0 -129
- package/src/tree/contextObserverCallback.ts +0 -58
- package/src/tree/dataFormatterValidator.ts +0 -14
- package/src/tree/dataValidator.ts +0 -14
- package/src/tree/treeObservables.ts +0 -106
- package/src/utils/d3Scale.ts +0 -198
- package/tsconfig.base.json +0 -14
- package/tsconfig.json +0 -3
- package/vite-env.d.ts +0 -7
- package/vite.config.js +0 -23
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DefineLayerConfig, ExtendableContext, LayerEnableProps } from './types';
|
|
2
|
+
|
|
3
|
+
export declare const defineCanvasLayer: <ExtendContext extends ExtendableContext, PluginParams extends Record<string, any>, LayerParams extends Record<string, any>>(config: DefineLayerConfig<"canvas", ExtendContext, PluginParams, LayerParams>) => {
|
|
4
|
+
new (): {
|
|
5
|
+
_name: string;
|
|
6
|
+
_defaultParams: LayerParams;
|
|
7
|
+
_layerIndex: number;
|
|
8
|
+
_initShow: boolean;
|
|
9
|
+
_enable: (enableProps: LayerEnableProps<"canvas", ExtendContext, PluginParams, LayerParams>) => void;
|
|
10
|
+
_disable: () => void;
|
|
11
|
+
_updateParams: (params: Partial<LayerParams>) => void;
|
|
12
|
+
_forceReplaceParams: (params: LayerParams) => void;
|
|
13
|
+
_getParams: () => Readonly<LayerParams>;
|
|
14
|
+
_destroy: () => void;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DeepPartial, DefinePluginConfig, ChartContext, ExtendableContext } from './types';
|
|
2
|
+
|
|
3
|
+
export declare const defineCanvasPlugin: <ExtendContext extends ExtendableContext, PluginParams extends Record<string, any>, AllLayerParams extends Record<string, any>>(config: DefinePluginConfig<ExtendContext, PluginParams, AllLayerParams>) => {
|
|
4
|
+
new (params?: DeepPartial<PluginParams | AllLayerParams>): {
|
|
5
|
+
_name: string;
|
|
6
|
+
_elementType: "canvas";
|
|
7
|
+
_getId: () => string;
|
|
8
|
+
_setId: (id: string) => void;
|
|
9
|
+
_injectContext: (context: ChartContext<{}>) => void;
|
|
10
|
+
show: (names: (keyof AllLayerParams) | (keyof AllLayerParams)[]) => void;
|
|
11
|
+
showOnly: (names: (keyof AllLayerParams) | (keyof AllLayerParams)[]) => void;
|
|
12
|
+
showAll: () => void;
|
|
13
|
+
hide: (names: (keyof AllLayerParams) | (keyof AllLayerParams)[]) => void;
|
|
14
|
+
hideAll: () => void;
|
|
15
|
+
toggle: (names: (keyof AllLayerParams) | (keyof AllLayerParams)[]) => void;
|
|
16
|
+
getShownLayerNames: () => (keyof AllLayerParams)[];
|
|
17
|
+
updateParams: (patch: DeepPartial<PluginParams | AllLayerParams>) => void;
|
|
18
|
+
forceReplaceParams: (full: PluginParams | AllLayerParams) => void;
|
|
19
|
+
getParams: () => Readonly<PluginParams | AllLayerParams>;
|
|
20
|
+
destroy: () => void;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DefineLayerConfig, ExtendableContext, LayerEnableProps } from './types';
|
|
2
|
+
|
|
3
|
+
export declare const defineSVGLayer: <ExtendContext extends ExtendableContext, PluginParams extends Record<string, any>, LayerParams extends Record<string, any>>(config: DefineLayerConfig<"svg", ExtendContext, PluginParams, LayerParams>) => {
|
|
4
|
+
new (): {
|
|
5
|
+
_name: string;
|
|
6
|
+
_defaultParams: LayerParams;
|
|
7
|
+
_layerIndex: number;
|
|
8
|
+
_initShow: boolean;
|
|
9
|
+
_enable: (enableProps: LayerEnableProps<"svg", ExtendContext, PluginParams, LayerParams>) => void;
|
|
10
|
+
_disable: () => void;
|
|
11
|
+
_updateParams: (params: Partial<LayerParams>) => void;
|
|
12
|
+
_forceReplaceParams: (params: LayerParams) => void;
|
|
13
|
+
_getParams: () => Readonly<LayerParams>;
|
|
14
|
+
_destroy: () => void;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DeepPartial, DefinePluginConfig, ChartContext, ExtendableContext } from './types';
|
|
2
|
+
|
|
3
|
+
export declare const defineSVGPlugin: <ExtendContext extends ExtendableContext, PluginParams extends Record<string, any>, AllLayerParams extends Record<string, any>>(config: DefinePluginConfig<ExtendContext, PluginParams, AllLayerParams>) => {
|
|
4
|
+
new (params?: DeepPartial<PluginParams | AllLayerParams>): {
|
|
5
|
+
_name: string;
|
|
6
|
+
_elementType: "svg";
|
|
7
|
+
_getId: () => string;
|
|
8
|
+
_setId: (id: string) => void;
|
|
9
|
+
_injectContext: (context: ChartContext<{}>) => void;
|
|
10
|
+
show: (names: (keyof AllLayerParams) | (keyof AllLayerParams)[]) => void;
|
|
11
|
+
showOnly: (names: (keyof AllLayerParams) | (keyof AllLayerParams)[]) => void;
|
|
12
|
+
showAll: () => void;
|
|
13
|
+
hide: (names: (keyof AllLayerParams) | (keyof AllLayerParams)[]) => void;
|
|
14
|
+
hideAll: () => void;
|
|
15
|
+
toggle: (names: (keyof AllLayerParams) | (keyof AllLayerParams)[]) => void;
|
|
16
|
+
getShownLayerNames: () => (keyof AllLayerParams)[];
|
|
17
|
+
updateParams: (patch: DeepPartial<PluginParams | AllLayerParams>) => void;
|
|
18
|
+
forceReplaceParams: (full: PluginParams | AllLayerParams) => void;
|
|
19
|
+
getParams: () => Readonly<PluginParams | AllLayerParams>;
|
|
20
|
+
destroy: () => void;
|
|
21
|
+
};
|
|
22
|
+
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
7
|
-
export { defineSeriesPlugin } from './defineSeriesPlugin';
|
|
8
|
-
export { defineGridPlugin } from './defineGridPlugin';
|
|
9
|
-
export { defineMultiGridPlugin } from './defineMultiGridPlugin';
|
|
10
|
-
export { defineMultiValuePlugin } from './defineMultiValuePlugin';
|
|
11
|
-
export { defineNoneDataPlugin } from './defineNoneDataPlugin';
|
|
12
|
-
export { defineRelationshipPlugin } from './defineRelationshipPlugin';
|
|
13
|
-
export { defineTreePlugin } from './defineTreePlugin';
|
|
1
|
+
export { OrbCharts } from './OrbCharts';
|
|
2
|
+
export { defineSVGPlugin } from './defineSVGPlugin';
|
|
3
|
+
export { defineSVGLayer } from './defineSVGLayer';
|
|
4
|
+
export { defineCanvasPlugin } from './defineCanvasPlugin';
|
|
5
|
+
export { defineCanvasLayer } from './defineCanvasLayer';
|
|
6
|
+
export * from './types';
|
|
14
7
|
export * from './utils';
|
|
15
|
-
export * from './defaults';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DefineLayerConfig, LayerEntity, ExtendableContext } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare const createLayer: <ExtendContext extends ExtendableContext, PluginParams extends Record<string, any>, LayerParams extends Record<string, any>>(elementType: "canvas" | "svg", config: DefineLayerConfig<"svg" | "canvas", ExtendContext, PluginParams, LayerParams>) => LayerEntity<ExtendContext, PluginParams, LayerParams>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DeepPartial, DefinePluginConfig, ExtendableContext, PluginEntity } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare const createPlugin: <ElementType extends "svg" | "canvas", ExtendContext extends ExtendableContext, PluginParams, AllLayerParams>(elementType: ElementType, config: DefinePluginConfig<ExtendContext, PluginParams, AllLayerParams>, initPluginParams?: DeepPartial<PluginParams | AllLayerParams>) => PluginEntity<ElementType, PluginParams, AllLayerParams>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
declare const testRawData: ({
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
dataset: string;
|
|
5
|
+
series: string;
|
|
6
|
+
category: string;
|
|
7
|
+
value: number;
|
|
8
|
+
source?: undefined;
|
|
9
|
+
target?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
source: string;
|
|
14
|
+
target: string;
|
|
15
|
+
dataset: string;
|
|
16
|
+
series: string;
|
|
17
|
+
category: string;
|
|
18
|
+
value: number;
|
|
19
|
+
})[];
|
|
20
|
+
declare namespace testEncoding {
|
|
21
|
+
namespace dataset {
|
|
22
|
+
let from: string;
|
|
23
|
+
let sort: string;
|
|
24
|
+
}
|
|
25
|
+
namespace series {
|
|
26
|
+
let from_1: string;
|
|
27
|
+
export { from_1 as from };
|
|
28
|
+
let sort_1: string;
|
|
29
|
+
export { sort_1 as sort };
|
|
30
|
+
}
|
|
31
|
+
namespace category {
|
|
32
|
+
let from_2: string;
|
|
33
|
+
export { from_2 as from };
|
|
34
|
+
let sort_2: string;
|
|
35
|
+
export { sort_2 as sort };
|
|
36
|
+
}
|
|
37
|
+
namespace value {
|
|
38
|
+
let from_3: string;
|
|
39
|
+
export { from_3 as from };
|
|
40
|
+
let sort_3: string;
|
|
41
|
+
export { sort_3 as sort };
|
|
42
|
+
export let aggregate: string;
|
|
43
|
+
}
|
|
44
|
+
let multivariate: any[];
|
|
45
|
+
namespace color {
|
|
46
|
+
let from_4: string;
|
|
47
|
+
export { from_4 as from };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
declare namespace testTheme {
|
|
51
|
+
let colorScheme: string;
|
|
52
|
+
namespace colors {
|
|
53
|
+
namespace light {
|
|
54
|
+
let data: string[];
|
|
55
|
+
let primary: string;
|
|
56
|
+
let secondary: string;
|
|
57
|
+
let dataContrast: string[];
|
|
58
|
+
let background: string;
|
|
59
|
+
}
|
|
60
|
+
namespace dark {
|
|
61
|
+
let data_1: string[];
|
|
62
|
+
export { data_1 as data };
|
|
63
|
+
let primary_1: string;
|
|
64
|
+
export { primary_1 as primary };
|
|
65
|
+
let secondary_1: string;
|
|
66
|
+
export { secondary_1 as secondary };
|
|
67
|
+
let dataContrast_1: string[];
|
|
68
|
+
export { dataContrast_1 as dataContrast };
|
|
69
|
+
let background_1: string;
|
|
70
|
+
export { background_1 as background };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
let fontSize: number;
|
|
74
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare function printTree(node: any, depth?: number): void;
|
|
2
|
+
declare const testRawData: {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
parent: string;
|
|
6
|
+
dataset: string;
|
|
7
|
+
series: string;
|
|
8
|
+
category: string;
|
|
9
|
+
value: number;
|
|
10
|
+
}[];
|
|
11
|
+
declare const nodeMap: Map<any, any>;
|
|
12
|
+
declare const rootNodes: any[];
|
|
13
|
+
declare const childrenMap: Map<any, any>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DeepPartial, ChartContext, Encoding, PluginEntity, RawData, Theme } from './index';
|
|
2
|
+
|
|
3
|
+
export interface SizeConfig {
|
|
4
|
+
width: number | 'auto';
|
|
5
|
+
height: number | 'auto';
|
|
6
|
+
resizeDebounce: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ChartOptions {
|
|
9
|
+
size: SizeConfig;
|
|
10
|
+
theme: Theme;
|
|
11
|
+
data: RawData;
|
|
12
|
+
encoding: Encoding;
|
|
13
|
+
plugins: PluginEntity<any, any, any>[];
|
|
14
|
+
}
|
|
15
|
+
export interface PartialChartOptions {
|
|
16
|
+
size?: Partial<SizeConfig>;
|
|
17
|
+
theme?: DeepPartial<Theme>;
|
|
18
|
+
data?: RawData;
|
|
19
|
+
encoding?: DeepPartial<Encoding>;
|
|
20
|
+
plugins?: PluginEntity<any, any, any>[];
|
|
21
|
+
}
|
|
22
|
+
export interface CreateChart {
|
|
23
|
+
(element: HTMLElement | Element, options?: PartialChartOptions): ChartEntity;
|
|
24
|
+
}
|
|
25
|
+
export interface ChartEntity {
|
|
26
|
+
resize(sizeConfig: SizeConfig): void;
|
|
27
|
+
setData(data: RawData): void;
|
|
28
|
+
updateEncoding(patch: DeepPartial<Encoding>): void;
|
|
29
|
+
forceReplaceEncoding(full: Encoding): void;
|
|
30
|
+
getEncoding(): Readonly<Encoding>;
|
|
31
|
+
setPlugins(plugins: PluginEntity<any, any, any>[]): void;
|
|
32
|
+
addPlugin(plugin: PluginEntity<any, any, any>): void;
|
|
33
|
+
removePlugin(id: string): void;
|
|
34
|
+
updateTheme(patch: DeepPartial<Theme>): void;
|
|
35
|
+
forceReplaceTheme(full: Theme): void;
|
|
36
|
+
getTheme(): Readonly<Theme>;
|
|
37
|
+
destroy(): void;
|
|
38
|
+
context: ChartContext<{}>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Observable, Subject } from 'rxjs';
|
|
2
|
+
import { Encoding, ModelData, PluginInfo, Theme, EventData, LayerInfo } from './index';
|
|
3
|
+
|
|
4
|
+
export interface Size {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ExtendableContext {
|
|
9
|
+
[key: string]: Observable<any> | Subject<any> | Function | any;
|
|
10
|
+
}
|
|
11
|
+
export type ChartContext<ExtendContext extends ExtendableContext> = {
|
|
12
|
+
root: HTMLElement | Element;
|
|
13
|
+
svg: SVGElement | null;
|
|
14
|
+
canvas: HTMLCanvasElement | null;
|
|
15
|
+
encoding$: Observable<Encoding>;
|
|
16
|
+
seriesData$: Observable<ModelData<'series'>[]>;
|
|
17
|
+
gridData$: Observable<ModelData<'grid'>[]>;
|
|
18
|
+
multivariateData$: Observable<ModelData<'multivariate'>[]>;
|
|
19
|
+
graphData$: Observable<ModelData<'graph'>[]>;
|
|
20
|
+
treeData$: Observable<ModelData<'tree'>[]>;
|
|
21
|
+
plugins$: Observable<readonly PluginInfo[]>;
|
|
22
|
+
theme$: Observable<Theme>;
|
|
23
|
+
event$: Observable<EventData>;
|
|
24
|
+
eventTrigger$: Subject<EventData>;
|
|
25
|
+
size$: Observable<Size>;
|
|
26
|
+
_updateLayerElements: <ElementType extends "svg" | "canvas">(elementType: ElementType, fromPluginName: string, fetchLayerInfo: LayerInfo[]) => Record<string, ElementType extends "svg" ? SVGGElement : HTMLCanvasElement>;
|
|
27
|
+
} & ExtendContext;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface EncodingDataset {
|
|
2
|
+
from: string;
|
|
3
|
+
sort: 'original' | 'alphabetical' | string[];
|
|
4
|
+
}
|
|
5
|
+
export interface EncodingSeries {
|
|
6
|
+
from: string;
|
|
7
|
+
sort: 'original' | 'alphabetical' | string[];
|
|
8
|
+
}
|
|
9
|
+
export interface EncodingCategory {
|
|
10
|
+
from: string;
|
|
11
|
+
sort: 'original' | 'alphabetical' | string[];
|
|
12
|
+
}
|
|
13
|
+
export interface EncodingValue {
|
|
14
|
+
from: string;
|
|
15
|
+
sort: 'original' | 'asc' | 'desc';
|
|
16
|
+
aggregate: 'sum' | 'mean' | 'median' | 'min' | 'max' | 'count' | 'none';
|
|
17
|
+
}
|
|
18
|
+
export interface EncodingMultivariateItem {
|
|
19
|
+
from: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}
|
|
22
|
+
export type EncodingMultivariate = EncodingMultivariateItem[];
|
|
23
|
+
export interface EncodingColor {
|
|
24
|
+
from: 'index' | 'series' | 'category' | 'dataset';
|
|
25
|
+
}
|
|
26
|
+
export interface Encoding {
|
|
27
|
+
dataset: EncodingDataset;
|
|
28
|
+
series: EncodingSeries;
|
|
29
|
+
category: EncodingCategory;
|
|
30
|
+
value: EncodingValue;
|
|
31
|
+
multivariate: EncodingMultivariate;
|
|
32
|
+
color: EncodingColor;
|
|
33
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ModelType, RenderDatumBase } from '../../../core/src/types/index';
|
|
2
|
+
|
|
3
|
+
export type EventType = 'click' | 'mouseover' | 'mousemove' | 'mouseout' | 'dragstart' | 'drag' | 'dragend' | 'zoom' | 'transitionMove' | 'transitionEnd';
|
|
4
|
+
export interface EventData<T extends ModelType = ModelType, ExtendTypes extends Record<string, any> = {}> {
|
|
5
|
+
eventName: EventType;
|
|
6
|
+
pluginName: string;
|
|
7
|
+
layerName: string;
|
|
8
|
+
target: RenderDatumBase<T, ExtendTypes> | null;
|
|
9
|
+
data?: any;
|
|
10
|
+
tween?: number;
|
|
11
|
+
event?: Event;
|
|
12
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DeepPartial, ChartContext, ExtendableContext, ValidatorResult } from './index';
|
|
3
|
+
|
|
4
|
+
export interface LayerInfo {
|
|
5
|
+
pluginId: string;
|
|
6
|
+
pluginName: string;
|
|
7
|
+
layerName: string;
|
|
8
|
+
layerIndex: number;
|
|
9
|
+
}
|
|
10
|
+
export interface SVGLayerEnableProps<ExtendContext extends ExtendableContext, PluginParams, LayerParams> {
|
|
11
|
+
context: ChartContext<ExtendContext>;
|
|
12
|
+
svgG: SVGGElement;
|
|
13
|
+
pluginParams$: Observable<PluginParams>;
|
|
14
|
+
initLayerParams: DeepPartial<LayerParams>;
|
|
15
|
+
}
|
|
16
|
+
export interface CanvasLayerEnableProps<ExtendContext extends ExtendableContext, PluginParams, LayerParams> {
|
|
17
|
+
context: ChartContext<ExtendContext>;
|
|
18
|
+
canvas: HTMLCanvasElement;
|
|
19
|
+
pluginParams$: Observable<PluginParams>;
|
|
20
|
+
initLayerParams: DeepPartial<LayerParams>;
|
|
21
|
+
}
|
|
22
|
+
export type LayerEnableProps<ElementType extends 'svg' | 'canvas', ExtendContext extends ExtendableContext, PluginParams, LayerParams> = ElementType extends 'svg' ? SVGLayerEnableProps<ExtendContext, PluginParams, LayerParams> : ElementType extends 'canvas' ? CanvasLayerEnableProps<ExtendContext, PluginParams, LayerParams> : never;
|
|
23
|
+
export interface SVGLayerSetupProps<ExtendContext extends ExtendableContext, PluginParams, LayerParams> {
|
|
24
|
+
context: ChartContext<ExtendContext>;
|
|
25
|
+
svgG: SVGGElement;
|
|
26
|
+
pluginParams$: Observable<PluginParams>;
|
|
27
|
+
layerParams$: Observable<LayerParams>;
|
|
28
|
+
}
|
|
29
|
+
export interface CanvasLayerSetupProps<ExtendContext extends ExtendableContext, PluginParams, LayerParams> {
|
|
30
|
+
context: ChartContext<ExtendContext>;
|
|
31
|
+
canvas: HTMLCanvasElement;
|
|
32
|
+
pluginParams$: Observable<PluginParams>;
|
|
33
|
+
layerParams$: Observable<LayerParams>;
|
|
34
|
+
}
|
|
35
|
+
export type LayerSetupProps<ElementType extends 'svg' | 'canvas', ExtendContext extends ExtendableContext, PluginParams, LayerParams> = ElementType extends 'svg' ? SVGLayerSetupProps<ExtendContext, PluginParams, LayerParams> : ElementType extends 'canvas' ? CanvasLayerSetupProps<ExtendContext, PluginParams, LayerParams> : never;
|
|
36
|
+
export interface DefineLayerConfig<ElementType extends 'svg' | 'canvas', ExtendContext extends ExtendableContext, PluginParams extends Record<string, any>, LayerParams extends Record<string, any>> {
|
|
37
|
+
name: string;
|
|
38
|
+
defaultParams: LayerParams;
|
|
39
|
+
layerIndex: number;
|
|
40
|
+
initShow: boolean;
|
|
41
|
+
validator?: (params: DeepPartial<LayerParams>) => ValidatorResult;
|
|
42
|
+
setup: (setupProps: LayerSetupProps<ElementType, ExtendContext, PluginParams, LayerParams>) => () => void;
|
|
43
|
+
}
|
|
44
|
+
export interface LayerEntity<ExtendContext extends ExtendableContext, PluginParams, LayerParams> {
|
|
45
|
+
readonly _name: string;
|
|
46
|
+
readonly _defaultParams: LayerParams;
|
|
47
|
+
readonly _layerIndex: number;
|
|
48
|
+
readonly _initShow: boolean;
|
|
49
|
+
_enable(enableProps: LayerEnableProps<'svg' | 'canvas', ExtendContext, PluginParams, LayerParams>): void;
|
|
50
|
+
_disable(): void;
|
|
51
|
+
_updateParams(params: DeepPartial<LayerParams>): void;
|
|
52
|
+
_forceReplaceParams(params: LayerParams): void;
|
|
53
|
+
_getParams: () => LayerParams;
|
|
54
|
+
_destroy(): void;
|
|
55
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export type ModelType = 'series' | 'grid' | 'multivariate' | 'graph' | 'tree';
|
|
2
|
+
export interface ModelDatumBase {
|
|
3
|
+
id: string;
|
|
4
|
+
index: number;
|
|
5
|
+
modelType: ModelType;
|
|
6
|
+
name: string;
|
|
7
|
+
data: any;
|
|
8
|
+
value: number | null;
|
|
9
|
+
color: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ModelDatumSeries extends ModelDatumBase {
|
|
12
|
+
series: string;
|
|
13
|
+
seriesIndex: number;
|
|
14
|
+
category: string;
|
|
15
|
+
categoryIndex: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ModelDatumGrid extends ModelDatumBase {
|
|
18
|
+
series: string;
|
|
19
|
+
seriesIndex: number;
|
|
20
|
+
category: string;
|
|
21
|
+
categoryIndex: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ModelDatumMultivariate extends ModelDatumBase {
|
|
24
|
+
series: string;
|
|
25
|
+
seriesIndex: number;
|
|
26
|
+
category: string;
|
|
27
|
+
categoryIndex: number;
|
|
28
|
+
multivariate: Array<{
|
|
29
|
+
index: number;
|
|
30
|
+
name: string;
|
|
31
|
+
value: number | null;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
export interface ModelDatumGraphNode extends ModelDatumBase {
|
|
35
|
+
series: string;
|
|
36
|
+
seriesIndex: number;
|
|
37
|
+
category: string;
|
|
38
|
+
categoryIndex: number;
|
|
39
|
+
}
|
|
40
|
+
export interface ModelDatumGraphEdge extends ModelDatumBase {
|
|
41
|
+
series: string;
|
|
42
|
+
seriesIndex: number;
|
|
43
|
+
category: string;
|
|
44
|
+
categoryIndex: number;
|
|
45
|
+
source: string;
|
|
46
|
+
sourceIndex: number;
|
|
47
|
+
target: string;
|
|
48
|
+
targetIndex: number;
|
|
49
|
+
}
|
|
50
|
+
export interface ModelDatumTree extends ModelDatumBase {
|
|
51
|
+
parent: string | null;
|
|
52
|
+
parentIndex: number | null;
|
|
53
|
+
depth: number;
|
|
54
|
+
seq: number;
|
|
55
|
+
children: ModelDatumTree[];
|
|
56
|
+
series: string;
|
|
57
|
+
seriesIndex: number;
|
|
58
|
+
category: string;
|
|
59
|
+
categoryIndex: number;
|
|
60
|
+
}
|
|
61
|
+
export type ModelDatum<T extends ModelType> = T extends 'series' ? ModelDatumSeries : T extends 'grid' ? ModelDatumGrid : T extends 'multivariate' ? ModelDatumMultivariate : T extends 'graph' ? ModelDatumGraphNode : T extends 'tree' ? ModelDatumTree : unknown;
|
|
62
|
+
export type ModelDataSeries = ModelDatum<'series'>[][];
|
|
63
|
+
export type ModelDataGrid = ModelDatum<'grid'>[][];
|
|
64
|
+
export type ModelDataMultivariate = ModelDatum<'multivariate'>[][];
|
|
65
|
+
export interface ModelDataGraph {
|
|
66
|
+
nodes: ModelDatumGraphNode[];
|
|
67
|
+
edges: ModelDatumGraphEdge[];
|
|
68
|
+
}
|
|
69
|
+
export type ModelDataTree = ModelDatum<'tree'>;
|
|
70
|
+
export type ModelData<T extends ModelType = ModelType> = T extends 'series' ? ModelDataSeries : T extends 'grid' ? ModelDataGrid : T extends 'multivariate' ? ModelDataMultivariate : T extends 'graph' ? ModelDataGraph : T extends 'tree' ? ModelDataTree : unknown;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DeepPartial, LayerEntity, ChartContext, ExtendableContext } from './index';
|
|
3
|
+
import { ValidatorResult } from '../types/Validator';
|
|
4
|
+
|
|
5
|
+
export interface PluginInfo {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
elementType: 'svg' | 'canvas';
|
|
9
|
+
shownLayers: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface PluginSetupProps<ExtendContext extends ExtendableContext, PluginParams extends Record<string, any>> {
|
|
12
|
+
context: ChartContext<ExtendContext>;
|
|
13
|
+
pluginParams$: Observable<PluginParams>;
|
|
14
|
+
}
|
|
15
|
+
export interface DefinePluginConfig<ExtendContext extends ExtendableContext, PluginParams extends Record<string, any>, AllLayerParams extends Record<string, any>> {
|
|
16
|
+
name: string;
|
|
17
|
+
defaultParams?: PluginParams;
|
|
18
|
+
validator?: (params: DeepPartial<AllLayerParams | PluginParams>) => ValidatorResult;
|
|
19
|
+
layers?: LayerEntity<ExtendContext, PluginParams, AllLayerParams[keyof AllLayerParams]>[];
|
|
20
|
+
setup?: (props: PluginSetupProps<ExtendContext, PluginParams>) => () => void;
|
|
21
|
+
}
|
|
22
|
+
export interface PluginEntity<ElementType extends 'svg' | 'canvas', PluginParams extends Record<string, any>, AllLayerParams extends Record<string, any>> {
|
|
23
|
+
readonly _name: string;
|
|
24
|
+
readonly _elementType: ElementType;
|
|
25
|
+
_getId: () => string;
|
|
26
|
+
_setId: (id: string) => void;
|
|
27
|
+
_injectContext(context: ChartContext<{}>): void;
|
|
28
|
+
show(names: (keyof AllLayerParams) | (keyof AllLayerParams)[]): void;
|
|
29
|
+
showOnly(names: (keyof AllLayerParams) | (keyof AllLayerParams)[]): void;
|
|
30
|
+
showAll(): void;
|
|
31
|
+
hide(names: (keyof AllLayerParams) | (keyof AllLayerParams)[]): void;
|
|
32
|
+
hideAll(): void;
|
|
33
|
+
toggle(names: (keyof AllLayerParams) | (keyof AllLayerParams)[]): void;
|
|
34
|
+
getShownLayerNames(): (keyof AllLayerParams)[];
|
|
35
|
+
updateParams(patch: DeepPartial<PluginParams | AllLayerParams>): void;
|
|
36
|
+
forceReplaceParams(full: PluginParams | AllLayerParams): void;
|
|
37
|
+
getParams(): Readonly<PluginParams | AllLayerParams>;
|
|
38
|
+
destroy(): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type RawData = RawDataColumn[] | RawDataColumn[][];
|
|
2
|
+
export type DynamicDefaultRawDataFields = {
|
|
3
|
+
value?: number | null;
|
|
4
|
+
x?: number | null;
|
|
5
|
+
y?: number | null;
|
|
6
|
+
z?: number | null;
|
|
7
|
+
dataset?: string;
|
|
8
|
+
series?: string;
|
|
9
|
+
category?: string;
|
|
10
|
+
};
|
|
11
|
+
export type RawDataColumn<DynamicFields extends Record<string, any> = DynamicDefaultRawDataFields> = {
|
|
12
|
+
id?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
source?: string;
|
|
15
|
+
target?: string;
|
|
16
|
+
parent?: string;
|
|
17
|
+
data?: any;
|
|
18
|
+
} & DynamicFields;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ModelType, ModelDatum, ModelDatumGraphEdge } from './index';
|
|
2
|
+
|
|
3
|
+
export type RenderDatumBase<T extends ModelType, ExtendTypes extends Record<string, any> = {}> = ModelDatum<T> & ExtendTypes;
|
|
4
|
+
export type RenderDatumGraphEdge<ExtendTypes extends Record<string, any> = {}> = ModelDatumGraphEdge & ExtendTypes;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Colors {
|
|
2
|
+
data: string[];
|
|
3
|
+
primary: string;
|
|
4
|
+
secondary: string;
|
|
5
|
+
dataContrast: string[];
|
|
6
|
+
background: string;
|
|
7
|
+
}
|
|
8
|
+
export type ColorScheme = 'light' | 'dark';
|
|
9
|
+
export interface Theme {
|
|
10
|
+
colorScheme: ColorScheme | 'auto';
|
|
11
|
+
colors: {
|
|
12
|
+
light: Colors;
|
|
13
|
+
dark: Colors;
|
|
14
|
+
};
|
|
15
|
+
fontSize: string | number;
|
|
16
|
+
}
|
|
17
|
+
export type ColorType = 'none' | keyof Colors;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ToBeTypes = 'string' | 'number' | 'boolean' | 'object' | 'object[]' | 'string[]' | 'number[]' | 'Function' | 'null' | 'undefined';
|
|
2
|
+
export type ToBeOption = 'ColorType';
|
|
3
|
+
export interface ValidatorRuleToBeTypes {
|
|
4
|
+
toBeTypes: ToBeTypes[];
|
|
5
|
+
}
|
|
6
|
+
export interface ValidatorRuleToBe {
|
|
7
|
+
toBe: string;
|
|
8
|
+
test: (value: any) => boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ValidatorRuleToBeOption {
|
|
11
|
+
toBeOption: ToBeOption;
|
|
12
|
+
}
|
|
13
|
+
export type ValidatorRule<T> = {
|
|
14
|
+
[key in keyof T]: ValidatorRuleToBeTypes | ValidatorRuleToBe | ValidatorRuleToBeOption;
|
|
15
|
+
};
|
|
16
|
+
export interface ValidatorResult {
|
|
17
|
+
status: 'success' | 'warning' | 'error';
|
|
18
|
+
columnName: string;
|
|
19
|
+
expectToBe: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './Chart';
|
|
2
|
+
export * from './ChartContext';
|
|
3
|
+
export * from './Encoding';
|
|
4
|
+
export * from './Event';
|
|
5
|
+
export * from './Layers';
|
|
6
|
+
export * from './ModelData';
|
|
7
|
+
export * from './Plugin';
|
|
8
|
+
export * from './RawData';
|
|
9
|
+
export * from './RenderData';
|
|
10
|
+
export * from './Theme';
|
|
11
|
+
export * from './Validator';
|
|
12
|
+
export * from './Common';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 聚合函數工具集
|
|
3
|
+
* 用於處理數值陣列的各種聚合運算
|
|
4
|
+
*/
|
|
5
|
+
export type AggregateType = 'sum' | 'mean' | 'median' | 'min' | 'max' | 'count' | 'none';
|
|
6
|
+
/**
|
|
7
|
+
* 計算數值陣列的總和
|
|
8
|
+
*/
|
|
9
|
+
export declare function sum(values: (number | null)[]): number | null;
|
|
10
|
+
/**
|
|
11
|
+
* 計算數值陣列的平均值
|
|
12
|
+
*/
|
|
13
|
+
export declare function mean(values: (number | null)[]): number | null;
|
|
14
|
+
/**
|
|
15
|
+
* 計算數值陣列的中位數
|
|
16
|
+
*/
|
|
17
|
+
export declare function median(values: (number | null)[]): number | null;
|
|
18
|
+
/**
|
|
19
|
+
* 計算數值陣列的最小值
|
|
20
|
+
*/
|
|
21
|
+
export declare function min(values: (number | null)[]): number | null;
|
|
22
|
+
/**
|
|
23
|
+
* 計算數值陣列的最大值
|
|
24
|
+
*/
|
|
25
|
+
export declare function max(values: (number | null)[]): number | null;
|
|
26
|
+
/**
|
|
27
|
+
* 計算數值陣列的有效數量
|
|
28
|
+
*/
|
|
29
|
+
export declare function count(values: (number | null)[]): number;
|
|
30
|
+
/**
|
|
31
|
+
* 不進行聚合,返回第一個有效值
|
|
32
|
+
*/
|
|
33
|
+
export declare function none(values: (number | null)[]): number | null;
|
|
34
|
+
/**
|
|
35
|
+
* 根據聚合類型執行對應的聚合函數
|
|
36
|
+
*/
|
|
37
|
+
export declare function aggregate(values: (number | null)[], type: AggregateType): number | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Theme } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 根據索引和主題計算對應的顏色
|
|
5
|
+
* @param index 索引值
|
|
6
|
+
* @param theme 主題設定
|
|
7
|
+
* @returns 對應的顏色(hex 格式)
|
|
8
|
+
*/
|
|
9
|
+
export declare function getColorByIndex(index: number, theme: Theme): string;
|
|
10
|
+
/**
|
|
11
|
+
* 根據不同的 encoding.color.from 計算顏色
|
|
12
|
+
* @param colorFrom 顏色來源類型
|
|
13
|
+
* @param options 包含所有可能索引的選項物件
|
|
14
|
+
* @param theme 主題設定
|
|
15
|
+
* @returns 對應的顏色(hex 格式)
|
|
16
|
+
*/
|
|
17
|
+
export declare function getColorByFrom(colorFrom: 'index' | 'series' | 'category' | 'dataset', options: {
|
|
18
|
+
index?: number;
|
|
19
|
+
seriesIndex?: number;
|
|
20
|
+
categoryIndex?: number;
|
|
21
|
+
datasetIndex?: number;
|
|
22
|
+
}, theme: Theme): string;
|