@oliasoft-open-source/charts-library 3.4.7-beta-1 → 3.4.8-beta-1
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/declaration.d.ts +0 -2
- package/dist/index.js +612 -659
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/bar-chart-default-props.d.ts +26 -30
- package/dist/src/components/bar-chart/bar-chart.interface.d.ts +70 -37
- package/dist/src/components/bar-chart/get-bar-chart-data-labels.d.ts +14 -11
- package/dist/src/components/bar-chart/get-bar-chart-scales.d.ts +2 -3
- package/dist/src/components/bar-chart/get-bar-chart-tooltips.d.ts +16 -3
- package/dist/src/components/controls/axes-options/axes-options-interfaces.d.ts +19 -0
- package/dist/src/components/{line-chart/controls → controls}/axes-options/axes-options.d.ts +1 -1
- package/dist/src/components/line-chart/controls/axes-options/axes-options-form-state.d.ts +3 -8
- package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +32 -18
- package/dist/src/components/line-chart/controls/controls-portal.d.ts +1 -6
- package/dist/src/components/line-chart/controls/controls.d.ts +1 -1
- package/dist/src/components/line-chart/controls/drag-options-interfaces.d.ts +5 -5
- package/dist/src/components/line-chart/controls/line-options.d.ts +1 -9
- package/dist/src/components/line-chart/hooks/hooks.interface.d.ts +13 -0
- package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +6 -28
- package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +37 -0
- package/dist/src/components/line-chart/hooks/use-toggle-handler.d.ts +1 -2
- package/dist/src/components/line-chart/initialize/config.d.ts +2 -2
- package/dist/src/components/line-chart/legend/legend-interface.d.ts +18 -24
- package/dist/src/components/line-chart/legend/legend-panel.d.ts +2 -2
- package/dist/src/components/line-chart/line-chart-get-default-props.d.ts +30 -38
- package/dist/src/components/line-chart/line-chart.interface.d.ts +61 -48
- package/dist/src/components/line-chart/plugins/chart-area-text-plugin.d.ts +1 -14
- package/dist/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.d.ts +4 -5
- package/dist/src/components/line-chart/plugins/plugins.interface.d.ts +2 -2
- package/dist/src/components/line-chart/state/initial-state.d.ts +2 -20
- package/dist/src/components/line-chart/state/line-chart-reducer.d.ts +1 -2
- package/dist/src/components/line-chart/state/manage-state-in-local-storage.d.ts +2 -3
- package/dist/src/components/line-chart/state/state.interfaces.d.ts +7 -32
- package/dist/src/components/line-chart/{hooks → state}/use-chart-state.d.ts +1 -13
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.d.ts +1 -1
- package/dist/src/components/line-chart/utils/generate-line-chart-datasets.d.ts +1 -3
- package/dist/src/components/line-chart/utils/get-axes-ranges-from-chart.d.ts +2 -9
- package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +2 -3
- package/dist/src/components/line-chart/utils/get-line-chart-scales.d.ts +4 -4
- package/dist/src/components/line-chart/utils/get-line-chart-tooltips.d.ts +2 -2
- package/dist/src/components/line-chart/utils/translations/get-translations.d.ts +1 -2
- package/dist/src/components/pie-chart/pie-chart-get-default-props.d.ts +8 -12
- package/dist/src/components/pie-chart/pie-chart-utils.d.ts +2 -0
- package/dist/src/components/pie-chart/pie-chart.d.ts +2 -1
- package/dist/src/components/pie-chart/pie-chart.interface.d.ts +51 -52
- package/dist/src/components/scatter-chart/scatter-chart.d.ts +1 -1
- package/dist/src/components/scatter-chart/scatter-chart.intefrace.d.ts +16 -6
- package/dist/src/helpers/chart-border-plugin.d.ts +7 -0
- package/dist/src/helpers/chart-interface.d.ts +85 -0
- package/dist/src/{components/common/helpers → helpers}/enums.d.ts +1 -2
- package/dist/src/helpers/get-chart-annotation.d.ts +12 -0
- package/dist/src/helpers/get-draggableData.d.ts +18 -0
- package/dist/src/{components/common/helpers → helpers}/range/range.d.ts +6 -6
- package/package.json +1 -1
- package/dist/src/components/common/common.interface.d.ts +0 -139
- package/dist/src/components/common/helpers/chart-border-plugin.d.ts +0 -8
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +0 -27
- package/dist/src/components/common/helpers/get-draggableData.d.ts +0 -18
- package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +0 -52
- /package/dist/src/{components/common/helpers → helpers}/chart-consts.d.ts +0 -0
- /package/dist/src/{components/common/helpers → helpers}/range/estimate-data-series-have-close-values.d.ts +0 -0
|
@@ -1,42 +1,34 @@
|
|
|
1
1
|
import { ILineChartProps } from './line-chart.interface';
|
|
2
|
-
import { AlignOptions, Position } from '../common/helpers/enums';
|
|
3
2
|
export declare const getDefaultProps: (props: ILineChartProps) => {
|
|
4
3
|
persistenceId: string;
|
|
5
|
-
controlsPortalId: string;
|
|
4
|
+
controlsPortalId: string | null;
|
|
6
5
|
testId: string | null;
|
|
7
|
-
data:
|
|
8
|
-
datasets: import("./line-chart.interface").ILineChartDataset[];
|
|
9
|
-
} | undefined;
|
|
6
|
+
data: any;
|
|
10
7
|
options: {
|
|
11
8
|
title: string | string[];
|
|
12
|
-
scales:
|
|
9
|
+
scales: any;
|
|
13
10
|
axes: {
|
|
14
|
-
x:
|
|
15
|
-
y:
|
|
11
|
+
x: any;
|
|
12
|
+
y: any;
|
|
16
13
|
};
|
|
17
14
|
additionalAxesOptions: {
|
|
18
|
-
chartScaleType:
|
|
19
|
-
reverse:
|
|
20
|
-
beginAtZero:
|
|
21
|
-
stepSize:
|
|
22
|
-
suggestedMin:
|
|
23
|
-
suggestedMax:
|
|
24
|
-
range:
|
|
25
|
-
autoAxisPadding:
|
|
15
|
+
chartScaleType: any;
|
|
16
|
+
reverse: any;
|
|
17
|
+
beginAtZero: any;
|
|
18
|
+
stepSize: any;
|
|
19
|
+
suggestedMin: any;
|
|
20
|
+
suggestedMax: any;
|
|
21
|
+
range: any;
|
|
22
|
+
autoAxisPadding: any;
|
|
26
23
|
};
|
|
27
24
|
chartStyling: {
|
|
28
|
-
width: string | number
|
|
29
|
-
height: string | number
|
|
25
|
+
width: string | number;
|
|
26
|
+
height: string | number;
|
|
30
27
|
maintainAspectRatio: boolean;
|
|
31
28
|
staticChartHeight: boolean;
|
|
32
29
|
performanceMode: boolean;
|
|
33
|
-
squareAspectRatio:
|
|
34
|
-
layoutPadding:
|
|
35
|
-
top: number;
|
|
36
|
-
bottom: number;
|
|
37
|
-
left: number;
|
|
38
|
-
right: number;
|
|
39
|
-
};
|
|
30
|
+
squareAspectRatio: boolean;
|
|
31
|
+
layoutPadding: any;
|
|
40
32
|
};
|
|
41
33
|
tooltip: {
|
|
42
34
|
tooltips: boolean;
|
|
@@ -62,38 +54,38 @@ export declare const getDefaultProps: (props: ILineChartProps) => {
|
|
|
62
54
|
};
|
|
63
55
|
showAnnotations: boolean;
|
|
64
56
|
controlAnnotation: boolean;
|
|
65
|
-
annotationsData: import("
|
|
57
|
+
annotationsData: import("../../helpers/chart-interface").IChartAnnotationsData[];
|
|
66
58
|
};
|
|
67
59
|
legend: {
|
|
68
60
|
display: boolean;
|
|
69
|
-
position:
|
|
70
|
-
align:
|
|
71
|
-
customLegend: import("
|
|
61
|
+
position: "top" | "bottom" | "right";
|
|
62
|
+
align: "start" | "center" | "end";
|
|
63
|
+
customLegend: import("../../helpers/chart-interface").ICustomLegend;
|
|
72
64
|
usePointStyle: boolean;
|
|
73
65
|
};
|
|
74
66
|
chartOptions: {
|
|
75
67
|
showPoints: boolean;
|
|
76
|
-
enableZoom:
|
|
68
|
+
enableZoom: true;
|
|
77
69
|
enablePan: boolean;
|
|
78
70
|
showLine: boolean;
|
|
79
71
|
closeOnOutsideClick: boolean;
|
|
80
72
|
};
|
|
81
73
|
interactions: {
|
|
82
|
-
onLegendClick: (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
onAnimationComplete: (
|
|
74
|
+
onLegendClick: () => any;
|
|
75
|
+
onPointHover: () => any;
|
|
76
|
+
onPointUnhover: () => any;
|
|
77
|
+
onAnimationComplete: () => any;
|
|
86
78
|
};
|
|
79
|
+
depthType: import("./line-chart.interface").IDepthType;
|
|
87
80
|
dragData: {
|
|
88
81
|
enableDragData: boolean;
|
|
89
82
|
showTooltip: boolean;
|
|
90
83
|
roundPoints: boolean;
|
|
91
84
|
dragX: boolean;
|
|
92
85
|
dragY: boolean;
|
|
93
|
-
onDragStart: (
|
|
94
|
-
onDrag: (
|
|
95
|
-
onDragEnd: (
|
|
86
|
+
onDragStart: () => any;
|
|
87
|
+
onDrag: () => any;
|
|
88
|
+
onDragEnd: () => any;
|
|
96
89
|
};
|
|
97
|
-
depthType: import("./line-chart.interface").IDepthType;
|
|
98
90
|
};
|
|
99
91
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { LinearScaleOptions } from 'chart.js';
|
|
2
|
+
import { IChartAnnotations, IChartDraggableData, IChartInteractions, IChartLegend, IChartStyling } from '../../helpers/chart-interface';
|
|
3
|
+
export interface IChartOptions {
|
|
3
4
|
showPoints: boolean;
|
|
5
|
+
enableZoom: boolean;
|
|
6
|
+
enablePan: boolean;
|
|
4
7
|
closeOnOutsideClick: boolean;
|
|
5
8
|
showLine: boolean;
|
|
6
9
|
}
|
|
@@ -10,24 +13,26 @@ export interface ILineChartGraph {
|
|
|
10
13
|
showDataLabels: boolean;
|
|
11
14
|
showMinorGridlines: boolean;
|
|
12
15
|
}
|
|
13
|
-
export interface ILineChartTooltip
|
|
16
|
+
export interface ILineChartTooltip {
|
|
17
|
+
tooltips: boolean;
|
|
18
|
+
showLabelsInTooltips: boolean;
|
|
14
19
|
hideSimulationName: boolean;
|
|
15
20
|
}
|
|
16
|
-
export interface
|
|
21
|
+
export interface IChartRange {
|
|
17
22
|
min: number;
|
|
18
23
|
max: number;
|
|
19
24
|
}
|
|
20
|
-
export interface ILineRange {
|
|
21
|
-
[key: string]: ILineChartRange;
|
|
22
|
-
}
|
|
23
25
|
export interface ILineChartAdditionalAxesOptions {
|
|
24
26
|
chartScaleType: 'linear' | 'logarithmic';
|
|
25
27
|
reverse: boolean;
|
|
26
28
|
beginAtZero: boolean;
|
|
27
|
-
stepSize
|
|
28
|
-
suggestedMin
|
|
29
|
-
suggestedMax
|
|
30
|
-
range
|
|
29
|
+
stepSize: number;
|
|
30
|
+
suggestedMin: number;
|
|
31
|
+
suggestedMax: number;
|
|
32
|
+
range: {
|
|
33
|
+
x: IChartRange;
|
|
34
|
+
y: IChartRange;
|
|
35
|
+
};
|
|
31
36
|
autoAxisPadding: boolean;
|
|
32
37
|
}
|
|
33
38
|
export interface IUnitOptions {
|
|
@@ -38,69 +43,77 @@ export interface IUnitOptions {
|
|
|
38
43
|
export interface ILineChartAxis<PositionType> {
|
|
39
44
|
label: string;
|
|
40
45
|
position: PositionType;
|
|
41
|
-
color: string
|
|
46
|
+
color: string;
|
|
42
47
|
unit: IUnitOptions;
|
|
43
48
|
}
|
|
44
49
|
export interface ILineChartAxes {
|
|
45
50
|
x: ILineChartAxis<'top' | 'bottom'>[];
|
|
46
51
|
y: ILineChartAxis<'left' | 'right'>[];
|
|
47
|
-
|
|
52
|
+
}
|
|
53
|
+
export interface ILineScales {
|
|
54
|
+
x: LinearScaleOptions;
|
|
55
|
+
y: LinearScaleOptions;
|
|
48
56
|
}
|
|
49
57
|
export interface IDepthType {
|
|
50
58
|
options: string[];
|
|
51
59
|
selectedUnit: string;
|
|
52
60
|
setSelectedUnit: () => void;
|
|
53
61
|
}
|
|
54
|
-
export interface
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
export interface ILineChartOptions extends ICommonOptions {
|
|
71
|
-
title?: string | string[];
|
|
72
|
-
axes: ILineChartAxes;
|
|
73
|
-
scales: ICommonScales;
|
|
74
|
-
additionalAxesOptions: ILineChartAdditionalAxesOptions;
|
|
75
|
-
chartStyling: ILineChartStyling;
|
|
62
|
+
export interface IChartDragData {
|
|
63
|
+
enableDragData: boolean;
|
|
64
|
+
showTooltip: boolean;
|
|
65
|
+
roundPoints: boolean;
|
|
66
|
+
dragX: boolean;
|
|
67
|
+
dragY: boolean;
|
|
68
|
+
onDragStart: () => any;
|
|
69
|
+
onDrag: () => any;
|
|
70
|
+
onDragEnd: () => any;
|
|
71
|
+
}
|
|
72
|
+
export interface ILineChartOptions {
|
|
73
|
+
title: string | string[];
|
|
74
|
+
axes: any;
|
|
75
|
+
scales: any;
|
|
76
|
+
additionalAxesOptions: any;
|
|
77
|
+
chartStyling: IChartStyling;
|
|
76
78
|
tooltip: ILineChartTooltip;
|
|
77
79
|
graph: ILineChartGraph;
|
|
78
|
-
annotations:
|
|
79
|
-
legend:
|
|
80
|
-
chartOptions:
|
|
81
|
-
interactions:
|
|
82
|
-
dragData?: ICommonDragData;
|
|
80
|
+
annotations: IChartAnnotations;
|
|
81
|
+
legend: IChartLegend;
|
|
82
|
+
chartOptions: IChartOptions;
|
|
83
|
+
interactions: IChartInteractions;
|
|
83
84
|
depthType: IDepthType;
|
|
85
|
+
draggableData: IChartDraggableData;
|
|
86
|
+
dragData: IChartDragData;
|
|
84
87
|
}
|
|
85
|
-
export interface
|
|
88
|
+
export interface IDataPoint {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
label?: string[];
|
|
92
|
+
}
|
|
93
|
+
export interface ILineChartDataset {
|
|
94
|
+
label?: string;
|
|
86
95
|
lineTension?: number;
|
|
96
|
+
borderColor?: string;
|
|
87
97
|
pointBackgroundColor?: string;
|
|
98
|
+
backgroundColor?: string;
|
|
88
99
|
pointRadius?: number;
|
|
89
100
|
pointHoverRadius?: number;
|
|
90
101
|
pointHitRadius?: number;
|
|
102
|
+
borderWidth?: number;
|
|
91
103
|
fill?: boolean;
|
|
92
104
|
yAxisID?: string;
|
|
93
105
|
formation?: boolean;
|
|
94
|
-
|
|
95
|
-
pointStyle?: string;
|
|
106
|
+
data: IDataPoint[];
|
|
96
107
|
}
|
|
97
|
-
export interface ILineChartData
|
|
98
|
-
|
|
108
|
+
export interface ILineChartData {
|
|
109
|
+
testId: string | null;
|
|
110
|
+
data: {
|
|
111
|
+
labels?: string[];
|
|
99
112
|
datasets: ILineChartDataset[];
|
|
100
|
-
};
|
|
113
|
+
} | any;
|
|
101
114
|
options: ILineChartOptions;
|
|
102
|
-
persistenceId
|
|
103
|
-
controlsPortalId
|
|
115
|
+
persistenceId: string;
|
|
116
|
+
controlsPortalId: string | null;
|
|
104
117
|
}
|
|
105
118
|
export interface ILineChartProps {
|
|
106
119
|
chart: ILineChartData;
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import { Chart, ChartConfiguration, Plugin } from 'chart.js';
|
|
2
|
-
import { Position } from '../../common/helpers/enums';
|
|
3
|
-
interface CustomChartConfiguration extends ChartConfiguration {
|
|
4
|
-
showLabel?: boolean;
|
|
5
|
-
text: string;
|
|
6
|
-
fontSize: number;
|
|
7
|
-
xOffset: number;
|
|
8
|
-
yOffset: number;
|
|
9
|
-
lineHeight: number;
|
|
10
|
-
maxWidth: number;
|
|
11
|
-
position: Position;
|
|
12
|
-
}
|
|
13
1
|
export declare const chartAreaTextPlugin: {
|
|
14
2
|
id: string;
|
|
15
|
-
beforeDraw: (chart:
|
|
3
|
+
beforeDraw: (chart: any, _args: any, options: any) => void;
|
|
16
4
|
};
|
|
17
|
-
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const getMinorTickPositions: (majorTickPositions: number[], scale: Scale) => number[];
|
|
1
|
+
export declare const getLargestMajorTickWidth: (majorTickPositions: any) => any;
|
|
2
|
+
export declare const isValidPosition: (minorTickPosition: any, majorTickPositions: any, scale: any) => boolean;
|
|
3
|
+
export declare const getMinorTickPositions: (majorTickPositions: Array<number>, scale: any) => number[];
|
|
5
4
|
export declare const chartMinorGridlinesPlugin: {
|
|
6
5
|
id: string;
|
|
7
|
-
beforeDatasetsDraw: (chart:
|
|
6
|
+
beforeDatasetsDraw: (chart: any) => void;
|
|
8
7
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Position } from '
|
|
1
|
+
import { Position } from '../../../helpers/enums';
|
|
2
2
|
export interface IDrawText {
|
|
3
3
|
ctx: CanvasRenderingContext2D;
|
|
4
4
|
lines: Array<string>;
|
|
5
5
|
lineHeight: number;
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
8
|
-
position: Position;
|
|
8
|
+
position: typeof Position;
|
|
9
9
|
}
|
|
@@ -1,34 +1,16 @@
|
|
|
1
|
-
import { ILChartOptions, ILineChartAdditionalAxesOptions, ILineChartAxes, ILineLegend } from '../line-chart.interface';
|
|
2
|
-
import { ICommonAnnotations, ICommonDragData } from '../../common/common.interface';
|
|
3
|
-
interface inputInitState {
|
|
4
|
-
options: {
|
|
5
|
-
additionalAxesOptions: ILineChartAdditionalAxesOptions;
|
|
6
|
-
annotations: ICommonAnnotations;
|
|
7
|
-
axes: ILineChartAxes;
|
|
8
|
-
chartOptions: ILChartOptions;
|
|
9
|
-
legend: ILineLegend;
|
|
10
|
-
dragData: ICommonDragData;
|
|
11
|
-
};
|
|
12
|
-
persistenceId?: string;
|
|
13
|
-
}
|
|
14
1
|
/**
|
|
15
2
|
Initial chart state for the line chart.
|
|
16
3
|
|
|
17
4
|
@param {Object} options - The chart options.
|
|
18
5
|
@return {Object} The initial chart state.
|
|
19
6
|
*/
|
|
20
|
-
declare const initialState: ({ options, persistenceId }:
|
|
7
|
+
declare const initialState: ({ options, persistenceId }: any) => {
|
|
21
8
|
zoomEnabled: any;
|
|
22
9
|
panEnabled: any;
|
|
23
10
|
pointsEnabled: any;
|
|
24
11
|
lineEnabled: any;
|
|
25
12
|
legendEnabled: any;
|
|
26
|
-
axes:
|
|
27
|
-
unit?: import("../line-chart.interface").IUnitOptions | undefined;
|
|
28
|
-
max?: number | undefined;
|
|
29
|
-
min?: number | undefined;
|
|
30
|
-
id: string;
|
|
31
|
-
}[];
|
|
13
|
+
axes: any[];
|
|
32
14
|
showAnnotationLineIndex: number[];
|
|
33
15
|
showTable: boolean;
|
|
34
16
|
enableDragPoints: any;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const reducer: (state: IState, action: IAction) => IState;
|
|
1
|
+
export declare const reducer: (state: any, action: any) => (base?: ((draft: any) => void) | undefined, ...args: unknown[]) => (draft: any) => void;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { IState } from './state.interfaces';
|
|
2
1
|
/**
|
|
3
2
|
* Retrieves the chart state from local storage.
|
|
4
3
|
*
|
|
5
4
|
* @param {string|''} persistenceId - The chart persistenceId.
|
|
6
5
|
* @returns {object|null} The chart state object or null if not found.
|
|
7
6
|
*/
|
|
8
|
-
export declare const getChartStateFromStorage: (persistenceId
|
|
7
|
+
export declare const getChartStateFromStorage: (persistenceId: string) => any;
|
|
9
8
|
/**
|
|
10
9
|
* Stores the chart state in local storage.
|
|
11
10
|
*
|
|
12
11
|
* @param {object} state - The chart state object to store.
|
|
13
12
|
* @param {string|''} persistenceId - The chart persistenceId.
|
|
14
13
|
*/
|
|
15
|
-
export declare const storeChartStateInStorage: (state:
|
|
14
|
+
export declare const storeChartStateInStorage: (state: any, persistenceId: string) => void;
|
|
@@ -1,33 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
axisType?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface InitialState {
|
|
11
|
-
zoomEnabled: boolean;
|
|
12
|
-
panEnabled: boolean;
|
|
13
|
-
pointsEnabled: boolean;
|
|
14
|
-
lineEnabled: boolean;
|
|
15
|
-
legendEnabled: boolean;
|
|
16
|
-
axes: IAxisState[];
|
|
17
|
-
showAnnotationLineIndex?: number[];
|
|
18
|
-
showTable: boolean;
|
|
19
|
-
enableDragPoints: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface IInitAxisRange {
|
|
22
|
-
id: string;
|
|
23
|
-
min: number;
|
|
24
|
-
max: number;
|
|
25
|
-
unit?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface IState extends InitialState {
|
|
28
|
-
initialAxesRanges: IInitAxisRange[];
|
|
29
|
-
}
|
|
30
|
-
export interface IAction<T = string, P = any> {
|
|
31
|
-
type: T;
|
|
32
|
-
payload?: P;
|
|
1
|
+
export interface IUseChartState {
|
|
2
|
+
chartRef: any;
|
|
3
|
+
options: any;
|
|
4
|
+
state: any;
|
|
5
|
+
generatedDatasets: Array<any>;
|
|
6
|
+
dispatch: () => void;
|
|
7
|
+
persistenceId: any;
|
|
33
8
|
}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Chart } from 'chart.js';
|
|
3
|
-
import { IState } from '../state/state.interfaces';
|
|
4
|
-
import { ILineChartDataset, ILineChartOptions } from '../line-chart.interface';
|
|
5
|
-
interface IUseChartState {
|
|
6
|
-
chartRef: RefObject<Chart>;
|
|
7
|
-
options: ILineChartOptions;
|
|
8
|
-
state: IState;
|
|
9
|
-
generatedDatasets: ILineChartDataset[];
|
|
10
|
-
dispatch: Dispatch<any>;
|
|
11
|
-
persistenceId?: string;
|
|
12
|
-
}
|
|
1
|
+
import { IUseChartState } from './state.interfaces';
|
|
13
2
|
/**
|
|
14
3
|
* Hook for managing the state of the chart.
|
|
15
4
|
*
|
|
@@ -21,4 +10,3 @@ interface IUseChartState {
|
|
|
21
10
|
* @param persistenceId - The chart persistenceId.
|
|
22
11
|
*/
|
|
23
12
|
export declare const useChartState: ({ chartRef, options, state, generatedDatasets, dispatch, persistenceId, }: IUseChartState) => void;
|
|
24
|
-
export {};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { IState } from '../state/state.interfaces';
|
|
2
|
-
import { ILineChartOptions } from '../line-chart.interface';
|
|
3
1
|
/**
|
|
4
2
|
* Generates line chart datasets based on the provided datasets, state, and options.
|
|
5
3
|
*
|
|
@@ -9,4 +7,4 @@ import { ILineChartOptions } from '../line-chart.interface';
|
|
|
9
7
|
* @param {Object} translations - The getTranslations object with the label property
|
|
10
8
|
* @returns {Array} - The generated line chart datasets with applied settings and configurations.
|
|
11
9
|
*/
|
|
12
|
-
export declare const generateLineChartDatasets: (datasets: Array<any>, state:
|
|
10
|
+
export declare const generateLineChartDatasets: (datasets: Array<any>, state: any, options: any, { label }: any) => any[];
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { IInitAxisRange } from '../state/state.interfaces';
|
|
4
|
-
interface IAxes {
|
|
5
|
-
[key: string]: IInitAxisRange[];
|
|
6
|
-
}
|
|
7
|
-
export declare const getAxesRangesFromChart: (chartRef: RefObject<Chart>, axes: IAxes) => {
|
|
8
|
-
unit?: string | undefined;
|
|
1
|
+
export declare const getAxesRangesFromChart: (chartRef: any, axes: any) => {
|
|
2
|
+
unit?: any;
|
|
9
3
|
id: any;
|
|
10
4
|
min: any;
|
|
11
5
|
max: any;
|
|
12
6
|
}[];
|
|
13
|
-
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TooltipItem } from 'chart.js';
|
|
2
1
|
import { ILineChartOptions } from '../line-chart.interface';
|
|
3
2
|
/**
|
|
4
3
|
* adjusts the position of the label depends on chart area
|
|
@@ -8,8 +7,8 @@ import { ILineChartOptions } from '../line-chart.interface';
|
|
|
8
7
|
*/
|
|
9
8
|
declare const getLineChartDataLabels: (options: ILineChartOptions) => {
|
|
10
9
|
display: string;
|
|
11
|
-
align: (context: any) => import("
|
|
12
|
-
formatter: (_value: any, context:
|
|
10
|
+
align: (context: any) => import("../../../helpers/enums").AlignOptions.End | import("../../../helpers/enums").AlignOptions.Start | import("../../../helpers/enums").AlignOptions.Right | import("../../../helpers/enums").AlignOptions.Left;
|
|
11
|
+
formatter: (_value: any, context: any) => any;
|
|
13
12
|
} | {
|
|
14
13
|
display: boolean;
|
|
15
14
|
align?: undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IState } from '../state/state.interfaces';
|
|
2
1
|
import { ILineChartOptions } from '../line-chart.interface';
|
|
2
|
+
import { IInitialState } from '../../../helpers/chart-interface';
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
|
-
* @param {ILineChartOptions} options - line chart options object
|
|
6
|
-
* @param {
|
|
5
|
+
* @param {import('../line-chart.interface').ILineChartOptions} options - line chart options object
|
|
6
|
+
* @param {import('../../../helpers/chart-interface').IInitialState} state - chart state object controlled by useReducer or similar
|
|
7
7
|
*/
|
|
8
|
-
declare const getLineChartScales: (options: ILineChartOptions, state:
|
|
8
|
+
declare const getLineChartScales: (options: ILineChartOptions, state: IInitialState) => any;
|
|
9
9
|
export default getLineChartScales;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChartHoverMode } from '
|
|
1
|
+
import { ChartHoverMode } from '../../../helpers/enums';
|
|
2
2
|
import { ILineChartOptions } from '../line-chart.interface';
|
|
3
3
|
export declare const getUnitsFromLabel: (label: string) => string;
|
|
4
4
|
/**
|
|
@@ -16,7 +16,7 @@ declare const getLineChartToolTips: (options: ILineChartOptions) => {
|
|
|
16
16
|
callbacks: {
|
|
17
17
|
title: (tooltipItem: any, _data: any) => string;
|
|
18
18
|
label: (tooltipItem: any) => string;
|
|
19
|
-
afterLabel: (tooltipItem:
|
|
19
|
+
afterLabel: (tooltipItem: any) => string;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
export default getLineChartToolTips;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { defaultTranslations } from '../../constants/default-translations';
|
|
2
1
|
/**
|
|
3
2
|
* Merges custom getTranslations with the default getTranslations.
|
|
4
3
|
* If a custom translation is provided for a key, it will override the default one.
|
|
5
4
|
* @param {object} translations - Custom getTranslations.
|
|
6
5
|
* @returns {object} - The resulting getTranslations object, containing both default and custom getTranslations.
|
|
7
6
|
*/
|
|
8
|
-
export declare const getTranslations: (translations?:
|
|
7
|
+
export declare const getTranslations: (translations?: any) => {};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { IPieChartProps } from './pie-chart.interface';
|
|
2
|
-
import { AlignOptions, Position } from '../common/helpers/enums';
|
|
3
2
|
export declare const getDefaultProps: (props: IPieChartProps) => {
|
|
4
3
|
testId: string | null;
|
|
5
|
-
data:
|
|
6
|
-
labels: string[];
|
|
7
|
-
datasets: import("./pie-chart.interface").IPieChartDataset[];
|
|
8
|
-
};
|
|
4
|
+
data: import("./pie-chart.interface").IChartData;
|
|
9
5
|
options: {
|
|
10
6
|
title: string | string[];
|
|
11
7
|
chartStyling: {
|
|
12
|
-
width: string | number
|
|
13
|
-
height: string | number
|
|
8
|
+
width: string | number;
|
|
9
|
+
height: string | number;
|
|
14
10
|
maintainAspectRatio: boolean;
|
|
15
11
|
staticChartHeight: boolean;
|
|
16
12
|
performanceMode: boolean;
|
|
@@ -27,17 +23,17 @@ export declare const getDefaultProps: (props: IPieChartProps) => {
|
|
|
27
23
|
legend: {
|
|
28
24
|
display: boolean;
|
|
29
25
|
useDataset: boolean;
|
|
30
|
-
position:
|
|
31
|
-
align:
|
|
26
|
+
position: "top" | "bottom" | "right";
|
|
27
|
+
align: "start" | "center" | "end";
|
|
32
28
|
};
|
|
33
29
|
chartOptions: {
|
|
34
30
|
enableZoom: boolean;
|
|
35
31
|
enablePan: boolean;
|
|
36
32
|
};
|
|
37
33
|
interactions: {
|
|
38
|
-
onLegendClick: (
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
onLegendClick: (legendItem: string, hidden: boolean) => any;
|
|
35
|
+
onPieHover: (evt: Event, datasetIndex: string | number, index: string | number, generatedDataset: any) => any;
|
|
36
|
+
onPieUnhover: (evt: Event) => any;
|
|
41
37
|
};
|
|
42
38
|
};
|
|
43
39
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IPieChartProps } from './pie-chart.interface';
|
|
2
2
|
/**
|
|
3
3
|
* this is a pie chart component
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {} props
|
|
5
|
+
* @param {import('./pie-chart.interface').IPieChartProps} IPieChartProps
|
|
5
6
|
* ./pie-chart.interface
|
|
6
7
|
*/
|
|
7
8
|
declare const PieChart: (props: IPieChartProps) => JSX.Element;
|