@oliasoft-open-source/charts-library 3.4.6 → 3.4.7-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 +2 -0
- package/dist/index.js +658 -611
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/bar-chart-default-props.d.ts +30 -26
- package/dist/src/components/bar-chart/bar-chart.interface.d.ts +37 -70
- package/dist/src/components/bar-chart/get-bar-chart-data-labels.d.ts +11 -14
- package/dist/src/components/bar-chart/get-bar-chart-scales.d.ts +3 -2
- package/dist/src/components/bar-chart/get-bar-chart-tooltips.d.ts +3 -16
- package/dist/src/components/common/common.interface.d.ts +139 -0
- package/dist/src/components/common/helpers/chart-border-plugin.d.ts +8 -0
- package/dist/src/{helpers → components/common/helpers}/enums.d.ts +2 -1
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +27 -0
- package/dist/src/components/common/helpers/get-draggableData.d.ts +18 -0
- package/dist/src/{helpers → components/common/helpers}/range/range.d.ts +6 -6
- package/dist/src/components/line-chart/controls/axes-options/axes-options-form-state.d.ts +8 -3
- package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +52 -0
- package/dist/src/components/{controls → line-chart/controls}/axes-options/axes-options.d.ts +1 -1
- package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +18 -32
- package/dist/src/components/line-chart/controls/controls-portal.d.ts +6 -1
- 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 +9 -1
- package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +28 -6
- package/dist/src/components/line-chart/{state → hooks}/use-chart-state.d.ts +13 -1
- package/dist/src/components/line-chart/hooks/use-toggle-handler.d.ts +2 -1
- package/dist/src/components/line-chart/initialize/config.d.ts +2 -2
- package/dist/src/components/line-chart/legend/legend-interface.d.ts +24 -18
- 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 +38 -30
- package/dist/src/components/line-chart/line-chart.interface.d.ts +48 -61
- package/dist/src/components/line-chart/plugins/chart-area-text-plugin.d.ts +14 -1
- package/dist/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.d.ts +5 -4
- package/dist/src/components/line-chart/plugins/plugins.interface.d.ts +2 -2
- package/dist/src/components/line-chart/state/initial-state.d.ts +20 -2
- package/dist/src/components/line-chart/state/line-chart-reducer.d.ts +2 -1
- package/dist/src/components/line-chart/state/manage-state-in-local-storage.d.ts +3 -2
- package/dist/src/components/line-chart/state/state.interfaces.d.ts +32 -7
- 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 +3 -1
- package/dist/src/components/line-chart/utils/get-axes-ranges-from-chart.d.ts +9 -2
- package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +3 -2
- 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 +2 -1
- package/dist/src/components/pie-chart/pie-chart-get-default-props.d.ts +12 -8
- package/dist/src/components/pie-chart/pie-chart.d.ts +1 -2
- package/dist/src/components/pie-chart/pie-chart.interface.d.ts +52 -51
- package/dist/src/components/scatter-chart/scatter-chart.d.ts +1 -1
- package/dist/src/components/scatter-chart/scatter-chart.intefrace.d.ts +6 -16
- package/package.json +1 -1
- package/dist/src/components/controls/axes-options/axes-options-interfaces.d.ts +0 -19
- package/dist/src/components/line-chart/hooks/hooks.interface.d.ts +0 -13
- package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +0 -37
- package/dist/src/components/pie-chart/pie-chart-utils.d.ts +0 -2
- package/dist/src/helpers/chart-border-plugin.d.ts +0 -7
- package/dist/src/helpers/chart-interface.d.ts +0 -85
- package/dist/src/helpers/get-chart-annotation.d.ts +0 -12
- package/dist/src/helpers/get-draggableData.d.ts +0 -18
- /package/dist/src/{helpers → components/common/helpers}/chart-consts.d.ts +0 -0
- /package/dist/src/{helpers → components/common/helpers}/range/estimate-data-series-have-close-values.d.ts +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export interface IDragOptions {
|
|
2
|
-
onTogglePan: () =>
|
|
3
|
-
onToggleZoom: () =>
|
|
2
|
+
onTogglePan: () => void;
|
|
3
|
+
onToggleZoom: () => void;
|
|
4
4
|
panEnabled: boolean;
|
|
5
5
|
zoomEnabled: boolean;
|
|
6
6
|
enableDragPoints: boolean;
|
|
7
7
|
isDragDataAllowed: boolean;
|
|
8
|
-
onToggleDragPoints: () =>
|
|
9
|
-
onDisableDragOptions: () =>
|
|
10
|
-
translations:
|
|
8
|
+
onToggleDragPoints: () => void;
|
|
9
|
+
onDisableDragOptions: () => void;
|
|
10
|
+
translations: Record<string, string>;
|
|
11
11
|
}
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
interface ILineOptions {
|
|
2
|
+
lineEnabled: boolean;
|
|
3
|
+
onToggleLine: () => void;
|
|
4
|
+
onTogglePoints: () => void;
|
|
5
|
+
pointsEnabled: boolean;
|
|
6
|
+
translations: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export declare const LineOptions: ({ lineEnabled, onToggleLine, onTogglePoints, pointsEnabled, translations, }: ILineOptions) => JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dispatch, RefObject } from 'react';
|
|
2
|
+
import { Chart, ChartEvent } from 'chart.js';
|
|
3
|
+
import { ICommonHoveredItems } from '../../common/common.interface';
|
|
4
|
+
import { ILineChartDataset, ILineChartOptions } from '../line-chart.interface';
|
|
5
|
+
import { IState } from '../state/state.interfaces';
|
|
6
|
+
interface IUseChartFunctions {
|
|
7
|
+
chartRef: RefObject<Chart>;
|
|
8
|
+
state: IState;
|
|
9
|
+
options: ILineChartOptions;
|
|
10
|
+
dispatch: Dispatch<any>;
|
|
11
|
+
generatedDatasets: ILineChartDataset[];
|
|
12
|
+
}
|
|
2
13
|
/**
|
|
3
14
|
* Custom hook that encapsulates the chart-related functions and their dependencies
|
|
4
15
|
* @param {Object} chartRef - Chart reference
|
|
@@ -8,16 +19,27 @@ import { IHooksInterface } from './hooks.interface';
|
|
|
8
19
|
* @param {Array} generatedDatasets - Chart datasets
|
|
9
20
|
* @returns {Object} An object containing the chart-related functions
|
|
10
21
|
*/
|
|
11
|
-
export declare const useChartFunctions: ({ chartRef, state, options, dispatch, generatedDatasets, }:
|
|
12
|
-
legendClick: (
|
|
22
|
+
export declare const useChartFunctions: ({ chartRef, state, options, dispatch, generatedDatasets, }: IUseChartFunctions) => {
|
|
23
|
+
legendClick: (_e: ChartEvent, legendItem: any) => void;
|
|
13
24
|
resetZoom: () => void;
|
|
14
|
-
onHover: (hoveredPoint: any, setHoveredPoint: any) => (evt:
|
|
25
|
+
onHover: (hoveredPoint: any, setHoveredPoint: any) => (evt: ChartEvent, hoveredItems: ICommonHoveredItems[]) => void;
|
|
15
26
|
handleDownload: () => void;
|
|
16
27
|
handleKeyDown: (evt: any) => void;
|
|
17
28
|
handleKeyUp: (evt: any) => void;
|
|
18
|
-
controlsAxes:
|
|
19
|
-
|
|
29
|
+
controlsAxes: {
|
|
30
|
+
max?: number | undefined;
|
|
31
|
+
min?: number | undefined;
|
|
32
|
+
id?: string | undefined;
|
|
33
|
+
label?: string | undefined;
|
|
34
|
+
unit?: string | import("../line-chart.interface").IUnitOptions | undefined;
|
|
35
|
+
axisType?: string | undefined;
|
|
36
|
+
}[];
|
|
37
|
+
controlsAxesLabels: {
|
|
38
|
+
id: string;
|
|
39
|
+
label: string;
|
|
40
|
+
}[];
|
|
20
41
|
updateAxesRangesFromChart: () => void;
|
|
21
42
|
onResetAxes: () => void;
|
|
22
43
|
onUpdateAxes: ({ axes }: any) => void;
|
|
23
44
|
};
|
|
45
|
+
export {};
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dispatch, RefObject } from 'react';
|
|
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
|
+
}
|
|
2
13
|
/**
|
|
3
14
|
* Hook for managing the state of the chart.
|
|
4
15
|
*
|
|
@@ -10,3 +21,4 @@ import { IUseChartState } from './state.interfaces';
|
|
|
10
21
|
* @param persistenceId - The chart persistenceId.
|
|
11
22
|
*/
|
|
12
23
|
export declare const useChartState: ({ chartRef, options, state, generatedDatasets, dispatch, persistenceId, }: IUseChartState) => void;
|
|
24
|
+
export {};
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @param {string} key - The key to access the corresponding value in the config object.
|
|
4
4
|
* @returns {*} - The value associated with the given key in the config object or config.
|
|
5
5
|
*/
|
|
6
|
-
export declare const getConfig: any;
|
|
6
|
+
export declare const getConfig: (key?: string) => any;
|
|
7
7
|
/**
|
|
8
8
|
* Set a new value for the given key in the config object.
|
|
9
9
|
* @param {string} key - The key to access the corresponding value in the config object.
|
|
10
10
|
* @param {*} newValue - The new value to be set for the given key.
|
|
11
11
|
*/
|
|
12
|
-
export declare const setConfig: (key: string, newValue:
|
|
12
|
+
export declare const setConfig: (key: string, newValue: string | Record<string, string>) => void;
|
|
@@ -1,31 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dispatch, MouseEventHandler, RefObject } from 'react';
|
|
2
|
+
import { Chart, ChartArea } from 'chart.js';
|
|
3
|
+
import { IState } from '../state/state.interfaces';
|
|
4
|
+
import { ILineChartDataset, ILineChartOptions } from '../line-chart.interface';
|
|
5
|
+
import { Position } from '../../common/helpers/enums';
|
|
2
6
|
export interface ILegendDropZone {
|
|
3
|
-
position:
|
|
4
|
-
onDrop: () =>
|
|
5
|
-
placeholderSize
|
|
7
|
+
position: Position;
|
|
8
|
+
onDrop: () => void;
|
|
9
|
+
placeholderSize?: {
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
};
|
|
6
13
|
}
|
|
7
14
|
export interface ILegendDropZones {
|
|
8
|
-
chartArea:
|
|
15
|
+
chartArea: ChartArea;
|
|
9
16
|
setLegendPosition: (position: Position) => void;
|
|
10
|
-
isDragging:
|
|
11
|
-
placeholderSize
|
|
12
|
-
width
|
|
13
|
-
height
|
|
17
|
+
isDragging: boolean;
|
|
18
|
+
placeholderSize?: {
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
14
21
|
};
|
|
15
22
|
}
|
|
16
23
|
export interface ILegendItem {
|
|
17
24
|
hidden: boolean;
|
|
18
|
-
dataset:
|
|
19
|
-
handleClick:
|
|
25
|
+
dataset: ILineChartDataset;
|
|
26
|
+
handleClick: MouseEventHandler<HTMLDivElement>;
|
|
20
27
|
}
|
|
21
28
|
export interface ILegend {
|
|
22
|
-
chartRef:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
generatedDatasets: any;
|
|
29
|
+
chartRef: RefObject<Chart>;
|
|
30
|
+
state: IState;
|
|
31
|
+
options: ILineChartOptions;
|
|
32
|
+
dispatch: Dispatch<any>;
|
|
33
|
+
generatedDatasets: ILineChartDataset[];
|
|
34
|
+
translations: Record<string, string>;
|
|
29
35
|
}
|
|
30
36
|
export interface ILegendPanel extends ILegend {
|
|
31
37
|
legendPosition: Position;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ILegendPanel } from './legend-interface';
|
|
3
|
-
declare const LegendPanel:
|
|
3
|
+
declare const LegendPanel: import("react").ForwardRefExoticComponent<ILegendPanel & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export default LegendPanel;
|
|
@@ -1,34 +1,42 @@
|
|
|
1
1
|
import { ILineChartProps } from './line-chart.interface';
|
|
2
|
+
import { AlignOptions, Position } from '../common/helpers/enums';
|
|
2
3
|
export declare const getDefaultProps: (props: ILineChartProps) => {
|
|
3
4
|
persistenceId: string;
|
|
4
|
-
controlsPortalId: string
|
|
5
|
+
controlsPortalId: string;
|
|
5
6
|
testId: string | null;
|
|
6
|
-
data:
|
|
7
|
+
data: {
|
|
8
|
+
datasets: import("./line-chart.interface").ILineChartDataset[];
|
|
9
|
+
} | undefined;
|
|
7
10
|
options: {
|
|
8
11
|
title: string | string[];
|
|
9
|
-
scales:
|
|
12
|
+
scales: import("../common/common.interface").ICommonScales;
|
|
10
13
|
axes: {
|
|
11
|
-
x:
|
|
12
|
-
y:
|
|
14
|
+
x: import("./line-chart.interface").ILineChartAxis<"top" | "bottom">[];
|
|
15
|
+
y: import("./line-chart.interface").ILineChartAxis<"left" | "right">[];
|
|
13
16
|
};
|
|
14
17
|
additionalAxesOptions: {
|
|
15
|
-
chartScaleType:
|
|
16
|
-
reverse:
|
|
17
|
-
beginAtZero:
|
|
18
|
-
stepSize:
|
|
19
|
-
suggestedMin:
|
|
20
|
-
suggestedMax:
|
|
21
|
-
range:
|
|
22
|
-
autoAxisPadding:
|
|
18
|
+
chartScaleType: "linear" | "logarithmic";
|
|
19
|
+
reverse: boolean;
|
|
20
|
+
beginAtZero: boolean;
|
|
21
|
+
stepSize: number | undefined;
|
|
22
|
+
suggestedMin: number | undefined;
|
|
23
|
+
suggestedMax: number | undefined;
|
|
24
|
+
range: import("./line-chart.interface").ILineRange;
|
|
25
|
+
autoAxisPadding: boolean;
|
|
23
26
|
};
|
|
24
27
|
chartStyling: {
|
|
25
|
-
width: string | number;
|
|
26
|
-
height: string | number;
|
|
28
|
+
width: string | number | undefined;
|
|
29
|
+
height: string | number | undefined;
|
|
27
30
|
maintainAspectRatio: boolean;
|
|
28
31
|
staticChartHeight: boolean;
|
|
29
32
|
performanceMode: boolean;
|
|
30
|
-
squareAspectRatio:
|
|
31
|
-
layoutPadding:
|
|
33
|
+
squareAspectRatio: number | undefined;
|
|
34
|
+
layoutPadding: string | number | {
|
|
35
|
+
top: number;
|
|
36
|
+
bottom: number;
|
|
37
|
+
left: number;
|
|
38
|
+
right: number;
|
|
39
|
+
};
|
|
32
40
|
};
|
|
33
41
|
tooltip: {
|
|
34
42
|
tooltips: boolean;
|
|
@@ -54,38 +62,38 @@ export declare const getDefaultProps: (props: ILineChartProps) => {
|
|
|
54
62
|
};
|
|
55
63
|
showAnnotations: boolean;
|
|
56
64
|
controlAnnotation: boolean;
|
|
57
|
-
annotationsData: import("
|
|
65
|
+
annotationsData: import("../common/common.interface").ICommonAnnotationsData[];
|
|
58
66
|
};
|
|
59
67
|
legend: {
|
|
60
68
|
display: boolean;
|
|
61
|
-
position:
|
|
62
|
-
align:
|
|
63
|
-
customLegend: import("
|
|
69
|
+
position: Position;
|
|
70
|
+
align: AlignOptions;
|
|
71
|
+
customLegend: import("../common/common.interface").ICommonCustomLegend<any>;
|
|
64
72
|
usePointStyle: boolean;
|
|
65
73
|
};
|
|
66
74
|
chartOptions: {
|
|
67
75
|
showPoints: boolean;
|
|
68
|
-
enableZoom:
|
|
76
|
+
enableZoom: boolean;
|
|
69
77
|
enablePan: boolean;
|
|
70
78
|
showLine: boolean;
|
|
71
79
|
closeOnOutsideClick: boolean;
|
|
72
80
|
};
|
|
73
81
|
interactions: {
|
|
74
|
-
onLegendClick: () =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
onAnimationComplete: () =>
|
|
82
|
+
onLegendClick: ((text: string, hidden: boolean) => void) | undefined;
|
|
83
|
+
onHover: ((event?: import("chart.js").ChartEvent | undefined, datasetIndex?: number | undefined, index?: number | undefined, generatedDataset?: any[] | undefined) => void) | undefined;
|
|
84
|
+
onUnhover: ((event?: import("chart.js").ChartEvent | undefined, datasetIndex?: number | undefined, index?: number | undefined, generatedDataset?: any[] | undefined) => void) | undefined;
|
|
85
|
+
onAnimationComplete: (() => void) | undefined;
|
|
78
86
|
};
|
|
79
|
-
depthType: import("./line-chart.interface").IDepthType;
|
|
80
87
|
dragData: {
|
|
81
88
|
enableDragData: boolean;
|
|
82
89
|
showTooltip: boolean;
|
|
83
90
|
roundPoints: boolean;
|
|
84
91
|
dragX: boolean;
|
|
85
92
|
dragY: boolean;
|
|
86
|
-
onDragStart: () =>
|
|
87
|
-
onDrag: () =>
|
|
88
|
-
onDragEnd: () =>
|
|
93
|
+
onDragStart: (() => void) | undefined;
|
|
94
|
+
onDrag: (() => void) | undefined;
|
|
95
|
+
onDragEnd: (() => void) | undefined;
|
|
89
96
|
};
|
|
97
|
+
depthType: import("./line-chart.interface").IDepthType;
|
|
90
98
|
};
|
|
91
99
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface IChartOptions {
|
|
1
|
+
import { ICommonAnnotations, ICommonChartOptions, ICommonCustomLegend, ICommonData, ICommonDataset, ICommonDragData, ICommonInteractions, ICommonLegend, ICommonOptions, ICommonScales, ICommonStyling, ICommonTooltip } from '../common/common.interface';
|
|
2
|
+
export interface ILChartOptions extends ICommonChartOptions {
|
|
4
3
|
showPoints: boolean;
|
|
5
|
-
enableZoom: boolean;
|
|
6
|
-
enablePan: boolean;
|
|
7
4
|
closeOnOutsideClick: boolean;
|
|
8
5
|
showLine: boolean;
|
|
9
6
|
}
|
|
@@ -13,26 +10,24 @@ export interface ILineChartGraph {
|
|
|
13
10
|
showDataLabels: boolean;
|
|
14
11
|
showMinorGridlines: boolean;
|
|
15
12
|
}
|
|
16
|
-
export interface ILineChartTooltip {
|
|
17
|
-
tooltips: boolean;
|
|
18
|
-
showLabelsInTooltips: boolean;
|
|
13
|
+
export interface ILineChartTooltip extends ICommonTooltip {
|
|
19
14
|
hideSimulationName: boolean;
|
|
20
15
|
}
|
|
21
|
-
export interface
|
|
16
|
+
export interface ILineChartRange {
|
|
22
17
|
min: number;
|
|
23
18
|
max: number;
|
|
24
19
|
}
|
|
20
|
+
export interface ILineRange {
|
|
21
|
+
[key: string]: ILineChartRange;
|
|
22
|
+
}
|
|
25
23
|
export interface ILineChartAdditionalAxesOptions {
|
|
26
24
|
chartScaleType: 'linear' | 'logarithmic';
|
|
27
25
|
reverse: boolean;
|
|
28
26
|
beginAtZero: boolean;
|
|
29
|
-
stepSize
|
|
30
|
-
suggestedMin
|
|
31
|
-
suggestedMax
|
|
32
|
-
range
|
|
33
|
-
x: IChartRange;
|
|
34
|
-
y: IChartRange;
|
|
35
|
-
};
|
|
27
|
+
stepSize?: number;
|
|
28
|
+
suggestedMin?: number;
|
|
29
|
+
suggestedMax?: number;
|
|
30
|
+
range?: ILineRange;
|
|
36
31
|
autoAxisPadding: boolean;
|
|
37
32
|
}
|
|
38
33
|
export interface IUnitOptions {
|
|
@@ -43,77 +38,69 @@ export interface IUnitOptions {
|
|
|
43
38
|
export interface ILineChartAxis<PositionType> {
|
|
44
39
|
label: string;
|
|
45
40
|
position: PositionType;
|
|
46
|
-
color: string;
|
|
41
|
+
color: string | string[];
|
|
47
42
|
unit: IUnitOptions;
|
|
48
43
|
}
|
|
49
44
|
export interface ILineChartAxes {
|
|
50
45
|
x: ILineChartAxis<'top' | 'bottom'>[];
|
|
51
46
|
y: ILineChartAxis<'left' | 'right'>[];
|
|
52
|
-
|
|
53
|
-
export interface ILineScales {
|
|
54
|
-
x: LinearScaleOptions;
|
|
55
|
-
y: LinearScaleOptions;
|
|
47
|
+
[key: string]: ILineChartAxis<any>[];
|
|
56
48
|
}
|
|
57
49
|
export interface IDepthType {
|
|
58
50
|
options: string[];
|
|
59
51
|
selectedUnit: string;
|
|
60
52
|
setSelectedUnit: () => void;
|
|
61
53
|
}
|
|
62
|
-
export interface
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
54
|
+
export interface ILineChartStyling extends ICommonStyling {
|
|
55
|
+
squareAspectRatio?: number;
|
|
56
|
+
layoutPadding?: string | number | {
|
|
57
|
+
top: number;
|
|
58
|
+
bottom: number;
|
|
59
|
+
left: number;
|
|
60
|
+
right: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface ILineInteractions extends ICommonInteractions {
|
|
64
|
+
onAnimationComplete?: () => void;
|
|
65
|
+
}
|
|
66
|
+
export interface ILineLegend extends ICommonLegend {
|
|
67
|
+
customLegend?: ICommonCustomLegend<any>;
|
|
68
|
+
usePointStyle?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface ILineChartOptions extends ICommonOptions {
|
|
71
|
+
title?: string | string[];
|
|
72
|
+
axes: ILineChartAxes;
|
|
73
|
+
scales: ICommonScales;
|
|
74
|
+
additionalAxesOptions: ILineChartAdditionalAxesOptions;
|
|
75
|
+
chartStyling: ILineChartStyling;
|
|
78
76
|
tooltip: ILineChartTooltip;
|
|
79
77
|
graph: ILineChartGraph;
|
|
80
|
-
annotations:
|
|
81
|
-
legend:
|
|
82
|
-
chartOptions:
|
|
83
|
-
interactions:
|
|
78
|
+
annotations: ICommonAnnotations;
|
|
79
|
+
legend: ILineLegend;
|
|
80
|
+
chartOptions: ILChartOptions;
|
|
81
|
+
interactions: ILineInteractions;
|
|
82
|
+
dragData?: ICommonDragData;
|
|
84
83
|
depthType: IDepthType;
|
|
85
|
-
draggableData: IChartDraggableData;
|
|
86
|
-
dragData: IChartDragData;
|
|
87
84
|
}
|
|
88
|
-
export interface
|
|
89
|
-
x: number;
|
|
90
|
-
y: number;
|
|
91
|
-
label?: string[];
|
|
92
|
-
}
|
|
93
|
-
export interface ILineChartDataset {
|
|
94
|
-
label?: string;
|
|
85
|
+
export interface ILineChartDataset extends ICommonDataset {
|
|
95
86
|
lineTension?: number;
|
|
96
|
-
borderColor?: string;
|
|
97
87
|
pointBackgroundColor?: string;
|
|
98
|
-
backgroundColor?: string;
|
|
99
88
|
pointRadius?: number;
|
|
100
89
|
pointHoverRadius?: number;
|
|
101
90
|
pointHitRadius?: number;
|
|
102
|
-
borderWidth?: number;
|
|
103
91
|
fill?: boolean;
|
|
104
92
|
yAxisID?: string;
|
|
105
93
|
formation?: boolean;
|
|
106
|
-
|
|
94
|
+
displayGroup?: any;
|
|
95
|
+
pointStyle?: string;
|
|
107
96
|
}
|
|
108
|
-
export interface ILineChartData {
|
|
109
|
-
|
|
110
|
-
data: {
|
|
111
|
-
labels?: string[];
|
|
97
|
+
export interface ILineChartData extends ICommonData {
|
|
98
|
+
data?: {
|
|
112
99
|
datasets: ILineChartDataset[];
|
|
113
|
-
}
|
|
100
|
+
};
|
|
114
101
|
options: ILineChartOptions;
|
|
115
|
-
persistenceId
|
|
116
|
-
controlsPortalId
|
|
102
|
+
persistenceId?: string;
|
|
103
|
+
controlsPortalId?: string;
|
|
117
104
|
}
|
|
118
105
|
export interface ILineChartProps {
|
|
119
106
|
chart: ILineChartData;
|
|
@@ -1,4 +1,17 @@
|
|
|
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
|
+
}
|
|
1
13
|
export declare const chartAreaTextPlugin: {
|
|
2
14
|
id: string;
|
|
3
|
-
beforeDraw: (chart:
|
|
15
|
+
beforeDraw: (chart: Chart, _args: Plugin, options: CustomChartConfiguration) => void;
|
|
4
16
|
};
|
|
17
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
1
|
+
import { Chart, Scale } from 'chart.js';
|
|
2
|
+
export declare const getLargestMajorTickWidth: (majorTickPositions: number[]) => number;
|
|
3
|
+
export declare const isValidPosition: (minorTickPosition: number, majorTickPositions: number[], scale: Scale) => boolean;
|
|
4
|
+
export declare const getMinorTickPositions: (majorTickPositions: number[], scale: Scale) => number[];
|
|
4
5
|
export declare const chartMinorGridlinesPlugin: {
|
|
5
6
|
id: string;
|
|
6
|
-
beforeDatasetsDraw: (chart:
|
|
7
|
+
beforeDatasetsDraw: (chart: Chart) => void;
|
|
7
8
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Position } from '
|
|
1
|
+
import { Position } from '../../common/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:
|
|
8
|
+
position: Position;
|
|
9
9
|
}
|
|
@@ -1,16 +1,34 @@
|
|
|
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
|
+
}
|
|
1
14
|
/**
|
|
2
15
|
Initial chart state for the line chart.
|
|
3
16
|
|
|
4
17
|
@param {Object} options - The chart options.
|
|
5
18
|
@return {Object} The initial chart state.
|
|
6
19
|
*/
|
|
7
|
-
declare const initialState: ({ options, persistenceId }:
|
|
20
|
+
declare const initialState: ({ options, persistenceId }: inputInitState) => {
|
|
8
21
|
zoomEnabled: any;
|
|
9
22
|
panEnabled: any;
|
|
10
23
|
pointsEnabled: any;
|
|
11
24
|
lineEnabled: any;
|
|
12
25
|
legendEnabled: any;
|
|
13
|
-
axes:
|
|
26
|
+
axes: {
|
|
27
|
+
unit?: import("../line-chart.interface").IUnitOptions | undefined;
|
|
28
|
+
max?: number | undefined;
|
|
29
|
+
min?: number | undefined;
|
|
30
|
+
id: string;
|
|
31
|
+
}[];
|
|
14
32
|
showAnnotationLineIndex: number[];
|
|
15
33
|
showTable: boolean;
|
|
16
34
|
enableDragPoints: any;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { IAction, IState } from './state.interfaces';
|
|
2
|
+
export declare const reducer: (state: IState, action: IAction) => IState;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { IState } from './state.interfaces';
|
|
1
2
|
/**
|
|
2
3
|
* Retrieves the chart state from local storage.
|
|
3
4
|
*
|
|
4
5
|
* @param {string|''} persistenceId - The chart persistenceId.
|
|
5
6
|
* @returns {object|null} The chart state object or null if not found.
|
|
6
7
|
*/
|
|
7
|
-
export declare const getChartStateFromStorage: (persistenceId
|
|
8
|
+
export declare const getChartStateFromStorage: (persistenceId?: string) => any;
|
|
8
9
|
/**
|
|
9
10
|
* Stores the chart state in local storage.
|
|
10
11
|
*
|
|
11
12
|
* @param {object} state - The chart state object to store.
|
|
12
13
|
* @param {string|''} persistenceId - The chart persistenceId.
|
|
13
14
|
*/
|
|
14
|
-
export declare const storeChartStateInStorage: (state:
|
|
15
|
+
export declare const storeChartStateInStorage: (state: IState, persistenceId?: string) => void;
|
|
@@ -1,8 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { IUnitOptions } from '../line-chart.interface';
|
|
2
|
+
export interface IAxisState {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
min?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
unit?: IUnitOptions | string;
|
|
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;
|
|
8
33
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IState } from '../state/state.interfaces';
|
|
2
|
+
import { ILineChartOptions } from '../line-chart.interface';
|
|
1
3
|
/**
|
|
2
4
|
* Generates line chart datasets based on the provided datasets, state, and options.
|
|
3
5
|
*
|
|
@@ -7,4 +9,4 @@
|
|
|
7
9
|
* @param {Object} translations - The getTranslations object with the label property
|
|
8
10
|
* @returns {Array} - The generated line chart datasets with applied settings and configurations.
|
|
9
11
|
*/
|
|
10
|
-
export declare const generateLineChartDatasets: (datasets: Array<any>, state:
|
|
12
|
+
export declare const generateLineChartDatasets: (datasets: Array<any>, state: IState, options: ILineChartOptions, { label }: any) => any[];
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Chart } from 'chart.js';
|
|
2
|
+
import { RefObject } from 'react';
|
|
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;
|
|
3
9
|
id: any;
|
|
4
10
|
min: any;
|
|
5
11
|
max: any;
|
|
6
12
|
}[];
|
|
13
|
+
export {};
|