@oliasoft-open-source/charts-library 5.9.0-beta-8 → 5.9.0-beta-10
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 +120 -68
- package/dist/index.js +210 -132
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -32,9 +32,7 @@ export declare const BarChart: (props: IBarChartProps) => JSX_2.Element;
|
|
|
32
32
|
|
|
33
33
|
export declare enum ChartDirection {
|
|
34
34
|
VERTICAL = "vertical",
|
|
35
|
-
HORIZONTAL = "horizontal"
|
|
36
|
-
Vertical = "vertical",
|
|
37
|
-
Horizontal = "horizontal"
|
|
35
|
+
HORIZONTAL = "horizontal"
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
export declare enum ChartHoverMode {
|
|
@@ -45,11 +43,8 @@ export declare enum ChartType {
|
|
|
45
43
|
LINE = "line",
|
|
46
44
|
BAR = "bar",
|
|
47
45
|
PIE = "pie",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Bar = "bar",
|
|
51
|
-
Pie = "pie",
|
|
52
|
-
Scatter = "scatter"
|
|
46
|
+
DOUGHNUT = "doughnut",
|
|
47
|
+
SCATTER = "scatter"
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
export declare const COLORS: string[];
|
|
@@ -63,6 +58,10 @@ export declare enum CursorStyle {
|
|
|
63
58
|
Move = "move"
|
|
64
59
|
}
|
|
65
60
|
|
|
61
|
+
export declare type DeepPartial<T> = T extends (...args: unknown[]) => unknown ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? {
|
|
62
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
63
|
+
} : T;
|
|
64
|
+
|
|
66
65
|
export declare enum DragAxis {
|
|
67
66
|
X = "x",
|
|
68
67
|
Y = "y",
|
|
@@ -99,6 +98,17 @@ export declare enum GradientDirection {
|
|
|
99
98
|
TopRightToBottomLeft = 7
|
|
100
99
|
}
|
|
101
100
|
|
|
101
|
+
export declare interface IAnnotationLabelConfig {
|
|
102
|
+
backgroundColor?: string;
|
|
103
|
+
display?: boolean;
|
|
104
|
+
position?: string;
|
|
105
|
+
color?: string;
|
|
106
|
+
font?: string;
|
|
107
|
+
borderColor?: string;
|
|
108
|
+
callout?: Record<string, unknown>;
|
|
109
|
+
[key: string]: unknown;
|
|
110
|
+
}
|
|
111
|
+
|
|
102
112
|
export declare interface IBarAdditionalAxesOptions extends ICommonAdditionalAxesOptions {
|
|
103
113
|
stackedX?: boolean;
|
|
104
114
|
stackedY?: boolean;
|
|
@@ -122,6 +132,11 @@ export declare interface IBarChartData extends ICommonData {
|
|
|
122
132
|
options: IBarOptions;
|
|
123
133
|
}
|
|
124
134
|
|
|
135
|
+
export declare interface IBarChartDataInput extends Omit<IBarChartData, 'options' | 'data'> {
|
|
136
|
+
data?: DeepPartial<IBarChartData['data']>;
|
|
137
|
+
options?: IBarOptionsInput;
|
|
138
|
+
}
|
|
139
|
+
|
|
125
140
|
export declare interface IBarChartDataset extends ICommonDataset {
|
|
126
141
|
isAnnotation?: boolean;
|
|
127
142
|
annotationIndex?: number;
|
|
@@ -135,7 +150,7 @@ export declare interface IBarChartDataset extends ICommonDataset {
|
|
|
135
150
|
}
|
|
136
151
|
|
|
137
152
|
export declare interface IBarChartProps {
|
|
138
|
-
chart:
|
|
153
|
+
chart: IBarChartDataInput;
|
|
139
154
|
}
|
|
140
155
|
|
|
141
156
|
export declare interface IBarDefaultProps {
|
|
@@ -168,7 +183,7 @@ export declare interface IBarLegend extends ICommonLegend {
|
|
|
168
183
|
}
|
|
169
184
|
|
|
170
185
|
export declare interface IBarOptions extends ICommonOptions {
|
|
171
|
-
direction
|
|
186
|
+
direction?: 'vertical' | 'horizontal';
|
|
172
187
|
axes: IBarAxes;
|
|
173
188
|
scales?: ICommonScales;
|
|
174
189
|
additionalAxesOptions?: IBarAdditionalAxesOptions;
|
|
@@ -179,6 +194,8 @@ export declare interface IBarOptions extends ICommonOptions {
|
|
|
179
194
|
dragData?: ICommonDragData;
|
|
180
195
|
}
|
|
181
196
|
|
|
197
|
+
export declare type IBarOptionsInput = DeepPartial<IBarOptions>;
|
|
198
|
+
|
|
182
199
|
export declare interface IBarStyling extends ICommonStyling {
|
|
183
200
|
squareAspectRatio?: boolean;
|
|
184
201
|
layoutPadding?: string | number | {
|
|
@@ -189,11 +206,30 @@ export declare interface IBarStyling extends ICommonStyling {
|
|
|
189
206
|
};
|
|
190
207
|
}
|
|
191
208
|
|
|
209
|
+
export declare interface ICalloutLabelConfig {
|
|
210
|
+
enabled?: boolean;
|
|
211
|
+
color?: string;
|
|
212
|
+
font?: string;
|
|
213
|
+
borderColor?: string;
|
|
214
|
+
strokeStyle?: string;
|
|
215
|
+
lineWidth?: number;
|
|
216
|
+
startOffset?: number;
|
|
217
|
+
endOffset?: number;
|
|
218
|
+
margin?: number;
|
|
219
|
+
xValue?: number;
|
|
220
|
+
yValue?: number;
|
|
221
|
+
xAdjust?: number;
|
|
222
|
+
yAdjust?: number;
|
|
223
|
+
onDragStart?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
224
|
+
onDrag?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
225
|
+
onDragEnd?: (coordinates: ICoordinates, annotation: ICommonAnnotationsData) => void;
|
|
226
|
+
}
|
|
227
|
+
|
|
192
228
|
export declare interface IChartDataLabelsOptions {
|
|
193
229
|
display?: 'auto' | boolean;
|
|
194
230
|
align?: 'center';
|
|
195
231
|
anchor?: 'center';
|
|
196
|
-
formatter?: (_value:
|
|
232
|
+
formatter?: (_value: unknown, context: unknown) => unknown;
|
|
197
233
|
}
|
|
198
234
|
|
|
199
235
|
export declare interface IChartGeneratedLabel {
|
|
@@ -204,7 +240,7 @@ export declare interface IChartGeneratedLabel {
|
|
|
204
240
|
}
|
|
205
241
|
|
|
206
242
|
declare interface IChartGraph {
|
|
207
|
-
showMinorGridlines
|
|
243
|
+
showMinorGridlines?: boolean;
|
|
208
244
|
}
|
|
209
245
|
|
|
210
246
|
export declare interface IChartLegendItemFilter {
|
|
@@ -215,8 +251,8 @@ export declare interface IChartLegendItemFilter {
|
|
|
215
251
|
|
|
216
252
|
export declare interface ICommonAdditionalAxesOptions {
|
|
217
253
|
chartScaleType?: 'linear' | 'logarithmic';
|
|
218
|
-
reverse
|
|
219
|
-
beginAtZero
|
|
254
|
+
reverse?: boolean;
|
|
255
|
+
beginAtZero?: boolean;
|
|
220
256
|
stepSize?: number;
|
|
221
257
|
stacked?: boolean;
|
|
222
258
|
suggestedMin?: number;
|
|
@@ -226,14 +262,14 @@ export declare interface ICommonAdditionalAxesOptions {
|
|
|
226
262
|
}
|
|
227
263
|
|
|
228
264
|
export declare interface ICommonAnnotation {
|
|
229
|
-
showLabel
|
|
230
|
-
text
|
|
231
|
-
position
|
|
232
|
-
fontSize
|
|
233
|
-
xOffset
|
|
234
|
-
yOffset
|
|
235
|
-
maxWidth
|
|
236
|
-
lineHeight
|
|
265
|
+
showLabel?: boolean;
|
|
266
|
+
text?: string | string[];
|
|
267
|
+
position?: string;
|
|
268
|
+
fontSize?: number;
|
|
269
|
+
xOffset?: number;
|
|
270
|
+
yOffset?: number;
|
|
271
|
+
maxWidth?: number;
|
|
272
|
+
lineHeight?: number;
|
|
237
273
|
}
|
|
238
274
|
|
|
239
275
|
export declare interface ICommonAnnotationElement {
|
|
@@ -274,21 +310,21 @@ export declare interface ICommonAnnotationsData {
|
|
|
274
310
|
hideLegend?: boolean;
|
|
275
311
|
labelOffsetPx?: number;
|
|
276
312
|
id?: string;
|
|
277
|
-
adjustScaleRange
|
|
278
|
-
annotationAxis
|
|
279
|
-
rotation
|
|
280
|
-
color
|
|
281
|
-
endValue
|
|
313
|
+
adjustScaleRange?: boolean;
|
|
314
|
+
annotationAxis?: 'x' | 'y';
|
|
315
|
+
rotation?: number;
|
|
316
|
+
color?: string;
|
|
317
|
+
endValue?: number;
|
|
282
318
|
borderWidth?: number;
|
|
283
319
|
backgroundColor?: string;
|
|
284
|
-
label
|
|
285
|
-
labelConfig?:
|
|
286
|
-
type
|
|
287
|
-
value
|
|
288
|
-
xMin
|
|
289
|
-
xMax
|
|
290
|
-
yMin
|
|
291
|
-
yMax
|
|
320
|
+
label?: string;
|
|
321
|
+
labelConfig?: IAnnotationLabelConfig;
|
|
322
|
+
type?: DraggableAnnotationType;
|
|
323
|
+
value?: number;
|
|
324
|
+
xMin?: number;
|
|
325
|
+
xMax?: number;
|
|
326
|
+
yMin?: number;
|
|
327
|
+
yMax?: number;
|
|
292
328
|
xValue?: number;
|
|
293
329
|
yValue?: number;
|
|
294
330
|
radius?: number;
|
|
@@ -309,18 +345,18 @@ export declare interface ICommonAnnotationsData {
|
|
|
309
345
|
opacity?: number;
|
|
310
346
|
}
|
|
311
347
|
|
|
312
|
-
export declare interface ICommonAxis<PositionType =
|
|
313
|
-
label
|
|
314
|
-
position
|
|
315
|
-
color
|
|
348
|
+
export declare interface ICommonAxis<PositionType = string> {
|
|
349
|
+
label?: string;
|
|
350
|
+
position?: PositionType;
|
|
351
|
+
color?: string | string[];
|
|
316
352
|
unit?: string;
|
|
317
353
|
gridLines?: boolean;
|
|
318
354
|
stepSize?: number;
|
|
319
355
|
}
|
|
320
356
|
|
|
321
357
|
export declare interface ICommonChartOptions {
|
|
322
|
-
enableZoom
|
|
323
|
-
enablePan
|
|
358
|
+
enableZoom?: boolean;
|
|
359
|
+
enablePan?: boolean;
|
|
324
360
|
}
|
|
325
361
|
|
|
326
362
|
export declare interface ICommonChartPlugins {
|
|
@@ -404,8 +440,8 @@ export declare interface ICommonInteractions {
|
|
|
404
440
|
|
|
405
441
|
export declare interface ICommonLegend {
|
|
406
442
|
display: boolean;
|
|
407
|
-
position
|
|
408
|
-
align
|
|
443
|
+
position?: Position;
|
|
444
|
+
align?: AlignOptions;
|
|
409
445
|
}
|
|
410
446
|
|
|
411
447
|
export declare interface ICommonOptions {
|
|
@@ -439,9 +475,9 @@ export declare interface ICommonStyling {
|
|
|
439
475
|
}
|
|
440
476
|
|
|
441
477
|
export declare interface ICommonTooltip {
|
|
442
|
-
tooltips
|
|
443
|
-
showLabelsInTooltips
|
|
444
|
-
scientificNotation
|
|
478
|
+
tooltips?: boolean;
|
|
479
|
+
showLabelsInTooltips?: boolean;
|
|
480
|
+
scientificNotation?: boolean;
|
|
445
481
|
callbacks?: ICommonTooltipCallbacks;
|
|
446
482
|
}
|
|
447
483
|
|
|
@@ -534,21 +570,23 @@ export declare interface IGeneratedScatterChartDataset {
|
|
|
534
570
|
}
|
|
535
571
|
|
|
536
572
|
export declare interface ILChartOptions extends ICommonChartOptions {
|
|
537
|
-
showPoints
|
|
538
|
-
closeOnOutsideClick
|
|
539
|
-
showLine
|
|
573
|
+
showPoints?: boolean;
|
|
574
|
+
closeOnOutsideClick?: boolean;
|
|
575
|
+
showLine?: boolean;
|
|
576
|
+
enableZoom?: boolean;
|
|
577
|
+
enablePan?: boolean;
|
|
540
578
|
enableDragAnnotation?: boolean;
|
|
541
579
|
}
|
|
542
580
|
|
|
543
581
|
export declare interface ILineChartAdditionalAxesOptions {
|
|
544
|
-
chartScaleType
|
|
545
|
-
reverse
|
|
546
|
-
beginAtZero
|
|
582
|
+
chartScaleType?: 'linear' | 'logarithmic';
|
|
583
|
+
reverse?: boolean;
|
|
584
|
+
beginAtZero?: boolean;
|
|
547
585
|
stepSize?: number;
|
|
548
586
|
suggestedMin?: number;
|
|
549
587
|
suggestedMax?: number;
|
|
550
588
|
range?: ILineRange;
|
|
551
|
-
autoAxisPadding
|
|
589
|
+
autoAxisPadding?: boolean;
|
|
552
590
|
}
|
|
553
591
|
|
|
554
592
|
export declare interface ILineChartAxes {
|
|
@@ -557,12 +595,12 @@ export declare interface ILineChartAxes {
|
|
|
557
595
|
[key: string]: ILineChartAxis[];
|
|
558
596
|
}
|
|
559
597
|
|
|
560
|
-
export declare interface ILineChartAxis<PositionType =
|
|
598
|
+
export declare interface ILineChartAxis<PositionType = TAxisPosition> {
|
|
561
599
|
id?: string;
|
|
562
|
-
label
|
|
563
|
-
position
|
|
564
|
-
color
|
|
565
|
-
unit?: IUnitOptions;
|
|
600
|
+
label?: string;
|
|
601
|
+
position?: PositionType;
|
|
602
|
+
color?: string | string[];
|
|
603
|
+
unit?: IUnitOptions | string;
|
|
566
604
|
stepSize?: number;
|
|
567
605
|
gridLines?: ILineChartGraph;
|
|
568
606
|
min?: number | string;
|
|
@@ -578,6 +616,11 @@ export declare interface ILineChartData extends ICommonData {
|
|
|
578
616
|
controlsPortalId?: string;
|
|
579
617
|
}
|
|
580
618
|
|
|
619
|
+
export declare interface ILineChartDataInput extends Omit<ILineChartData, 'data' | 'options'> {
|
|
620
|
+
data?: DeepPartial<ILineChartData['data']>;
|
|
621
|
+
options?: ILineChartOptionsInput;
|
|
622
|
+
}
|
|
623
|
+
|
|
581
624
|
export declare interface ILineChartDataset extends ICommonDataset {
|
|
582
625
|
lineTension?: number;
|
|
583
626
|
pointBackgroundColor?: string;
|
|
@@ -593,10 +636,10 @@ export declare interface ILineChartDataset extends ICommonDataset {
|
|
|
593
636
|
}
|
|
594
637
|
|
|
595
638
|
export declare interface ILineChartGraph {
|
|
596
|
-
lineTension
|
|
597
|
-
spanGaps
|
|
598
|
-
showDataLabels
|
|
599
|
-
showMinorGridlines
|
|
639
|
+
lineTension?: number;
|
|
640
|
+
spanGaps?: boolean;
|
|
641
|
+
showDataLabels?: boolean;
|
|
642
|
+
showMinorGridlines?: boolean;
|
|
600
643
|
}
|
|
601
644
|
|
|
602
645
|
export declare interface ILineChartOptions extends ICommonOptions {
|
|
@@ -615,8 +658,10 @@ export declare interface ILineChartOptions extends ICommonOptions {
|
|
|
615
658
|
depthType?: IDepthType | object;
|
|
616
659
|
}
|
|
617
660
|
|
|
661
|
+
export declare type ILineChartOptionsInput = DeepPartial<ILineChartOptions>;
|
|
662
|
+
|
|
618
663
|
export declare interface ILineChartProps {
|
|
619
|
-
chart:
|
|
664
|
+
chart: ILineChartDataInput;
|
|
620
665
|
table?: ReactNode;
|
|
621
666
|
headerComponent?: ReactNode;
|
|
622
667
|
subheaderComponent?: ReactNode;
|
|
@@ -638,8 +683,8 @@ export declare interface ILineChartStyling extends ICommonStyling {
|
|
|
638
683
|
}
|
|
639
684
|
|
|
640
685
|
export declare interface ILineChartTooltip extends ICommonTooltip {
|
|
641
|
-
hideSimulationName
|
|
642
|
-
scientificNotation
|
|
686
|
+
hideSimulationName?: boolean;
|
|
687
|
+
scientificNotation?: boolean;
|
|
643
688
|
}
|
|
644
689
|
|
|
645
690
|
export declare interface ILineInteractions extends ICommonInteractions {
|
|
@@ -731,13 +776,18 @@ export declare interface IScatterChartData extends ICommonData {
|
|
|
731
776
|
options: IScatterOptions;
|
|
732
777
|
}
|
|
733
778
|
|
|
779
|
+
export declare interface IScatterChartDataInput extends Omit<IScatterChartData, 'data' | 'options'> {
|
|
780
|
+
data?: DeepPartial<IScatterChartData['data']>;
|
|
781
|
+
options?: IScatterOptionsInput;
|
|
782
|
+
}
|
|
783
|
+
|
|
734
784
|
export declare interface IScatterChartDataset extends ICommonDataset {
|
|
735
785
|
data: IScatterDataValue[];
|
|
736
786
|
hideLegend?: boolean;
|
|
737
787
|
}
|
|
738
788
|
|
|
739
789
|
export declare interface IScatterChartProps {
|
|
740
|
-
chart:
|
|
790
|
+
chart: IScatterChartDataInput;
|
|
741
791
|
testId?: string | null;
|
|
742
792
|
}
|
|
743
793
|
|
|
@@ -772,9 +822,11 @@ export declare interface IScatterOptions extends ICommonOptions {
|
|
|
772
822
|
legend?: IScatterLegend;
|
|
773
823
|
axes?: IScatterAxes;
|
|
774
824
|
additionalAxesOptions?: ICommonAdditionalAxesOptions;
|
|
775
|
-
direction
|
|
825
|
+
direction?: ChartDirection;
|
|
776
826
|
}
|
|
777
827
|
|
|
828
|
+
export declare type IScatterOptionsInput = DeepPartial<IScatterOptions>;
|
|
829
|
+
|
|
778
830
|
export declare interface IScatterTooltip {
|
|
779
831
|
enabled?: boolean;
|
|
780
832
|
tooltips?: boolean;
|
|
@@ -899,7 +951,7 @@ export declare type TVerticalMarkerTick = {
|
|
|
899
951
|
labelOffsetPx?: number;
|
|
900
952
|
};
|
|
901
953
|
|
|
902
|
-
export declare type UnusedParameter = unknown
|
|
954
|
+
export declare type UnusedParameter = unknown;
|
|
903
955
|
|
|
904
956
|
export { }
|
|
905
957
|
|
package/dist/index.js
CHANGED
|
@@ -18682,11 +18682,8 @@ var ChartType = /* @__PURE__ */ function(ChartType) {
|
|
|
18682
18682
|
ChartType["LINE"] = "line";
|
|
18683
18683
|
ChartType["BAR"] = "bar";
|
|
18684
18684
|
ChartType["PIE"] = "pie";
|
|
18685
|
+
ChartType["DOUGHNUT"] = "doughnut";
|
|
18685
18686
|
ChartType["SCATTER"] = "scatter";
|
|
18686
|
-
ChartType["Line"] = "line";
|
|
18687
|
-
ChartType["Bar"] = "bar";
|
|
18688
|
-
ChartType["Pie"] = "pie";
|
|
18689
|
-
ChartType["Scatter"] = "scatter";
|
|
18690
18687
|
return ChartType;
|
|
18691
18688
|
}({});
|
|
18692
18689
|
var CursorStyle = /* @__PURE__ */ function(CursorStyle) {
|
|
@@ -18707,8 +18704,6 @@ var ScaleType = /* @__PURE__ */ function(ScaleType) {
|
|
|
18707
18704
|
var ChartDirection = /* @__PURE__ */ function(ChartDirection) {
|
|
18708
18705
|
ChartDirection["VERTICAL"] = "vertical";
|
|
18709
18706
|
ChartDirection["HORIZONTAL"] = "horizontal";
|
|
18710
|
-
ChartDirection["Vertical"] = "vertical";
|
|
18711
|
-
ChartDirection["Horizontal"] = "horizontal";
|
|
18712
18707
|
return ChartDirection;
|
|
18713
18708
|
}({});
|
|
18714
18709
|
var TooltipLabel = /* @__PURE__ */ function(TooltipLabel) {
|
|
@@ -20068,10 +20063,34 @@ var defaultAxis = (position) => ({
|
|
|
20068
20063
|
setSelectedUnit: () => {}
|
|
20069
20064
|
}
|
|
20070
20065
|
});
|
|
20071
|
-
var
|
|
20072
|
-
|
|
20073
|
-
|
|
20066
|
+
var normalizeUnit = (unit) => {
|
|
20067
|
+
if (!unit) return {
|
|
20068
|
+
options: [],
|
|
20069
|
+
selectedUnit: "",
|
|
20070
|
+
setSelectedUnit: () => {}
|
|
20071
|
+
};
|
|
20072
|
+
if (typeof unit === "string") return unit;
|
|
20073
|
+
return {
|
|
20074
|
+
options: unit.options ?? [],
|
|
20075
|
+
selectedUnit: unit.selectedUnit ?? "",
|
|
20076
|
+
setSelectedUnit: unit.setSelectedUnit ?? (() => {})
|
|
20077
|
+
};
|
|
20078
|
+
};
|
|
20079
|
+
var normalizeAxis = (axis, fallbackPosition) => ({
|
|
20080
|
+
...defaultAxis(fallbackPosition),
|
|
20081
|
+
...axis || {},
|
|
20082
|
+
position: axis?.position ?? fallbackPosition,
|
|
20083
|
+
color: axis?.color ?? "",
|
|
20084
|
+
unit: normalizeUnit(axis?.unit)
|
|
20074
20085
|
});
|
|
20086
|
+
var defaultAxes$2 = (axes) => {
|
|
20087
|
+
const xAxes = Array.isArray(axes?.x) ? axes.x : [];
|
|
20088
|
+
const yAxes = Array.isArray(axes?.y) ? axes.y : [];
|
|
20089
|
+
return {
|
|
20090
|
+
x: xAxes.length > 0 ? xAxes.map((axis, index) => normalizeAxis(axis, index % 2 === 0 ? "bottom" : "top")) : [defaultAxis("bottom")],
|
|
20091
|
+
y: yAxes.length > 0 ? yAxes.map((axis, index) => normalizeAxis(axis, index % 2 === 0 ? "left" : "right")) : [defaultAxis("left")]
|
|
20092
|
+
};
|
|
20093
|
+
};
|
|
20075
20094
|
var defaultAdditionalAxesOptions$2 = (options) => ({
|
|
20076
20095
|
chartScaleType: options?.chartScaleType || "linear",
|
|
20077
20096
|
reverse: options?.reverse || false,
|
|
@@ -20079,23 +20098,30 @@ var defaultAdditionalAxesOptions$2 = (options) => ({
|
|
|
20079
20098
|
stepSize: options?.stepSize,
|
|
20080
20099
|
suggestedMin: options?.suggestedMin,
|
|
20081
20100
|
suggestedMax: options?.suggestedMax,
|
|
20082
|
-
range: options?.range,
|
|
20101
|
+
range: options?.range ? Object.fromEntries(Object.entries(options.range).map(([key, value]) => [key, {
|
|
20102
|
+
min: value?.min ?? 0,
|
|
20103
|
+
max: value?.max ?? 0
|
|
20104
|
+
}])) : void 0,
|
|
20083
20105
|
autoAxisPadding: options?.autoAxisPadding ?? false
|
|
20084
20106
|
});
|
|
20085
|
-
var defaultChartStyling$3 = (options) =>
|
|
20086
|
-
|
|
20087
|
-
|
|
20088
|
-
|
|
20089
|
-
|
|
20090
|
-
|
|
20091
|
-
|
|
20092
|
-
|
|
20093
|
-
|
|
20094
|
-
|
|
20095
|
-
|
|
20096
|
-
|
|
20097
|
-
|
|
20098
|
-
|
|
20107
|
+
var defaultChartStyling$3 = (options) => {
|
|
20108
|
+
const layoutPadding = options?.layoutPadding;
|
|
20109
|
+
const normalizedLayoutPadding = typeof layoutPadding === "number" ? layoutPadding : {
|
|
20110
|
+
top: layoutPadding?.top ?? 0,
|
|
20111
|
+
bottom: layoutPadding?.bottom ?? 20,
|
|
20112
|
+
left: layoutPadding?.left ?? 0,
|
|
20113
|
+
right: layoutPadding?.right ?? 0
|
|
20114
|
+
};
|
|
20115
|
+
return {
|
|
20116
|
+
width: options?.width,
|
|
20117
|
+
height: options?.height,
|
|
20118
|
+
maintainAspectRatio: options?.maintainAspectRatio ?? false,
|
|
20119
|
+
staticChartHeight: options?.staticChartHeight ?? false,
|
|
20120
|
+
performanceMode: options?.performanceMode ?? true,
|
|
20121
|
+
squareAspectRatio: options?.squareAspectRatio ?? false,
|
|
20122
|
+
layoutPadding: normalizedLayoutPadding
|
|
20123
|
+
};
|
|
20124
|
+
};
|
|
20099
20125
|
var defaultTooltip$3 = (tooltip) => ({
|
|
20100
20126
|
tooltips: tooltip?.tooltips ?? true,
|
|
20101
20127
|
showLabelsInTooltips: tooltip?.showLabelsInTooltips ?? false,
|
|
@@ -20110,9 +20136,18 @@ var defaultGraph$3 = (graph) => ({
|
|
|
20110
20136
|
showMinorGridlines: graph?.showMinorGridlines ?? false
|
|
20111
20137
|
});
|
|
20112
20138
|
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
|
+
const asCallback = (fn) => typeof fn === "function" ? fn : void 0;
|
|
20113
20144
|
return annotationsData ? annotationsData.map((ann) => ({
|
|
20114
20145
|
...ann,
|
|
20115
|
-
display: ann?.display ?? true
|
|
20146
|
+
display: ann?.display ?? true,
|
|
20147
|
+
onDragStart: asCallback(ann?.onDragStart),
|
|
20148
|
+
onDrag: asCallback(ann?.onDrag),
|
|
20149
|
+
onDragEnd: asCallback(ann?.onDragEnd),
|
|
20150
|
+
dragRange: normalizeDragRange(ann?.dragRange)
|
|
20116
20151
|
})) : [];
|
|
20117
20152
|
};
|
|
20118
20153
|
var defaultAnnotations$2 = (annotations) => ({
|
|
@@ -20151,9 +20186,9 @@ var defaultLegend$3 = (legend) => ({
|
|
|
20151
20186
|
display: legend?.display ?? true,
|
|
20152
20187
|
position: legend?.position ?? Position.BottomLeft,
|
|
20153
20188
|
align: legend?.align ?? AlignOptions.Center,
|
|
20154
|
-
customLegend:
|
|
20155
|
-
customLegendPlugin: null,
|
|
20156
|
-
customLegendContainerID: ""
|
|
20189
|
+
customLegend: {
|
|
20190
|
+
customLegendPlugin: legend?.customLegend?.customLegendPlugin && typeof legend.customLegend.customLegendPlugin === "object" && "id" in legend.customLegend.customLegendPlugin ? legend.customLegend.customLegendPlugin : null,
|
|
20191
|
+
customLegendContainerID: typeof legend?.customLegend?.customLegendContainerID === "string" ? legend.customLegend.customLegendContainerID : ""
|
|
20157
20192
|
},
|
|
20158
20193
|
usePointStyle: legend?.usePointStyle ?? true
|
|
20159
20194
|
});
|
|
@@ -20166,9 +20201,9 @@ var defaultChartOptions$3 = (options) => ({
|
|
|
20166
20201
|
closeOnOutsideClick: options?.closeOnOutsideClick ?? false
|
|
20167
20202
|
});
|
|
20168
20203
|
var defaultInteractions$3 = (interactions) => ({
|
|
20169
|
-
onLegendClick: interactions?.onLegendClick,
|
|
20170
|
-
onHover: interactions?.onHover,
|
|
20171
|
-
onUnhover: interactions?.onUnhover,
|
|
20204
|
+
onLegendClick: typeof interactions?.onLegendClick === "function" ? interactions.onLegendClick : void 0,
|
|
20205
|
+
onHover: typeof interactions?.onHover === "function" ? interactions.onHover : void 0,
|
|
20206
|
+
onUnhover: typeof interactions?.onUnhover === "function" ? interactions.onUnhover : void 0,
|
|
20172
20207
|
onAnimationComplete: interactions?.onAnimationComplete
|
|
20173
20208
|
});
|
|
20174
20209
|
var defaultDragData$1 = (dragData) => ({
|
|
@@ -20181,6 +20216,28 @@ var defaultDragData$1 = (dragData) => ({
|
|
|
20181
20216
|
onDrag: dragData?.onDrag,
|
|
20182
20217
|
onDragEnd: dragData?.onDragEnd
|
|
20183
20218
|
});
|
|
20219
|
+
var normalizeLineChartOptions = (options = {}) => ({
|
|
20220
|
+
title: options?.title ?? "",
|
|
20221
|
+
scales: options?.scales ?? {
|
|
20222
|
+
x: {},
|
|
20223
|
+
y: {}
|
|
20224
|
+
},
|
|
20225
|
+
axes: defaultAxes$2(options?.axes),
|
|
20226
|
+
additionalAxesOptions: defaultAdditionalAxesOptions$2(options?.additionalAxesOptions),
|
|
20227
|
+
chartStyling: defaultChartStyling$3(options?.chartStyling),
|
|
20228
|
+
tooltip: defaultTooltip$3(options?.tooltip),
|
|
20229
|
+
graph: defaultGraph$3(options?.graph),
|
|
20230
|
+
annotations: defaultAnnotations$2(options?.annotations),
|
|
20231
|
+
legend: defaultLegend$3(options?.legend),
|
|
20232
|
+
chartOptions: defaultChartOptions$3(options?.chartOptions),
|
|
20233
|
+
interactions: defaultInteractions$3(options?.interactions),
|
|
20234
|
+
dragData: defaultDragData$1(options?.dragData),
|
|
20235
|
+
depthType: options?.depthType ?? {}
|
|
20236
|
+
});
|
|
20237
|
+
var normalizeLineDatasets = (datasets) => (datasets ?? []).map((dataset) => ({
|
|
20238
|
+
...dataset,
|
|
20239
|
+
data: dataset?.data ?? []
|
|
20240
|
+
}));
|
|
20184
20241
|
var getDefaultProps$3 = (props) => {
|
|
20185
20242
|
const chart = props?.chart || {};
|
|
20186
20243
|
const options = chart?.options || {};
|
|
@@ -20188,22 +20245,8 @@ var getDefaultProps$3 = (props) => {
|
|
|
20188
20245
|
persistenceId: chart?.persistenceId ?? "",
|
|
20189
20246
|
controlsPortalId: chart?.controlsPortalId ?? "",
|
|
20190
20247
|
testId: chart?.testId ?? void 0,
|
|
20191
|
-
data:
|
|
20192
|
-
options:
|
|
20193
|
-
title: options?.title ?? "",
|
|
20194
|
-
scales: options?.scales ?? {},
|
|
20195
|
-
axes: defaultAxes$2(options?.axes),
|
|
20196
|
-
additionalAxesOptions: defaultAdditionalAxesOptions$2(options?.additionalAxesOptions),
|
|
20197
|
-
chartStyling: defaultChartStyling$3(options?.chartStyling),
|
|
20198
|
-
tooltip: defaultTooltip$3(options?.tooltip),
|
|
20199
|
-
graph: defaultGraph$3(options?.graph),
|
|
20200
|
-
annotations: defaultAnnotations$2(options?.annotations),
|
|
20201
|
-
legend: defaultLegend$3(options?.legend),
|
|
20202
|
-
chartOptions: defaultChartOptions$3(options?.chartOptions),
|
|
20203
|
-
interactions: defaultInteractions$3(options?.interactions),
|
|
20204
|
-
dragData: defaultDragData$1(options?.dragData),
|
|
20205
|
-
depthType: options?.depthType ?? {}
|
|
20206
|
-
}
|
|
20248
|
+
data: { datasets: normalizeLineDatasets(chart?.data?.datasets) },
|
|
20249
|
+
options: normalizeLineChartOptions(options)
|
|
20207
20250
|
};
|
|
20208
20251
|
};
|
|
20209
20252
|
//#endregion
|
|
@@ -20543,6 +20586,7 @@ var getAxesDataFromMetasets = (generatedDatasets, scalesKeys, annotationsData) =
|
|
|
20543
20586
|
};
|
|
20544
20587
|
//#endregion
|
|
20545
20588
|
//#region src/components/line-chart/utils/axis-scales/axis-scales.ts
|
|
20589
|
+
var toScalesMap = (scales) => scales ?? {};
|
|
20546
20590
|
var shouldCalculate = (min, max) => !isNil(min) || !isNil(max);
|
|
20547
20591
|
/**
|
|
20548
20592
|
* Auto scales axis ranges (mix, max) if no explicit range is set
|
|
@@ -20552,7 +20596,7 @@ var shouldCalculate = (min, max) => !isNil(min) || !isNil(max);
|
|
|
20552
20596
|
*/
|
|
20553
20597
|
var autoScale = (options, state, generatedDatasets) => {
|
|
20554
20598
|
const { additionalAxesOptions, annotations: { annotationsData = [], controlAnnotation = false } = {} } = options || {};
|
|
20555
|
-
const scales = getLineChartScales(options, state)
|
|
20599
|
+
const scales = toScalesMap(getLineChartScales(options, state));
|
|
20556
20600
|
const datasets = controlAnnotation ? generatedDatasets.filter(({ isAnnotation }) => !isAnnotation) : generatedDatasets;
|
|
20557
20601
|
if (!additionalAxesOptions?.autoAxisPadding && !estimateDataSeriesHaveCloseValues(datasets)) return scales;
|
|
20558
20602
|
const scalesKeys = Object.keys(scales) ?? [];
|
|
@@ -20561,9 +20605,9 @@ var autoScale = (options, state, generatedDatasets) => {
|
|
|
20561
20605
|
const scale = scales[key];
|
|
20562
20606
|
const { min: propMin = void 0, max: propMax = void 0 } = scale;
|
|
20563
20607
|
const { min: suggestedMin, max: suggestedMax } = getSuggestedAxisRange({
|
|
20564
|
-
data: data[key],
|
|
20565
|
-
beginAtZero: additionalAxesOptions?.beginAtZero,
|
|
20566
|
-
autoAxisPadding: additionalAxesOptions?.autoAxisPadding
|
|
20608
|
+
data: (data[key] ?? []).filter((value) => typeof value === "number"),
|
|
20609
|
+
beginAtZero: additionalAxesOptions?.beginAtZero ?? false,
|
|
20610
|
+
autoAxisPadding: additionalAxesOptions?.autoAxisPadding ?? false
|
|
20567
20611
|
});
|
|
20568
20612
|
const res = { [key]: {
|
|
20569
20613
|
...scale,
|
|
@@ -20663,7 +20707,7 @@ var getLineChartToolTips = (options) => {
|
|
|
20663
20707
|
callbacks: {}
|
|
20664
20708
|
};
|
|
20665
20709
|
}
|
|
20666
|
-
const { scientificNotation } = options?.tooltip ?? {};
|
|
20710
|
+
const { scientificNotation = true } = options?.tooltip ?? {};
|
|
20667
20711
|
const getTooltipLabels = ({ xAxisID = "", yAxisID = "" }) => {
|
|
20668
20712
|
const xIndex = xAxisID?.length > 1 ? Number(xAxisID?.[1]) - 1 : 0;
|
|
20669
20713
|
const yIndex = yAxisID?.length > 1 ? Number(yAxisID?.[1]) - 1 : 0;
|
|
@@ -20688,7 +20732,7 @@ var getLineChartToolTips = (options) => {
|
|
|
20688
20732
|
return `${customFormatNumber$1(titleLabel === TooltipLabel.Y ? tooltipItem?.[0]?.parsed?.y : tooltipItem?.[0]?.parsed?.x, scientificNotation)} ${titleAxisLabel}`;
|
|
20689
20733
|
};
|
|
20690
20734
|
const labelCallback = (tooltipItem) => {
|
|
20691
|
-
const { showLabelsInTooltips } = options?.tooltip ?? {};
|
|
20735
|
+
const { showLabelsInTooltips = false } = options?.tooltip ?? {};
|
|
20692
20736
|
let label = tooltipItem?.dataset?.label || "";
|
|
20693
20737
|
const { valueLabel = "", valueAxisLabel = "" } = getTooltipLabels(tooltipItem?.dataset) ?? {};
|
|
20694
20738
|
const getTooltipItemValue = () => {
|
|
@@ -21191,6 +21235,9 @@ var getCalloutAnnotation = (refAnnotation, index) => {
|
|
|
21191
21235
|
const color = calloutCfg?.color ?? "hsl(60, 10.34482759%, 12.5%)";
|
|
21192
21236
|
const font = calloutCfg?.font ?? `12px "Roobert", "Noto Sans", sans-serif`;
|
|
21193
21237
|
const borderColor = calloutCfg?.borderColor ?? "transparent";
|
|
21238
|
+
const onCalloutDragStart = typeof calloutCfg?.onDragStart === "function" ? calloutCfg.onDragStart : void 0;
|
|
21239
|
+
const onCalloutDrag = typeof calloutCfg?.onDrag === "function" ? calloutCfg.onDrag : void 0;
|
|
21240
|
+
const onCalloutDragEnd = typeof calloutCfg?.onDragEnd === "function" ? calloutCfg.onDragEnd : void 0;
|
|
21194
21241
|
const strokeStyle = calloutCfg.strokeStyle ?? baseAnnotation.borderColor;
|
|
21195
21242
|
const lineWidth = typeof calloutCfg.lineWidth === "number" ? calloutCfg.lineWidth : 1;
|
|
21196
21243
|
const startOffset = typeof calloutCfg.startOffset === "number" ? calloutCfg.startOffset : 6;
|
|
@@ -21233,14 +21280,14 @@ var getCalloutAnnotation = (refAnnotation, index) => {
|
|
|
21233
21280
|
leave: ({ element }, { chart }) => {
|
|
21234
21281
|
return handleLabelLeave(element, chart, { enableDrag: true });
|
|
21235
21282
|
},
|
|
21236
|
-
onDragStart:
|
|
21237
|
-
return
|
|
21283
|
+
onDragStart: onCalloutDragStart ? () => (coords) => {
|
|
21284
|
+
return onCalloutDragStart(coords, refAnnotation);
|
|
21238
21285
|
} : void 0,
|
|
21239
|
-
onDrag:
|
|
21240
|
-
return
|
|
21286
|
+
onDrag: onCalloutDrag ? () => (coords) => {
|
|
21287
|
+
return onCalloutDrag(coords, refAnnotation);
|
|
21241
21288
|
} : void 0,
|
|
21242
|
-
onDragEnd:
|
|
21243
|
-
return
|
|
21289
|
+
onDragEnd: onCalloutDragEnd ? () => (coords) => {
|
|
21290
|
+
return onCalloutDragEnd(coords, refAnnotation);
|
|
21244
21291
|
} : void 0,
|
|
21245
21292
|
calloutConnector: {
|
|
21246
21293
|
enabled: true,
|
|
@@ -21586,8 +21633,9 @@ var useChartPlugins = ({ options, resetZoom }) => {
|
|
|
21586
21633
|
*/
|
|
21587
21634
|
var useToggleCustomLegendVisibility = (memoState, memoOptions) => {
|
|
21588
21635
|
useEffect(() => {
|
|
21589
|
-
|
|
21590
|
-
|
|
21636
|
+
const containerId = memoOptions?.legend?.customLegend?.customLegendContainerID;
|
|
21637
|
+
if (memoOptions?.legend?.customLegend?.customLegendPlugin && typeof containerId === "string") {
|
|
21638
|
+
const parent = document.getElementById(containerId);
|
|
21591
21639
|
if (parent !== null) parent.style.visibility = memoState.legendEnabled ? "visible" : "hidden";
|
|
21592
21640
|
}
|
|
21593
21641
|
}, [
|
|
@@ -22563,7 +22611,8 @@ var renderLegendItemSymbol = (dataset, chartType, index) => {
|
|
|
22563
22611
|
children: /* @__PURE__ */ jsx(TbSquareFilled, { color })
|
|
22564
22612
|
});
|
|
22565
22613
|
}
|
|
22566
|
-
case ChartType.PIE:
|
|
22614
|
+
case ChartType.PIE:
|
|
22615
|
+
case ChartType.DOUGHNUT: return /* @__PURE__ */ jsx("span", {
|
|
22567
22616
|
className: legend_module_default.legendItemPoint,
|
|
22568
22617
|
children: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgCircle, {}) })
|
|
22569
22618
|
});
|
|
@@ -37223,7 +37272,7 @@ var getBarChartDataLabels = (options) => {
|
|
|
37223
37272
|
*/
|
|
37224
37273
|
var getBarChartToolTips = (options) => {
|
|
37225
37274
|
const getTooltipLabels = (dataset) => {
|
|
37226
|
-
const isDirectionVertical = isVertical(options.direction);
|
|
37275
|
+
const isDirectionVertical = isVertical(options.direction ?? "vertical");
|
|
37227
37276
|
const x = Array.isArray(options.axes?.x) ? options.axes.x : [];
|
|
37228
37277
|
const y = Array.isArray(options.axes?.y) ? options.axes.y : [];
|
|
37229
37278
|
const getAxisIndex = (axisID) => {
|
|
@@ -37341,8 +37390,8 @@ var bar_chart_module_default = {
|
|
|
37341
37390
|
//#endregion
|
|
37342
37391
|
//#region src/components/bar-chart/bar-chart-default-props.ts
|
|
37343
37392
|
var defaultAxes$1 = (axes) => ({
|
|
37344
|
-
x: axes?.x
|
|
37345
|
-
y: axes?.y
|
|
37393
|
+
x: axes?.x ?? [{}],
|
|
37394
|
+
y: axes?.y ?? [{}]
|
|
37346
37395
|
});
|
|
37347
37396
|
var defaultAdditionalAxesOptions$1 = (options) => ({
|
|
37348
37397
|
chartScaleType: options?.chartScaleType || "linear",
|
|
@@ -37374,9 +37423,18 @@ var defaultGraph$1 = (graph) => ({
|
|
|
37374
37423
|
showMinorGridlines: graph?.showMinorGridlines || false
|
|
37375
37424
|
});
|
|
37376
37425
|
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
|
+
const asCallback = (fn) => typeof fn === "function" ? fn : void 0;
|
|
37377
37431
|
return annotationsData ? annotationsData.map((ann) => ({
|
|
37378
37432
|
...ann,
|
|
37379
|
-
display: ann?.display ?? true
|
|
37433
|
+
display: ann?.display ?? true,
|
|
37434
|
+
onDragStart: asCallback(ann?.onDragStart),
|
|
37435
|
+
onDrag: asCallback(ann?.onDrag),
|
|
37436
|
+
onDragEnd: asCallback(ann?.onDragEnd),
|
|
37437
|
+
dragRange: normalizeDragRange(ann?.dragRange)
|
|
37380
37438
|
})) : [];
|
|
37381
37439
|
};
|
|
37382
37440
|
var defaultAnnotations$1 = (annotations) => ({
|
|
@@ -37388,9 +37446,9 @@ var defaultLegend$1 = (legend) => ({
|
|
|
37388
37446
|
display: legend?.display ?? true,
|
|
37389
37447
|
position: legend?.position || Position.TopLeft,
|
|
37390
37448
|
align: legend?.align || AlignOptions.Center,
|
|
37391
|
-
customLegend:
|
|
37392
|
-
customLegendPlugin: null,
|
|
37393
|
-
customLegendContainerID: ""
|
|
37449
|
+
customLegend: {
|
|
37450
|
+
customLegendPlugin: legend?.customLegend?.customLegendPlugin && typeof legend.customLegend.customLegendPlugin === "object" && "id" in legend.customLegend.customLegendPlugin ? legend.customLegend.customLegendPlugin : null,
|
|
37451
|
+
customLegendContainerID: typeof legend?.customLegend?.customLegendContainerID === "string" ? legend.customLegend.customLegendContainerID : ""
|
|
37394
37452
|
}
|
|
37395
37453
|
});
|
|
37396
37454
|
var defaultChartOptions$1 = (options) => ({
|
|
@@ -37398,9 +37456,9 @@ var defaultChartOptions$1 = (options) => ({
|
|
|
37398
37456
|
enablePan: options?.enablePan || false
|
|
37399
37457
|
});
|
|
37400
37458
|
var defaultInteractions$1 = (interactions) => ({
|
|
37401
|
-
onLegendClick: interactions?.onLegendClick,
|
|
37402
|
-
onHover: interactions?.onHover,
|
|
37403
|
-
onUnhover: interactions?.onUnhover
|
|
37459
|
+
onLegendClick: typeof interactions?.onLegendClick === "function" ? interactions.onLegendClick : void 0,
|
|
37460
|
+
onHover: typeof interactions?.onHover === "function" ? interactions.onHover : void 0,
|
|
37461
|
+
onUnhover: typeof interactions?.onUnhover === "function" ? interactions.onUnhover : void 0
|
|
37404
37462
|
});
|
|
37405
37463
|
var defaultDragData = (dragData) => ({
|
|
37406
37464
|
enableDragData: dragData?.enableDragData ?? false,
|
|
@@ -37412,27 +37470,35 @@ var defaultDragData = (dragData) => ({
|
|
|
37412
37470
|
onDrag: dragData?.onDrag,
|
|
37413
37471
|
onDragEnd: dragData?.onDragEnd
|
|
37414
37472
|
});
|
|
37473
|
+
var normalizeBarOptions = (options = {}) => ({
|
|
37474
|
+
title: options?.title || "",
|
|
37475
|
+
direction: options?.direction || "vertical",
|
|
37476
|
+
axes: defaultAxes$1(options?.axes),
|
|
37477
|
+
additionalAxesOptions: defaultAdditionalAxesOptions$1(options?.additionalAxesOptions),
|
|
37478
|
+
chartStyling: defaultChartStyling$1(options?.chartStyling),
|
|
37479
|
+
tooltip: defaultTooltip$1(options?.tooltip),
|
|
37480
|
+
graph: defaultGraph$1(options?.graph),
|
|
37481
|
+
annotations: defaultAnnotations$1(options?.annotations),
|
|
37482
|
+
legend: defaultLegend$1(options?.legend),
|
|
37483
|
+
chartOptions: defaultChartOptions$1(options?.chartOptions),
|
|
37484
|
+
interactions: defaultInteractions$1(options?.interactions),
|
|
37485
|
+
dragData: defaultDragData(options?.dragData)
|
|
37486
|
+
});
|
|
37487
|
+
var normalizeBarDatasets = (datasets) => (datasets ?? []).map((dataset) => ({
|
|
37488
|
+
...dataset,
|
|
37489
|
+
data: dataset?.data ?? []
|
|
37490
|
+
}));
|
|
37415
37491
|
var getDefaultProps$1 = (props) => {
|
|
37416
37492
|
const chart = props?.chart || {};
|
|
37417
37493
|
const options = chart?.options || {};
|
|
37418
37494
|
return {
|
|
37419
37495
|
testId: chart?.testId ?? "",
|
|
37420
37496
|
controlsPortalId: chart?.controlsPortalId ?? "",
|
|
37421
|
-
data:
|
|
37422
|
-
|
|
37423
|
-
|
|
37424
|
-
|
|
37425
|
-
|
|
37426
|
-
additionalAxesOptions: defaultAdditionalAxesOptions$1(options?.additionalAxesOptions),
|
|
37427
|
-
chartStyling: defaultChartStyling$1(options?.chartStyling),
|
|
37428
|
-
tooltip: defaultTooltip$1(options?.tooltip),
|
|
37429
|
-
graph: defaultGraph$1(options?.graph),
|
|
37430
|
-
annotations: defaultAnnotations$1(options?.annotations),
|
|
37431
|
-
legend: defaultLegend$1(options?.legend),
|
|
37432
|
-
chartOptions: defaultChartOptions$1(options?.chartOptions),
|
|
37433
|
-
interactions: defaultInteractions$1(options?.interactions),
|
|
37434
|
-
dragData: defaultDragData(options?.dragData)
|
|
37435
|
-
}
|
|
37497
|
+
data: {
|
|
37498
|
+
labels: chart?.data?.labels ?? [],
|
|
37499
|
+
datasets: normalizeBarDatasets(chart?.data?.datasets)
|
|
37500
|
+
},
|
|
37501
|
+
options: normalizeBarOptions(options)
|
|
37436
37502
|
};
|
|
37437
37503
|
};
|
|
37438
37504
|
//#endregion
|
|
@@ -37667,25 +37733,29 @@ var useScatterChartConfig = (chart, chartRef) => {
|
|
|
37667
37733
|
};
|
|
37668
37734
|
//#endregion
|
|
37669
37735
|
//#region src/components/scatter-chart/scatter-chart-get-default-props.ts
|
|
37736
|
+
var normalizeGradientColors = (colors) => (colors ?? GRADIENT_COLORS).map((item, index) => ({
|
|
37737
|
+
offset: item.offset ?? index / Math.max((colors?.length ?? 2) - 1, 1),
|
|
37738
|
+
color: item.color ?? GRADIENT_COLORS[index % GRADIENT_COLORS.length].color
|
|
37739
|
+
}));
|
|
37670
37740
|
var defaultChartGradient = (gradient) => ({
|
|
37671
37741
|
display: gradient?.display ?? false,
|
|
37672
|
-
gradientColors: gradient?.gradientColors
|
|
37742
|
+
gradientColors: normalizeGradientColors(gradient?.gradientColors),
|
|
37673
37743
|
direction: gradient?.direction ?? GradientDirection.BottomLeftToTopRight
|
|
37674
37744
|
});
|
|
37675
37745
|
var defaultChartStyling = (styling) => ({
|
|
37676
37746
|
width: styling?.width ?? "auto",
|
|
37677
37747
|
height: styling?.height ?? "auto",
|
|
37678
|
-
maintainAspectRatio: styling?.maintainAspectRatio
|
|
37679
|
-
staticChartHeight: styling?.staticChartHeight
|
|
37748
|
+
maintainAspectRatio: styling?.maintainAspectRatio ?? false,
|
|
37749
|
+
staticChartHeight: styling?.staticChartHeight ?? false,
|
|
37680
37750
|
performanceMode: styling?.performanceMode ?? true,
|
|
37681
37751
|
gradient: defaultChartGradient(styling?.gradient)
|
|
37682
37752
|
});
|
|
37683
37753
|
var defaultTooltip = (tooltip) => ({
|
|
37684
37754
|
enabled: tooltip?.enabled ?? true,
|
|
37685
37755
|
tooltips: tooltip?.tooltips ?? true,
|
|
37686
|
-
showLabelsInTooltips: tooltip?.showLabelsInTooltips
|
|
37687
|
-
backgroundColor: tooltip?.backgroundColor
|
|
37688
|
-
displayColors: tooltip?.displayColors
|
|
37756
|
+
showLabelsInTooltips: tooltip?.showLabelsInTooltips ?? false,
|
|
37757
|
+
backgroundColor: tooltip?.backgroundColor ?? "#333",
|
|
37758
|
+
displayColors: tooltip?.displayColors ?? false,
|
|
37689
37759
|
scientificNotation: tooltip?.scientificNotation ?? true
|
|
37690
37760
|
});
|
|
37691
37761
|
var defaultGraph = (graph) => ({
|
|
@@ -37694,44 +37764,51 @@ var defaultGraph = (graph) => ({
|
|
|
37694
37764
|
});
|
|
37695
37765
|
var defaultLegend = (legend) => ({
|
|
37696
37766
|
display: legend?.display ?? true,
|
|
37697
|
-
useDataset: legend?.useDataset
|
|
37698
|
-
position: legend?.position
|
|
37699
|
-
align: legend?.align
|
|
37767
|
+
useDataset: legend?.useDataset ?? false,
|
|
37768
|
+
position: legend?.position ?? Position.BottomLeft,
|
|
37769
|
+
align: legend?.align ?? AlignOptions.Center
|
|
37700
37770
|
});
|
|
37701
37771
|
var defaultChartOptions = (options) => ({
|
|
37702
|
-
enableZoom: options?.enableZoom
|
|
37703
|
-
enablePan: options?.enablePan
|
|
37772
|
+
enableZoom: options?.enableZoom ?? false,
|
|
37773
|
+
enablePan: options?.enablePan ?? false
|
|
37704
37774
|
});
|
|
37705
37775
|
var defaultInteractions = (interactions) => ({
|
|
37706
|
-
onLegendClick: interactions?.onLegendClick,
|
|
37707
|
-
onHover: interactions?.onHover,
|
|
37708
|
-
onUnhover: interactions?.onUnhover,
|
|
37709
|
-
onAnimationComplete:
|
|
37776
|
+
onLegendClick: typeof interactions?.onLegendClick === "function" ? interactions.onLegendClick : void 0,
|
|
37777
|
+
onHover: typeof interactions?.onHover === "function" ? interactions.onHover : void 0,
|
|
37778
|
+
onUnhover: typeof interactions?.onUnhover === "function" ? interactions.onUnhover : void 0,
|
|
37779
|
+
onAnimationComplete: void 0
|
|
37710
37780
|
});
|
|
37711
|
-
var defaultChartData = (data) => {
|
|
37712
|
-
|
|
37713
|
-
|
|
37714
|
-
|
|
37715
|
-
|
|
37716
|
-
}
|
|
37717
|
-
|
|
37718
|
-
|
|
37719
|
-
|
|
37720
|
-
|
|
37721
|
-
|
|
37722
|
-
|
|
37781
|
+
var defaultChartData = (data) => ({
|
|
37782
|
+
labels: data?.labels ?? [],
|
|
37783
|
+
datasets: (data?.datasets ?? []).map((dataset) => ({
|
|
37784
|
+
...dataset,
|
|
37785
|
+
data: dataset?.data ?? []
|
|
37786
|
+
}))
|
|
37787
|
+
});
|
|
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
|
+
var defaultAnnotationsData = (annotationsData) => (annotationsData ?? []).map((ann) => ({
|
|
37793
|
+
...ann,
|
|
37794
|
+
display: ann.display ?? true,
|
|
37795
|
+
onDragStart: typeof ann.onDragStart === "function" ? ann.onDragStart : void 0,
|
|
37796
|
+
onDrag: typeof ann.onDrag === "function" ? ann.onDrag : void 0,
|
|
37797
|
+
onDragEnd: typeof ann.onDragEnd === "function" ? ann.onDragEnd : void 0,
|
|
37798
|
+
dragRange: normalizeDragRange(ann.dragRange)
|
|
37799
|
+
}));
|
|
37723
37800
|
var defaultAnnotations = (annotations) => ({
|
|
37724
37801
|
showAnnotations: annotations?.showAnnotations ?? true,
|
|
37725
|
-
controlAnnotation: annotations?.controlAnnotation
|
|
37802
|
+
controlAnnotation: annotations?.controlAnnotation ?? false,
|
|
37726
37803
|
annotationsData: defaultAnnotationsData(annotations?.annotationsData)
|
|
37727
37804
|
});
|
|
37728
37805
|
var defaultAxes = (axes) => ({
|
|
37729
|
-
x: axes?.x
|
|
37730
|
-
y: axes?.y
|
|
37806
|
+
x: axes?.x ?? [{}],
|
|
37807
|
+
y: axes?.y ?? [{}]
|
|
37731
37808
|
});
|
|
37732
37809
|
var defaultAdditionalAxesOptions = (options) => ({
|
|
37733
|
-
reverse: options?.reverse
|
|
37734
|
-
stacked: options?.stacked
|
|
37810
|
+
reverse: options?.reverse ?? false,
|
|
37811
|
+
stacked: options?.stacked ?? false,
|
|
37735
37812
|
beginAtZero: options?.beginAtZero ?? true,
|
|
37736
37813
|
stepSize: options?.stepSize,
|
|
37737
37814
|
suggestedMin: options?.suggestedMin,
|
|
@@ -37739,25 +37816,26 @@ var defaultAdditionalAxesOptions = (options) => ({
|
|
|
37739
37816
|
min: options?.min,
|
|
37740
37817
|
max: options?.max
|
|
37741
37818
|
});
|
|
37819
|
+
var normalizeScatterOptions = (options = {}) => ({
|
|
37820
|
+
title: options?.title ?? "",
|
|
37821
|
+
axes: defaultAxes(options?.axes),
|
|
37822
|
+
additionalAxesOptions: defaultAdditionalAxesOptions(options?.additionalAxesOptions),
|
|
37823
|
+
direction: options?.direction ?? ChartDirection.VERTICAL,
|
|
37824
|
+
chartStyling: defaultChartStyling(options?.chartStyling),
|
|
37825
|
+
tooltip: defaultTooltip(options?.tooltip),
|
|
37826
|
+
graph: defaultGraph(options?.graph),
|
|
37827
|
+
legend: defaultLegend(options?.legend),
|
|
37828
|
+
annotations: defaultAnnotations(options?.annotations),
|
|
37829
|
+
chartOptions: defaultChartOptions(options?.chartOptions),
|
|
37830
|
+
interactions: defaultInteractions(options?.interactions)
|
|
37831
|
+
});
|
|
37742
37832
|
var getDefaultProps = (props) => {
|
|
37743
37833
|
const chart = props?.chart || {};
|
|
37744
37834
|
const options = chart?.options || {};
|
|
37745
37835
|
return {
|
|
37746
37836
|
testId: chart?.testId ?? null,
|
|
37747
37837
|
data: defaultChartData(chart?.data),
|
|
37748
|
-
options:
|
|
37749
|
-
title: options?.title || "",
|
|
37750
|
-
axes: defaultAxes(options?.axes),
|
|
37751
|
-
additionalAxesOptions: defaultAdditionalAxesOptions(options?.additionalAxesOptions),
|
|
37752
|
-
direction: options?.direction || ChartDirection.VERTICAL,
|
|
37753
|
-
chartStyling: defaultChartStyling(options?.chartStyling),
|
|
37754
|
-
tooltip: defaultTooltip(options?.tooltip),
|
|
37755
|
-
graph: defaultGraph(options?.graph),
|
|
37756
|
-
legend: defaultLegend(options?.legend),
|
|
37757
|
-
annotations: defaultAnnotations(options?.annotations),
|
|
37758
|
-
chartOptions: defaultChartOptions(options?.chartOptions),
|
|
37759
|
-
interactions: defaultInteractions(options?.interactions)
|
|
37760
|
-
}
|
|
37838
|
+
options: normalizeScatterOptions(options)
|
|
37761
37839
|
};
|
|
37762
37840
|
};
|
|
37763
37841
|
//#endregion
|
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-10",
|
|
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": {
|
|
@@ -94,14 +94,14 @@
|
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"build:package": "tsc && vite build",
|
|
97
|
-
"build:storybook": "storybook build --quiet --output-dir ./
|
|
97
|
+
"build:storybook": "storybook build --quiet --output-dir ./public",
|
|
98
98
|
"build": "pnpm build:package && pnpm build:storybook",
|
|
99
99
|
"dev:storybook": "storybook dev -p 6006",
|
|
100
100
|
"lint:check": "oxlint -c .oxlintrc.json .",
|
|
101
101
|
"lint:fix": "oxlint -c .oxlintrc.json --fix .",
|
|
102
102
|
"prettier:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,css,less}\"",
|
|
103
103
|
"prettier:fix": "prettier --write \"**/*.{ts,tsx,js,jsx,json,css,less}\"",
|
|
104
|
-
"preview:storybook": "pnpm exec http-server ./
|
|
104
|
+
"preview:storybook": "pnpm exec http-server ./public -o -p 9005 -c-1",
|
|
105
105
|
"test": "pnpm run prettier:check && pnpm run lint:check && pnpm run test:unit",
|
|
106
106
|
"test:unit": "vitest run",
|
|
107
107
|
"test:unit:coverage": "vitest run --coverage"
|