@oliasoft-open-source/charts-library 3.3.8 → 3.4.0-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 +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18349 -18611
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/bar-chart-default-props.d.ts +69 -0
- package/dist/src/components/bar-chart/bar-chart.d.ts +3 -0
- package/dist/src/components/bar-chart/bar-chart.interface.d.ts +83 -0
- package/dist/src/components/bar-chart/get-bar-chart-data-labels.d.ts +16 -0
- package/dist/src/components/bar-chart/get-bar-chart-scales.d.ts +5 -0
- package/dist/src/components/bar-chart/get-bar-chart-tooltips.d.ts +15 -0
- package/dist/src/components/controls/axes-options/axes-options-interfaces.d.ts +19 -0
- package/dist/src/components/line-chart/constants/default-translations.d.ts +24 -0
- package/dist/src/components/line-chart/constants/line-chart-consts.d.ts +12 -0
- package/dist/src/components/line-chart/controls/axes-options/action-types.d.ts +5 -0
- package/dist/src/components/line-chart/controls/axes-options/axes-options-form-state.d.ts +18 -0
- package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +34 -0
- package/dist/src/components/line-chart/controls/controls-portal.d.ts +2 -0
- package/dist/src/components/line-chart/controls/controls.d.ts +6 -0
- package/dist/src/components/line-chart/controls/drag-options-interfaces.d.ts +11 -0
- package/dist/src/components/line-chart/controls/drag-options.d.ts +5 -0
- package/dist/src/components/line-chart/controls/line-options.d.ts +1 -0
- 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 +23 -0
- package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +36 -0
- package/dist/src/components/line-chart/hooks/use-toggle-handler.d.ts +10 -0
- package/dist/src/components/line-chart/initialize/config.d.ts +12 -0
- package/dist/src/components/line-chart/initialize/initialize-line-chart.d.ts +12 -0
- package/dist/src/components/line-chart/legend/legend-constants.d.ts +1 -0
- package/dist/src/components/line-chart/legend/legend-dropzone.d.ts +3 -0
- package/dist/src/components/line-chart/legend/legend-item.d.ts +3 -0
- package/dist/src/components/line-chart/legend/legend-panel.d.ts +4 -0
- package/dist/src/components/line-chart/legend/legend.d.ts +3 -0
- package/dist/src/components/line-chart/line-chart-get-default-props.d.ts +91 -0
- package/dist/src/components/line-chart/line-chart.d.ts +3 -0
- package/dist/src/components/line-chart/line-chart.interface.d.ts +121 -0
- package/dist/src/components/line-chart/plugins/chart-area-text-plugin.d.ts +4 -0
- package/dist/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.d.ts +7 -0
- package/dist/src/components/line-chart/plugins/plugin-constants.d.ts +11 -0
- package/dist/src/components/line-chart/plugins/plugins.interface.d.ts +9 -0
- package/dist/src/components/line-chart/state/action-types.d.ts +12 -0
- package/dist/src/components/line-chart/state/initial-state.d.ts +18 -0
- package/dist/src/components/line-chart/state/line-chart-reducer.d.ts +1 -0
- package/dist/src/components/line-chart/state/manage-state-in-local-storage.d.ts +14 -0
- package/dist/src/components/line-chart/state/state.interfaces.d.ts +8 -0
- package/dist/src/components/line-chart/state/use-chart-state.d.ts +12 -0
- package/dist/src/components/line-chart/utils/axis-formatting/axis-formatting.d.ts +1 -0
- package/dist/src/components/line-chart/utils/axis-scales/axis-scales.d.ts +10 -0
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-condition.d.ts +9 -0
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-data.d.ts +11 -0
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.d.ts +5 -0
- package/dist/src/components/line-chart/utils/generate-line-chart-datasets.d.ts +10 -0
- package/dist/src/components/line-chart/utils/get-axes-ranges-from-chart.d.ts +6 -0
- package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +17 -0
- package/dist/src/components/line-chart/utils/get-line-chart-scales.d.ts +9 -0
- package/dist/src/components/line-chart/utils/get-line-chart-tooltips.d.ts +16 -0
- package/dist/src/components/line-chart/utils/line-chart-utils.d.ts +31 -0
- package/dist/src/components/line-chart/utils/translations/get-translations.d.ts +7 -0
- package/dist/src/components/pie-chart/pie-chart-get-default-props.d.ts +39 -0
- package/dist/src/components/pie-chart/pie-chart-utils.d.ts +2 -0
- package/dist/src/components/pie-chart/pie-chart.d.ts +9 -0
- package/dist/src/components/pie-chart/pie-chart.interface.d.ts +54 -0
- package/dist/src/components/scatter-chart/scatter-chart.d.ts +7 -0
- package/dist/src/components/scatter-chart/scatter-chart.intefrace.d.ts +28 -0
- package/dist/src/helpers/chart-border-plugin.d.ts +7 -0
- package/dist/src/helpers/chart-consts.d.ts +32 -0
- package/dist/src/helpers/chart-interface.d.ts +85 -0
- package/dist/src/helpers/enums.d.ts +86 -0
- package/dist/src/helpers/get-chart-annotation.d.ts +12 -0
- package/dist/src/helpers/get-draggableData.d.ts +18 -0
- package/dist/src/helpers/range/estimate-data-series-have-close-values.d.ts +10 -0
- package/dist/src/helpers/range/range.d.ts +33 -0
- package/package.json +13 -11
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { IBarChartProps } from './bar-chart.interface';
|
|
2
|
+
export declare const getDefaultProps: (props: IBarChartProps) => {
|
|
3
|
+
testId: string | null;
|
|
4
|
+
data: any;
|
|
5
|
+
options: {
|
|
6
|
+
title: string | string[];
|
|
7
|
+
direction: "vertical" | "horizontal";
|
|
8
|
+
axes: {
|
|
9
|
+
x: import("./bar-chart.interface").IBarChartAxes<"top" | "bottom">[];
|
|
10
|
+
y: import("./bar-chart.interface").IBarChartAxes<"left" | "right">[];
|
|
11
|
+
};
|
|
12
|
+
additionalAxesOptions: {
|
|
13
|
+
chartScaleType: "linear" | "logarithmic";
|
|
14
|
+
reverse: boolean;
|
|
15
|
+
stacked: boolean;
|
|
16
|
+
beginAtZero: boolean;
|
|
17
|
+
stepSize: number;
|
|
18
|
+
suggestedMin: number;
|
|
19
|
+
suggestedMax: number;
|
|
20
|
+
min: number;
|
|
21
|
+
max: number;
|
|
22
|
+
};
|
|
23
|
+
chartStyling: {
|
|
24
|
+
width: string | number;
|
|
25
|
+
height: string | number;
|
|
26
|
+
maintainAspectRatio: boolean;
|
|
27
|
+
staticChartHeight: boolean;
|
|
28
|
+
performanceMode: boolean;
|
|
29
|
+
};
|
|
30
|
+
tooltip: {
|
|
31
|
+
tooltips: boolean;
|
|
32
|
+
showLabelsInTooltips: boolean;
|
|
33
|
+
};
|
|
34
|
+
graph: {
|
|
35
|
+
showDataLabels: boolean;
|
|
36
|
+
showMinorGridlines: boolean;
|
|
37
|
+
};
|
|
38
|
+
annotations: {
|
|
39
|
+
showAnnotations: boolean;
|
|
40
|
+
controlAnnotation: boolean;
|
|
41
|
+
annotationsData: import("../../helpers/chart-interface").IChartAnnotationsData[];
|
|
42
|
+
};
|
|
43
|
+
legend: {
|
|
44
|
+
display: boolean;
|
|
45
|
+
position: "top" | "bottom" | "right";
|
|
46
|
+
align: "start" | "center" | "end";
|
|
47
|
+
customLegend: import("../../helpers/chart-interface").ICustomLegend;
|
|
48
|
+
};
|
|
49
|
+
chartOptions: {
|
|
50
|
+
enableZoom: boolean;
|
|
51
|
+
enablePan: boolean;
|
|
52
|
+
};
|
|
53
|
+
interactions: {
|
|
54
|
+
onLegendClick: () => any;
|
|
55
|
+
onBarHover: any;
|
|
56
|
+
onBarUnhover: any;
|
|
57
|
+
};
|
|
58
|
+
dragData: {
|
|
59
|
+
enableDragData: any;
|
|
60
|
+
showTooltip: any;
|
|
61
|
+
roundPoints: any;
|
|
62
|
+
dragX: any;
|
|
63
|
+
dragY: any;
|
|
64
|
+
onDragStart: any;
|
|
65
|
+
onDrag: any;
|
|
66
|
+
onDragEnd: any;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { LinearScaleOptions } from 'chart.js';
|
|
2
|
+
import { IChartAnnotations, IChartDraggableData, IChartInteractions, IChartLegend, IChartStyling } from '../../helpers/chart-interface';
|
|
3
|
+
export interface IChartOptions {
|
|
4
|
+
enableZoom: boolean;
|
|
5
|
+
enablePan: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface IBarChartGraph {
|
|
8
|
+
showDataLabels: boolean;
|
|
9
|
+
showMinorGridlines: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface IBarChartTooltip {
|
|
12
|
+
tooltips: boolean;
|
|
13
|
+
showLabelsInTooltips: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface IBarChartAdditionalAxesOptions {
|
|
16
|
+
chartScaleType: 'linear' | 'logarithmic';
|
|
17
|
+
reverse: boolean;
|
|
18
|
+
beginAtZero: boolean;
|
|
19
|
+
stepSize: number;
|
|
20
|
+
stacked: boolean;
|
|
21
|
+
suggestedMin: number;
|
|
22
|
+
suggestedMax: number;
|
|
23
|
+
min: number;
|
|
24
|
+
max: number;
|
|
25
|
+
}
|
|
26
|
+
export interface IBarChartAxes<PositionType> {
|
|
27
|
+
label: string;
|
|
28
|
+
position: PositionType;
|
|
29
|
+
color: string;
|
|
30
|
+
unit: string;
|
|
31
|
+
}
|
|
32
|
+
export interface IBarScales {
|
|
33
|
+
x: LinearScaleOptions;
|
|
34
|
+
y: LinearScaleOptions;
|
|
35
|
+
}
|
|
36
|
+
export interface IBarChartOptions {
|
|
37
|
+
title: string | string[];
|
|
38
|
+
direction: 'vertical' | 'horizontal';
|
|
39
|
+
axes: {
|
|
40
|
+
x: IBarChartAxes<'top' | 'bottom'>[];
|
|
41
|
+
y: IBarChartAxes<'left' | 'right'>[];
|
|
42
|
+
};
|
|
43
|
+
scales: IBarScales;
|
|
44
|
+
additionalAxesOptions: IBarChartAdditionalAxesOptions;
|
|
45
|
+
chartStyling: IChartStyling;
|
|
46
|
+
tooltip: IBarChartTooltip;
|
|
47
|
+
graph: IBarChartGraph;
|
|
48
|
+
annotations: IChartAnnotations;
|
|
49
|
+
legend: IChartLegend;
|
|
50
|
+
chartOptions: IChartOptions;
|
|
51
|
+
interactions: IChartInteractions;
|
|
52
|
+
draggableData: IChartDraggableData;
|
|
53
|
+
}
|
|
54
|
+
export interface IBarDataPoint {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
label?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface IBarChartDataset {
|
|
60
|
+
label?: string;
|
|
61
|
+
data: number[] | number[][] | IBarDataPoint[];
|
|
62
|
+
borderSkipped?: string;
|
|
63
|
+
backgroundColor?: string[];
|
|
64
|
+
borderColor?: string[];
|
|
65
|
+
borderRadius?: number;
|
|
66
|
+
borderWidth?: number;
|
|
67
|
+
yAxisID?: string;
|
|
68
|
+
stack?: number;
|
|
69
|
+
isAnnotation: boolean;
|
|
70
|
+
annotationIndex: number | string;
|
|
71
|
+
type: 'bar' | 'line';
|
|
72
|
+
}
|
|
73
|
+
export interface IBarChartData {
|
|
74
|
+
testId: string | null;
|
|
75
|
+
data: {
|
|
76
|
+
labels?: string[];
|
|
77
|
+
datasets: IBarChartDataset[];
|
|
78
|
+
} | any;
|
|
79
|
+
options: IBarChartOptions;
|
|
80
|
+
}
|
|
81
|
+
export interface IBarChartProps {
|
|
82
|
+
chart: IBarChartData;
|
|
83
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IBarChartOptions } from './bar-chart.interface';
|
|
2
|
+
/**
|
|
3
|
+
* @param {import('./bar-chart.interface').IBarChartOptions} options - bar chart options object
|
|
4
|
+
*/
|
|
5
|
+
declare const getBarChartDataLabels: (options: IBarChartOptions) => {
|
|
6
|
+
display: string;
|
|
7
|
+
align: "start" | "center" | "end";
|
|
8
|
+
anchor: "start" | "center" | "end";
|
|
9
|
+
formatter: (value: any, context: any) => string | number;
|
|
10
|
+
} | {
|
|
11
|
+
display: boolean;
|
|
12
|
+
align?: undefined;
|
|
13
|
+
anchor?: undefined;
|
|
14
|
+
formatter?: undefined;
|
|
15
|
+
};
|
|
16
|
+
export default getBarChartDataLabels;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import('./bar-chart.interface').IBarChartOptions} options - bar chart options object
|
|
3
|
+
*/
|
|
4
|
+
declare const getBarChartToolTips: (options: any) => {
|
|
5
|
+
enabled: any;
|
|
6
|
+
mode: "nearest";
|
|
7
|
+
intersect: boolean;
|
|
8
|
+
padding: number;
|
|
9
|
+
callbacks: {
|
|
10
|
+
title: (tooltipItem: any, data: any) => string;
|
|
11
|
+
label: (tooltipItem: any) => string;
|
|
12
|
+
afterLabel: (tooltipItem: any) => string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default getBarChartToolTips;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface IDepthType {
|
|
2
|
+
selectedDepthType: string;
|
|
3
|
+
setSelectedDepthType: (obj: any) => any;
|
|
4
|
+
options: Array<string>;
|
|
5
|
+
}
|
|
6
|
+
export interface IAxesOptions {
|
|
7
|
+
initialAxesRanges: Array<Object>;
|
|
8
|
+
axes: Array<any>;
|
|
9
|
+
controlsAxesLabels: Array<Object>;
|
|
10
|
+
onUpdateAxes: (obj: any) => any;
|
|
11
|
+
onResetAxes: () => any;
|
|
12
|
+
depthType: IDepthType;
|
|
13
|
+
close?: () => any;
|
|
14
|
+
}
|
|
15
|
+
export interface IOnEdit {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const defaultTranslations: Readonly<{
|
|
2
|
+
label: "Label";
|
|
3
|
+
pointsLines: "Points & lines";
|
|
4
|
+
linesOnly: "Lines only";
|
|
5
|
+
pointsOnly: "Points only";
|
|
6
|
+
axesOptions: "Axes options";
|
|
7
|
+
resetAxes: "Reset Axes";
|
|
8
|
+
done: "Done";
|
|
9
|
+
downloadAsPNG: "Download as PNG";
|
|
10
|
+
showChart: "Show chart";
|
|
11
|
+
showTable: "Show table";
|
|
12
|
+
dragToZoom: "Drag to zoom";
|
|
13
|
+
dragToPan: "Drag to pan";
|
|
14
|
+
dragToMovePoints: "Drag to move points";
|
|
15
|
+
dragDisabled: "Drag disabled";
|
|
16
|
+
hideLegend: "Hide Legend";
|
|
17
|
+
showLegend: "Show Legend";
|
|
18
|
+
mustHaveAValue: "Must have a value";
|
|
19
|
+
mustBeANumber: "Must be a number";
|
|
20
|
+
mustBeLessThanMax: "Must be less than max";
|
|
21
|
+
mustBeGreaterThanMin: "Must be greater than min";
|
|
22
|
+
doubleClickToReset: "Double click on canvas to reset";
|
|
23
|
+
orDoubleClickToCanvas: "or double click on canvas";
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const DEFAULT_POINT_RADIUS = 2;
|
|
2
|
+
export declare const DEFAULT_HOVER_RADIUS = 5;
|
|
3
|
+
export declare const DEFAULT_BORDER_WIDTH = 1;
|
|
4
|
+
export declare const BORDER_JOIN_STYLE = "round";
|
|
5
|
+
export declare const DEFAULT_LINE_POINT_RADIUS = 0;
|
|
6
|
+
export declare const DEFAULT_BACKGROUND_COLOR = "transparent";
|
|
7
|
+
export declare const ZOOM_BOX_BACKGROUND_COLOR = "rgba(0, 0, 0, 0.1)";
|
|
8
|
+
export declare const DOUBLE_CLICK = "dblclick";
|
|
9
|
+
export declare const INIT_KEYS: {
|
|
10
|
+
TRANSLATIONS: string;
|
|
11
|
+
LANGUAGE_KEY: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize local component form state for a custom loads density table
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} args
|
|
5
|
+
* @param {Object} args.initialAxesRanges
|
|
6
|
+
* @param {Array} [args.axes]
|
|
7
|
+
* @returns {Object} formState
|
|
8
|
+
*/
|
|
9
|
+
export declare const initializeFormState: ({ initialAxesRanges, axes }: any) => any;
|
|
10
|
+
export declare const validateAxes: (formState: any) => any;
|
|
11
|
+
/**
|
|
12
|
+
* Local component form state reducer for a axes options form
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} state Local component form state
|
|
15
|
+
* @param {Action} action Action with type and payload
|
|
16
|
+
* @returns {Object} FormState
|
|
17
|
+
*/
|
|
18
|
+
export declare const reducer: (state: any, action: any) => any;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface IControlsProps {
|
|
2
|
+
headerComponent: Element;
|
|
3
|
+
subheaderComponent: Element;
|
|
4
|
+
table: Element;
|
|
5
|
+
controlsPortalId: string;
|
|
6
|
+
}
|
|
7
|
+
interface IControlsState {
|
|
8
|
+
enableDragPoints: boolean;
|
|
9
|
+
initialAxesRanges: Array<object>;
|
|
10
|
+
legendEnabled: boolean;
|
|
11
|
+
lineEnabled: boolean;
|
|
12
|
+
panEnabled: boolean;
|
|
13
|
+
pointsEnabled: boolean;
|
|
14
|
+
showTable: boolean;
|
|
15
|
+
zoomEnabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface IControlsOptions {
|
|
18
|
+
dragData: {
|
|
19
|
+
enableDragData: boolean;
|
|
20
|
+
};
|
|
21
|
+
title: string;
|
|
22
|
+
depthType: any;
|
|
23
|
+
}
|
|
24
|
+
export interface IControls {
|
|
25
|
+
props: IControlsProps;
|
|
26
|
+
chartRef: any;
|
|
27
|
+
state: IControlsState;
|
|
28
|
+
options: IControlsOptions;
|
|
29
|
+
dispatch: () => any;
|
|
30
|
+
generatedDatasets: Array<object>;
|
|
31
|
+
translations: any;
|
|
32
|
+
controlsPortalId: any;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IControls } from './controls-interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* @param {import('./controls-interfaces').IControls} obj
|
|
4
|
+
*/
|
|
5
|
+
declare const Controls: ({ props: { headerComponent, subheaderComponent, table }, chartRef, state, options, dispatch, generatedDatasets, translations, controlsPortalId, }: IControls) => JSX.Element;
|
|
6
|
+
export default Controls;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IDragOptions {
|
|
2
|
+
onTogglePan: () => any;
|
|
3
|
+
onToggleZoom: () => any;
|
|
4
|
+
panEnabled: boolean;
|
|
5
|
+
zoomEnabled: boolean;
|
|
6
|
+
enableDragPoints: boolean;
|
|
7
|
+
isDragDataAllowed: boolean;
|
|
8
|
+
onToggleDragPoints: () => any;
|
|
9
|
+
onDisableDragOptions: () => any;
|
|
10
|
+
translations: any;
|
|
11
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IDragOptions } from './drag-options-interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* @param {import('./drag-options-interfaces').IDragOptions} obj
|
|
4
|
+
*/
|
|
5
|
+
export declare const DragOptions: ({ onTogglePan, onToggleZoom, panEnabled, zoomEnabled, enableDragPoints, isDragDataAllowed, onToggleDragPoints, onDisableDragOptions, translations: { dragToZoom, doubleClickToReset, dragToPan, orDoubleClickToCanvas, dragToMovePoints, dragDisabled, }, }: IDragOptions) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LineOptions: ({ lineEnabled, onToggleLine, onTogglePoints, pointsEnabled, translations, }: any) => JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface IHooksInterface {
|
|
2
|
+
chartRef: {
|
|
3
|
+
current: any;
|
|
4
|
+
};
|
|
5
|
+
state: any;
|
|
6
|
+
options: any;
|
|
7
|
+
dispatch: (obj: object) => any;
|
|
8
|
+
generatedDatasets: Array<Object>;
|
|
9
|
+
}
|
|
10
|
+
export interface IUseChartPluginsInterface {
|
|
11
|
+
options: any;
|
|
12
|
+
resetZoom: any;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IHooksInterface } from './hooks.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook that encapsulates the chart-related functions and their dependencies
|
|
4
|
+
* @param {Object} chartRef - Chart reference
|
|
5
|
+
* @param {Object} state - The component state
|
|
6
|
+
* @param {Object} options - Chart options
|
|
7
|
+
* @param {Function} dispatch - Dispatch function from useReducer
|
|
8
|
+
* @param {Array} generatedDatasets - Chart datasets
|
|
9
|
+
* @returns {Object} An object containing the chart-related functions
|
|
10
|
+
*/
|
|
11
|
+
export declare const useChartFunctions: ({ chartRef, state, options, dispatch, generatedDatasets, }: IHooksInterface) => {
|
|
12
|
+
legendClick: (e: any, legendItem: any) => void;
|
|
13
|
+
resetZoom: () => void;
|
|
14
|
+
onHover: (hoveredPoint: any, setHoveredPoint: any) => (evt: Event, hoveredItems: Array<any>) => void;
|
|
15
|
+
handleDownload: () => void;
|
|
16
|
+
handleKeyDown: (evt: any) => void;
|
|
17
|
+
handleKeyUp: (evt: any) => void;
|
|
18
|
+
controlsAxes: any;
|
|
19
|
+
controlsAxesLabels: any[];
|
|
20
|
+
updateAxesRangesFromChart: () => void;
|
|
21
|
+
onResetAxes: () => void;
|
|
22
|
+
onUpdateAxes: ({ axes }: any) => void;
|
|
23
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IHooksInterface } from './hooks.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook to generate chart options.
|
|
4
|
+
* @function
|
|
5
|
+
* @param {Object} chartRef - The chart reference.
|
|
6
|
+
* @param {Object} state - The chart state.
|
|
7
|
+
* @param {Object} options - The chart options.
|
|
8
|
+
* @param {Function} dispatch - The dispatch function for state management.
|
|
9
|
+
* @param {Array} generatedDatasets - The generated datasets.
|
|
10
|
+
* @returns {Object} The chart options object.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useChartOptions: ({ chartRef, state, options, dispatch, generatedDatasets, }: IHooksInterface) => {
|
|
13
|
+
layout: {
|
|
14
|
+
padding: any;
|
|
15
|
+
};
|
|
16
|
+
onHover: (evt: Event, hoveredItems: any[]) => void;
|
|
17
|
+
maintainAspectRatio: any;
|
|
18
|
+
aspectRatio: number | null;
|
|
19
|
+
animation: boolean | {
|
|
20
|
+
duration: number;
|
|
21
|
+
onComplete: any;
|
|
22
|
+
};
|
|
23
|
+
hover: {
|
|
24
|
+
mode: "nearest";
|
|
25
|
+
intersect: boolean;
|
|
26
|
+
};
|
|
27
|
+
elements: {
|
|
28
|
+
line: {
|
|
29
|
+
pointStyle: "circle";
|
|
30
|
+
showLine: any;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
scales: any;
|
|
34
|
+
plugins: any;
|
|
35
|
+
events: readonly string[];
|
|
36
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const useToggleHandlers: (dispatch: any) => {
|
|
2
|
+
onToggleLegend: () => void;
|
|
3
|
+
onToggleLine: () => void;
|
|
4
|
+
onTogglePan: () => void;
|
|
5
|
+
onTogglePoints: () => void;
|
|
6
|
+
onToggleTable: () => void;
|
|
7
|
+
onToggleZoom: () => void;
|
|
8
|
+
onToggleDragPoints: () => void;
|
|
9
|
+
onDisableDragOptions: () => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieve the value for the given key from the config object.
|
|
3
|
+
* @param {string} key - The key to access the corresponding value in the config object.
|
|
4
|
+
* @returns {*} - The value associated with the given key in the config object or config.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getConfig: any;
|
|
7
|
+
/**
|
|
8
|
+
* Set a new value for the given key in the config object.
|
|
9
|
+
* @param {string} key - The key to access the corresponding value in the config object.
|
|
10
|
+
* @param {*} newValue - The new value to be set for the given key.
|
|
11
|
+
*/
|
|
12
|
+
export declare const setConfig: (key: string, newValue: any) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize the charts library with the provided configurations.
|
|
3
|
+
* This function will store the configuration options in a config object.
|
|
4
|
+
* @param {object} options - An object containing the configuration options for the library.
|
|
5
|
+
* @param {object} options.translations - The translations to be used in the library.
|
|
6
|
+
* @param {string} options.languageKey - The language key to be stored in the config object, used for translations.
|
|
7
|
+
* @param {...object} options - Any additional options to be stored in the config object.
|
|
8
|
+
*/
|
|
9
|
+
export declare const initializeLineChart: ({ languageKey, ...options }: {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
languageKey?: string | undefined;
|
|
12
|
+
}) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LEGEND_MARGIN = 4;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ILineChartProps } from './line-chart.interface';
|
|
2
|
+
export declare const getDefaultProps: (props: ILineChartProps) => {
|
|
3
|
+
persistenceId: string;
|
|
4
|
+
controlsPortalId: string | null;
|
|
5
|
+
testId: string | null;
|
|
6
|
+
data: any;
|
|
7
|
+
options: {
|
|
8
|
+
title: string | string[];
|
|
9
|
+
scales: any;
|
|
10
|
+
axes: {
|
|
11
|
+
x: any;
|
|
12
|
+
y: any;
|
|
13
|
+
};
|
|
14
|
+
additionalAxesOptions: {
|
|
15
|
+
chartScaleType: any;
|
|
16
|
+
reverse: any;
|
|
17
|
+
beginAtZero: any;
|
|
18
|
+
stepSize: any;
|
|
19
|
+
suggestedMin: any;
|
|
20
|
+
suggestedMax: any;
|
|
21
|
+
range: any;
|
|
22
|
+
autoAxisPadding: any;
|
|
23
|
+
};
|
|
24
|
+
chartStyling: {
|
|
25
|
+
width: string | number;
|
|
26
|
+
height: string | number;
|
|
27
|
+
maintainAspectRatio: boolean;
|
|
28
|
+
staticChartHeight: boolean;
|
|
29
|
+
performanceMode: boolean;
|
|
30
|
+
squareAspectRatio: boolean;
|
|
31
|
+
layoutPadding: any;
|
|
32
|
+
};
|
|
33
|
+
tooltip: {
|
|
34
|
+
tooltips: boolean;
|
|
35
|
+
showLabelsInTooltips: boolean;
|
|
36
|
+
hideSimulationName: boolean;
|
|
37
|
+
};
|
|
38
|
+
graph: {
|
|
39
|
+
lineTension: number;
|
|
40
|
+
spanGaps: boolean;
|
|
41
|
+
showDataLabels: boolean;
|
|
42
|
+
showMinorGridlines: boolean;
|
|
43
|
+
};
|
|
44
|
+
annotations: {
|
|
45
|
+
labelAnnotation: {
|
|
46
|
+
showLabel: boolean;
|
|
47
|
+
text: string | string[];
|
|
48
|
+
position: string;
|
|
49
|
+
fontSize: number;
|
|
50
|
+
xOffset: number;
|
|
51
|
+
yOffset: number;
|
|
52
|
+
maxWidth: number;
|
|
53
|
+
lineHeight: number;
|
|
54
|
+
};
|
|
55
|
+
showAnnotations: boolean;
|
|
56
|
+
controlAnnotation: boolean;
|
|
57
|
+
annotationsData: import("../../helpers/chart-interface").IChartAnnotationsData[];
|
|
58
|
+
};
|
|
59
|
+
legend: {
|
|
60
|
+
display: boolean;
|
|
61
|
+
position: "top" | "bottom" | "right";
|
|
62
|
+
align: "start" | "center" | "end";
|
|
63
|
+
customLegend: import("../../helpers/chart-interface").ICustomLegend;
|
|
64
|
+
usePointStyle: boolean;
|
|
65
|
+
};
|
|
66
|
+
chartOptions: {
|
|
67
|
+
showPoints: boolean;
|
|
68
|
+
enableZoom: true;
|
|
69
|
+
enablePan: boolean;
|
|
70
|
+
showLine: boolean;
|
|
71
|
+
closeOnOutsideClick: boolean;
|
|
72
|
+
};
|
|
73
|
+
interactions: {
|
|
74
|
+
onLegendClick: () => any;
|
|
75
|
+
onPointHover: () => any;
|
|
76
|
+
onPointUnhover: () => any;
|
|
77
|
+
onAnimationComplete: () => any;
|
|
78
|
+
};
|
|
79
|
+
depthType: import("./line-chart.interface").IDepthType;
|
|
80
|
+
dragData: {
|
|
81
|
+
enableDragData: boolean;
|
|
82
|
+
showTooltip: true;
|
|
83
|
+
roundPoints: true;
|
|
84
|
+
dragX: true;
|
|
85
|
+
dragY: true;
|
|
86
|
+
onDragStart: () => any;
|
|
87
|
+
onDrag: () => any;
|
|
88
|
+
onDragEnd: () => any;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|