@oliasoft-open-source/charts-library 3.7.0-beta-2 → 3.7.0-beta-3

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 (33) hide show
  1. package/dist/index.js +333 -177
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/components/bar-chart/get-bar-chart-data-labels.d.ts +1 -2
  4. package/dist/src/components/bar-chart/get-bar-chart-scales.d.ts +1 -2
  5. package/dist/src/components/common/common.interface.d.ts +2 -1
  6. package/dist/src/components/common/helpers/chart-border-plugin.d.ts +2 -2
  7. package/dist/src/components/common/helpers/chart-utils.d.ts +91 -0
  8. package/dist/src/components/common/helpers/get-custom-legend-plugin-example.d.ts +1 -1
  9. package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +2 -2
  10. package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +2 -2
  11. package/dist/src/components/line-chart/controls/drag-options-interfaces.d.ts +1 -1
  12. package/dist/src/components/line-chart/controls/line-options.d.ts +2 -1
  13. package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +2 -13
  14. package/dist/src/components/line-chart/hooks/use-chart-plugins.d.ts +7 -0
  15. package/dist/src/components/line-chart/hooks/use-chart-state.d.ts +2 -3
  16. package/dist/src/components/line-chart/hooks/use-generated-labels.d.ts +1 -0
  17. package/dist/src/components/line-chart/hooks/use-legend-state.d.ts +40 -0
  18. package/dist/src/components/line-chart/legend/create-style-object.d.ts +26 -0
  19. package/dist/src/components/line-chart/legend/legend-interface.d.ts +1 -1
  20. package/dist/src/components/line-chart/line-chart-get-default-props.d.ts +2 -99
  21. package/dist/src/components/line-chart/line-chart.interface.d.ts +3 -3
  22. package/dist/src/components/line-chart/line-chart.stories.d.ts +72 -0
  23. package/dist/src/components/line-chart/state/initial-state.d.ts +4 -26
  24. package/dist/src/components/line-chart/utils/__tests__/get-line-chart-tooltips.test.d.ts +1 -0
  25. package/dist/src/components/line-chart/utils/axis-formatting/axis-formatting.d.ts +1 -1
  26. package/dist/src/components/line-chart/utils/check-custom-option/check-custom-option.d.ts +15 -0
  27. package/dist/src/components/line-chart/utils/check-custom-option/check-custom-option.test.d.ts +1 -0
  28. package/dist/src/components/line-chart/utils/enums.d.ts +4 -0
  29. package/dist/src/components/line-chart/utils/get-axis-range-by-type.d.ts +10 -0
  30. package/dist/src/components/line-chart/utils/get-generated-labels.d.ts +1 -0
  31. package/package.json +2 -1
  32. package/dist/declaration.d.ts +0 -17
  33. /package/dist/src/components/line-chart/utils/{get-line-chart-tooltips.test.d.ts → __tests__/get-axis-range-by-type.test.d.ts} +0 -0
@@ -1,7 +1,6 @@
1
- import { Options } from 'chartjs-plugin-datalabels';
2
1
  import { IBarOptions } from './bar-chart.interface';
3
2
  type ExtendedDisplayOptions = 'auto' | boolean;
4
- interface IExtendedDataLabelsOptions extends Options {
3
+ interface IExtendedDataLabelsOptions {
5
4
  display: ExtendedDisplayOptions;
6
5
  }
7
6
  /**
@@ -1,6 +1,5 @@
1
- import { Chart } from 'chart.js';
2
1
  /**
3
2
  * @param {IBarChartData} chart - chart data
4
3
  */
5
- declare const getBarChartScales: (chart: Chart) => any;
4
+ declare const getBarChartScales: (chart: any) => any;
6
5
  export default getBarChartScales;
@@ -1,5 +1,6 @@
1
1
  import { ChartEvent, ChartTypeRegistry, LinearScaleOptions, Plugin } from 'chart.js';
2
2
  import { AlignOptions, Position } from './helpers/enums';
3
+ export type TAxisPosition = 'top' | 'bottom' | 'left' | 'right';
3
4
  export interface ICommonDataValue {
4
5
  x: number;
5
6
  y: number;
@@ -124,7 +125,7 @@ export interface ICommonHoveredItems {
124
125
  }
125
126
  export interface ICommonChartPlugins {
126
127
  legend: {
127
- position: 'top' | 'right' | 'bottom' | 'left';
128
+ position: TAxisPosition;
128
129
  };
129
130
  title: {
130
131
  display: boolean;
@@ -1,8 +1,8 @@
1
- import { Chart, ChartConfiguration, Plugin } from 'chart.js';
1
+ import { Plugin } from 'chart.js';
2
2
  /**
3
3
  * Chart border plugin config
4
4
  */
5
5
  export declare const chartAreaBorderPlugin: {
6
6
  id: string;
7
- beforeDraw(chart: Chart, _args: Plugin, options: ChartConfiguration): void;
7
+ beforeDraw(chart: any, _args: Plugin, options: any): void;
8
8
  };
@@ -0,0 +1,91 @@
1
+ import { ChartTypeRegistry, Plugin } from 'chart.js';
2
+ import { ICommonAnnotationsData, ICommonCustomLegend } from '../common.interface';
3
+ import { Position } from './enums';
4
+ interface IChartGraph {
5
+ showMinorGridlines: boolean;
6
+ }
7
+ interface IOptions {
8
+ title?: string | string[];
9
+ legend?: {
10
+ position: Position;
11
+ display?: boolean;
12
+ align?: string;
13
+ usePointStyle?: boolean;
14
+ };
15
+ }
16
+ interface IStyling {
17
+ width?: string | number;
18
+ height?: string | number;
19
+ squareAspectRatio?: number | boolean;
20
+ maintainAspectRatio?: boolean;
21
+ staticChartHeight?: boolean;
22
+ performanceMode?: boolean;
23
+ }
24
+ interface IAxis {
25
+ label: string;
26
+ }
27
+ interface ILegend {
28
+ customLegend?: ICommonCustomLegend<any>;
29
+ }
30
+ /**
31
+ * @param { graph } graph - graph data from chart options
32
+ * @param { legend } legend
33
+ * @return {[]}
34
+ */
35
+ export declare const getPlugins: <T extends keyof ChartTypeRegistry>(graph: IChartGraph, legend: ILegend) => any;
36
+ /**
37
+ * @param {string[]} colors - color schema
38
+ * @return {string} - random color
39
+ */
40
+ export declare const generateRandomColor: (colors: string[]) => string[];
41
+ /**
42
+ * @param {annotationsData[]} annotationsData
43
+ * @return {number[]|*[]}
44
+ */
45
+ export declare const setAnnotations: (annotationsData: ICommonAnnotationsData[]) => number[];
46
+ /**
47
+ * @param {ICommonChartOptions} options - chart options object
48
+ * @return {{color: (string|undefined), display: boolean, text}|{}}
49
+ */
50
+ export declare const getTitle: (options: IOptions) => {
51
+ display: boolean;
52
+ text: string | string[] | undefined;
53
+ } | {
54
+ display?: undefined;
55
+ text?: undefined;
56
+ };
57
+ /**
58
+ * @function isVertical
59
+ * @param {'vertical'|'horizontal'|string} direction
60
+ * @return {boolean} returns true if chart direction is vertical
61
+ */
62
+ export declare const isVertical: (direction: string) => boolean;
63
+ /**
64
+ * @param {'x'|'y'} axisType
65
+ * @param {number} i - index
66
+ * @return {'top'|'bottom'|'left'|'right'|*}
67
+ */
68
+ export declare const getAxisPosition: (axisType: string, i: number) => Position;
69
+ /**
70
+ * @param {chartStyling} chartStyling
71
+ * @param {Object} styles - styles imported form .less file
72
+ * @return {string} - class name
73
+ */
74
+ export declare const getClassName: (chartStyling: IStyling, styles: Record<string, string>) => string;
75
+ export declare const getLegend: (options: IOptions, clickHandler: (_e: any, legendItem: any) => void) => {
76
+ position: Position;
77
+ display: boolean | undefined;
78
+ align: string | undefined;
79
+ labels: {
80
+ boxHeight: number;
81
+ boxWidth: number | undefined;
82
+ usePointStyle: boolean | undefined;
83
+ };
84
+ onClick: (_e: any, legendItem: any) => void;
85
+ };
86
+ export declare const afterLabelCallback: (tooltipItem: Record<string, any>) => string;
87
+ export declare const getTooltipLabel: (tooltipItem: Record<string, any>, showLabelsInTooltips: boolean) => string;
88
+ export declare const getChartFileName: (axes: IAxis[]) => string;
89
+ export declare const setDefaultTheme: () => void;
90
+ export declare const isNilOrEmpty: (value: any) => boolean;
91
+ export {};
@@ -1,4 +1,4 @@
1
- import { Chart, Plugin, ChartConfiguration } from 'chart.js';
1
+ import { Chart, ChartConfiguration, Plugin } from 'chart.js';
2
2
  /**
3
3
  * Gets an example custom legend plugin for use in storybook.
4
4
  * @param {string} customLegendContainerID - the id of the div container to put the generated legend in
@@ -15,7 +15,7 @@ export interface IAxesOptions {
15
15
  controlsAxesLabels: IAxisControlLabel[];
16
16
  onUpdateAxes: (axes: IAxisState) => void;
17
17
  onResetAxes: () => void;
18
- depthType: IDepthType;
18
+ depthType?: IDepthType | object;
19
19
  close?: () => void;
20
20
  }
21
21
  export interface IOnEdit {
@@ -27,7 +27,7 @@ export interface IAxisFormState {
27
27
  id: string;
28
28
  min: number | string;
29
29
  max: number | string;
30
- unit: string | IUnitOptions;
30
+ unit?: string | IUnitOptions;
31
31
  }
32
32
  export type IInitializeAxisFormState = IAxisFormState[];
33
33
  export interface IError {
@@ -1,9 +1,9 @@
1
- import { Dispatch, RefObject } from 'react';
1
+ import { Dispatch, ReactNode, RefObject } from 'react';
2
2
  import { Chart } from 'chart.js';
3
3
  import { ILineChartDataset, ILineChartOptions } from '../line-chart.interface';
4
4
  import { IState } from '../state/state.interfaces';
5
5
  export interface IControls {
6
- headerComponent?: Element;
6
+ headerComponent?: ReactNode;
7
7
  subheaderComponent?: Element;
8
8
  table?: Element;
9
9
  chartRef: RefObject<Chart>;
@@ -4,7 +4,7 @@ export interface IDragOptions {
4
4
  panEnabled: boolean;
5
5
  zoomEnabled: boolean;
6
6
  enableDragPoints: boolean;
7
- isDragDataAllowed: boolean;
7
+ isDragDataAllowed?: boolean;
8
8
  onToggleDragPoints: () => void;
9
9
  onDisableDragOptions: () => void;
10
10
  translations: Record<string, string>;
@@ -4,6 +4,7 @@ interface ILineOptions {
4
4
  onTogglePoints: () => void;
5
5
  pointsEnabled: boolean;
6
6
  translations: Record<string, string>;
7
+ hasCustomOpt: boolean;
7
8
  }
8
- export declare const LineOptions: ({ lineEnabled, onToggleLine, onTogglePoints, pointsEnabled, translations, }: ILineOptions) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const LineOptions: ({ lineEnabled, onToggleLine, onTogglePoints, pointsEnabled, translations, hasCustomOpt, }: ILineOptions) => import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -2,7 +2,7 @@ import { Dispatch, RefObject } from 'react';
2
2
  import { Chart, ChartEvent } from 'chart.js';
3
3
  import { ICommonHoveredItems } from '../../common/common.interface';
4
4
  import { ILineChartDataset, ILineChartOptions } from '../line-chart.interface';
5
- import { IState } from '../state/state.interfaces';
5
+ import { InitialState, IState } from '../state/state.interfaces';
6
6
  interface IUseChartFunctions {
7
7
  chartRef: RefObject<Chart>;
8
8
  state: IState;
@@ -20,28 +20,17 @@ interface IUseChartFunctions {
20
20
  * @returns {Object} An object containing the chart-related functions
21
21
  */
22
22
  export declare const useChartFunctions: ({ chartRef, state, options, dispatch, generatedDatasets, }: IUseChartFunctions) => {
23
- legendClick: (_e: ChartEvent, legendItem: any) => void;
24
23
  resetZoom: () => void;
25
24
  onHover: (hoveredPoint: any, setHoveredPoint: any) => (evt: ChartEvent, hoveredItems: ICommonHoveredItems[]) => void;
26
25
  handleDownload: () => void;
27
26
  handleKeyDown: (evt: any) => void;
28
27
  handleKeyUp: (evt: any) => void;
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
28
  controlsAxesLabels: {
38
29
  id: string;
39
30
  label: string;
40
31
  }[];
41
32
  updateAxesRangesFromChart: () => void;
42
33
  onResetAxes: () => void;
43
- onUpdateAxes: ({ axes }: {
44
- axes: any;
45
- }) => void;
34
+ onUpdateAxes: ({ axes }: InitialState) => void;
46
35
  };
47
36
  export {};
@@ -0,0 +1,7 @@
1
+ import { ILineChartOptions } from '../line-chart.interface';
2
+ interface IUseChartPlugins {
3
+ options: ILineChartOptions;
4
+ resetZoom: () => void;
5
+ }
6
+ export declare const useChartPlugins: ({ options, resetZoom }: IUseChartPlugins) => any[];
7
+ export {};
@@ -1,12 +1,11 @@
1
1
  import { Dispatch, RefObject } from 'react';
2
2
  import { Chart } from 'chart.js';
3
3
  import { IState } from '../state/state.interfaces';
4
- import { ILineChartDataset, ILineChartOptions } from '../line-chart.interface';
4
+ import { ILineChartOptions } from '../line-chart.interface';
5
5
  interface IUseChartState {
6
6
  chartRef: RefObject<Chart>;
7
7
  options: ILineChartOptions;
8
8
  state: IState;
9
- generatedDatasets: ILineChartDataset[];
10
9
  dispatch: Dispatch<any>;
11
10
  persistenceId?: string;
12
11
  }
@@ -20,5 +19,5 @@ interface IUseChartState {
20
19
  * @param dispatch - The dispatch function for state management.
21
20
  * @param persistenceId - The chart persistenceId.
22
21
  */
23
- export declare const useChartState: ({ chartRef, options, state, generatedDatasets, dispatch, persistenceId, }: IUseChartState) => void;
22
+ export declare const useChartState: ({ chartRef, options, state, dispatch, persistenceId, }: IUseChartState) => void;
24
23
  export {};
@@ -0,0 +1 @@
1
+ export declare const useGeneratedLabels: (chartRef: any, generatedDatasets: Record<string, any>[]) => any[];
@@ -0,0 +1,40 @@
1
+ import { Dispatch, RefObject } from 'react';
2
+ import { Chart, ChartEvent } from 'chart.js';
3
+ import { ILineChartOptions } from '../line-chart.interface';
4
+ import { IState } from '../state/state.interfaces';
5
+ export interface IUseLegendStateProps {
6
+ chartRef: RefObject<Chart>;
7
+ options: ILineChartOptions;
8
+ state: IState;
9
+ dispatch: Dispatch<any>;
10
+ }
11
+ export type THiddenState = {
12
+ label: string;
13
+ hidden: boolean;
14
+ datasetIndex: number;
15
+ };
16
+ /**
17
+ * Custom hook to manage legend state.
18
+ */
19
+ export declare const useLegendState: ({ chartRef, options, state, dispatch, }: IUseLegendStateProps) => {
20
+ legendClick: (_e: ChartEvent, legendItem: any) => void;
21
+ hiddenStates: THiddenState[];
22
+ legend: {
23
+ position: import("../../common/helpers/enums").Position;
24
+ display: boolean | undefined;
25
+ align: string | undefined;
26
+ labels: {
27
+ boxHeight: number;
28
+ boxWidth: number | undefined;
29
+ usePointStyle: boolean | undefined;
30
+ };
31
+ onClick: (_e: any, legendItem: any) => void;
32
+ };
33
+ customLegendPlugin: {
34
+ htmlLegend: {
35
+ containerID: string;
36
+ } | null | undefined;
37
+ };
38
+ upsertHiddenState: ({ label, datasetIndex, hidden }: THiddenState) => void;
39
+ clearNonExistentDatasets: (datasets: Record<string, any>[]) => void;
40
+ };
@@ -0,0 +1,26 @@
1
+ import { Position } from '../../common/helpers/enums';
2
+ interface IChartArea {
3
+ top: number;
4
+ left: number;
5
+ bottom: number;
6
+ right: number;
7
+ }
8
+ interface IChart {
9
+ height?: number;
10
+ width?: number;
11
+ chartArea: IChartArea;
12
+ }
13
+ interface ILegendStyle {
14
+ left: number | undefined;
15
+ right: number | undefined;
16
+ top: number | undefined;
17
+ bottom: number | undefined;
18
+ maxHeight: number;
19
+ maxWidth: number;
20
+ margin: number;
21
+ }
22
+ /**
23
+ * Creates a style object for positioning and sizing the legend panel based on the chart dimensions and legend position.
24
+ */
25
+ export declare const createLegendStyle: (legendPosition: Position, chart: IChart) => ILegendStyle;
26
+ export {};
@@ -31,7 +31,7 @@ export interface ILegend {
31
31
  options: ILineChartOptions;
32
32
  dispatch: Dispatch<any>;
33
33
  generatedDatasets: ILineChartDataset[];
34
- translations: Record<string, string>;
34
+ translations?: Record<string, string>;
35
35
  }
36
36
  export interface ILegendPanel extends ILegend {
37
37
  legendPosition: Position;
@@ -1,99 +1,2 @@
1
- import { ILineChartProps } from './line-chart.interface';
2
- import { AlignOptions, Position } from '../common/helpers/enums';
3
- export declare const getDefaultProps: (props: ILineChartProps) => {
4
- persistenceId: string;
5
- controlsPortalId: string;
6
- testId: string | null;
7
- data: {
8
- datasets: import("./line-chart.interface").ILineChartDataset[];
9
- } | undefined;
10
- options: {
11
- title: string | string[];
12
- scales: import("../common/common.interface").ICommonScales;
13
- axes: {
14
- x: import("./line-chart.interface").ILineChartAxis<"bottom" | "top">[] | {}[];
15
- y: import("./line-chart.interface").ILineChartAxis<"left" | "right">[] | {}[];
16
- };
17
- additionalAxesOptions: {
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 | undefined;
25
- autoAxisPadding: boolean;
26
- };
27
- chartStyling: {
28
- width: string | number | undefined;
29
- height: string | number | undefined;
30
- maintainAspectRatio: boolean;
31
- staticChartHeight: boolean;
32
- performanceMode: boolean;
33
- squareAspectRatio: number | boolean;
34
- layoutPadding: string | number | {
35
- top: number;
36
- bottom: number;
37
- left: number;
38
- right: number;
39
- };
40
- };
41
- tooltip: {
42
- tooltips: boolean;
43
- showLabelsInTooltips: boolean;
44
- hideSimulationName: boolean;
45
- };
46
- graph: {
47
- lineTension: number;
48
- spanGaps: boolean;
49
- showDataLabels: boolean;
50
- showMinorGridlines: boolean;
51
- };
52
- annotations: {
53
- labelAnnotation: {
54
- showLabel: boolean;
55
- text: string | string[];
56
- position: string;
57
- fontSize: number;
58
- xOffset: number;
59
- yOffset: number;
60
- maxWidth: number;
61
- lineHeight: number;
62
- };
63
- showAnnotations: boolean;
64
- controlAnnotation: boolean;
65
- annotationsData: import("../common/common.interface").ICommonAnnotationsData[];
66
- };
67
- legend: {
68
- display: boolean;
69
- position: Position;
70
- align: AlignOptions;
71
- customLegend: import("../common/common.interface").ICommonCustomLegend<any>;
72
- usePointStyle: boolean;
73
- };
74
- chartOptions: {
75
- showPoints: boolean;
76
- enableZoom: boolean;
77
- enablePan: boolean;
78
- showLine: boolean;
79
- closeOnOutsideClick: boolean;
80
- };
81
- interactions: {
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;
86
- };
87
- dragData: {
88
- enableDragData: boolean;
89
- showTooltip: boolean;
90
- roundPoints: boolean;
91
- dragX: boolean;
92
- dragY: boolean;
93
- onDragStart: (() => void) | undefined;
94
- onDrag: (() => void) | undefined;
95
- onDragEnd: (() => void) | undefined;
96
- };
97
- depthType: import("./line-chart.interface").IDepthType;
98
- };
99
- };
1
+ import { ILineChartData, ILineChartProps } from './line-chart.interface';
2
+ export declare const getDefaultProps: (props: ILineChartProps) => ILineChartData;
@@ -39,7 +39,7 @@ export interface ILineChartAxis<PositionType> {
39
39
  label: string;
40
40
  position: PositionType;
41
41
  color: string | string[];
42
- unit: IUnitOptions;
42
+ unit?: IUnitOptions;
43
43
  }
44
44
  export interface ILineChartAxes {
45
45
  x: ILineChartAxis<'top' | 'bottom'>[];
@@ -52,7 +52,7 @@ export interface IDepthType {
52
52
  setSelectedUnit: () => void;
53
53
  }
54
54
  export interface ILineChartStyling extends ICommonStyling {
55
- squareAspectRatio?: number;
55
+ squareAspectRatio?: number | boolean;
56
56
  layoutPadding?: string | number | {
57
57
  top: number;
58
58
  bottom: number;
@@ -80,7 +80,7 @@ export interface ILineChartOptions extends ICommonOptions {
80
80
  chartOptions: ILChartOptions;
81
81
  interactions: ILineInteractions;
82
82
  dragData?: ICommonDragData;
83
- depthType: IDepthType;
83
+ depthType?: IDepthType | object;
84
84
  }
85
85
  export interface ILineChartDataset extends ICommonDataset {
86
86
  lineTension?: number;
@@ -1003,6 +1003,78 @@ export namespace TestLongLegendLabels {
1003
1003
  export { args_37 as args };
1004
1004
  }
1005
1005
  export function TestResizingContainer(): import("react/jsx-runtime").JSX.Element;
1006
+ export function PartialRange(args: any): import("react/jsx-runtime").JSX.Element;
1007
+ export namespace PartialRange {
1008
+ export namespace args_38 {
1009
+ export namespace chart_36 {
1010
+ export namespace data_18 {
1011
+ const datasets_18: {
1012
+ label: string;
1013
+ data: {
1014
+ x: number;
1015
+ y: number;
1016
+ }[];
1017
+ }[];
1018
+ export { datasets_18 as datasets };
1019
+ }
1020
+ export { data_18 as data };
1021
+ export namespace options_32 {
1022
+ export namespace additionalAxesOptions_5 {
1023
+ export namespace range_2 {
1024
+ export namespace x_7 {
1025
+ const max_4: number;
1026
+ export { max_4 as max };
1027
+ }
1028
+ export { x_7 as x };
1029
+ export namespace y_6 {
1030
+ const min_4: number;
1031
+ export { min_4 as min };
1032
+ }
1033
+ export { y_6 as y };
1034
+ }
1035
+ export { range_2 as range };
1036
+ }
1037
+ export { additionalAxesOptions_5 as additionalAxesOptions };
1038
+ }
1039
+ export { options_32 as options };
1040
+ }
1041
+ export { chart_36 as chart };
1042
+ }
1043
+ export { args_38 as args };
1044
+ }
1045
+ export function CombiningTypes(args: any): import("react/jsx-runtime").JSX.Element;
1046
+ export namespace CombiningTypes {
1047
+ export namespace args_39 {
1048
+ export namespace chart_37 {
1049
+ export namespace data_19 {
1050
+ const datasets_19: ({
1051
+ label: string;
1052
+ showPoints: boolean;
1053
+ data: {
1054
+ x: number;
1055
+ y: number;
1056
+ }[];
1057
+ showLine?: undefined;
1058
+ } | {
1059
+ label: string;
1060
+ showLine: boolean;
1061
+ data: {
1062
+ x: number;
1063
+ y: number;
1064
+ }[];
1065
+ showPoints?: undefined;
1066
+ })[];
1067
+ export { datasets_19 as datasets };
1068
+ }
1069
+ export { data_19 as data };
1070
+ export namespace options_33 { }
1071
+ export { options_33 as options };
1072
+ }
1073
+ export { chart_37 as chart };
1074
+ }
1075
+ export { args_39 as args };
1076
+ }
1077
+ export function ExternalSelect(): import("react/jsx-runtime").JSX.Element;
1006
1078
  import { LineChart } from './line-chart';
1007
1079
  declare namespace basicChart { }
1008
1080
  declare const customLegendContainerID: "custom-legend-container";
@@ -1,14 +1,7 @@
1
- import { ILChartOptions, ILineChartAdditionalAxesOptions, ILineChartAxes, ILineLegend } from '../line-chart.interface';
2
- import { ICommonAnnotations, ICommonDragData } from '../../common/common.interface';
1
+ import { IState } from './state.interfaces';
2
+ import { ILineChartOptions } from '../line-chart.interface';
3
3
  interface inputInitState {
4
- options: {
5
- additionalAxesOptions: ILineChartAdditionalAxesOptions;
6
- annotations: ICommonAnnotations;
7
- axes: ILineChartAxes;
8
- chartOptions: ILChartOptions;
9
- legend: ILineLegend;
10
- dragData: ICommonDragData;
11
- };
4
+ options: ILineChartOptions;
12
5
  persistenceId?: string;
13
6
  }
14
7
  /**
@@ -17,20 +10,5 @@ interface inputInitState {
17
10
  @param {Object} options - The chart options.
18
11
  @return {Object} The initial chart state.
19
12
  */
20
- declare const initialState: ({ options, persistenceId }: inputInitState) => {
21
- zoomEnabled: any;
22
- panEnabled: any;
23
- pointsEnabled: any;
24
- lineEnabled: any;
25
- legendEnabled: any;
26
- axes: {
27
- unit?: import("../line-chart.interface").IUnitOptions | undefined;
28
- max?: number | undefined;
29
- min?: number | undefined;
30
- id: string;
31
- }[];
32
- showAnnotationLineIndex: number[];
33
- showTable: boolean;
34
- enableDragPoints: any;
35
- };
13
+ declare const initialState: ({ options, persistenceId }: inputInitState) => IState;
36
14
  export default initialState;
@@ -1 +1 @@
1
- export declare const formatAxisLabelNumbers: (tickValue: number, ticks: Array<any>, locale?: string) => string;
1
+ export declare const formatAxisLabelNumbers: (tickValue: number, ticks: Array<any>) => string;
@@ -0,0 +1,15 @@
1
+ type TCustomOptionType = {
2
+ [key: string]: string;
3
+ } | string | string[];
4
+ type TDataType = Record<string, unknown> | Array<any>;
5
+ /**
6
+ * Checks if a single dataset or an array of datasets has a custom option.
7
+ * Iterates through each custom option defined in the customOptions parameter.
8
+ * Returns true if any dataset has any custom option, otherwise returns false.
9
+ *
10
+ * @param {any | any[]} data - The dataset or array of datasets to check.
11
+ * @param {TCustomOptionType} customOptions - The custom options to check for.
12
+ * @returns {boolean} - True if any dataset has any custom option, otherwise false.
13
+ */
14
+ export declare const checkCustomOption: (data: TDataType, customOptions: TCustomOptionType) => boolean;
15
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare enum CUSTOM_OPTION {
2
+ showLine = "showLine",
3
+ showPoints = "showPoints"
4
+ }
@@ -0,0 +1,10 @@
1
+ import { RefObject } from 'react';
2
+ import { Chart } from 'chart.js';
3
+ import { ICommonAnnotationsData } from '../../common/common.interface.ts';
4
+ export type TAxisType = 'x' | 'y' | 'x1' | 'y1';
5
+ interface IMinMax {
6
+ min: number;
7
+ max: number;
8
+ }
9
+ export declare const getAxisRangeByType: (chartRef: RefObject<Chart>, axesType: TAxisType, annotationsData: ICommonAnnotationsData[]) => IMinMax | null;
10
+ export {};
@@ -0,0 +1 @@
1
+ export declare const getGeneratedLabels: (chart: any) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "3.7.0-beta-2",
3
+ "version": "3.7.0-beta-3",
4
4
  "description": "React Chart Library (based on Chart.js and react-chart-js-2)",
5
5
  "homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
6
6
  "resolutions": {
@@ -64,6 +64,7 @@
64
64
  "@storybook/react": "^7.0.18",
65
65
  "@storybook/react-vite": "^7.0.18",
66
66
  "@storybook/testing-library": "^0.2.2",
67
+ "@types/jest": "^29.5.6",
67
68
  "@types/react": "^18.2.24",
68
69
  "@typescript-eslint/parser": "^6.7.4",
69
70
  "@vitejs/plugin-react-swc": "^3.3.2",