@orbcharts/core 3.0.0-beta.3 → 3.0.0-beta.4

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.
Files changed (77) hide show
  1. package/LICENSE +200 -200
  2. package/dist/orbcharts-core.es.js +2623 -2338
  3. package/dist/orbcharts-core.umd.js +4 -4
  4. package/dist/src/utils/d3Scale.d.ts +28 -0
  5. package/dist/src/utils/gridObservables.d.ts +29 -19
  6. package/dist/src/utils/index.d.ts +1 -1
  7. package/dist/src/utils/multiGridObservables.d.ts +2 -2
  8. package/dist/src/utils/multiValueObservables.d.ts +73 -0
  9. package/dist/src/utils/orbchartsUtils.d.ts +19 -5
  10. package/dist/src/utils/seriesObservables.d.ts +4 -4
  11. package/dist/src/utils/treeObservables.d.ts +2 -5
  12. package/lib/core-types.ts +7 -7
  13. package/package.json +42 -42
  14. package/src/AbstractChart.ts +57 -57
  15. package/src/GridChart.ts +24 -24
  16. package/src/MultiGridChart.ts +24 -24
  17. package/src/MultiValueChart.ts +24 -24
  18. package/src/RelationshipChart.ts +24 -24
  19. package/src/SeriesChart.ts +24 -24
  20. package/src/TreeChart.ts +24 -24
  21. package/src/base/createBaseChart.ts +505 -505
  22. package/src/base/createBasePlugin.ts +153 -153
  23. package/src/base/validators/chartOptionsValidator.ts +23 -23
  24. package/src/base/validators/chartParamsValidator.ts +133 -133
  25. package/src/base/validators/elementValidator.ts +13 -13
  26. package/src/base/validators/pluginsValidator.ts +14 -14
  27. package/src/defaults.ts +235 -232
  28. package/src/defineGridPlugin.ts +3 -3
  29. package/src/defineMultiGridPlugin.ts +3 -3
  30. package/src/defineMultiValuePlugin.ts +3 -3
  31. package/src/defineNoneDataPlugin.ts +4 -4
  32. package/src/defineRelationshipPlugin.ts +3 -3
  33. package/src/defineSeriesPlugin.ts +3 -3
  34. package/src/defineTreePlugin.ts +3 -3
  35. package/src/grid/computedDataFn.ts +129 -129
  36. package/src/grid/contextObserverCallback.ts +176 -155
  37. package/src/grid/dataFormatterValidator.ts +101 -101
  38. package/src/grid/dataValidator.ts +12 -12
  39. package/src/index.ts +20 -20
  40. package/src/multiGrid/computedDataFn.ts +123 -123
  41. package/src/multiGrid/contextObserverCallback.ts +41 -41
  42. package/src/multiGrid/dataFormatterValidator.ts +115 -115
  43. package/src/multiGrid/dataValidator.ts +12 -12
  44. package/src/multiValue/computedDataFn.ts +110 -176
  45. package/src/multiValue/contextObserverCallback.ts +160 -12
  46. package/src/multiValue/dataFormatterValidator.ts +9 -9
  47. package/src/multiValue/dataValidator.ts +9 -9
  48. package/src/relationship/computedDataFn.ts +125 -125
  49. package/src/relationship/contextObserverCallback.ts +12 -12
  50. package/src/relationship/dataFormatterValidator.ts +9 -9
  51. package/src/relationship/dataValidator.ts +9 -9
  52. package/src/series/computedDataFn.ts +88 -88
  53. package/src/series/contextObserverCallback.ts +100 -100
  54. package/src/series/dataFormatterValidator.ts +41 -41
  55. package/src/series/dataValidator.ts +12 -12
  56. package/src/tree/computedDataFn.ts +129 -130
  57. package/src/tree/contextObserverCallback.ts +58 -61
  58. package/src/tree/dataFormatterValidator.ts +13 -13
  59. package/src/tree/dataValidator.ts +13 -13
  60. package/src/utils/commonUtils.ts +55 -55
  61. package/src/utils/d3Scale.ts +198 -0
  62. package/src/utils/errorMessage.ts +42 -42
  63. package/src/utils/gridObservables.ts +671 -614
  64. package/src/utils/index.ts +9 -9
  65. package/src/utils/multiGridObservables.ts +392 -366
  66. package/src/utils/multiValueObservables.ts +643 -0
  67. package/src/utils/observables.ts +219 -219
  68. package/src/utils/orbchartsUtils.ts +377 -352
  69. package/src/utils/seriesObservables.ts +175 -175
  70. package/src/utils/treeObservables.ts +105 -94
  71. package/src/utils/validator.ts +126 -125
  72. package/tsconfig.base.json +13 -13
  73. package/tsconfig.json +2 -2
  74. package/vite-env.d.ts +6 -6
  75. package/vite.config.js +22 -22
  76. package/dist/src/utils/d3Utils.d.ts +0 -19
  77. package/src/utils/d3Utils.ts +0 -108
@@ -0,0 +1,28 @@
1
+ import * as d3 from 'd3';
2
+ export declare const createValueToAxisScale: ({ maxValue, minValue, axisWidth, scaleDomain, scaleRange, reverse }: {
3
+ maxValue: number;
4
+ minValue: number;
5
+ axisWidth: number;
6
+ scaleDomain: [number | "min" | "auto", number | "max" | "auto"];
7
+ scaleRange: [number, number];
8
+ reverse?: boolean;
9
+ }) => d3.ScaleLinear<number, number, never>;
10
+ export declare const createAxisToValueScale: ({ maxValue, minValue, axisWidth, scaleDomain, scaleRange, reverse }: {
11
+ maxValue: number;
12
+ minValue: number;
13
+ axisWidth: number;
14
+ scaleDomain: [number | "min" | "auto", number | "max" | "auto"];
15
+ scaleRange: [number, number];
16
+ reverse?: boolean;
17
+ }) => d3.ScaleLinear<number, number, never>;
18
+ export declare const createLabelToAxisScale: ({ axisLabels, axisWidth, padding }: {
19
+ axisLabels: string[];
20
+ axisWidth: number;
21
+ padding?: number;
22
+ }) => d3.ScalePoint<string>;
23
+ export declare const createAxisToLabelIndexScale: ({ axisLabels, axisWidth, padding, reverse }: {
24
+ axisLabels: string[] | Date[];
25
+ axisWidth: number;
26
+ padding?: number;
27
+ reverse?: boolean;
28
+ }) => d3.ScaleQuantize<number, never>;
@@ -1,28 +1,11 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ComputedDataTypeMap, ComputedDataGrid, ComputedDatumGrid, DataFormatterTypeMap, DataFormatterGrid, ComputedLayoutDatumGrid, ComputedLayoutDataGrid, GridContainerPosition, Layout, TransformData } from '../../lib/core-types';
2
+ import { ComputedDataTypeMap, ComputedDataGrid, ComputedDatumGrid, DataFormatterTypeMap, DataFormatterGrid, ComputedLayoutDatumGrid, ComputedLayoutDataGrid, ContainerPositionScaled, Layout, TransformData } from '../../lib/core-types';
3
3
 
4
4
  export declare const gridComputedLayoutDataObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
5
5
  computedData$: Observable<ComputedDataTypeMap<"grid">>;
6
6
  fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
7
7
  layout$: Observable<Layout>;
8
8
  }) => Observable<ComputedLayoutDatumGrid[][]>;
9
- export declare const gridAxesTransformObservable: ({ fullDataFormatter$, layout$ }: {
10
- fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
11
- layout$: Observable<Layout>;
12
- }) => Observable<TransformData>;
13
- export declare const gridAxesReverseTransformObservable: ({ gridAxesTransform$ }: {
14
- gridAxesTransform$: Observable<TransformData>;
15
- }) => Observable<TransformData>;
16
- export declare const gridGraphicTransformObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
17
- computedData$: Observable<ComputedDataTypeMap<"grid">>;
18
- fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
19
- layout$: Observable<Layout>;
20
- }) => Observable<TransformData>;
21
- export declare const gridGraphicReverseScaleObservable: ({ gridContainerPosition$, gridAxesTransform$, gridGraphicTransform$ }: {
22
- gridContainerPosition$: Observable<GridContainerPosition[]>;
23
- gridAxesTransform$: Observable<TransformData>;
24
- gridGraphicTransform$: Observable<TransformData>;
25
- }) => Observable<[number, number][]>;
26
9
  export declare const gridAxesSizeObservable: ({ fullDataFormatter$, layout$ }: {
27
10
  fullDataFormatter$: Observable<DataFormatterGrid>;
28
11
  layout$: Observable<Layout>;
@@ -43,8 +26,35 @@ export declare const gridContainerPositionObservable: ({ computedData$, fullData
43
26
  computedData$: Observable<ComputedDataTypeMap<"grid">>;
44
27
  fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
45
28
  layout$: Observable<Layout>;
46
- }) => Observable<GridContainerPosition[]>;
29
+ }) => Observable<ContainerPositionScaled[]>;
47
30
  export declare const computedStackedDataObservables: ({ isSeriesSeprate$, computedData$ }: {
48
31
  isSeriesSeprate$: Observable<boolean>;
49
32
  computedData$: Observable<ComputedDataGrid>;
50
33
  }) => Observable<ComputedDataGrid>;
34
+ export declare const groupScaleDomainValueObservable: ({ computedData$, fullDataFormatter$ }: {
35
+ computedData$: Observable<ComputedDataGrid>;
36
+ fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
37
+ }) => Observable<[number, number]>;
38
+ export declare const filteredMinMaxValueObservable: ({ computedData$, groupScaleDomainValue$ }: {
39
+ computedData$: Observable<ComputedDataGrid>;
40
+ groupScaleDomainValue$: Observable<[number, number]>;
41
+ }) => Observable<[number, number]>;
42
+ export declare const gridAxesTransformObservable: ({ fullDataFormatter$, layout$ }: {
43
+ fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
44
+ layout$: Observable<Layout>;
45
+ }) => Observable<TransformData>;
46
+ export declare const gridAxesReverseTransformObservable: ({ gridAxesTransform$ }: {
47
+ gridAxesTransform$: Observable<TransformData>;
48
+ }) => Observable<TransformData>;
49
+ export declare const gridGraphicTransformObservable: ({ computedData$, groupScaleDomainValue$, filteredMinMaxValue$, fullDataFormatter$, layout$ }: {
50
+ computedData$: Observable<ComputedDataTypeMap<"grid">>;
51
+ groupScaleDomainValue$: Observable<[number, number]>;
52
+ filteredMinMaxValue$: Observable<[number, number]>;
53
+ fullDataFormatter$: Observable<DataFormatterTypeMap<"grid">>;
54
+ layout$: Observable<Layout>;
55
+ }) => Observable<TransformData>;
56
+ export declare const gridGraphicReverseScaleObservable: ({ gridContainerPosition$, gridAxesTransform$, gridGraphicTransform$ }: {
57
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>;
58
+ gridAxesTransform$: Observable<TransformData>;
59
+ gridGraphicTransform$: Observable<TransformData>;
60
+ }) => Observable<[number, number][]>;
@@ -1,5 +1,5 @@
1
1
  export * from './commonUtils';
2
- export * from './d3Utils';
2
+ export * from './d3Scale';
3
3
  export * from './gridObservables';
4
4
  export * from './multiGridObservables';
5
5
  export * from './observables';
@@ -1,5 +1,5 @@
1
1
  import { Subject, Observable } from 'rxjs';
2
- import { ChartParams, ComputedDataTypeMap, ContextObserverMultiGridDetail, DataFormatterTypeMap, EventMultiGrid, GridContainerPosition, Layout } from '../../lib/core-types';
2
+ import { ChartParams, ComputedDataTypeMap, ContextObserverMultiGridDetail, DataFormatterTypeMap, EventMultiGrid, ContainerPositionScaled, Layout } from '../../lib/core-types';
3
3
 
4
4
  export declare const multiGridEachDetailObservable: ({ fullDataFormatter$, computedData$, layout$, fullChartParams$, event$ }: {
5
5
  fullDataFormatter$: Observable<DataFormatterTypeMap<"multiGrid">>;
@@ -12,4 +12,4 @@ export declare const multiGridContainerObservable: ({ computedData$, fullDataFor
12
12
  computedData$: Observable<ComputedDataTypeMap<"multiGrid">>;
13
13
  fullDataFormatter$: Observable<DataFormatterTypeMap<"multiGrid">>;
14
14
  layout$: Observable<Layout>;
15
- }) => Observable<GridContainerPosition[][]>;
15
+ }) => Observable<ContainerPositionScaled[][]>;
@@ -0,0 +1,73 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ComputedDataTypeMap, ComputedDatumMultiValue, DataFormatterTypeMap, ComputedLayoutDatumMultiValue, ComputedLayoutDataMultiValue, ContainerPositionScaled, Layout, TransformData } from '../../lib/core-types';
3
+
4
+ export declare const minMaxXYObservable: ({ computedData$ }: {
5
+ computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
6
+ }) => Observable<{
7
+ minX: number;
8
+ maxX: number;
9
+ minY: number;
10
+ maxY: number;
11
+ }>;
12
+ export declare const multiValueComputedLayoutDataObservable: ({ computedData$, minMaxXY$, fullDataFormatter$, layout$ }: {
13
+ computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
14
+ minMaxXY$: Observable<{
15
+ minX: number;
16
+ maxX: number;
17
+ minY: number;
18
+ maxY: number;
19
+ }>;
20
+ fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
21
+ layout$: Observable<Layout>;
22
+ }) => Observable<ComputedLayoutDataMultiValue>;
23
+ export declare const multiValueCategoryLabelsObservable: ({ computedData$, fullDataFormatter$ }: {
24
+ computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
25
+ fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
26
+ }) => Observable<string[]>;
27
+ export declare const multiValueVisibleComputedDataObservable: ({ computedData$ }: {
28
+ computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
29
+ }) => Observable<ComputedDatumMultiValue[][]>;
30
+ export declare const multiValueVisibleComputedLayoutDataObservable: ({ computedLayoutData$ }: {
31
+ computedLayoutData$: Observable<ComputedLayoutDataMultiValue>;
32
+ }) => Observable<ComputedLayoutDatumMultiValue[][]>;
33
+ export declare const multiValueContainerPositionObservable: ({ computedData$, fullDataFormatter$, layout$ }: {
34
+ computedData$: Observable<ComputedDataTypeMap<"multiValue">>;
35
+ fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
36
+ layout$: Observable<Layout>;
37
+ }) => Observable<ContainerPositionScaled[]>;
38
+ export declare const filteredMinMaxXYDataObservable: ({ visibleComputedLayoutData$, minMaxXY$, fullDataFormatter$ }: {
39
+ visibleComputedLayoutData$: Observable<ComputedLayoutDataMultiValue>;
40
+ minMaxXY$: Observable<{
41
+ minX: number;
42
+ maxX: number;
43
+ minY: number;
44
+ maxY: number;
45
+ }>;
46
+ fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
47
+ }) => Observable<{
48
+ datumList: ComputedLayoutDatumMultiValue[];
49
+ minXDatum: ComputedLayoutDatumMultiValue;
50
+ maxXDatum: ComputedLayoutDatumMultiValue;
51
+ minYDatum: ComputedLayoutDatumMultiValue;
52
+ maxYDatum: ComputedLayoutDatumMultiValue;
53
+ }>;
54
+ export declare const multiValueGraphicTransformObservable: ({ minMaxXY$, filteredMinMaxXYData$, fullDataFormatter$, layout$ }: {
55
+ minMaxXY$: Observable<{
56
+ minX: number;
57
+ maxX: number;
58
+ minY: number;
59
+ maxY: number;
60
+ }>;
61
+ filteredMinMaxXYData$: Observable<{
62
+ minXDatum: ComputedLayoutDatumMultiValue;
63
+ maxXDatum: ComputedLayoutDatumMultiValue;
64
+ minYDatum: ComputedLayoutDatumMultiValue;
65
+ maxYDatum: ComputedLayoutDatumMultiValue;
66
+ }>;
67
+ fullDataFormatter$: Observable<DataFormatterTypeMap<"multiValue">>;
68
+ layout$: Observable<Layout>;
69
+ }) => Observable<TransformData>;
70
+ export declare const multiValueGraphicReverseScaleObservable: ({ multiValueContainerPosition$, multiValueGraphicTransform$ }: {
71
+ multiValueContainerPosition$: Observable<ContainerPositionScaled[]>;
72
+ multiValueGraphicTransform$: Observable<TransformData>;
73
+ }) => Observable<[number, number][]>;
@@ -1,9 +1,10 @@
1
- import { ChartType, ChartParams, DatumValue, DataSeries, DataGrid, DataGridDatum, DataMultiGrid, DataMultiValue, DataFormatterContainer, SeriesDirection, DataFormatterGridGrid, SeriesContainerPosition, GridContainerPosition, Layout } from '../../lib/core-types';
1
+ import { ChartType, ChartParams, DatumValue, DataSeries, DataGrid, DataGridDatum, DataMultiGrid, DataMultiValue, ComputedLayoutDatumMultiValue, DataFormatterContainer, SeriesDirection, DataFormatterGridGrid, ContainerPosition, ContainerPositionScaled, Layout } from '../../lib/core-types';
2
2
  import * as d3 from 'd3';
3
3
  export declare function formatValueToLabel(value: any, valueFormatter: string | ((text: d3.NumberValue) => string)): string;
4
- export declare function createDefaultDatumId(chartTypeOrPrefix: string, levelOneIndex: number, levelTwoIndex: number, levelThreeIndex?: number): string;
4
+ export declare function createDefaultDatumId(chartTypeOrPrefix: string, levelOneIndex: number, levelTwoIndex?: number, levelThreeIndex?: number): string;
5
5
  export declare function createDefaultSeriesLabel(chartTypeOrPrefix: string, seriesIndex: number): string;
6
6
  export declare function createDefaultGroupLabel(chartTypeOrPrefix: string, groupIndex: number): string;
7
+ export declare function createDefaultCategoryLabel(): string;
7
8
  export declare function createGridSeriesLabels({ transposedDataGrid, dataFormatterGrid, chartType }: {
8
9
  transposedDataGrid: DataGridDatum[][];
9
10
  dataFormatterGrid: DataFormatterGridGrid;
@@ -31,8 +32,21 @@ export declare function getMinAndMaxValue(data: DatumValue[]): [number, number];
31
32
  export declare function getMinAndMaxSeries(data: DataSeries): [number, number];
32
33
  export declare function getMinAndMaxGrid(data: DataGrid): [number, number];
33
34
  export declare function getMinAndMaxMultiGrid(data: DataMultiGrid): [number, number];
34
- export declare function getMinAndMaxMultiValue(data: DataMultiValue, valueIndex?: number): [number, number];
35
+ export declare function getMinAndMaxMultiValue(data: DataMultiValue, valueIndex: number): [number, number];
36
+ export declare function getMinAndMaxMultiValueXY({ data, minX, maxX, minY, maxY }: {
37
+ data: ComputedLayoutDatumMultiValue[][];
38
+ minX: number;
39
+ maxX: number;
40
+ minY: number;
41
+ maxY: number;
42
+ }): {
43
+ minXDatum: ComputedLayoutDatumMultiValue;
44
+ maxXDatum: ComputedLayoutDatumMultiValue;
45
+ minYDatum: ComputedLayoutDatumMultiValue;
46
+ maxYDatum: ComputedLayoutDatumMultiValue;
47
+ filteredData: ComputedLayoutDatumMultiValue[][];
48
+ };
35
49
  export declare function transposeData<T>(seriesDirection: SeriesDirection, data: T[][]): T[][];
36
50
  export declare function seriesColorPredicate(seriesIndex: number, chartParams: ChartParams): string;
37
- export declare function calcSeriesContainerLayout(layout: Layout, container: DataFormatterContainer, amount: number): SeriesContainerPosition[];
38
- export declare function calcGridContainerLayout(layout: Layout, container: DataFormatterContainer, amount: number): GridContainerPosition[];
51
+ export declare function calcSeriesContainerLayout(layout: Layout, container: DataFormatterContainer, amount: number): ContainerPosition[];
52
+ export declare function calcGridContainerLayout(layout: Layout, container: DataFormatterContainer, amount: number): ContainerPositionScaled[];
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ComputedDatumSeries, ComputedDataTypeMap, DataFormatterTypeMap, SeriesContainerPosition, Layout } from '../../lib/core-types';
2
+ import { ComputedDatumSeries, ComputedDataTypeMap, DataFormatterTypeMap, ContainerPosition, Layout } from '../../lib/core-types';
3
3
 
4
4
  export declare const separateSeriesObservable: ({ fullDataFormatter$ }: {
5
5
  fullDataFormatter$: Observable<DataFormatterTypeMap<"series">>;
@@ -18,9 +18,9 @@ export declare const seriesContainerPositionObservable: ({ computedData$, fullDa
18
18
  computedData$: Observable<ComputedDataTypeMap<"series">>;
19
19
  fullDataFormatter$: Observable<DataFormatterTypeMap<"series">>;
20
20
  layout$: Observable<Layout>;
21
- }) => Observable<SeriesContainerPosition[]>;
21
+ }) => Observable<ContainerPosition[]>;
22
22
  export declare const seriesContainerPositionMapObservable: ({ seriesContainerPosition$, seriesLabels$, separateSeries$ }: {
23
- seriesContainerPosition$: Observable<SeriesContainerPosition[]>;
23
+ seriesContainerPosition$: Observable<ContainerPosition[]>;
24
24
  seriesLabels$: Observable<string[]>;
25
25
  separateSeries$: Observable<boolean>;
26
- }) => Observable<Map<string, SeriesContainerPosition>>;
26
+ }) => Observable<Map<string, ContainerPosition>>;
@@ -1,13 +1,10 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ComputedDataTree, DataFormatterTree } from '../../lib/core-types';
2
+ import { ComputedDataTree } from '../../lib/core-types';
3
3
 
4
4
  export declare const nodeListObservable: ({ computedData$ }: {
5
5
  computedData$: Observable<ComputedDataTree>;
6
6
  }) => Observable<ComputedDataTree[]>;
7
- export declare const existCategoryLabelsObservable: ({ nodeList$, fullDataFormatter$ }: {
8
- nodeList$: Observable<ComputedDataTree[]>;
9
- fullDataFormatter$: Observable<DataFormatterTree>;
10
- }) => Observable<string[]>;
7
+ export declare const categoryLabelsObservable: (CategoryDataMap$: Observable<Map<string, ComputedDataTree[]>>) => Observable<string[]>;
11
8
  export declare const treeVisibleComputedDataObservable: ({ computedData$ }: {
12
9
  computedData$: Observable<ComputedDataTree>;
13
10
  }) => Observable<ComputedDataTree>;
package/lib/core-types.ts CHANGED
@@ -1,7 +1,7 @@
1
-
2
-
3
- export * from '@orbcharts/core-types'
4
-
5
- // test
6
- // export * from '../../orbcharts-core-types/src'
7
-
1
+
2
+
3
+ export * from '@orbcharts/core-types'
4
+
5
+ // test
6
+ // export * from '../../orbcharts-core-types/src'
7
+
package/package.json CHANGED
@@ -1,42 +1,42 @@
1
- {
2
- "name": "@orbcharts/core",
3
- "version": "3.0.0-beta.3",
4
- "description": "OrbCharts is an open source chart library based on d3.js and rx.js",
5
- "author": "Blue Planet Inc.",
6
- "license": "Apache-2.0",
7
- "keywords": [
8
- "d3",
9
- "rxjs",
10
- "svg",
11
- "visualization",
12
- "infographic",
13
- "graph",
14
- "chart"
15
- ],
16
- "private": false,
17
- "publishConfig": {
18
- "access": "public",
19
- "registry": "https://registry.npmjs.org/"
20
- },
21
- "files": [
22
- "*"
23
- ],
24
- "module": "./dist/orbcharts-core.es.js",
25
- "types": "./dist/src/index.d.ts",
26
- "scripts": {
27
- "test": "echo \"Error: no test specified\" && exit 1",
28
- "build": "vite build --mode production"
29
- },
30
- "devDependencies": {
31
- "@types/d3": "^7.4.0",
32
- "ts-loader": "^9.4.2",
33
- "typescript": "^5.0.4",
34
- "vite": "^5.3.5",
35
- "vite-plugin-dts": "^3.7.3"
36
- },
37
- "dependencies": {
38
- "@orbcharts/core-types": "^3.0.0-beta.2",
39
- "d3": "^7.8.5",
40
- "rxjs": "^7.8.1"
41
- }
42
- }
1
+ {
2
+ "name": "@orbcharts/core",
3
+ "version": "3.0.0-beta.4",
4
+ "description": "OrbCharts is an open source chart library based on d3.js and rx.js",
5
+ "author": "Blue Planet Inc.",
6
+ "license": "Apache-2.0",
7
+ "keywords": [
8
+ "d3",
9
+ "rxjs",
10
+ "svg",
11
+ "visualization",
12
+ "infographic",
13
+ "graph",
14
+ "chart"
15
+ ],
16
+ "private": false,
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "registry": "https://registry.npmjs.org/"
20
+ },
21
+ "files": [
22
+ "*"
23
+ ],
24
+ "module": "./dist/orbcharts-core.es.js",
25
+ "types": "./dist/src/index.d.ts",
26
+ "scripts": {
27
+ "test": "echo \"Error: no test specified\" && exit 1",
28
+ "build": "vite build --mode production"
29
+ },
30
+ "devDependencies": {
31
+ "@types/d3": "^7.4.0",
32
+ "ts-loader": "^9.4.2",
33
+ "typescript": "^5.0.4",
34
+ "vite": "^5.3.5",
35
+ "vite-plugin-dts": "^3.7.3"
36
+ },
37
+ "dependencies": {
38
+ "@orbcharts/core-types": "^3.0.0-beta.3",
39
+ "d3": "^7.8.5",
40
+ "rxjs": "^7.8.1"
41
+ }
42
+ }
@@ -1,57 +1,57 @@
1
- import * as d3 from 'd3'
2
- import {
3
- Subject } from 'rxjs'
4
- import type {
5
- ComputedDataFn,
6
- DataValidator,
7
- ChartEntity,
8
- ChartType,
9
- ChartParamsPartial,
10
- ContextObserverCallback,
11
- ChartOptionsPartial,
12
- DataTypeMap,
13
- DataFormatterTypeMap,
14
- DataFormatterPartialTypeMap,
15
- DataFormatterValidator,
16
- EventTypeMap,
17
- PluginEntity } from '../lib/core-types'
18
- import { createBaseChart } from './base/createBaseChart'
19
- import { createOrbChartsErrorMessage } from './utils/errorMessage'
20
-
21
- export abstract class AbstractChart<T extends ChartType> implements ChartEntity<T> {
22
- selection: d3.Selection<SVGGElement, unknown, HTMLElement, unknown>
23
- destroy: () => void
24
- data$: Subject<DataTypeMap<T>> = new Subject()
25
- dataFormatter$: Subject<DataFormatterPartialTypeMap<T>> = new Subject()
26
- plugins$: Subject<PluginEntity<T, any, any>[]> = new Subject()
27
- chartParams$: Subject<ChartParamsPartial> = new Subject()
28
- event$: Subject<EventTypeMap<T>> = new Subject()
29
-
30
- constructor (
31
- { defaultDataFormatter, dataFormatterValidator, computedDataFn, dataValidator, contextObserverCallback }: {
32
- defaultDataFormatter: DataFormatterTypeMap<T>
33
- dataFormatterValidator: DataFormatterValidator<T>
34
- computedDataFn: ComputedDataFn<T>
35
- dataValidator: DataValidator<T>
36
- contextObserverCallback: ContextObserverCallback<T>
37
- },
38
- element: HTMLElement | Element,
39
- options?: ChartOptionsPartial<T>
40
- ) {
41
- try {
42
- const baseChart = createBaseChart({ defaultDataFormatter, dataFormatterValidator, computedDataFn, dataValidator, contextObserverCallback })
43
- const chartEntity = baseChart(element, options)
44
-
45
- this.selection = chartEntity.selection
46
- this.destroy = chartEntity.destroy
47
- this.data$ = chartEntity.data$
48
- this.dataFormatter$ = chartEntity.dataFormatter$
49
- this.plugins$ = chartEntity.plugins$
50
- this.chartParams$ = chartEntity.chartParams$
51
- this.event$ = chartEntity.event$
52
- } catch (e) {
53
- console.error(createOrbChartsErrorMessage(e))
54
- }
55
- }
56
-
57
- }
1
+ import * as d3 from 'd3'
2
+ import {
3
+ Subject } from 'rxjs'
4
+ import type {
5
+ ComputedDataFn,
6
+ DataValidator,
7
+ ChartEntity,
8
+ ChartType,
9
+ ChartParamsPartial,
10
+ ContextObserverCallback,
11
+ ChartOptionsPartial,
12
+ DataTypeMap,
13
+ DataFormatterTypeMap,
14
+ DataFormatterPartialTypeMap,
15
+ DataFormatterValidator,
16
+ EventTypeMap,
17
+ PluginEntity } from '../lib/core-types'
18
+ import { createBaseChart } from './base/createBaseChart'
19
+ import { createOrbChartsErrorMessage } from './utils/errorMessage'
20
+
21
+ export abstract class AbstractChart<T extends ChartType> implements ChartEntity<T> {
22
+ selection: d3.Selection<SVGGElement, unknown, HTMLElement, unknown>
23
+ destroy: () => void
24
+ data$: Subject<DataTypeMap<T>> = new Subject()
25
+ dataFormatter$: Subject<DataFormatterPartialTypeMap<T>> = new Subject()
26
+ plugins$: Subject<PluginEntity<T, any, any>[]> = new Subject()
27
+ chartParams$: Subject<ChartParamsPartial> = new Subject()
28
+ event$: Subject<EventTypeMap<T>> = new Subject()
29
+
30
+ constructor (
31
+ { defaultDataFormatter, dataFormatterValidator, computedDataFn, dataValidator, contextObserverCallback }: {
32
+ defaultDataFormatter: DataFormatterTypeMap<T>
33
+ dataFormatterValidator: DataFormatterValidator<T>
34
+ computedDataFn: ComputedDataFn<T>
35
+ dataValidator: DataValidator<T>
36
+ contextObserverCallback: ContextObserverCallback<T>
37
+ },
38
+ element: HTMLElement | Element,
39
+ options?: ChartOptionsPartial<T>
40
+ ) {
41
+ try {
42
+ const baseChart = createBaseChart({ defaultDataFormatter, dataFormatterValidator, computedDataFn, dataValidator, contextObserverCallback })
43
+ const chartEntity = baseChart(element, options)
44
+
45
+ this.selection = chartEntity.selection
46
+ this.destroy = chartEntity.destroy
47
+ this.data$ = chartEntity.data$
48
+ this.dataFormatter$ = chartEntity.dataFormatter$
49
+ this.plugins$ = chartEntity.plugins$
50
+ this.chartParams$ = chartEntity.chartParams$
51
+ this.event$ = chartEntity.event$
52
+ } catch (e) {
53
+ console.error(createOrbChartsErrorMessage(e))
54
+ }
55
+ }
56
+
57
+ }
package/src/GridChart.ts CHANGED
@@ -1,25 +1,25 @@
1
- import type {
2
- ChartEntity,
3
- ChartOptionsPartial } from '../lib/core-types'
4
- import { DATA_FORMATTER_GRID_DEFAULT } from './defaults'
5
- import { dataFormatterValidator } from './grid/dataFormatterValidator'
6
- import { computedDataFn } from './grid/computedDataFn'
7
- import { dataValidator } from './grid/dataValidator'
8
- import { contextObserverCallback } from './grid/contextObserverCallback'
9
- import { AbstractChart } from './AbstractChart'
10
-
11
- export class GridChart extends AbstractChart<'grid'> implements ChartEntity<'grid'> {
12
- constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'grid'>) {
13
- super(
14
- {
15
- defaultDataFormatter: DATA_FORMATTER_GRID_DEFAULT,
16
- dataFormatterValidator,
17
- computedDataFn,
18
- dataValidator,
19
- contextObserverCallback
20
- },
21
- element,
22
- options
23
- )
24
- }
1
+ import type {
2
+ ChartEntity,
3
+ ChartOptionsPartial } from '../lib/core-types'
4
+ import { DATA_FORMATTER_GRID_DEFAULT } from './defaults'
5
+ import { dataFormatterValidator } from './grid/dataFormatterValidator'
6
+ import { computedDataFn } from './grid/computedDataFn'
7
+ import { dataValidator } from './grid/dataValidator'
8
+ import { contextObserverCallback } from './grid/contextObserverCallback'
9
+ import { AbstractChart } from './AbstractChart'
10
+
11
+ export class GridChart extends AbstractChart<'grid'> implements ChartEntity<'grid'> {
12
+ constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'grid'>) {
13
+ super(
14
+ {
15
+ defaultDataFormatter: DATA_FORMATTER_GRID_DEFAULT,
16
+ dataFormatterValidator,
17
+ computedDataFn,
18
+ dataValidator,
19
+ contextObserverCallback
20
+ },
21
+ element,
22
+ options
23
+ )
24
+ }
25
25
  }
@@ -1,25 +1,25 @@
1
- import type {
2
- ChartEntity,
3
- ChartOptionsPartial } from '../lib/core-types'
4
- import { DATA_FORMATTER_MULTI_GRID_DEFAULT } from './defaults'
5
- import { dataFormatterValidator } from './multiGrid/dataFormatterValidator'
6
- import { computedDataFn } from './multiGrid/computedDataFn'
7
- import { dataValidator } from './multiGrid/dataValidator'
8
- import { contextObserverCallback } from './multiGrid/contextObserverCallback'
9
- import { AbstractChart } from './AbstractChart'
10
-
11
- export class MultiGridChart extends AbstractChart<'multiGrid'> implements ChartEntity<'multiGrid'> {
12
- constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'multiGrid'>) {
13
- super(
14
- {
15
- defaultDataFormatter: DATA_FORMATTER_MULTI_GRID_DEFAULT,
16
- dataFormatterValidator,
17
- computedDataFn,
18
- dataValidator,
19
- contextObserverCallback
20
- },
21
- element,
22
- options
23
- )
24
- }
1
+ import type {
2
+ ChartEntity,
3
+ ChartOptionsPartial } from '../lib/core-types'
4
+ import { DATA_FORMATTER_MULTI_GRID_DEFAULT } from './defaults'
5
+ import { dataFormatterValidator } from './multiGrid/dataFormatterValidator'
6
+ import { computedDataFn } from './multiGrid/computedDataFn'
7
+ import { dataValidator } from './multiGrid/dataValidator'
8
+ import { contextObserverCallback } from './multiGrid/contextObserverCallback'
9
+ import { AbstractChart } from './AbstractChart'
10
+
11
+ export class MultiGridChart extends AbstractChart<'multiGrid'> implements ChartEntity<'multiGrid'> {
12
+ constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'multiGrid'>) {
13
+ super(
14
+ {
15
+ defaultDataFormatter: DATA_FORMATTER_MULTI_GRID_DEFAULT,
16
+ dataFormatterValidator,
17
+ computedDataFn,
18
+ dataValidator,
19
+ contextObserverCallback
20
+ },
21
+ element,
22
+ options
23
+ )
24
+ }
25
25
  }
@@ -1,25 +1,25 @@
1
- import type {
2
- ChartEntity,
3
- ChartOptionsPartial } from '../lib/core-types'
4
- import { DATA_FORMATTER_MULTI_VALUE_DEFAULT } from './defaults'
5
- import { dataFormatterValidator } from './multiValue/dataFormatterValidator'
6
- import { computedDataFn } from './multiValue/computedDataFn'
7
- import { dataValidator } from './multiValue/dataValidator'
8
- import { contextObserverCallback } from './multiValue/contextObserverCallback'
9
- import { AbstractChart } from './AbstractChart'
10
-
11
- export class MultiValueChart extends AbstractChart<'multiValue'> implements ChartEntity<'multiValue'> {
12
- constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'multiValue'>) {
13
- super(
14
- {
15
- defaultDataFormatter: DATA_FORMATTER_MULTI_VALUE_DEFAULT,
16
- dataFormatterValidator,
17
- computedDataFn,
18
- dataValidator,
19
- contextObserverCallback
20
- },
21
- element,
22
- options
23
- )
24
- }
1
+ import type {
2
+ ChartEntity,
3
+ ChartOptionsPartial } from '../lib/core-types'
4
+ import { DATA_FORMATTER_MULTI_VALUE_DEFAULT } from './defaults'
5
+ import { dataFormatterValidator } from './multiValue/dataFormatterValidator'
6
+ import { computedDataFn } from './multiValue/computedDataFn'
7
+ import { dataValidator } from './multiValue/dataValidator'
8
+ import { contextObserverCallback } from './multiValue/contextObserverCallback'
9
+ import { AbstractChart } from './AbstractChart'
10
+
11
+ export class MultiValueChart extends AbstractChart<'multiValue'> implements ChartEntity<'multiValue'> {
12
+ constructor (element: HTMLElement | Element, options?: ChartOptionsPartial<'multiValue'>) {
13
+ super(
14
+ {
15
+ defaultDataFormatter: DATA_FORMATTER_MULTI_VALUE_DEFAULT,
16
+ dataFormatterValidator,
17
+ computedDataFn,
18
+ dataValidator,
19
+ contextObserverCallback
20
+ },
21
+ element,
22
+ options
23
+ )
24
+ }
25
25
  }