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

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,7 +133,9 @@ 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']>;
136
+ data?: DeepPartial<IBarChartData['data']> & {
137
+ datasets?: Array<DeepPartial<IBarChartDataset> | Record<string, unknown> | null>;
138
+ };
137
139
  options?: IBarOptionsInput;
138
140
  }
139
141
 
@@ -194,7 +196,30 @@ export declare interface IBarOptions extends ICommonOptions {
194
196
  dragData?: ICommonDragData;
195
197
  }
196
198
 
197
- export declare type IBarOptionsInput = DeepPartial<IBarOptions>;
199
+ export declare type IBarOptionsInput = DeepPartial<IBarOptions> & {
200
+ title?: unknown;
201
+ direction?: string;
202
+ axes?: {
203
+ x?: ILooseBarAxis[];
204
+ y?: ILooseBarAxis[];
205
+ [key: string]: ILooseBarAxis[] | undefined;
206
+ };
207
+ legend?: DeepPartial<IBarLegend> & {
208
+ position?: string;
209
+ align?: string;
210
+ } & Record<string, unknown>;
211
+ chartStyling?: DeepPartial<IBarStyling> & {
212
+ hideControls?: boolean;
213
+ minHeight?: number | string;
214
+ } & Record<string, unknown>;
215
+ interactions?: DeepPartial<ICommonInteractions> & {
216
+ enableZoom?: boolean;
217
+ enablePan?: boolean;
218
+ } & Record<string, unknown>;
219
+ annotations?: (DeepPartial<ICommonAnnotations> & {
220
+ annotationsData?: ILooseBarAnnotation[];
221
+ }) | null;
222
+ };
198
223
 
199
224
  export declare interface IBarStyling extends ICommonStyling {
200
225
  squareAspectRatio?: boolean;
@@ -617,7 +642,17 @@ export declare interface ILineChartData extends ICommonData {
617
642
  }
618
643
 
619
644
  export declare interface ILineChartDataInput extends Omit<ILineChartData, 'data' | 'options'> {
620
- data?: DeepPartial<ILineChartData['data']>;
645
+ data?: DeepPartial<ILineChartData['data']> & {
646
+ datasets?: Array<(DeepPartial<ILineChartDataset> & {
647
+ lineTension?: number | string;
648
+ fill?: boolean | string | Record<string, unknown>;
649
+ pointStyle?: unknown;
650
+ showPoint?: boolean;
651
+ showPoints?: boolean;
652
+ lineHeight?: number;
653
+ data?: Array<DeepPartial<ICommonDataValue> | null>;
654
+ } & Record<string, unknown>) | Record<string, unknown> | null>;
655
+ };
621
656
  options?: ILineChartOptionsInput;
622
657
  }
623
658
 
@@ -658,7 +693,36 @@ export declare interface ILineChartOptions extends ICommonOptions {
658
693
  depthType?: IDepthType | object;
659
694
  }
660
695
 
661
- export declare type ILineChartOptionsInput = DeepPartial<ILineChartOptions>;
696
+ export declare type ILineChartOptionsInput = DeepPartial<ILineChartOptions> & {
697
+ title?: unknown;
698
+ direction?: string;
699
+ axes?: {
700
+ x?: ILooseLineAxis[];
701
+ y?: ILooseLineAxis[];
702
+ [key: string]: ILooseLineAxis[] | undefined;
703
+ };
704
+ legend?: DeepPartial<ILineLegend> & {
705
+ position?: string;
706
+ align?: string;
707
+ } & Record<string, unknown>;
708
+ chartStyling?: DeepPartial<ILineChartStyling> & {
709
+ hideControls?: boolean;
710
+ minHeight?: number | string;
711
+ } & Record<string, unknown>;
712
+ interactions?: DeepPartial<ILineInteractions> & {
713
+ enableZoom?: boolean;
714
+ enablePan?: boolean;
715
+ } & Record<string, unknown>;
716
+ graph?: DeepPartial<ILineChartGraph> & {
717
+ tooltip?: unknown;
718
+ } & Record<string, unknown>;
719
+ annotations?: (DeepPartial<ICommonAnnotations> & {
720
+ annotationsData?: ILooseLineAnnotation[];
721
+ }) | null;
722
+ additionalAxesOptions?: DeepPartial<ILineChartAdditionalAxesOptions> & {
723
+ range?: ILineRange | ILineChartRange | Record<string, ILineChartRange | undefined>;
724
+ } & Record<string, unknown>;
725
+ };
662
726
 
663
727
  export declare interface ILineChartProps {
664
728
  chart: ILineChartDataInput;
@@ -700,6 +764,36 @@ export declare interface ILineRange {
700
764
  [key: string]: ILineChartRange;
701
765
  }
702
766
 
767
+ declare type ILooseBarAnnotation = DeepPartial<ICommonAnnotationsData> & Record<string, unknown> & {
768
+ annotationAxis?: string;
769
+ type?: string;
770
+ value?: number | string | null;
771
+ };
772
+
773
+ declare type ILooseBarAxis = DeepPartial<ICommonAxis<string>> & Record<string, unknown>;
774
+
775
+ declare type ILooseLineAnnotation = DeepPartial<ICommonAnnotations['annotationsData'] extends Array<infer T> ? T : never> & Record<string, unknown> & {
776
+ annotationAxis?: string;
777
+ type?: string;
778
+ value?: number | string | null;
779
+ xMin?: number | string | null;
780
+ xMax?: number | string | null;
781
+ yMin?: number | string | null;
782
+ yMax?: number | string | null;
783
+ xValue?: number | string | null;
784
+ yValue?: number | string | null;
785
+ };
786
+
787
+ declare type ILooseLineAxis = DeepPartial<ILineChartAxis<string>> & Record<string, unknown>;
788
+
789
+ declare type ILooseScatterAnnotation = DeepPartial<ICommonDataValue> & Record<string, unknown> & {
790
+ annotationAxis?: string;
791
+ type?: string;
792
+ value?: number | string | null;
793
+ };
794
+
795
+ declare type ILooseScatterAxis = DeepPartial<ICommonAxis<string>> & Record<string, unknown>;
796
+
703
797
  /**
704
798
  * Initialize the charts library with the provided configurations.
705
799
  * This function will store the configuration options in a config object.
@@ -761,6 +855,8 @@ export declare type IPieLegendItemFilter = IChartLegendItemFilter;
761
855
  export declare interface IPieOptions extends ICommonOptions {
762
856
  graph?: IPieGraph;
763
857
  legend?: IPieLegend;
858
+ axes?: unknown;
859
+ [key: string]: unknown;
764
860
  }
765
861
 
766
862
  export declare type IPiesDataLabelsOptions = IChartDataLabelsOptions;
@@ -777,7 +873,9 @@ export declare interface IScatterChartData extends ICommonData {
777
873
  }
778
874
 
779
875
  export declare interface IScatterChartDataInput extends Omit<IScatterChartData, 'data' | 'options'> {
780
- data?: DeepPartial<IScatterChartData['data']>;
876
+ data?: DeepPartial<IScatterChartData['data']> & {
877
+ datasets?: Array<DeepPartial<IScatterChartDataset> | Record<string, unknown> | null>;
878
+ };
781
879
  options?: IScatterOptionsInput;
782
880
  }
783
881
 
@@ -825,7 +923,27 @@ export declare interface IScatterOptions extends ICommonOptions {
825
923
  direction?: ChartDirection;
826
924
  }
827
925
 
828
- export declare type IScatterOptionsInput = DeepPartial<IScatterOptions>;
926
+ export declare type IScatterOptionsInput = DeepPartial<IScatterOptions> & {
927
+ title?: unknown;
928
+ direction?: string;
929
+ axes?: {
930
+ x?: ILooseScatterAxis[];
931
+ y?: ILooseScatterAxis[];
932
+ [key: string]: ILooseScatterAxis[] | undefined;
933
+ };
934
+ legend?: DeepPartial<IScatterLegend> & {
935
+ position?: string;
936
+ align?: string;
937
+ } & Record<string, unknown>;
938
+ chartStyling?: Record<string, unknown>;
939
+ interactions?: DeepPartial<ICommonOptions['interactions']> & {
940
+ enableZoom?: boolean;
941
+ enablePan?: boolean;
942
+ } & Record<string, unknown>;
943
+ annotations?: (DeepPartial<ICommonOptions['annotations']> & {
944
+ annotationsData?: ILooseScatterAnnotation[];
945
+ }) | null;
946
+ };
829
947
 
830
948
  export declare interface IScatterTooltip {
831
949
  enabled?: boolean;
package/dist/index.js CHANGED
@@ -20052,6 +20052,21 @@ var TextLabelPosition = {
20052
20052
  BOTTOM_RIGHT: "bottom-right"
20053
20053
  };
20054
20054
  //#endregion
20055
+ //#region src/components/common/helpers/input-normalizers.ts
20056
+ var normalizeTitle = (title) => {
20057
+ return typeof title === "string" || Array.isArray(title) ? title : "";
20058
+ };
20059
+ var normalizeCartesianDirection = (direction) => {
20060
+ return typeof direction === "string" && direction.toLowerCase() === "horizontal" ? "horizontal" : "vertical";
20061
+ };
20062
+ var normalizeChartDirection = (direction) => {
20063
+ return normalizeCartesianDirection(direction) === "horizontal" ? ChartDirection.HORIZONTAL : ChartDirection.VERTICAL;
20064
+ };
20065
+ var normalizeDragRange = (range) => ({
20066
+ x: Array.isArray(range?.x) && range.x.length >= 2 ? [range.x[0], range.x[1]] : void 0,
20067
+ y: Array.isArray(range?.y) && range.y.length >= 2 ? [range.y[0], range.y[1]] : void 0
20068
+ });
20069
+ //#endregion
20055
20070
  //#region src/components/line-chart/line-chart-get-default-props.ts
20056
20071
  var defaultAxis = (position) => ({
20057
20072
  label: "",
@@ -20136,10 +20151,6 @@ var defaultGraph$3 = (graph) => ({
20136
20151
  showMinorGridlines: graph?.showMinorGridlines ?? false
20137
20152
  });
20138
20153
  var defaultAnnotationsData$2 = (annotationsData) => {
20139
- const normalizeDragRange = (range) => ({
20140
- x: Array.isArray(range?.x) && range.x.length >= 2 ? [range.x[0], range.x[1]] : void 0,
20141
- y: Array.isArray(range?.y) && range.y.length >= 2 ? [range.y[0], range.y[1]] : void 0
20142
- });
20143
20154
  const asCallback = (fn) => typeof fn === "function" ? fn : void 0;
20144
20155
  return annotationsData ? annotationsData.map((ann) => ({
20145
20156
  ...ann,
@@ -20217,7 +20228,7 @@ var defaultDragData$1 = (dragData) => ({
20217
20228
  onDragEnd: dragData?.onDragEnd
20218
20229
  });
20219
20230
  var normalizeLineChartOptions = (options = {}) => ({
20220
- title: options?.title ?? "",
20231
+ title: normalizeTitle(options?.title),
20221
20232
  scales: options?.scales ?? {
20222
20233
  x: {},
20223
20234
  y: {}
@@ -37423,10 +37434,6 @@ var defaultGraph$1 = (graph) => ({
37423
37434
  showMinorGridlines: graph?.showMinorGridlines || false
37424
37435
  });
37425
37436
  var defaultAnnotationsData$1 = (annotationsData) => {
37426
- const normalizeDragRange = (range) => ({
37427
- x: Array.isArray(range?.x) && range.x.length >= 2 ? [range.x[0], range.x[1]] : void 0,
37428
- y: Array.isArray(range?.y) && range.y.length >= 2 ? [range.y[0], range.y[1]] : void 0
37429
- });
37430
37437
  const asCallback = (fn) => typeof fn === "function" ? fn : void 0;
37431
37438
  return annotationsData ? annotationsData.map((ann) => ({
37432
37439
  ...ann,
@@ -37471,8 +37478,8 @@ var defaultDragData = (dragData) => ({
37471
37478
  onDragEnd: dragData?.onDragEnd
37472
37479
  });
37473
37480
  var normalizeBarOptions = (options = {}) => ({
37474
- title: options?.title || "",
37475
- direction: options?.direction || "vertical",
37481
+ title: normalizeTitle(options?.title),
37482
+ direction: normalizeCartesianDirection(options?.direction),
37476
37483
  axes: defaultAxes$1(options?.axes),
37477
37484
  additionalAxesOptions: defaultAdditionalAxesOptions$1(options?.additionalAxesOptions),
37478
37485
  chartStyling: defaultChartStyling$1(options?.chartStyling),
@@ -37785,10 +37792,6 @@ var defaultChartData = (data) => ({
37785
37792
  data: dataset?.data ?? []
37786
37793
  }))
37787
37794
  });
37788
- var normalizeDragRange = (range) => ({
37789
- x: Array.isArray(range?.x) && range.x.length >= 2 ? [range.x[0], range.x[1]] : void 0,
37790
- y: Array.isArray(range?.y) && range.y.length >= 2 ? [range.y[0], range.y[1]] : void 0
37791
- });
37792
37795
  var defaultAnnotationsData = (annotationsData) => (annotationsData ?? []).map((ann) => ({
37793
37796
  ...ann,
37794
37797
  display: ann.display ?? true,
@@ -37817,10 +37820,10 @@ var defaultAdditionalAxesOptions = (options) => ({
37817
37820
  max: options?.max
37818
37821
  });
37819
37822
  var normalizeScatterOptions = (options = {}) => ({
37820
- title: options?.title ?? "",
37823
+ title: normalizeTitle(options?.title),
37821
37824
  axes: defaultAxes(options?.axes),
37822
37825
  additionalAxesOptions: defaultAdditionalAxesOptions(options?.additionalAxesOptions),
37823
- direction: options?.direction ?? ChartDirection.VERTICAL,
37826
+ direction: normalizeChartDirection(options?.direction),
37824
37827
  chartStyling: defaultChartStyling(options?.chartStyling),
37825
37828
  tooltip: defaultTooltip(options?.tooltip),
37826
37829
  graph: defaultGraph(options?.graph),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "5.9.0-beta-10",
3
+ "version": "5.9.0-beta-11",
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": {