@oliasoft-open-source/charts-library 8.0.5 → 9.0.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.
Files changed (122) hide show
  1. package/dist/index.d.ts +15 -2249
  2. package/dist/index.js +927 -898
  3. package/dist/src/components/bar-chart/bar-chart-const.d.ts +2 -0
  4. package/dist/src/components/bar-chart/bar-chart-default-props.d.ts +3 -0
  5. package/dist/src/components/bar-chart/bar-chart.d.ts +43 -0
  6. package/dist/src/components/bar-chart/bar-chart.interface.d.ts +252 -0
  7. package/dist/src/components/bar-chart/utils/get-bar-chart-data-labels.d.ts +10 -0
  8. package/dist/src/components/bar-chart/utils/get-bar-chart-scales.d.ts +4 -0
  9. package/dist/src/components/bar-chart/utils/get-bar-chart-tooltips.d.ts +6 -0
  10. package/dist/src/components/bar-chart/utils/use-bar-chart-config.d.ts +13 -0
  11. package/dist/src/components/bar-chart/utils/use-bar-chart-options.d.ts +54 -0
  12. package/dist/src/components/common/common.interface.d.ts +510 -0
  13. package/dist/src/components/common/controls-portal.d.ts +7 -0
  14. package/dist/src/components/common/enums.d.ts +104 -0
  15. package/dist/src/components/common/helpers/add-transparency/add-transparency.d.ts +1 -0
  16. package/dist/src/components/common/helpers/callout-helpers/callout-helpers.d.ts +25 -0
  17. package/dist/src/components/common/helpers/chart-border-plugin.d.ts +16 -0
  18. package/dist/src/components/common/helpers/chart-consts.d.ts +40 -0
  19. package/dist/src/components/common/helpers/chart-utils.d.ts +86 -0
  20. package/dist/src/components/common/helpers/custom-format-number.d.ts +1 -0
  21. package/dist/src/components/common/helpers/download-png.d.ts +3 -0
  22. package/dist/src/components/common/helpers/get-cartesian-scale-options.d.ts +28 -0
  23. package/dist/src/components/common/helpers/get-chart-annotation.d.ts +139 -0
  24. package/dist/src/components/common/helpers/get-chart-from-ctx.d.ts +1 -0
  25. package/dist/src/components/common/helpers/get-draggableData.d.ts +18 -0
  26. package/dist/src/components/common/helpers/get-grouped-color-scheme/get-grouped-color-scheme.d.ts +12 -0
  27. package/dist/src/components/common/helpers/input-normalizers.d.ts +15 -0
  28. package/dist/src/components/common/helpers/range/estimate-data-series-have-close-values.d.ts +8 -0
  29. package/dist/src/components/common/helpers/range/range.d.ts +33 -0
  30. package/dist/src/components/common/helpers/to-annotation.d.ts +4 -0
  31. package/dist/src/components/common/hooks/use-generated-labels.d.ts +4 -0
  32. package/dist/src/components/common/hooks/use-legend-state.d.ts +28 -0
  33. package/dist/src/components/common/hooks/use-legend.d.ts +4 -0
  34. package/dist/src/components/common/hooks/use-update-annotations.d.ts +4 -0
  35. package/dist/src/components/common/legend-component/legend-dropzone.d.ts +3 -0
  36. package/dist/src/components/common/legend-component/legend-interface.d.ts +50 -0
  37. package/dist/src/components/common/legend-component/legend-item/LegendItemLine.d.ts +5 -0
  38. package/dist/src/components/common/legend-component/legend-item/legend-item.d.ts +3 -0
  39. package/dist/src/components/common/legend-component/legend-panel.d.ts +3 -0
  40. package/dist/src/components/common/legend-component/legend-position-storage.d.ts +3 -0
  41. package/dist/src/components/common/legend-component/legend.d.ts +3 -0
  42. package/dist/src/components/common/legend-component/state/legend-action-types.d.ts +3 -0
  43. package/dist/src/components/common/legend-component/state/legend-context.d.ts +14 -0
  44. package/dist/src/components/common/legend-component/state/legend-state-reducer.d.ts +30 -0
  45. package/dist/src/components/common/legend-component/utils/create-style-object.d.ts +27 -0
  46. package/dist/src/components/common/legend-component/utils/get-generated-labels.d.ts +3 -0
  47. package/dist/src/components/common/plugins/annotation-dragger-plugin/annotation-dragger-plugin.d.ts +15 -0
  48. package/dist/src/components/common/plugins/annotation-dragger-plugin/annotation-position-storage.d.ts +7 -0
  49. package/dist/src/components/common/plugins/annotation-dragger-plugin/enums.d.ts +23 -0
  50. package/dist/src/components/common/plugins/annotation-dragger-plugin/event-helpers.d.ts +6 -0
  51. package/dist/src/components/common/plugins/annotation-dragger-plugin/helpers.d.ts +53 -0
  52. package/dist/src/components/common/plugins/annotation-dragger-plugin/point-annotation-label.d.ts +5 -0
  53. package/dist/src/components/common/plugins/ellipsis-annotation-plugin/compute-ellipse-geometry.d.ts +9 -0
  54. package/dist/src/components/common/plugins/ellipsis-annotation-plugin/ellipsis-annotation-plugin.d.ts +18 -0
  55. package/dist/src/components/common/plugins/gradient-background-plugin/enums.d.ts +11 -0
  56. package/dist/src/components/common/plugins/gradient-background-plugin/gradient-background-plugin.d.ts +2 -0
  57. package/dist/src/components/line-chart/constants/default-translations.d.ts +25 -0
  58. package/dist/src/components/line-chart/constants/line-chart-consts.d.ts +13 -0
  59. package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +57 -0
  60. package/dist/src/components/line-chart/controls/axes-options/axes-options.d.ts +6 -0
  61. package/dist/src/components/line-chart/controls/axes-options/axes-validation.d.ts +8 -0
  62. package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +19 -0
  63. package/dist/src/components/line-chart/controls/controls.d.ts +4 -0
  64. package/dist/src/components/line-chart/controls/drag-options-interfaces.d.ts +14 -0
  65. package/dist/src/components/line-chart/controls/drag-options.d.ts +23 -0
  66. package/dist/src/components/line-chart/controls/line-options.d.ts +19 -0
  67. package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +32 -0
  68. package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +20 -0
  69. package/dist/src/components/line-chart/hooks/use-chart-plugins.d.ts +7 -0
  70. package/dist/src/components/line-chart/hooks/use-chart-state.d.ts +12 -0
  71. package/dist/src/components/line-chart/hooks/use-toggle-handler.d.ts +12 -0
  72. package/dist/src/components/line-chart/initialize/config.d.ts +12 -0
  73. package/dist/src/components/line-chart/initialize/initialize-line-chart.d.ts +17 -0
  74. package/dist/src/components/line-chart/line-chart-get-default-props.d.ts +3 -0
  75. package/dist/src/components/line-chart/line-chart.d.ts +42 -0
  76. package/dist/src/components/line-chart/line-chart.interface.d.ts +458 -0
  77. package/dist/src/components/line-chart/plugins/callout-plugin/callout-plugin.d.ts +11 -0
  78. package/dist/src/components/line-chart/plugins/callout-plugin/helpers.d.ts +42 -0
  79. package/dist/src/components/line-chart/plugins/chart-area-text-plugin.d.ts +17 -0
  80. package/dist/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.d.ts +8 -0
  81. package/dist/src/components/line-chart/plugins/line-markers-plugin/draw.d.ts +39 -0
  82. package/dist/src/components/line-chart/plugins/line-markers-plugin/line-markers-plugin.d.ts +10 -0
  83. package/dist/src/components/line-chart/plugins/line-markers-plugin/types.d.ts +204 -0
  84. package/dist/src/components/line-chart/plugins/line-markers-plugin/utils.d.ts +40 -0
  85. package/dist/src/components/line-chart/plugins/plugin-constants.d.ts +11 -0
  86. package/dist/src/components/line-chart/plugins/plugins.interface.d.ts +9 -0
  87. package/dist/src/components/line-chart/state/action-types.d.ts +12 -0
  88. package/dist/src/components/line-chart/state/helpers.d.ts +13 -0
  89. package/dist/src/components/line-chart/state/initial-state.d.ts +11 -0
  90. package/dist/src/components/line-chart/state/line-chart-reducer.d.ts +2 -0
  91. package/dist/src/components/line-chart/state/manage-state-in-local-storage.d.ts +15 -0
  92. package/dist/src/components/line-chart/state/state.interfaces.d.ts +26 -0
  93. package/dist/src/components/line-chart/utils/axis-formatting/axis-formatting.d.ts +2 -0
  94. package/dist/src/components/line-chart/utils/axis-scales/axis-scales.d.ts +18 -0
  95. package/dist/src/components/line-chart/utils/check-custom-option/check-custom-option.d.ts +12 -0
  96. package/dist/src/components/line-chart/utils/datalabels-alignment/datalabels-alignment.interface.d.ts +20 -0
  97. package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-condition.d.ts +8 -0
  98. package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-data.d.ts +11 -0
  99. package/dist/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.d.ts +6 -0
  100. package/dist/src/components/line-chart/utils/enums.d.ts +4 -0
  101. package/dist/src/components/line-chart/utils/generate-line-chart-datasets.d.ts +8 -0
  102. package/dist/src/components/line-chart/utils/get-annotations-data.d.ts +8 -0
  103. package/dist/src/components/line-chart/utils/get-axes-data-from-metasets.d.ts +5 -0
  104. package/dist/src/components/line-chart/utils/get-axis-range-by-type.d.ts +9 -0
  105. package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +16 -0
  106. package/dist/src/components/line-chart/utils/get-line-chart-scales.d.ts +5 -0
  107. package/dist/src/components/line-chart/utils/get-line-chart-tooltips.d.ts +31 -0
  108. package/dist/src/components/line-chart/utils/line-chart-utils.d.ts +24 -0
  109. package/dist/src/components/line-chart/utils/translations/get-translations.d.ts +8 -0
  110. package/dist/src/components/pie-chart/pie-chart-defalut-props.interface.d.ts +50 -0
  111. package/dist/src/components/pie-chart/pie-chart-get-default-props.d.ts +3 -0
  112. package/dist/src/components/pie-chart/pie-chart.d.ts +38 -0
  113. package/dist/src/components/pie-chart/pie-chart.interface.d.ts +150 -0
  114. package/dist/src/components/pie-chart/use-pie-chart-config.d.ts +42 -0
  115. package/dist/src/components/scatter-chart/hooks/use-scatter-chart-config.d.ts +69 -0
  116. package/dist/src/components/scatter-chart/scatter-chart-default-props.interface.d.ts +73 -0
  117. package/dist/src/components/scatter-chart/scatter-chart-get-default-props.d.ts +4 -0
  118. package/dist/src/components/scatter-chart/scatter-chart.d.ts +41 -0
  119. package/dist/src/components/scatter-chart/scatter-chart.interface.d.ts +193 -0
  120. package/dist/src/components/scatter-chart/utils/get-scales-config.d.ts +5 -0
  121. package/dist/src/components/scatter-chart/utils/get-tooltip-config.d.ts +21 -0
  122. package/package.json +34 -34
@@ -0,0 +1,2 @@
1
+ export declare const DISPLAY_SCIENTIFIC_LOWER_BOUND = 0.0001;
2
+ export declare const DISPLAY_SCIENTIFIC_UPPER_BOUND = 10000000;
@@ -0,0 +1,3 @@
1
+ import { IBarChartProps, IBarDefaultProps, IBarOptionsInput } from './bar-chart.interface';
2
+ export declare const normalizeBarOptions: (options?: IBarOptionsInput) => IBarDefaultProps['options'];
3
+ export declare const getDefaultProps: (props: IBarChartProps) => IBarDefaultProps;
@@ -0,0 +1,43 @@
1
+ import 'chartjs-adapter-date-fns';
2
+ import { IBarChartProps } from './bar-chart.interface';
3
+ /**
4
+ * Renders vertical or horizontal bars with optional stacking, annotations and a legend.
5
+ *
6
+ * Pass partial configuration through `chart`; omitted settings receive component defaults.
7
+ * The example uses sample data, labels and a height of 320 pixels; these are not default values.
8
+ *
9
+ * @remarks
10
+ * Defaults: vertical bars, a top-left legend, zero included in automatic scale bounds, and annotations enabled.
11
+ * Zoom, pan, stacking and data labels are disabled. No fixed width or height is assigned.
12
+ * Performance mode is enabled by default, disabling animations.
13
+ * The linked reference lists the complete normalized default configuration.
14
+ *
15
+ * @see https://gitlab.com/oliasoft-open-source/charts-library/-/blob/master/README.md#barchart
16
+ *
17
+ * @param props - Chart data and options.
18
+ * @returns The chart canvas and its associated UI.
19
+ * @example
20
+ * ```tsx
21
+ * <BarChart chart={{
22
+ * data: {
23
+ * labels: ['A', 'B', 'C'],
24
+ * datasets: [{
25
+ * label: 'DS A',
26
+ * data: [{ x: 'A', y: 10 }, { x: 'B', y: 20 }, { x: 'C', y: 15 }],
27
+ * }],
28
+ * },
29
+ * options: {
30
+ * direction: 'vertical',
31
+ * axes: {
32
+ * x: [{ label: 'Category', position: 'bottom' }],
33
+ * y: [{ label: 'Value', position: 'left' }],
34
+ * },
35
+ * chartStyling: { height: 320 },
36
+ * legend: { display: true, position: 'top-left' },
37
+ * graph: { showDataLabels: false },
38
+ * },
39
+ * }} />
40
+ * ```
41
+ */
42
+ declare const BarChartWithLegend: (props: IBarChartProps) => import("react").JSX.Element;
43
+ export { BarChartWithLegend as BarChart };
@@ -0,0 +1,252 @@
1
+ import type { ChartDataset } from 'chart.js';
2
+ import type { DeepPartial, ICommonAdditionalAxesOptions, ICommonAnnotations, ICommonAnnotationsData, ICommonAxis, ICommonChartOptions, ICommonCustomLegend, ICommonData, ICommonDataset, ICommonDataValue, ICommonDragData, ICommonGraph, ICommonInteractions, ICommonLegend, ICommonOptions, ICommonScales, ICommonStyling, ICommonTooltip } from '../common/common.interface';
3
+ import type { IChartGraph } from '../common/helpers/chart-utils.js';
4
+ import { ChartType } from '../common/enums';
5
+ /** BarChart canvas sizing and padding. */
6
+ export interface IBarStyling extends ICommonStyling {
7
+ /** Requests a square chart layout; LineChart also accepts a numeric layout value. */
8
+ squareAspectRatio?: boolean;
9
+ /** Padding around the chart area, globally or per side. */
10
+ layoutPadding?: string | number | {
11
+ top: number;
12
+ bottom: number;
13
+ left: number;
14
+ right: number;
15
+ };
16
+ }
17
+ /** BarChart legend options, including custom HTML legend integration. */
18
+ export interface IBarLegend extends ICommonLegend {
19
+ /** Custom legend plugin and its target DOM container. */
20
+ customLegend?: ICommonCustomLegend<any>;
21
+ }
22
+ /** Ordered horizontal and vertical BarChart axis collections. */
23
+ export interface IBarAxes {
24
+ /** Horizontal axis definitions in order. */
25
+ x: ICommonAxis<'top' | 'bottom'>[];
26
+ /** Vertical axis definitions in order. */
27
+ y: ICommonAxis<'left' | 'right'>[];
28
+ [key: string]: ICommonAxis[];
29
+ }
30
+ /** BarChart scale options with independent X/Y stacking controls. */
31
+ export interface IBarAdditionalAxesOptions extends ICommonAdditionalAxesOptions {
32
+ /** Enables stacking on the X scale. */
33
+ stackedX?: boolean;
34
+ /** Enables stacking on the Y scale. */
35
+ stackedY?: boolean;
36
+ }
37
+ /** Resolved BarChart options. Use {@link IBarOptionsInput} for partial consumer configuration. */
38
+ export interface IBarOptions extends ICommonOptions {
39
+ /** Chart orientation. Support and interpretation depend on the chart component. */
40
+ direction?: 'vertical' | 'horizontal';
41
+ /** Axis descriptions. Configure horizontal axes in `x` and vertical axes in `y`. */
42
+ axes: IBarAxes;
43
+ /** Chart.js scale configuration keyed by scale ID. */
44
+ scales?: ICommonScales;
45
+ /** Scale behaviour, bounds and tick settings shared across the chart axes. */
46
+ additionalAxesOptions?: IBarAdditionalAxesOptions;
47
+ /** Chart sizing and visual layout settings. */
48
+ chartStyling: IBarStyling;
49
+ /** Geometry, grid and data-label rendering options. */
50
+ graph?: ICommonGraph;
51
+ /** Annotation visibility, interaction and geometry configuration. */
52
+ annotations?: ICommonAnnotations;
53
+ /** Legend visibility, placement and custom rendering options. */
54
+ legend?: IBarLegend;
55
+ /** Point-dragging options and lifecycle callbacks. */
56
+ dragData?: ICommonDragData;
57
+ }
58
+ /** Input bar DS, including axis bindings and legend grouping. */
59
+ export interface IBarChartDataset extends ICommonDataset {
60
+ /** Marks a generated DS as annotation data rather than plotted input data. */
61
+ isAnnotation?: boolean;
62
+ /** Index of the source annotation in the annotation collection. */
63
+ annotationIndex?: number;
64
+ /** Controls whether a bar border edge is omitted. */
65
+ borderSkipped?: boolean;
66
+ /** Bar corner radius in pixels. */
67
+ borderRadius?: number;
68
+ /** Horizontal scale ID for this DS, such as `x` or `x2`. */
69
+ xAxisID?: string;
70
+ /** Vertical scale ID for this DS, such as `y` or `y2`. */
71
+ yAxisID?: string;
72
+ /** Initial visibility flag for the DS. */
73
+ hidden?: boolean;
74
+ /** Groups DS entries for legend display. */
75
+ displayGroup?: string | number;
76
+ /** Chart or annotation kind. */
77
+ type?: ChartType.BAR;
78
+ }
79
+ /** Bar labels and DS definitions. */
80
+ export interface IBarChartBaseData {
81
+ /** Labels associated with the input data. */
82
+ labels: string[];
83
+ /** DS definitions in rendering order. */
84
+ datasets: IBarChartDataset[];
85
+ }
86
+ /** Normalized BarChart data, options and controls container. */
87
+ export interface IBarChartData extends ICommonData {
88
+ /** Test identifier applied to the rendered chart container. */
89
+ testId?: string;
90
+ /** ID of an existing DOM element in which chart controls should be rendered. */
91
+ controlsPortalId?: string;
92
+ /** Values rendered by the chart or DS. */
93
+ data: IBarChartBaseData;
94
+ /** Configuration for this chart or generated element. */
95
+ options: IBarOptions;
96
+ }
97
+ /** Compatibility input for a BarChart axis. */
98
+ type ILooseBarAxis = Omit<DeepPartial<ICommonAxis<string>>, 'gridLines'> & {
99
+ [key: string]: unknown;
100
+ /** Grid-line configuration for this axis. */
101
+ gridLines?: unknown;
102
+ };
103
+ /** Compatibility annotation input normalized by BarChart. */
104
+ type ILooseBarAnnotation = Omit<DeepPartial<ICommonAnnotationsData>, 'annotationAxis'> & {
105
+ [key: string]: unknown;
106
+ /** Axis on which `value` and `endValue` locate the annotation. */
107
+ annotationAxis?: string;
108
+ /** Chart or annotation kind. */
109
+ type?: string;
110
+ /** Numeric value or axis coordinate represented by this item. */
111
+ value?: number | string | null;
112
+ };
113
+ /**
114
+ * Partial BarChart options accepted at the component boundary.
115
+ * Unknown fields are accepted for compatibility, not guaranteed to be forwarded.
116
+ */
117
+ export type IBarOptionsInput = Omit<DeepPartial<IBarOptions>, 'title' | 'direction' | 'axes' | 'legend' | 'chartStyling' | 'interactions' | 'annotations' | 'additionalAxesOptions' | 'scales'> & {
118
+ [key: string]: unknown;
119
+ /** Chart title; an array represents multiple lines. */
120
+ title?: unknown;
121
+ /** Chart orientation. Support and interpretation depend on the chart component. */
122
+ direction?: string;
123
+ /** Axis descriptions. Configure horizontal axes in `x` and vertical axes in `y`. */
124
+ axes?: {
125
+ /** Horizontal axis definitions in order. */
126
+ x?: ILooseBarAxis[];
127
+ /** Vertical axis definitions in order. */
128
+ y?: ILooseBarAxis[];
129
+ [key: string]: ILooseBarAxis[] | undefined;
130
+ };
131
+ /** Legend visibility, placement and custom rendering options. */
132
+ legend?: Omit<DeepPartial<IBarLegend>, 'position' | 'align'> & {
133
+ /** Visual placement of this element; does not select LineChart tooltip axes. */
134
+ position?: string;
135
+ /** Alignment within the available layout space. */
136
+ align?: string;
137
+ [key: string]: unknown;
138
+ };
139
+ /** Chart sizing and visual layout settings. */
140
+ chartStyling?: DeepPartial<IBarStyling> & {
141
+ /** Compatibility input; not currently consumed by the chart option normalizers. */
142
+ hideControls?: boolean;
143
+ /** Compatibility input; not currently consumed by the chart option normalizers. */
144
+ minHeight?: number | string;
145
+ [key: string]: unknown;
146
+ };
147
+ /** Scale behaviour, bounds and tick settings shared across the chart axes. */
148
+ additionalAxesOptions?: Omit<DeepPartial<IBarAdditionalAxesOptions>, 'chartScaleType'> & {
149
+ /** Scale family used when constructing axes. */
150
+ chartScaleType?: string;
151
+ [key: string]: unknown;
152
+ };
153
+ /** Chart.js scale configuration keyed by scale ID. */
154
+ scales?: Record<string, unknown>;
155
+ /** Callbacks for legend and pointer interactions. */
156
+ interactions?: DeepPartial<ICommonInteractions> & {
157
+ /** Compatibility interaction input; configure zoom through `chartOptions.enableZoom`. */
158
+ enableZoom?: boolean;
159
+ /** Compatibility interaction input; configure pan through `chartOptions.enablePan`. */
160
+ enablePan?: boolean;
161
+ [key: string]: unknown;
162
+ };
163
+ /** Annotation visibility, interaction and geometry configuration. */
164
+ annotations?: (Omit<DeepPartial<ICommonAnnotations>, 'annotationsData'> & {
165
+ /** Annotation definitions in drawing order. */
166
+ annotationsData?: ILooseBarAnnotation[];
167
+ }) | null;
168
+ };
169
+ /** Consumer-facing BarChart configuration with optional datasets and options. */
170
+ export interface IBarChartDataInput extends Omit<IBarChartData, 'options' | 'data'> {
171
+ /** Values rendered by the chart or DS. */
172
+ data?: Omit<DeepPartial<IBarChartData['data']>, 'datasets'> & {
173
+ /** DS definitions in rendering order. */
174
+ datasets?: Array<DeepPartial<IBarChartDataset> | object | null>;
175
+ };
176
+ /** Configuration for this chart or generated element. */
177
+ options?: IBarOptionsInput;
178
+ }
179
+ /** Props accepted by the BarChart React component. */
180
+ export interface IBarChartProps {
181
+ /** Chart data and options. Omitted optional settings are resolved by the component defaults. */
182
+ chart: IBarChartDataInput;
183
+ }
184
+ /** BarChart configuration after default values have been applied. */
185
+ export interface IBarDefaultProps {
186
+ /** Test identifier applied to the rendered chart container. */
187
+ testId: string;
188
+ /** ID of an existing DOM element in which chart controls should be rendered. */
189
+ controlsPortalId: string;
190
+ /** Values rendered by the chart or DS. */
191
+ data: IBarChartBaseData;
192
+ /** Configuration for this chart or generated element. */
193
+ options: {
194
+ /** Chart title; an array represents multiple lines. */
195
+ title?: string | string[];
196
+ /** Chart orientation. Support and interpretation depend on the chart component. */
197
+ direction: 'vertical' | 'horizontal';
198
+ /** Axis descriptions. Configure horizontal axes in `x` and vertical axes in `y`. */
199
+ axes: IBarAxes;
200
+ /** Scale behaviour, bounds and tick settings shared across the chart axes. */
201
+ additionalAxesOptions: IBarAdditionalAxesOptions;
202
+ /** Chart sizing and visual layout settings. */
203
+ chartStyling: IBarStyling;
204
+ /** Tooltip visibility, formatting and supported callbacks. */
205
+ tooltip: ICommonTooltip;
206
+ /** Geometry, grid and data-label rendering options. */
207
+ graph: IChartGraph;
208
+ /** Chart.js scale configuration keyed by scale ID. */
209
+ scales?: ICommonScales;
210
+ /** Annotation visibility, interaction and geometry configuration. */
211
+ annotations: {
212
+ /** Whether configured annotations are rendered. */
213
+ showAnnotations: boolean;
214
+ /** Enables annotation controls where supported by the chart. */
215
+ controlAnnotation: boolean;
216
+ /** Annotation definitions in drawing order. */
217
+ annotationsData: ICommonAnnotationsData[];
218
+ };
219
+ /** Legend visibility, placement and custom rendering options. */
220
+ legend: IBarLegend;
221
+ /** Initial interaction and rendering controls. */
222
+ chartOptions: ICommonChartOptions;
223
+ /** Callbacks for legend and pointer interactions. */
224
+ interactions: ICommonInteractions;
225
+ /** Point-dragging options and lifecycle callbacks. */
226
+ dragData: ICommonDragData;
227
+ };
228
+ }
229
+ /** Generated bar DS with annotation and legend metadata. */
230
+ export interface IGenerateBarChartDataset extends ChartDataset<'bar', ICommonDataValue[]> {
231
+ /** Canvas colour used for the element outline. */
232
+ borderColor: string;
233
+ /** Canvas fill colour; arrays provide per-element colours where supported. */
234
+ backgroundColor: string | string[];
235
+ /** Alternating dash and gap lengths in canvas pixels. */
236
+ borderDash?: number[];
237
+ /** Outline width in canvas pixels. */
238
+ borderWidth?: number;
239
+ /** Shape identifier retained for the generated annotation DS. */
240
+ annotationType?: string;
241
+ /** Excludes this entry from the legend where supported. */
242
+ hideLegend?: boolean;
243
+ /** Groups DS entries for legend display. */
244
+ displayGroup?: string | number;
245
+ /** Marks a generated DS as annotation data rather than plotted input data. */
246
+ isAnnotation?: boolean;
247
+ /** Index of the source annotation in the annotation collection. */
248
+ annotationIndex?: number;
249
+ }
250
+ /** Generated BarChart DS collection. */
251
+ export type TGenerateBarChartDatasets = IGenerateBarChartDataset[];
252
+ export {};
@@ -0,0 +1,10 @@
1
+ import { IBarOptions } from '../bar-chart.interface.ts';
2
+ type ExtendedDisplayOptions = 'auto' | boolean;
3
+ export interface IExtendedDataLabelsOptions {
4
+ display: ExtendedDisplayOptions;
5
+ }
6
+ /**
7
+ * Returns the data labels configuration for a bar chart.
8
+ */
9
+ declare const getBarChartDataLabels: (options: IBarOptions) => IExtendedDataLabelsOptions;
10
+ export default getBarChartDataLabels;
@@ -0,0 +1,4 @@
1
+ import { IBarDefaultProps } from '../bar-chart.interface';
2
+ import { ICommonScaleOptions } from '../../common/common.interface.js';
3
+ declare const getBarChartScales: (chart: IBarDefaultProps) => Record<string, ICommonScaleOptions>;
4
+ export default getBarChartScales;
@@ -0,0 +1,6 @@
1
+ import { IBarOptions } from '../bar-chart.interface';
2
+ /**
3
+ * @param {IBarOptions} options - bar chart options object
4
+ */
5
+ declare const getBarChartToolTips: (options: IBarOptions) => Record<string, any>;
6
+ export default getBarChartToolTips;
@@ -0,0 +1,13 @@
1
+ import type { RefObject } from 'react';
2
+ import type { ActiveElement, Chart, ChartEvent } from 'chart.js';
3
+ import { IBarDefaultProps, IBarOptions, TGenerateBarChartDatasets } from '../bar-chart.interface';
4
+ import type { ICommonHoveredItems, TChart } from '../../common/common.interface.js';
5
+ export interface IGenerateBarChartDatasetsProps {
6
+ datasets: TGenerateBarChartDatasets;
7
+ options: IBarOptions;
8
+ }
9
+ export declare const useBarChartConfig: (_chartRef: RefObject<TChart | null>, chart: IBarDefaultProps) => {
10
+ generatedDatasets: TGenerateBarChartDatasets;
11
+ onClick: (_evt: ChartEvent, _elements: ActiveElement[], chartInstance: Chart) => void;
12
+ onHover: (evt: ChartEvent, hoveredItems: ICommonHoveredItems[]) => void;
13
+ };
@@ -0,0 +1,54 @@
1
+ import { RefObject } from 'react';
2
+ import { AnimationSpec } from 'chart.js';
3
+ import { AxisType, ChartHoverMode } from '../../common/enums.js';
4
+ import { IBarDefaultProps } from '../bar-chart.interface';
5
+ import { TChart } from '../../common/common.interface.js';
6
+ export interface IUseBarChartOptionsProps {
7
+ chart: IBarDefaultProps;
8
+ chartRef: RefObject<TChart | null>;
9
+ }
10
+ export declare const getBarChartAnimation: (performanceMode?: boolean) => false | Partial<AnimationSpec<'bar'>>;
11
+ export declare const useBarChartOptions: ({ chart, chartRef }: IUseBarChartOptionsProps) => {
12
+ onClick: (_evt: import("chart.js").ChartEvent, _elements: import("chart.js").ActiveElement[], chartInstance: import("chart.js").Chart) => void;
13
+ onHover: (evt: import("chart.js").ChartEvent, hoveredItems: import("../../common/common.interface.js").ICommonHoveredItems[]) => void;
14
+ indexAxis: AxisType;
15
+ maintainAspectRatio: boolean | undefined;
16
+ animation: false | Partial<AnimationSpec<"bar">>;
17
+ hover: {
18
+ mode: ChartHoverMode;
19
+ intersect: boolean;
20
+ };
21
+ scales: Record<string, import("../../common/common.interface.js").ICommonScaleOptions>;
22
+ plugins: {
23
+ title: {
24
+ display: boolean;
25
+ text: string | string[];
26
+ } | {
27
+ display?: undefined;
28
+ text?: undefined;
29
+ };
30
+ datalabels: import("./get-bar-chart-data-labels").IExtendedDataLabelsOptions;
31
+ annotation: {
32
+ annotations: {};
33
+ };
34
+ tooltip: Record<string, any>;
35
+ legend: {
36
+ position: any;
37
+ align: 'center' | 'start' | 'end';
38
+ labels: {
39
+ boxHeight: number;
40
+ boxWidth: number | undefined;
41
+ usePointStyle: boolean | undefined;
42
+ };
43
+ onClick: (_: import("../../common/common.interface.js").UnusedParameter, legendItem: import("chart.js").LegendItem) => void;
44
+ display: boolean;
45
+ events: never[];
46
+ };
47
+ customLegendPlugin: {
48
+ htmlLegend: any;
49
+ };
50
+ chartAreaBorder: {
51
+ borderColor: string;
52
+ };
53
+ };
54
+ };