@oliasoft-open-source/charts-library 5.9.0-beta-11 → 5.9.0-beta-12
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 +74 -47
- package/dist/index.js +37 -19
- package/package.json +1 -1
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> |
|
|
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
|
-
|
|
211
|
+
[key: string]: unknown;
|
|
212
|
+
};
|
|
211
213
|
chartStyling?: DeepPartial<IBarStyling> & {
|
|
212
214
|
hideControls?: boolean;
|
|
213
215
|
minHeight?: number | string;
|
|
214
|
-
|
|
216
|
+
[key: string]: unknown;
|
|
217
|
+
};
|
|
215
218
|
interactions?: DeepPartial<ICommonInteractions> & {
|
|
216
219
|
enableZoom?: boolean;
|
|
217
220
|
enablePan?: boolean;
|
|
218
|
-
|
|
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
|
-
|
|
658
|
+
[key: string]: unknown;
|
|
659
|
+
}) | object | null>;
|
|
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,21 +707,25 @@ 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
|
-
|
|
713
|
+
[key: string]: unknown;
|
|
714
|
+
};
|
|
708
715
|
chartStyling?: DeepPartial<ILineChartStyling> & {
|
|
709
716
|
hideControls?: boolean;
|
|
710
717
|
minHeight?: number | string;
|
|
711
|
-
|
|
718
|
+
[key: string]: unknown;
|
|
719
|
+
};
|
|
712
720
|
interactions?: DeepPartial<ILineInteractions> & {
|
|
713
721
|
enableZoom?: boolean;
|
|
714
722
|
enablePan?: boolean;
|
|
715
|
-
|
|
723
|
+
[key: string]: unknown;
|
|
724
|
+
};
|
|
716
725
|
graph?: DeepPartial<ILineChartGraph> & {
|
|
717
726
|
tooltip?: unknown;
|
|
718
|
-
|
|
727
|
+
[key: string]: unknown;
|
|
728
|
+
};
|
|
719
729
|
annotations?: (DeepPartial<ICommonAnnotations> & {
|
|
720
730
|
annotationsData?: ILooseLineAnnotation[];
|
|
721
731
|
}) | null;
|
|
@@ -732,8 +742,8 @@ export declare interface ILineChartProps {
|
|
|
732
742
|
}
|
|
733
743
|
|
|
734
744
|
export declare interface ILineChartRange {
|
|
735
|
-
min
|
|
736
|
-
max
|
|
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> &
|
|
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>> &
|
|
785
|
+
declare type ILooseBarAxis = DeepPartial<ICommonAxis<string>> & {
|
|
786
|
+
[key: string]: unknown;
|
|
787
|
+
};
|
|
774
788
|
|
|
775
|
-
declare type ILooseLineAnnotation = DeepPartial<
|
|
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,21 @@ declare type ILooseLineAnnotation = DeepPartial<ICommonAnnotations['annotationsD
|
|
|
784
800
|
yValue?: number | string | null;
|
|
785
801
|
};
|
|
786
802
|
|
|
787
|
-
declare type ILooseLineAxis = DeepPartial<ILineChartAxis<string>> &
|
|
803
|
+
declare type ILooseLineAxis = DeepPartial<ILineChartAxis<string>> & {
|
|
804
|
+
[key: string]: unknown;
|
|
805
|
+
};
|
|
788
806
|
|
|
789
|
-
declare type ILooseScatterAnnotation = DeepPartial<
|
|
807
|
+
declare type ILooseScatterAnnotation = DeepPartial<ICommonAnnotationsData> & {
|
|
808
|
+
[key: string]: unknown;
|
|
809
|
+
} & {
|
|
790
810
|
annotationAxis?: string;
|
|
791
811
|
type?: string;
|
|
792
812
|
value?: number | string | null;
|
|
793
813
|
};
|
|
794
814
|
|
|
795
|
-
declare type ILooseScatterAxis = DeepPartial<ICommonAxis<string>> &
|
|
815
|
+
declare type ILooseScatterAxis = DeepPartial<ICommonAxis<string>> & {
|
|
816
|
+
[key: string]: unknown;
|
|
817
|
+
};
|
|
796
818
|
|
|
797
819
|
/**
|
|
798
820
|
* Initialize the charts library with the provided configurations.
|
|
@@ -873,8 +895,8 @@ export declare interface IScatterChartData extends ICommonData {
|
|
|
873
895
|
}
|
|
874
896
|
|
|
875
897
|
export declare interface IScatterChartDataInput extends Omit<IScatterChartData, 'data' | 'options'> {
|
|
876
|
-
data?: DeepPartial<IScatterChartData['data']> & {
|
|
877
|
-
datasets?: Array<DeepPartial<IScatterChartDataset> |
|
|
898
|
+
data?: Omit<DeepPartial<IScatterChartData['data']>, 'datasets'> & {
|
|
899
|
+
datasets?: Array<DeepPartial<IScatterChartDataset> | object | null>;
|
|
878
900
|
};
|
|
879
901
|
options?: IScatterOptionsInput;
|
|
880
902
|
}
|
|
@@ -923,7 +945,8 @@ export declare interface IScatterOptions extends ICommonOptions {
|
|
|
923
945
|
direction?: ChartDirection;
|
|
924
946
|
}
|
|
925
947
|
|
|
926
|
-
export declare type IScatterOptionsInput = DeepPartial<IScatterOptions> & {
|
|
948
|
+
export declare type IScatterOptionsInput = Omit<DeepPartial<IScatterOptions>, 'title' | 'direction' | 'axes' | 'legend' | 'chartStyling' | 'interactions' | 'annotations'> & {
|
|
949
|
+
[key: string]: unknown;
|
|
927
950
|
title?: unknown;
|
|
928
951
|
direction?: string;
|
|
929
952
|
axes?: {
|
|
@@ -931,16 +954,20 @@ export declare type IScatterOptionsInput = DeepPartial<IScatterOptions> & {
|
|
|
931
954
|
y?: ILooseScatterAxis[];
|
|
932
955
|
[key: string]: ILooseScatterAxis[] | undefined;
|
|
933
956
|
};
|
|
934
|
-
legend?: DeepPartial<IScatterLegend> & {
|
|
957
|
+
legend?: Omit<DeepPartial<IScatterLegend>, 'position' | 'align'> & {
|
|
935
958
|
position?: string;
|
|
936
959
|
align?: string;
|
|
937
|
-
|
|
938
|
-
|
|
960
|
+
[key: string]: unknown;
|
|
961
|
+
};
|
|
962
|
+
chartStyling?: {
|
|
963
|
+
[key: string]: unknown;
|
|
964
|
+
};
|
|
939
965
|
interactions?: DeepPartial<ICommonOptions['interactions']> & {
|
|
940
966
|
enableZoom?: boolean;
|
|
941
967
|
enablePan?: boolean;
|
|
942
|
-
|
|
943
|
-
|
|
968
|
+
[key: string]: unknown;
|
|
969
|
+
};
|
|
970
|
+
annotations?: (DeepPartial<ICommonAnnotations> & {
|
|
944
971
|
annotationsData?: ILooseScatterAnnotation[];
|
|
945
972
|
}) | null;
|
|
946
973
|
};
|
|
@@ -1074,22 +1101,6 @@ export declare type UnusedParameter = unknown;
|
|
|
1074
1101
|
export { }
|
|
1075
1102
|
|
|
1076
1103
|
|
|
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
1104
|
/**
|
|
1094
1105
|
* Vertical Markers Plugin
|
|
1095
1106
|
*
|
|
@@ -1141,3 +1152,19 @@ declare module 'chart.js' {
|
|
|
1141
1152
|
} | TVerticalMarkersOptions;
|
|
1142
1153
|
}
|
|
1143
1154
|
}
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
declare module 'chart.js' {
|
|
1158
|
+
interface PluginOptionsByType<TType extends ChartType> {
|
|
1159
|
+
annotationDraggerPlugin?: AnnotationDraggerPluginOptions;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
declare module 'chart.js' {
|
|
1165
|
+
interface PluginOptionsByType<TType extends ChartType> {
|
|
1166
|
+
calloutConnectorPlugin?: {
|
|
1167
|
+
enableCalloutAnnotation?: boolean;
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
}
|
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
|
|
20106
|
+
position: normalizeAxisPosition(axis?.position, fallbackPosition),
|
|
20098
20107
|
color: axis?.color ?? "",
|
|
20099
20108
|
unit: normalizeUnit(axis?.unit)
|
|
20100
20109
|
});
|
|
@@ -20195,8 +20204,8 @@ var defaultAnnotations$2 = (annotations) => ({
|
|
|
20195
20204
|
});
|
|
20196
20205
|
var defaultLegend$3 = (legend) => ({
|
|
20197
20206
|
display: legend?.display ?? true,
|
|
20198
|
-
position: legend?.position
|
|
20199
|
-
align: legend?.align
|
|
20207
|
+
position: normalizeLegendPosition(legend?.position, Position.BottomLeft),
|
|
20208
|
+
align: normalizeLegendAlign(legend?.align, AlignOptions.Center),
|
|
20200
20209
|
customLegend: {
|
|
20201
20210
|
customLegendPlugin: legend?.customLegend?.customLegendPlugin && typeof legend.customLegend.customLegendPlugin === "object" && "id" in legend.customLegend.customLegendPlugin ? legend.customLegend.customLegendPlugin : null,
|
|
20202
20211
|
customLegendContainerID: typeof legend?.customLegend?.customLegendContainerID === "string" ? legend.customLegend.customLegendContainerID : ""
|
|
@@ -20245,10 +20254,13 @@ var normalizeLineChartOptions = (options = {}) => ({
|
|
|
20245
20254
|
dragData: defaultDragData$1(options?.dragData),
|
|
20246
20255
|
depthType: options?.depthType ?? {}
|
|
20247
20256
|
});
|
|
20248
|
-
var normalizeLineDatasets = (datasets) => (datasets ?? []).map((dataset) =>
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
20257
|
+
var normalizeLineDatasets = (datasets) => (datasets ?? []).map((dataset) => {
|
|
20258
|
+
const normalizedDataset = dataset && typeof dataset === "object" ? dataset : {};
|
|
20259
|
+
return {
|
|
20260
|
+
...normalizedDataset,
|
|
20261
|
+
data: Array.isArray(normalizedDataset.data) ? normalizedDataset.data : []
|
|
20262
|
+
};
|
|
20263
|
+
});
|
|
20252
20264
|
var getDefaultProps$3 = (props) => {
|
|
20253
20265
|
const chart = props?.chart || {};
|
|
20254
20266
|
const options = chart?.options || {};
|
|
@@ -37451,8 +37463,8 @@ var defaultAnnotations$1 = (annotations) => ({
|
|
|
37451
37463
|
});
|
|
37452
37464
|
var defaultLegend$1 = (legend) => ({
|
|
37453
37465
|
display: legend?.display ?? true,
|
|
37454
|
-
position: legend?.position
|
|
37455
|
-
align: legend?.align
|
|
37466
|
+
position: normalizeLegendPosition(legend?.position, Position.TopLeft),
|
|
37467
|
+
align: normalizeLegendAlign(legend?.align, AlignOptions.Center),
|
|
37456
37468
|
customLegend: {
|
|
37457
37469
|
customLegendPlugin: legend?.customLegend?.customLegendPlugin && typeof legend.customLegend.customLegendPlugin === "object" && "id" in legend.customLegend.customLegendPlugin ? legend.customLegend.customLegendPlugin : null,
|
|
37458
37470
|
customLegendContainerID: typeof legend?.customLegend?.customLegendContainerID === "string" ? legend.customLegend.customLegendContainerID : ""
|
|
@@ -37491,10 +37503,13 @@ var normalizeBarOptions = (options = {}) => ({
|
|
|
37491
37503
|
interactions: defaultInteractions$1(options?.interactions),
|
|
37492
37504
|
dragData: defaultDragData(options?.dragData)
|
|
37493
37505
|
});
|
|
37494
|
-
var normalizeBarDatasets = (datasets) => (datasets ?? []).map((dataset) =>
|
|
37495
|
-
|
|
37496
|
-
|
|
37497
|
-
|
|
37506
|
+
var normalizeBarDatasets = (datasets) => (datasets ?? []).map((dataset) => {
|
|
37507
|
+
const normalizedDataset = dataset && typeof dataset === "object" ? dataset : {};
|
|
37508
|
+
return {
|
|
37509
|
+
...normalizedDataset,
|
|
37510
|
+
data: Array.isArray(normalizedDataset.data) ? normalizedDataset.data : []
|
|
37511
|
+
};
|
|
37512
|
+
});
|
|
37498
37513
|
var getDefaultProps$1 = (props) => {
|
|
37499
37514
|
const chart = props?.chart || {};
|
|
37500
37515
|
const options = chart?.options || {};
|
|
@@ -37772,8 +37787,8 @@ var defaultGraph = (graph) => ({
|
|
|
37772
37787
|
var defaultLegend = (legend) => ({
|
|
37773
37788
|
display: legend?.display ?? true,
|
|
37774
37789
|
useDataset: legend?.useDataset ?? false,
|
|
37775
|
-
position: legend?.position
|
|
37776
|
-
align: legend?.align
|
|
37790
|
+
position: normalizeLegendPosition(legend?.position, Position.BottomLeft),
|
|
37791
|
+
align: normalizeLegendAlign(legend?.align, AlignOptions.Center)
|
|
37777
37792
|
});
|
|
37778
37793
|
var defaultChartOptions = (options) => ({
|
|
37779
37794
|
enableZoom: options?.enableZoom ?? false,
|
|
@@ -37787,10 +37802,13 @@ var defaultInteractions = (interactions) => ({
|
|
|
37787
37802
|
});
|
|
37788
37803
|
var defaultChartData = (data) => ({
|
|
37789
37804
|
labels: data?.labels ?? [],
|
|
37790
|
-
datasets: (data?.datasets ?? []).map((dataset) =>
|
|
37791
|
-
|
|
37792
|
-
|
|
37793
|
-
|
|
37805
|
+
datasets: (data?.datasets ?? []).map((dataset) => {
|
|
37806
|
+
const normalizedDataset = dataset && typeof dataset === "object" ? dataset : {};
|
|
37807
|
+
return {
|
|
37808
|
+
...normalizedDataset,
|
|
37809
|
+
data: Array.isArray(normalizedDataset.data) ? normalizedDataset.data : []
|
|
37810
|
+
};
|
|
37811
|
+
})
|
|
37794
37812
|
});
|
|
37795
37813
|
var defaultAnnotationsData = (annotationsData) => (annotationsData ?? []).map((ann) => ({
|
|
37796
37814
|
...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-
|
|
3
|
+
"version": "5.9.0-beta-12",
|
|
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": {
|