@oliasoft-open-source/charts-library 5.9.0-beta-11 → 5.9.0-beta-13

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/index.d.ts CHANGED
@@ -133,8 +133,8 @@ export declare interface IBarChartData extends ICommonData {
133
133
  }
134
134
 
135
135
  export declare interface IBarChartDataInput extends Omit<IBarChartData, 'options' | 'data'> {
136
- data?: DeepPartial<IBarChartData['data']> & {
137
- datasets?: Array<DeepPartial<IBarChartDataset> | Record<string, unknown> | null>;
136
+ data?: Omit<DeepPartial<IBarChartData['data']>, 'datasets'> & {
137
+ datasets?: Array<DeepPartial<IBarChartDataset> | object | null>;
138
138
  };
139
139
  options?: IBarOptionsInput;
140
140
  }
@@ -196,7 +196,8 @@ export declare interface IBarOptions extends ICommonOptions {
196
196
  dragData?: ICommonDragData;
197
197
  }
198
198
 
199
- export declare type IBarOptionsInput = DeepPartial<IBarOptions> & {
199
+ export declare type IBarOptionsInput = Omit<DeepPartial<IBarOptions>, 'title' | 'direction' | 'axes' | 'legend' | 'chartStyling' | 'interactions' | 'annotations'> & {
200
+ [key: string]: unknown;
200
201
  title?: unknown;
201
202
  direction?: string;
202
203
  axes?: {
@@ -204,18 +205,21 @@ export declare type IBarOptionsInput = DeepPartial<IBarOptions> & {
204
205
  y?: ILooseBarAxis[];
205
206
  [key: string]: ILooseBarAxis[] | undefined;
206
207
  };
207
- legend?: DeepPartial<IBarLegend> & {
208
+ legend?: Omit<DeepPartial<IBarLegend>, 'position' | 'align'> & {
208
209
  position?: string;
209
210
  align?: string;
210
- } & Record<string, unknown>;
211
+ [key: string]: unknown;
212
+ };
211
213
  chartStyling?: DeepPartial<IBarStyling> & {
212
214
  hideControls?: boolean;
213
215
  minHeight?: number | string;
214
- } & Record<string, unknown>;
216
+ [key: string]: unknown;
217
+ };
215
218
  interactions?: DeepPartial<ICommonInteractions> & {
216
219
  enableZoom?: boolean;
217
220
  enablePan?: boolean;
218
- } & Record<string, unknown>;
221
+ [key: string]: unknown;
222
+ };
219
223
  annotations?: (DeepPartial<ICommonAnnotations> & {
220
224
  annotationsData?: ILooseBarAnnotation[];
221
225
  }) | null;
@@ -642,7 +646,7 @@ export declare interface ILineChartData extends ICommonData {
642
646
  }
643
647
 
644
648
  export declare interface ILineChartDataInput extends Omit<ILineChartData, 'data' | 'options'> {
645
- data?: DeepPartial<ILineChartData['data']> & {
649
+ data?: Omit<DeepPartial<ILineChartData['data']>, 'datasets'> & {
646
650
  datasets?: Array<(DeepPartial<ILineChartDataset> & {
647
651
  lineTension?: number | string;
648
652
  fill?: boolean | string | Record<string, unknown>;
@@ -651,7 +655,8 @@ export declare interface ILineChartDataInput extends Omit<ILineChartData, 'data'
651
655
  showPoints?: boolean;
652
656
  lineHeight?: number;
653
657
  data?: Array<DeepPartial<ICommonDataValue> | null>;
654
- } & Record<string, unknown>) | Record<string, unknown> | null>;
658
+ [key: string]: unknown;
659
+ }) | object | null> | object;
655
660
  };
656
661
  options?: ILineChartOptionsInput;
657
662
  }
@@ -693,7 +698,8 @@ export declare interface ILineChartOptions extends ICommonOptions {
693
698
  depthType?: IDepthType | object;
694
699
  }
695
700
 
696
- export declare type ILineChartOptionsInput = DeepPartial<ILineChartOptions> & {
701
+ export declare type ILineChartOptionsInput = Omit<DeepPartial<ILineChartOptions>, 'title' | 'axes' | 'legend' | 'chartStyling' | 'interactions' | 'graph' | 'annotations' | 'additionalAxesOptions'> & {
702
+ [key: string]: unknown;
697
703
  title?: unknown;
698
704
  direction?: string;
699
705
  axes?: {
@@ -701,24 +707,28 @@ export declare type ILineChartOptionsInput = DeepPartial<ILineChartOptions> & {
701
707
  y?: ILooseLineAxis[];
702
708
  [key: string]: ILooseLineAxis[] | undefined;
703
709
  };
704
- legend?: DeepPartial<ILineLegend> & {
710
+ legend?: Omit<DeepPartial<ILineLegend>, 'position' | 'align'> & {
705
711
  position?: string;
706
712
  align?: string;
707
- } & Record<string, unknown>;
713
+ [key: string]: unknown;
714
+ };
708
715
  chartStyling?: DeepPartial<ILineChartStyling> & {
709
716
  hideControls?: boolean;
710
717
  minHeight?: number | string;
711
- } & Record<string, unknown>;
718
+ [key: string]: unknown;
719
+ };
712
720
  interactions?: DeepPartial<ILineInteractions> & {
713
721
  enableZoom?: boolean;
714
722
  enablePan?: boolean;
715
- } & Record<string, unknown>;
723
+ [key: string]: unknown;
724
+ };
716
725
  graph?: DeepPartial<ILineChartGraph> & {
717
726
  tooltip?: unknown;
718
- } & Record<string, unknown>;
719
- annotations?: (DeepPartial<ICommonAnnotations> & {
727
+ [key: string]: unknown;
728
+ };
729
+ annotations?: (Omit<DeepPartial<ICommonAnnotations>, 'annotationsData'> & {
720
730
  annotationsData?: ILooseLineAnnotation[];
721
- }) | null;
731
+ }) | ILooseLineAnnotation[] | null;
722
732
  additionalAxesOptions?: DeepPartial<ILineChartAdditionalAxesOptions> & {
723
733
  range?: ILineRange | ILineChartRange | Record<string, ILineChartRange | undefined>;
724
734
  } & Record<string, unknown>;
@@ -732,8 +742,8 @@ export declare interface ILineChartProps {
732
742
  }
733
743
 
734
744
  export declare interface ILineChartRange {
735
- min: number;
736
- max: number;
745
+ min?: number;
746
+ max?: number;
737
747
  }
738
748
 
739
749
  export declare interface ILineChartStyling extends ICommonStyling {
@@ -764,15 +774,21 @@ export declare interface ILineRange {
764
774
  [key: string]: ILineChartRange;
765
775
  }
766
776
 
767
- declare type ILooseBarAnnotation = DeepPartial<ICommonAnnotationsData> & Record<string, unknown> & {
777
+ declare type ILooseBarAnnotation = DeepPartial<ICommonAnnotationsData> & {
778
+ [key: string]: unknown;
779
+ } & {
768
780
  annotationAxis?: string;
769
781
  type?: string;
770
782
  value?: number | string | null;
771
783
  };
772
784
 
773
- declare type ILooseBarAxis = DeepPartial<ICommonAxis<string>> & Record<string, unknown>;
785
+ declare type ILooseBarAxis = DeepPartial<ICommonAxis<string>> & {
786
+ [key: string]: unknown;
787
+ };
774
788
 
775
- declare type ILooseLineAnnotation = DeepPartial<ICommonAnnotations['annotationsData'] extends Array<infer T> ? T : never> & Record<string, unknown> & {
789
+ declare type ILooseLineAnnotation = DeepPartial<ICommonAnnotationsData> & {
790
+ [key: string]: unknown;
791
+ } & {
776
792
  annotationAxis?: string;
777
793
  type?: string;
778
794
  value?: number | string | null;
@@ -784,15 +800,22 @@ declare type ILooseLineAnnotation = DeepPartial<ICommonAnnotations['annotationsD
784
800
  yValue?: number | string | null;
785
801
  };
786
802
 
787
- declare type ILooseLineAxis = DeepPartial<ILineChartAxis<string>> & Record<string, unknown>;
803
+ declare type ILooseLineAxis = DeepPartial<ILineChartAxis<string>> & {
804
+ [key: string]: unknown;
805
+ stepSize?: unknown;
806
+ };
788
807
 
789
- declare type ILooseScatterAnnotation = DeepPartial<ICommonDataValue> & Record<string, unknown> & {
808
+ declare type ILooseScatterAnnotation = DeepPartial<ICommonAnnotationsData> & {
809
+ [key: string]: unknown;
810
+ } & {
790
811
  annotationAxis?: string;
791
812
  type?: string;
792
813
  value?: number | string | null;
793
814
  };
794
815
 
795
- declare type ILooseScatterAxis = DeepPartial<ICommonAxis<string>> & Record<string, unknown>;
816
+ declare type ILooseScatterAxis = DeepPartial<ICommonAxis<string>> & {
817
+ [key: string]: unknown;
818
+ };
796
819
 
797
820
  /**
798
821
  * Initialize the charts library with the provided configurations.
@@ -873,8 +896,8 @@ export declare interface IScatterChartData extends ICommonData {
873
896
  }
874
897
 
875
898
  export declare interface IScatterChartDataInput extends Omit<IScatterChartData, 'data' | 'options'> {
876
- data?: DeepPartial<IScatterChartData['data']> & {
877
- datasets?: Array<DeepPartial<IScatterChartDataset> | Record<string, unknown> | null>;
899
+ data?: Omit<DeepPartial<IScatterChartData['data']>, 'datasets'> & {
900
+ datasets?: Array<DeepPartial<IScatterChartDataset> | object | null>;
878
901
  };
879
902
  options?: IScatterOptionsInput;
880
903
  }
@@ -923,7 +946,8 @@ export declare interface IScatterOptions extends ICommonOptions {
923
946
  direction?: ChartDirection;
924
947
  }
925
948
 
926
- export declare type IScatterOptionsInput = DeepPartial<IScatterOptions> & {
949
+ export declare type IScatterOptionsInput = Omit<DeepPartial<IScatterOptions>, 'title' | 'direction' | 'axes' | 'legend' | 'chartStyling' | 'interactions' | 'annotations'> & {
950
+ [key: string]: unknown;
927
951
  title?: unknown;
928
952
  direction?: string;
929
953
  axes?: {
@@ -931,16 +955,20 @@ export declare type IScatterOptionsInput = DeepPartial<IScatterOptions> & {
931
955
  y?: ILooseScatterAxis[];
932
956
  [key: string]: ILooseScatterAxis[] | undefined;
933
957
  };
934
- legend?: DeepPartial<IScatterLegend> & {
958
+ legend?: Omit<DeepPartial<IScatterLegend>, 'position' | 'align'> & {
935
959
  position?: string;
936
960
  align?: string;
937
- } & Record<string, unknown>;
938
- chartStyling?: Record<string, unknown>;
961
+ [key: string]: unknown;
962
+ };
963
+ chartStyling?: {
964
+ [key: string]: unknown;
965
+ };
939
966
  interactions?: DeepPartial<ICommonOptions['interactions']> & {
940
967
  enableZoom?: boolean;
941
968
  enablePan?: boolean;
942
- } & Record<string, unknown>;
943
- annotations?: (DeepPartial<ICommonOptions['annotations']> & {
969
+ [key: string]: unknown;
970
+ };
971
+ annotations?: (DeepPartial<ICommonAnnotations> & {
944
972
  annotationsData?: ILooseScatterAnnotation[];
945
973
  }) | null;
946
974
  };
@@ -1074,22 +1102,6 @@ export declare type UnusedParameter = unknown;
1074
1102
  export { }
1075
1103
 
1076
1104
 
1077
- declare module 'chart.js' {
1078
- interface PluginOptionsByType<TType extends ChartType> {
1079
- annotationDraggerPlugin?: AnnotationDraggerPluginOptions;
1080
- }
1081
- }
1082
-
1083
-
1084
- declare module 'chart.js' {
1085
- interface PluginOptionsByType<TType extends ChartType> {
1086
- calloutConnectorPlugin?: {
1087
- enableCalloutAnnotation?: boolean;
1088
- };
1089
- }
1090
- }
1091
-
1092
-
1093
1105
  /**
1094
1106
  * Vertical Markers Plugin
1095
1107
  *
@@ -1141,3 +1153,19 @@ declare module 'chart.js' {
1141
1153
  } | TVerticalMarkersOptions;
1142
1154
  }
1143
1155
  }
1156
+
1157
+
1158
+ declare module 'chart.js' {
1159
+ interface PluginOptionsByType<TType extends ChartType> {
1160
+ annotationDraggerPlugin?: AnnotationDraggerPluginOptions;
1161
+ }
1162
+ }
1163
+
1164
+
1165
+ declare module 'chart.js' {
1166
+ interface PluginOptionsByType<TType extends ChartType> {
1167
+ calloutConnectorPlugin?: {
1168
+ enableCalloutAnnotation?: boolean;
1169
+ };
1170
+ }
1171
+ }
package/dist/index.js CHANGED
@@ -20062,6 +20062,12 @@ var normalizeCartesianDirection = (direction) => {
20062
20062
  var normalizeChartDirection = (direction) => {
20063
20063
  return normalizeCartesianDirection(direction) === "horizontal" ? ChartDirection.HORIZONTAL : ChartDirection.VERTICAL;
20064
20064
  };
20065
+ var normalizeLegendPosition = (position, fallback) => {
20066
+ return Object.values(Position).includes(String(position)) ? position : fallback;
20067
+ };
20068
+ var normalizeLegendAlign = (align, fallback) => {
20069
+ return Object.values(AlignOptions).includes(String(align)) ? align : fallback;
20070
+ };
20065
20071
  var normalizeDragRange = (range) => ({
20066
20072
  x: Array.isArray(range?.x) && range.x.length >= 2 ? [range.x[0], range.x[1]] : void 0,
20067
20073
  y: Array.isArray(range?.y) && range.y.length >= 2 ? [range.y[0], range.y[1]] : void 0
@@ -20091,10 +20097,13 @@ var normalizeUnit = (unit) => {
20091
20097
  setSelectedUnit: unit.setSelectedUnit ?? (() => {})
20092
20098
  };
20093
20099
  };
20100
+ var normalizeAxisPosition = (position, fallbackPosition) => {
20101
+ return typeof position === "string" && (fallbackPosition === "bottom" || fallbackPosition === "top" ? ["bottom", "top"] : ["left", "right"]).includes(position) ? position : fallbackPosition;
20102
+ };
20094
20103
  var normalizeAxis = (axis, fallbackPosition) => ({
20095
20104
  ...defaultAxis(fallbackPosition),
20096
20105
  ...axis || {},
20097
- position: axis?.position ?? fallbackPosition,
20106
+ position: normalizeAxisPosition(axis?.position, fallbackPosition),
20098
20107
  color: axis?.color ?? "",
20099
20108
  unit: normalizeUnit(axis?.unit)
20100
20109
  });
@@ -20162,41 +20171,48 @@ var defaultAnnotationsData$2 = (annotationsData) => {
20162
20171
  })) : [];
20163
20172
  };
20164
20173
  var defaultAnnotations$2 = (annotations) => ({
20165
- labelAnnotation: {
20166
- showLabel: annotations?.labelAnnotation?.showLabel ?? false,
20167
- text: annotations?.labelAnnotation?.text ?? "",
20168
- position: annotations?.labelAnnotation?.position ?? TextLabelPosition.BOTTOM_RIGHT,
20169
- fontSize: annotations?.labelAnnotation?.fontSize ?? 12,
20170
- xOffset: annotations?.labelAnnotation?.xOffset ?? 5,
20171
- yOffset: annotations?.labelAnnotation?.yOffset ?? 5,
20172
- maxWidth: annotations?.labelAnnotation?.maxWidth ?? 300,
20173
- lineHeight: annotations?.labelAnnotation?.lineHeight ?? 12
20174
- },
20175
- showAnnotations: annotations?.showAnnotations ?? false,
20176
- controlAnnotation: annotations?.controlAnnotation ?? false,
20177
- enableDragAnnotation: annotations?.enableDragAnnotation ?? false,
20178
- enableCalloutAnnotation: annotations?.enableCalloutAnnotation ?? false,
20179
- verticalMarkersAnnotation: {
20180
- enabled: annotations?.verticalMarkersAnnotation?.enabled ?? false,
20181
- itemGapPx: annotations?.verticalMarkersAnnotation?.itemGapPx ?? 4,
20182
- edgePaddingPx: annotations?.verticalMarkersAnnotation?.edgePaddingPx ?? 8,
20183
- stickToEdge: annotations?.verticalMarkersAnnotation?.stickToEdge ?? true,
20184
- stickSide: annotations?.verticalMarkersAnnotation?.stickSide ?? "right",
20185
- reverse: annotations?.verticalMarkersAnnotation?.reverse ?? false,
20186
- xValue: annotations?.verticalMarkersAnnotation?.xValue,
20187
- yStartValue: annotations?.verticalMarkersAnnotation?.yStartValue,
20188
- color: annotations?.verticalMarkersAnnotation?.color ?? "rgba(20,20,20,0.9)",
20189
- opacity: annotations?.verticalMarkersAnnotation?.opacity ?? 1,
20190
- lineWidth: annotations?.verticalMarkersAnnotation?.lineWidth ?? 1,
20191
- lineDash: annotations?.verticalMarkersAnnotation?.lineDash ?? [],
20192
- items: annotations?.verticalMarkersAnnotation?.items ?? []
20193
- },
20194
- annotationsData: defaultAnnotationsData$2(annotations?.annotationsData)
20174
+ ...!Array.isArray(annotations) ? annotations : {},
20175
+ ...Array.isArray(annotations) ? { annotationsData: annotations } : {},
20176
+ ...(() => {
20177
+ const annotationConfig = Array.isArray(annotations) ? void 0 : annotations;
20178
+ return {
20179
+ labelAnnotation: {
20180
+ showLabel: annotationConfig?.labelAnnotation?.showLabel ?? false,
20181
+ text: annotationConfig?.labelAnnotation?.text ?? "",
20182
+ position: annotationConfig?.labelAnnotation?.position ?? TextLabelPosition.BOTTOM_RIGHT,
20183
+ fontSize: annotationConfig?.labelAnnotation?.fontSize ?? 12,
20184
+ xOffset: annotationConfig?.labelAnnotation?.xOffset ?? 5,
20185
+ yOffset: annotationConfig?.labelAnnotation?.yOffset ?? 5,
20186
+ maxWidth: annotationConfig?.labelAnnotation?.maxWidth ?? 300,
20187
+ lineHeight: annotationConfig?.labelAnnotation?.lineHeight ?? 12
20188
+ },
20189
+ showAnnotations: annotationConfig?.showAnnotations ?? false,
20190
+ controlAnnotation: annotationConfig?.controlAnnotation ?? false,
20191
+ enableDragAnnotation: annotationConfig?.enableDragAnnotation ?? false,
20192
+ enableCalloutAnnotation: annotationConfig?.enableCalloutAnnotation ?? false,
20193
+ verticalMarkersAnnotation: {
20194
+ enabled: annotationConfig?.verticalMarkersAnnotation?.enabled ?? false,
20195
+ itemGapPx: annotationConfig?.verticalMarkersAnnotation?.itemGapPx ?? 4,
20196
+ edgePaddingPx: annotationConfig?.verticalMarkersAnnotation?.edgePaddingPx ?? 8,
20197
+ stickToEdge: annotationConfig?.verticalMarkersAnnotation?.stickToEdge ?? true,
20198
+ stickSide: annotationConfig?.verticalMarkersAnnotation?.stickSide ?? "right",
20199
+ reverse: annotationConfig?.verticalMarkersAnnotation?.reverse ?? false,
20200
+ xValue: annotationConfig?.verticalMarkersAnnotation?.xValue,
20201
+ yStartValue: annotationConfig?.verticalMarkersAnnotation?.yStartValue,
20202
+ color: annotationConfig?.verticalMarkersAnnotation?.color ?? "rgba(20,20,20,0.9)",
20203
+ opacity: annotationConfig?.verticalMarkersAnnotation?.opacity ?? 1,
20204
+ lineWidth: annotationConfig?.verticalMarkersAnnotation?.lineWidth ?? 1,
20205
+ lineDash: annotationConfig?.verticalMarkersAnnotation?.lineDash ?? [],
20206
+ items: annotationConfig?.verticalMarkersAnnotation?.items ?? []
20207
+ },
20208
+ annotationsData: defaultAnnotationsData$2(Array.isArray(annotations) ? annotations : annotations?.annotationsData)
20209
+ };
20210
+ })()
20195
20211
  });
20196
20212
  var defaultLegend$3 = (legend) => ({
20197
20213
  display: legend?.display ?? true,
20198
- position: legend?.position ?? Position.BottomLeft,
20199
- align: legend?.align ?? AlignOptions.Center,
20214
+ position: normalizeLegendPosition(legend?.position, Position.BottomLeft),
20215
+ align: normalizeLegendAlign(legend?.align, AlignOptions.Center),
20200
20216
  customLegend: {
20201
20217
  customLegendPlugin: legend?.customLegend?.customLegendPlugin && typeof legend.customLegend.customLegendPlugin === "object" && "id" in legend.customLegend.customLegendPlugin ? legend.customLegend.customLegendPlugin : null,
20202
20218
  customLegendContainerID: typeof legend?.customLegend?.customLegendContainerID === "string" ? legend.customLegend.customLegendContainerID : ""
@@ -20245,10 +20261,13 @@ var normalizeLineChartOptions = (options = {}) => ({
20245
20261
  dragData: defaultDragData$1(options?.dragData),
20246
20262
  depthType: options?.depthType ?? {}
20247
20263
  });
20248
- var normalizeLineDatasets = (datasets) => (datasets ?? []).map((dataset) => ({
20249
- ...dataset,
20250
- data: dataset?.data ?? []
20251
- }));
20264
+ var normalizeLineDatasets = (datasets) => (Array.isArray(datasets) ? datasets : []).map((dataset) => {
20265
+ const normalizedDataset = dataset && typeof dataset === "object" ? dataset : {};
20266
+ return {
20267
+ ...normalizedDataset,
20268
+ data: Array.isArray(normalizedDataset.data) ? normalizedDataset.data : []
20269
+ };
20270
+ });
20252
20271
  var getDefaultProps$3 = (props) => {
20253
20272
  const chart = props?.chart || {};
20254
20273
  const options = chart?.options || {};
@@ -37451,8 +37470,8 @@ var defaultAnnotations$1 = (annotations) => ({
37451
37470
  });
37452
37471
  var defaultLegend$1 = (legend) => ({
37453
37472
  display: legend?.display ?? true,
37454
- position: legend?.position || Position.TopLeft,
37455
- align: legend?.align || AlignOptions.Center,
37473
+ position: normalizeLegendPosition(legend?.position, Position.TopLeft),
37474
+ align: normalizeLegendAlign(legend?.align, AlignOptions.Center),
37456
37475
  customLegend: {
37457
37476
  customLegendPlugin: legend?.customLegend?.customLegendPlugin && typeof legend.customLegend.customLegendPlugin === "object" && "id" in legend.customLegend.customLegendPlugin ? legend.customLegend.customLegendPlugin : null,
37458
37477
  customLegendContainerID: typeof legend?.customLegend?.customLegendContainerID === "string" ? legend.customLegend.customLegendContainerID : ""
@@ -37491,10 +37510,13 @@ var normalizeBarOptions = (options = {}) => ({
37491
37510
  interactions: defaultInteractions$1(options?.interactions),
37492
37511
  dragData: defaultDragData(options?.dragData)
37493
37512
  });
37494
- var normalizeBarDatasets = (datasets) => (datasets ?? []).map((dataset) => ({
37495
- ...dataset,
37496
- data: dataset?.data ?? []
37497
- }));
37513
+ var normalizeBarDatasets = (datasets) => (Array.isArray(datasets) ? datasets : []).map((dataset) => {
37514
+ const normalizedDataset = dataset && typeof dataset === "object" ? dataset : {};
37515
+ return {
37516
+ ...normalizedDataset,
37517
+ data: Array.isArray(normalizedDataset.data) ? normalizedDataset.data : []
37518
+ };
37519
+ });
37498
37520
  var getDefaultProps$1 = (props) => {
37499
37521
  const chart = props?.chart || {};
37500
37522
  const options = chart?.options || {};
@@ -37772,8 +37794,8 @@ var defaultGraph = (graph) => ({
37772
37794
  var defaultLegend = (legend) => ({
37773
37795
  display: legend?.display ?? true,
37774
37796
  useDataset: legend?.useDataset ?? false,
37775
- position: legend?.position ?? Position.BottomLeft,
37776
- align: legend?.align ?? AlignOptions.Center
37797
+ position: normalizeLegendPosition(legend?.position, Position.BottomLeft),
37798
+ align: normalizeLegendAlign(legend?.align, AlignOptions.Center)
37777
37799
  });
37778
37800
  var defaultChartOptions = (options) => ({
37779
37801
  enableZoom: options?.enableZoom ?? false,
@@ -37787,10 +37809,13 @@ var defaultInteractions = (interactions) => ({
37787
37809
  });
37788
37810
  var defaultChartData = (data) => ({
37789
37811
  labels: data?.labels ?? [],
37790
- datasets: (data?.datasets ?? []).map((dataset) => ({
37791
- ...dataset,
37792
- data: dataset?.data ?? []
37793
- }))
37812
+ datasets: (Array.isArray(data?.datasets) ? data.datasets : []).map((dataset) => {
37813
+ const normalizedDataset = dataset && typeof dataset === "object" ? dataset : {};
37814
+ return {
37815
+ ...normalizedDataset,
37816
+ data: Array.isArray(normalizedDataset.data) ? normalizedDataset.data : []
37817
+ };
37818
+ })
37794
37819
  });
37795
37820
  var defaultAnnotationsData = (annotationsData) => (annotationsData ?? []).map((ann) => ({
37796
37821
  ...ann,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "5.9.0-beta-11",
3
+ "version": "5.9.0-beta-13",
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
  "bugs": {