@oliasoft-open-source/charts-library 3.3.8 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/declaration.d.ts +15 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +18349 -18611
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/components/bar-chart/bar-chart-default-props.d.ts +69 -0
  6. package/dist/src/components/bar-chart/bar-chart.d.ts +3 -0
  7. package/dist/src/components/bar-chart/bar-chart.interface.d.ts +83 -0
  8. package/dist/src/components/bar-chart/get-bar-chart-data-labels.d.ts +16 -0
  9. package/dist/src/components/bar-chart/get-bar-chart-scales.d.ts +5 -0
  10. package/dist/src/components/bar-chart/get-bar-chart-tooltips.d.ts +15 -0
  11. package/dist/src/components/controls/axes-options/axes-options-interfaces.d.ts +19 -0
  12. package/dist/src/components/line-chart/constants/default-translations.d.ts +24 -0
  13. package/dist/src/components/line-chart/constants/line-chart-consts.d.ts +12 -0
  14. package/dist/src/components/line-chart/controls/axes-options/action-types.d.ts +5 -0
  15. package/dist/src/components/line-chart/controls/axes-options/axes-options-form-state.d.ts +18 -0
  16. package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +34 -0
  17. package/dist/src/components/line-chart/controls/controls-portal.d.ts +2 -0
  18. package/dist/src/components/line-chart/controls/controls.d.ts +6 -0
  19. package/dist/src/components/line-chart/controls/drag-options-interfaces.d.ts +11 -0
  20. package/dist/src/components/line-chart/controls/drag-options.d.ts +5 -0
  21. package/dist/src/components/line-chart/controls/line-options.d.ts +1 -0
  22. package/dist/src/components/line-chart/hooks/hooks.interface.d.ts +13 -0
  23. package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +23 -0
  24. package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +36 -0
  25. package/dist/src/components/line-chart/hooks/use-toggle-handler.d.ts +10 -0
  26. package/dist/src/components/line-chart/initialize/config.d.ts +12 -0
  27. package/dist/src/components/line-chart/initialize/initialize-line-chart.d.ts +12 -0
  28. package/dist/src/components/line-chart/legend/legend-constants.d.ts +1 -0
  29. package/dist/src/components/line-chart/legend/legend-dropzone.d.ts +3 -0
  30. package/dist/src/components/line-chart/legend/legend-item.d.ts +3 -0
  31. package/dist/src/components/line-chart/legend/legend-panel.d.ts +4 -0
  32. package/dist/src/components/line-chart/legend/legend.d.ts +3 -0
  33. package/dist/src/components/line-chart/line-chart-get-default-props.d.ts +91 -0
  34. package/dist/src/components/line-chart/line-chart.d.ts +3 -0
  35. package/dist/src/components/line-chart/line-chart.interface.d.ts +121 -0
  36. package/dist/src/components/line-chart/plugins/chart-area-text-plugin.d.ts +4 -0
  37. package/dist/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.d.ts +7 -0
  38. package/dist/src/components/line-chart/plugins/plugin-constants.d.ts +11 -0
  39. package/dist/src/components/line-chart/plugins/plugins.interface.d.ts +9 -0
  40. package/dist/src/components/line-chart/state/action-types.d.ts +12 -0
  41. package/dist/src/components/line-chart/state/initial-state.d.ts +18 -0
  42. package/dist/src/components/line-chart/state/line-chart-reducer.d.ts +1 -0
  43. package/dist/src/components/line-chart/state/manage-state-in-local-storage.d.ts +14 -0
  44. package/dist/src/components/line-chart/state/state.interfaces.d.ts +8 -0
  45. package/dist/src/components/line-chart/state/use-chart-state.d.ts +12 -0
  46. package/dist/src/components/line-chart/utils/axis-formatting/axis-formatting.d.ts +1 -0
  47. package/dist/src/components/line-chart/utils/axis-scales/axis-scales.d.ts +10 -0
  48. package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-condition.d.ts +9 -0
  49. package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-data.d.ts +11 -0
  50. package/dist/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.d.ts +5 -0
  51. package/dist/src/components/line-chart/utils/generate-line-chart-datasets.d.ts +10 -0
  52. package/dist/src/components/line-chart/utils/get-axes-ranges-from-chart.d.ts +6 -0
  53. package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +17 -0
  54. package/dist/src/components/line-chart/utils/get-line-chart-scales.d.ts +9 -0
  55. package/dist/src/components/line-chart/utils/get-line-chart-tooltips.d.ts +16 -0
  56. package/dist/src/components/line-chart/utils/line-chart-utils.d.ts +31 -0
  57. package/dist/src/components/line-chart/utils/translations/get-translations.d.ts +7 -0
  58. package/dist/src/components/pie-chart/pie-chart-get-default-props.d.ts +39 -0
  59. package/dist/src/components/pie-chart/pie-chart-utils.d.ts +2 -0
  60. package/dist/src/components/pie-chart/pie-chart.d.ts +9 -0
  61. package/dist/src/components/pie-chart/pie-chart.interface.d.ts +54 -0
  62. package/dist/src/components/scatter-chart/scatter-chart.d.ts +7 -0
  63. package/dist/src/components/scatter-chart/scatter-chart.intefrace.d.ts +28 -0
  64. package/dist/src/helpers/chart-border-plugin.d.ts +7 -0
  65. package/dist/src/helpers/chart-consts.d.ts +32 -0
  66. package/dist/src/helpers/chart-interface.d.ts +85 -0
  67. package/dist/src/helpers/enums.d.ts +86 -0
  68. package/dist/src/helpers/get-chart-annotation.d.ts +12 -0
  69. package/dist/src/helpers/get-draggableData.d.ts +18 -0
  70. package/dist/src/helpers/range/estimate-data-series-have-close-values.d.ts +10 -0
  71. package/dist/src/helpers/range/range.d.ts +33 -0
  72. package/package.json +13 -11
@@ -0,0 +1,121 @@
1
+ import { LinearScaleOptions } from 'chart.js';
2
+ import { IChartAnnotations, IChartDraggableData, IChartInteractions, IChartLegend, IChartStyling } from '../../helpers/chart-interface';
3
+ export interface IChartOptions {
4
+ showPoints: boolean;
5
+ enableZoom: boolean;
6
+ enablePan: boolean;
7
+ closeOnOutsideClick: boolean;
8
+ showLine: boolean;
9
+ }
10
+ export interface ILineChartGraph {
11
+ lineTension: number;
12
+ spanGaps: boolean;
13
+ showDataLabels: boolean;
14
+ showMinorGridlines: boolean;
15
+ }
16
+ export interface ILineChartTooltip {
17
+ tooltips: boolean;
18
+ showLabelsInTooltips: boolean;
19
+ hideSimulationName: boolean;
20
+ }
21
+ export interface IChartRange {
22
+ min: number;
23
+ max: number;
24
+ }
25
+ export interface ILineChartAdditionalAxesOptions {
26
+ chartScaleType: 'linear' | 'logarithmic';
27
+ reverse: boolean;
28
+ beginAtZero: boolean;
29
+ stepSize: number;
30
+ suggestedMin: number;
31
+ suggestedMax: number;
32
+ range: {
33
+ x: IChartRange;
34
+ y: IChartRange;
35
+ };
36
+ autoAxisPadding: boolean;
37
+ }
38
+ export interface IUnitOptions {
39
+ options: string[];
40
+ selectedUnit: string;
41
+ setSelectedUnit: () => void;
42
+ }
43
+ export interface ILineChartAxis<PositionType> {
44
+ label: string;
45
+ position: PositionType;
46
+ color: string;
47
+ unit: IUnitOptions;
48
+ }
49
+ export interface ILineChartAxes {
50
+ x: ILineChartAxis<'top' | 'bottom'>[];
51
+ y: ILineChartAxis<'left' | 'right'>[];
52
+ }
53
+ export interface ILineScales {
54
+ x: LinearScaleOptions;
55
+ y: LinearScaleOptions;
56
+ }
57
+ export interface IDepthType {
58
+ options: string[];
59
+ selectedUnit: string;
60
+ setSelectedUnit: () => void;
61
+ }
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;
78
+ tooltip: ILineChartTooltip;
79
+ graph: ILineChartGraph;
80
+ annotations: IChartAnnotations;
81
+ legend: IChartLegend;
82
+ chartOptions: IChartOptions;
83
+ interactions: IChartInteractions;
84
+ depthType: IDepthType;
85
+ draggableData: IChartDraggableData;
86
+ dragData: IChartDragData;
87
+ }
88
+ export interface IDataPoint {
89
+ x: number;
90
+ y: number;
91
+ label?: string[];
92
+ }
93
+ export interface ILineChartDataset {
94
+ label?: string;
95
+ lineTension?: number;
96
+ borderColor?: string;
97
+ pointBackgroundColor?: string;
98
+ backgroundColor?: string;
99
+ pointRadius?: number;
100
+ pointHoverRadius?: number;
101
+ pointHitRadius?: number;
102
+ borderWidth?: number;
103
+ fill?: boolean;
104
+ yAxisID?: string;
105
+ formation?: boolean;
106
+ data: IDataPoint[];
107
+ }
108
+ export interface ILineChartData {
109
+ testId: string | null;
110
+ data: {
111
+ labels?: string[];
112
+ datasets: ILineChartDataset[];
113
+ } | any;
114
+ options: ILineChartOptions;
115
+ persistenceId: string;
116
+ controlsPortalId: string | null;
117
+ }
118
+ export interface ILineChartProps {
119
+ chart: ILineChartData;
120
+ table?: any;
121
+ }
@@ -0,0 +1,4 @@
1
+ export declare const chartAreaTextPlugin: {
2
+ id: string;
3
+ beforeDraw: (chart: any, _args: any, options: any) => void;
4
+ };
@@ -0,0 +1,7 @@
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[];
4
+ export declare const chartMinorGridlinesPlugin: {
5
+ id: string;
6
+ beforeDatasetsDraw: (chart: any) => void;
7
+ };
@@ -0,0 +1,11 @@
1
+ export declare const TextLabelPosition: {
2
+ TOP_LEFT: string;
3
+ TOP_CENTER: string;
4
+ TOP_RIGHT: string;
5
+ MIDDLE_LEFT: string;
6
+ MIDDLE_CENTER: string;
7
+ MIDDLE_RIGHT: string;
8
+ BOTTOM_LEFT: string;
9
+ BOTTOM_CENTER: string;
10
+ BOTTOM_RIGHT: string;
11
+ };
@@ -0,0 +1,9 @@
1
+ import { Position } from '../../../helpers/enums';
2
+ export interface IDrawText {
3
+ ctx: CanvasRenderingContext2D;
4
+ lines: Array<string>;
5
+ lineHeight: number;
6
+ x: number;
7
+ y: number;
8
+ position: typeof Position;
9
+ }
@@ -0,0 +1,12 @@
1
+ export declare const TOGGLE_ZOOM = "TOGGLE_ZOOM";
2
+ export declare const TOGGLE_PAN = "TOGGLE_PAN";
3
+ export declare const TOGGLE_POINTS = "TOGGLE_POINTS";
4
+ export declare const TOGGLE_LINE = "TOGGLE_LINE";
5
+ export declare const TOGGLE_LEGEND = "TOGGLE_LEGEND";
6
+ export declare const TOGGLE_ANNOTATION = "TOGGLE_ANNOTATION";
7
+ export declare const TOGGLE_TABLE = "TOGGLE_TABLE";
8
+ export declare const SAVE_INITIAL_AXES_RANGES = "SAVE_INITIAL_AXES_RANGES";
9
+ export declare const RESET_AXES_RANGES = "RESET_AXES_RANGES";
10
+ export declare const UPDATE_AXES_RANGES = "UPDATE_AXES_RANGES";
11
+ export declare const TOGGLE_DRAG_POINTS = "TOGGLE_DRAG_POINTS";
12
+ export declare const DISABLE_DRAG_OPTIONS = "DISABLE_DRAG_OPTIONS";
@@ -0,0 +1,18 @@
1
+ /**
2
+ Initial chart state for the line chart.
3
+
4
+ @param {Object} options - The chart options.
5
+ @return {Object} The initial chart state.
6
+ */
7
+ declare const initialState: ({ options, persistenceId }: any) => {
8
+ zoomEnabled: any;
9
+ panEnabled: any;
10
+ pointsEnabled: any;
11
+ lineEnabled: any;
12
+ legendEnabled: any;
13
+ axes: any[];
14
+ showAnnotationLineIndex: number[];
15
+ showTable: boolean;
16
+ enableDragPoints: any;
17
+ };
18
+ export default initialState;
@@ -0,0 +1 @@
1
+ export declare const reducer: (state: any, action: any) => (base?: ((draft: any) => void) | undefined, ...args: unknown[]) => (draft: any) => void;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Retrieves the chart state from local storage.
3
+ *
4
+ * @param {string|''} persistenceId - The chart persistenceId.
5
+ * @returns {object|null} The chart state object or null if not found.
6
+ */
7
+ export declare const getChartStateFromStorage: (persistenceId: string) => any;
8
+ /**
9
+ * Stores the chart state in local storage.
10
+ *
11
+ * @param {object} state - The chart state object to store.
12
+ * @param {string|''} persistenceId - The chart persistenceId.
13
+ */
14
+ export declare const storeChartStateInStorage: (state: any, persistenceId: string) => void;
@@ -0,0 +1,8 @@
1
+ export interface IUseChartState {
2
+ chartRef: any;
3
+ options: any;
4
+ state: any;
5
+ generatedDatasets: Array<any>;
6
+ dispatch: () => void;
7
+ persistenceId: any;
8
+ }
@@ -0,0 +1,12 @@
1
+ import { IUseChartState } from './state.interfaces';
2
+ /**
3
+ * Hook for managing the state of the chart.
4
+ *
5
+ * @param chartRef - The reference to the chart.
6
+ * @param options - The chart options.
7
+ * @param state - The chart state.
8
+ * @param {Array} generatedDatasets - An array of generated datasets for the chart.
9
+ * @param dispatch - The dispatch function for state management.
10
+ * @param persistenceId - The chart persistenceId.
11
+ */
12
+ export declare const useChartState: ({ chartRef, options, state, generatedDatasets, dispatch, persistenceId, }: IUseChartState) => void;
@@ -0,0 +1 @@
1
+ export declare const formatAxisLabelNumbers: (tickValue: number, ticks: Array<any>, locale?: string) => string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Auto scales axis ranges (mix, max) if no explicit range is set
3
+ * - overrides some edge cases not handled well by default chart.js
4
+ * - supports optional padding when `autoAxisPadding` is set
5
+ * - otherwise does not set min/max (falls back to chart.js default)
6
+ *
7
+ * @function autoScale
8
+ * @return {object} scales
9
+ */
10
+ export declare const autoScale: (options: any, state: any, generatedDatasets: any) => any;
@@ -0,0 +1,9 @@
1
+ /** returning boolean condition depends on label position and chart area
2
+ *
3
+ * @return {object} - returning object with boolean props
4
+ */
5
+ export declare const getCondition: (x: number, y: number, left: number, right: number, bottom: number) => {
6
+ overLeftSide: boolean;
7
+ overRightSide: boolean;
8
+ overBottomSide: boolean;
9
+ };
@@ -0,0 +1,11 @@
1
+ /** returning destructured data from context
2
+ *
3
+ * @return {object}
4
+ */
5
+ export declare const getAlignmentData: (context: any) => {
6
+ x: any;
7
+ y: any;
8
+ left: any;
9
+ right: any;
10
+ bottom: any;
11
+ };
@@ -0,0 +1,5 @@
1
+ /** returning position depends on condition
2
+ *
3
+ * @return {string} - position
4
+ */
5
+ export declare const getPosition: () => (context: any) => "left" | "right" | "start" | "end";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Generates line chart datasets based on the provided datasets, state, and options.
3
+ *
4
+ * @param {Array} datasets - The initial datasets for the line chart.
5
+ * @param {Object} state - The state object containing chart settings (e.g., lineEnabled, pointsEnabled, axes).
6
+ * @param {Object} options - The options object containing additional settings (e.g., annotations, graph).
7
+ * @param {Object} translations - The getTranslations object with the label property
8
+ * @returns {Array} - The generated line chart datasets with applied settings and configurations.
9
+ */
10
+ export declare const generateLineChartDatasets: (datasets: Array<any>, state: any, options: any, { label }: any) => any[];
@@ -0,0 +1,6 @@
1
+ export declare const getAxesRangesFromChart: (chartRef: any, axes: any) => {
2
+ unit?: any;
3
+ id: any;
4
+ min: any;
5
+ max: any;
6
+ }[];
@@ -0,0 +1,17 @@
1
+ import { ILineChartOptions } from '../line-chart.interface';
2
+ /**
3
+ * adjusts the position of the label depends on chart area
4
+ *
5
+ * @param {import('../line-chart.interface').ILineChartOptions} options - line chart options object
6
+ * @return {object} - returning position, if label exist in datasets item
7
+ */
8
+ declare const getLineChartDataLabels: (options: ILineChartOptions) => {
9
+ display: string;
10
+ align: (context: any) => "left" | "right" | "start" | "end";
11
+ formatter: (_value: any, context: any) => any;
12
+ } | {
13
+ display: boolean;
14
+ align?: undefined;
15
+ formatter?: undefined;
16
+ };
17
+ export default getLineChartDataLabels;
@@ -0,0 +1,9 @@
1
+ import { ILineChartOptions } from '../line-chart.interface';
2
+ import { IInitialState } from '../../../helpers/chart-interface';
3
+ /**
4
+ *
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
+ */
8
+ declare const getLineChartScales: (options: ILineChartOptions, state: IInitialState) => any;
9
+ export default getLineChartScales;
@@ -0,0 +1,16 @@
1
+ import { ILineChartOptions } from '../line-chart.interface';
2
+ /**
3
+ * @param {import('../line-chart.interface').ILineChartOptions} options - line chart options object
4
+ */
5
+ declare const getLineChartToolTips: (options: ILineChartOptions) => {
6
+ enabled: boolean;
7
+ mode: "nearest";
8
+ intersect: boolean;
9
+ padding: number;
10
+ callbacks: {
11
+ title: (tooltipItem: any, _data: any) => string;
12
+ label: (tooltipItem: any) => string;
13
+ afterLabel: (tooltipItem: any) => string;
14
+ };
15
+ };
16
+ export default getLineChartToolTips;
@@ -0,0 +1,31 @@
1
+ export declare const toNum: (value: string | number) => any;
2
+ export declare const isLessThanMax: (value: string | number, max: string | number) => boolean;
3
+ export declare const isGreaterThanMin: (value: string | number, min: string | number) => boolean;
4
+ /**
5
+ *
6
+ * @param {'x'|'y'} axisType
7
+ * @param {number} [index] - axis index; optional, 0 by default
8
+ * @param {boolean} [hasMultiAxes] - optional, false by default
9
+ * @return {string} - e.g. x if chart has singular axes; x, x2 - in case of multiple axes
10
+ */
11
+ export declare const generateAxisId: (axisType: string, index?: number, hasMultiAxes?: boolean) => string;
12
+ /**
13
+ Get axis type from a key string.
14
+ @param {string} string - The key string to extract from.
15
+ @returns {string} e.g. x1 => x
16
+ */
17
+ export declare const getAxisTypeFromKey: (string: string) => string;
18
+ /**
19
+ * Generates a key based on an array of values. The key changes
20
+ * if any of the values in the array change.
21
+ *
22
+ * @param {Array} values - The array of values to base the key on.
23
+ * @returns {String} The key.
24
+ */
25
+ export declare const generateKey: (values: Array<any>) => string;
26
+ /**
27
+ * Checks if a value is a primitive value (which includes strings, numbers, booleans, and null).
28
+ * @param {*} value - The value to check.
29
+ * @returns {boolean} - Returns true if the value is a primitive value, otherwise false.
30
+ */
31
+ export declare const isPrimitiveValue: (value: any) => boolean;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Merges custom getTranslations with the default getTranslations.
3
+ * If a custom translation is provided for a key, it will override the default one.
4
+ * @param {object} translations - Custom getTranslations.
5
+ * @returns {object} - The resulting getTranslations object, containing both default and custom getTranslations.
6
+ */
7
+ export declare const getTranslations: (translations?: any) => {};
@@ -0,0 +1,39 @@
1
+ import { IPieChartProps } from './pie-chart.interface';
2
+ export declare const getDefaultProps: (props: IPieChartProps) => {
3
+ testId: string | null;
4
+ data: import("./pie-chart.interface").IChartData;
5
+ options: {
6
+ title: string | string[];
7
+ chartStyling: {
8
+ width: string | number;
9
+ height: string | number;
10
+ maintainAspectRatio: boolean;
11
+ staticChartHeight: boolean;
12
+ performanceMode: boolean;
13
+ };
14
+ tooltip: {
15
+ tooltips: boolean;
16
+ showLabelsInTooltips: boolean;
17
+ };
18
+ graph: {
19
+ showDataLabels: boolean;
20
+ stacked: boolean;
21
+ cutout: string | number;
22
+ };
23
+ legend: {
24
+ display: boolean;
25
+ useDataset: boolean;
26
+ position: "top" | "bottom" | "right";
27
+ align: "start" | "center" | "end";
28
+ };
29
+ chartOptions: {
30
+ enableZoom: boolean;
31
+ enablePan: boolean;
32
+ };
33
+ interactions: {
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;
37
+ };
38
+ };
39
+ };
@@ -0,0 +1,2 @@
1
+ export declare const colors: string[];
2
+ export declare const generateRandomColor: () => string;
@@ -0,0 +1,9 @@
1
+ import { IPieChartProps } from './pie-chart.interface';
2
+ /**
3
+ * this is a pie chart component
4
+ * @param {} props
5
+ * @param {import('./pie-chart.interface').IPieChartProps} IPieChartProps
6
+ * ./pie-chart.interface
7
+ */
8
+ declare const PieChart: (props: IPieChartProps) => JSX.Element;
9
+ export { PieChart };
@@ -0,0 +1,54 @@
1
+ export interface IChartInteractions {
2
+ onLegendClick: (legendItem: string, hidden: boolean) => any;
3
+ onPointHover: () => any;
4
+ onPointUnhover: () => any;
5
+ onPieHover: (evt: Event, datasetIndex: string | number, index: string | number, generatedDataset: any) => any;
6
+ onPieUnhover: (evt: Event) => any;
7
+ }
8
+ export interface IChartOptions {
9
+ enableZoom: boolean;
10
+ enablePan: boolean;
11
+ }
12
+ export interface IChartLegend {
13
+ display: boolean;
14
+ position: 'top' | 'bottom' | 'right';
15
+ align: 'start' | 'center' | 'end';
16
+ useDataset: boolean;
17
+ }
18
+ export interface IChartGraph {
19
+ showDataLabels: boolean;
20
+ stacked: boolean;
21
+ cutout: number | string;
22
+ }
23
+ export interface IChartTooltip {
24
+ tooltips: boolean;
25
+ showLabelsInTooltips: boolean;
26
+ }
27
+ export interface IChartStyling {
28
+ width: number | string;
29
+ height: number | string;
30
+ maintainAspectRatio: boolean;
31
+ staticChartHeight: boolean;
32
+ performanceMode: boolean;
33
+ }
34
+ export interface IOptions {
35
+ title: string | string[];
36
+ chartStyling: IChartStyling;
37
+ tooltip: IChartTooltip;
38
+ graph: IChartGraph;
39
+ legend: IChartLegend;
40
+ chartOptions: IChartOptions;
41
+ interactions: IChartInteractions;
42
+ }
43
+ export interface IChartData {
44
+ labels: string;
45
+ datasets: any[];
46
+ }
47
+ export interface IChartProps {
48
+ testId: string | null;
49
+ data: IChartData;
50
+ options: IOptions;
51
+ }
52
+ export interface IPieChartProps {
53
+ chart: IChartProps;
54
+ }
@@ -0,0 +1,7 @@
1
+ import { IScatterChartProps } from './scatter-chart.intefrace';
2
+ /**
3
+ *
4
+ * @param {import('./scatter-chart.intefrace').IScatterChartProps} props
5
+ */
6
+ declare const ScatterChart: (props: IScatterChartProps) => JSX.Element;
7
+ export default ScatterChart;
@@ -0,0 +1,28 @@
1
+ import { IChartPlugins } from '../../helpers/chart-interface';
2
+ export interface IScatterChartOptions {
3
+ responsive: boolean;
4
+ maintainAspectRatio: boolean;
5
+ plugins: IChartPlugins;
6
+ }
7
+ export interface IScatterChartPoint {
8
+ x: number | string;
9
+ y: number | string;
10
+ label?: string;
11
+ }
12
+ export interface IScatterChartDataset {
13
+ label: string;
14
+ data: IScatterChartPoint[];
15
+ borderColor: string;
16
+ backgroundColor: string;
17
+ showLine: Boolean;
18
+ }
19
+ export interface IScatterChartData {
20
+ testId: string | null;
21
+ data: {
22
+ datasets: IScatterChartDataset[];
23
+ };
24
+ options: IScatterChartOptions;
25
+ }
26
+ export interface IScatterChartProps {
27
+ chart: IScatterChartData;
28
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Chart border plugin config
3
+ */
4
+ export declare const chartAreaBorderPlugin: {
5
+ id: string;
6
+ beforeDraw(chart: any, args: any, options: any): void;
7
+ };
@@ -0,0 +1,32 @@
1
+ export declare const BORDER_WIDTH: {
2
+ INITIAL: number;
3
+ HOVERED: number;
4
+ };
5
+ export declare const BORDER_COLOR = "rgba(0,0,0,0.1)";
6
+ export declare const ANNOTATION_DASH: number[];
7
+ export declare const DEFAULT_FONT_SIZE = 13;
8
+ export declare const DEFAULT_FONT_FAMILY = "\"Lato\", sans-serif";
9
+ export declare const DEFAULT_COLOR = "rgba(0,0,0,.87)";
10
+ export declare const LEGEND_LABEL_BOX_SIZE = 6;
11
+ export declare const LOGARITHMIC_STEPS: number[];
12
+ export declare const COLORS: string[];
13
+ /**
14
+ * @type {string}
15
+ * @desc equivalent of 0.6 rgba alpha chanel
16
+ */
17
+ export declare const ALPHA_CHANEL = "99";
18
+ /**
19
+ * @type {number}
20
+ * @desc #FFFFFF as decimal number
21
+ */
22
+ export declare const WHITE_COLOR_AS_DECIMAL = 16777215;
23
+ export declare const AUTO = "auto";
24
+ export declare const ANIMATION_DURATION: {
25
+ NO: number;
26
+ SLOW: number;
27
+ FAST: number;
28
+ };
29
+ export declare const DEFAULT_CHART_NAME = "new_chart";
30
+ export declare const CUSTOM_LEGEND_PLUGIN_NAME = "htmlLegend";
31
+ export declare const DECIMAL_POINT_TOLERANCE = 9;
32
+ export declare const MAX_DECIMAL_DIFF: number;
@@ -0,0 +1,85 @@
1
+ import { Plugin } from 'chart.js';
2
+ export interface IChartDraggableData {
3
+ enableDragData: boolean;
4
+ showTooltip: boolean;
5
+ roundPoints: boolean;
6
+ dragX: boolean;
7
+ dragY: boolean;
8
+ onDragStart: () => any;
9
+ onDrag: () => any;
10
+ onDragEnd: () => any;
11
+ }
12
+ export interface IChartAnnotationsData {
13
+ adjustScaleRange: boolean;
14
+ annotationAxis: 'x' | 'y';
15
+ color: string;
16
+ endValue: number;
17
+ label: string;
18
+ type: string;
19
+ value: number;
20
+ xMin: number;
21
+ xMax: number;
22
+ yMin: number;
23
+ yMax: number;
24
+ }
25
+ export interface ILabelAnnotation {
26
+ showLabel: boolean;
27
+ text: string | string[];
28
+ position?: string;
29
+ fontSize?: number;
30
+ xOffset?: number;
31
+ yOffset?: number;
32
+ maxWidth?: number;
33
+ lineHeight?: number;
34
+ }
35
+ export interface IChartAnnotations {
36
+ showAnnotations: boolean;
37
+ controlAnnotation: boolean;
38
+ annotationsData: IChartAnnotationsData[];
39
+ labelAnnotation: ILabelAnnotation;
40
+ }
41
+ export interface IChartStyling {
42
+ width: number | string;
43
+ height: number | string;
44
+ maintainAspectRatio: boolean;
45
+ squareAspectRatio?: boolean;
46
+ staticChartHeight: boolean;
47
+ performanceMode: boolean;
48
+ layoutPadding: any;
49
+ }
50
+ export interface ICustomLegend {
51
+ customLegendPlugin: Plugin | null;
52
+ customLegendContainerID: string;
53
+ }
54
+ export interface IChartLegend {
55
+ display: boolean;
56
+ position: 'top' | 'bottom' | 'right';
57
+ align: 'start' | 'center' | 'end';
58
+ customLegend?: ICustomLegend;
59
+ usePointStyle: boolean;
60
+ }
61
+ export interface IChartInteractions {
62
+ onLegendClick: () => any;
63
+ onPointHover: () => any;
64
+ onPointUnhover: () => any;
65
+ onAnimationComplete: () => any;
66
+ }
67
+ export interface IInitialState {
68
+ zoomEnabled?: boolean;
69
+ panEnabled?: boolean;
70
+ pointsEnabled?: boolean;
71
+ lineEnabled?: boolean;
72
+ legendEnabled?: boolean;
73
+ axes?: any;
74
+ showAnnotationLineIndex: [];
75
+ enableDragData?: boolean;
76
+ }
77
+ export interface IChartPlugins {
78
+ legend: {
79
+ position: 'top' | 'right' | 'bottom' | 'left';
80
+ };
81
+ title: {
82
+ display: boolean;
83
+ text: string;
84
+ };
85
+ }