@oliasoft-open-source/charts-library 5.9.0-beta-9 → 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 +118 -60
- package/dist/index.js +210 -126
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare enum ChartType {
|
|
|
43
43
|
LINE = "line",
|
|
44
44
|
BAR = "bar",
|
|
45
45
|
PIE = "pie",
|
|
46
|
+
DOUGHNUT = "doughnut",
|
|
46
47
|
SCATTER = "scatter"
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -57,6 +58,10 @@ export declare enum CursorStyle {
|
|
|
57
58
|
Move = "move"
|
|
58
59
|
}
|
|
59
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
|
+
|
|
60
65
|
export declare enum DragAxis {
|
|
61
66
|
X = "x",
|
|
62
67
|
Y = "y",
|
|
@@ -93,6 +98,17 @@ export declare enum GradientDirection {
|
|
|
93
98
|
TopRightToBottomLeft = 7
|
|
94
99
|
}
|
|
95
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
|
+
|
|
96
112
|
export declare interface IBarAdditionalAxesOptions extends ICommonAdditionalAxesOptions {
|
|
97
113
|
stackedX?: boolean;
|
|
98
114
|
stackedY?: boolean;
|
|
@@ -116,6 +132,11 @@ export declare interface IBarChartData extends ICommonData {
|
|
|
116
132
|
options: IBarOptions;
|
|
117
133
|
}
|
|
118
134
|
|
|
135
|
+
export declare interface IBarChartDataInput extends Omit<IBarChartData, 'options' | 'data'> {
|
|
136
|
+
data?: DeepPartial<IBarChartData['data']>;
|
|
137
|
+
options?: IBarOptionsInput;
|
|
138
|
+
}
|
|
139
|
+
|
|
119
140
|
export declare interface IBarChartDataset extends ICommonDataset {
|
|
120
141
|
isAnnotation?: boolean;
|
|
121
142
|
annotationIndex?: number;
|
|
@@ -129,7 +150,7 @@ export declare interface IBarChartDataset extends ICommonDataset {
|
|
|
129
150
|
}
|
|
130
151
|
|
|
131
152
|
export declare interface IBarChartProps {
|
|
132
|
-
chart:
|
|
153
|
+
chart: IBarChartDataInput;
|
|
133
154
|
}
|
|
134
155
|
|
|
135
156
|
export declare interface IBarDefaultProps {
|
|
@@ -162,7 +183,7 @@ export declare interface IBarLegend extends ICommonLegend {
|
|
|
162
183
|
}
|
|
163
184
|
|
|
164
185
|
export declare interface IBarOptions extends ICommonOptions {
|
|
165
|
-
direction
|
|
186
|
+
direction?: 'vertical' | 'horizontal';
|
|
166
187
|
axes: IBarAxes;
|
|
167
188
|
scales?: ICommonScales;
|
|
168
189
|
additionalAxesOptions?: IBarAdditionalAxesOptions;
|
|
@@ -173,6 +194,8 @@ export declare interface IBarOptions extends ICommonOptions {
|
|
|
173
194
|
dragData?: ICommonDragData;
|
|
174
195
|
}
|
|
175
196
|
|
|
197
|
+
export declare type IBarOptionsInput = DeepPartial<IBarOptions>;
|
|
198
|
+
|
|
176
199
|
export declare interface IBarStyling extends ICommonStyling {
|
|
177
200
|
squareAspectRatio?: boolean;
|
|
178
201
|
layoutPadding?: string | number | {
|
|
@@ -183,11 +206,30 @@ export declare interface IBarStyling extends ICommonStyling {
|
|
|
183
206
|
};
|
|
184
207
|
}
|
|
185
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
|
+
|
|
186
228
|
export declare interface IChartDataLabelsOptions {
|
|
187
229
|
display?: 'auto' | boolean;
|
|
188
230
|
align?: 'center';
|
|
189
231
|
anchor?: 'center';
|
|
190
|
-
formatter?: (_value:
|
|
232
|
+
formatter?: (_value: unknown, context: unknown) => unknown;
|
|
191
233
|
}
|
|
192
234
|
|
|
193
235
|
export declare interface IChartGeneratedLabel {
|
|
@@ -198,7 +240,7 @@ export declare interface IChartGeneratedLabel {
|
|
|
198
240
|
}
|
|
199
241
|
|
|
200
242
|
declare interface IChartGraph {
|
|
201
|
-
showMinorGridlines
|
|
243
|
+
showMinorGridlines?: boolean;
|
|
202
244
|
}
|
|
203
245
|
|
|
204
246
|
export declare interface IChartLegendItemFilter {
|
|
@@ -209,8 +251,8 @@ export declare interface IChartLegendItemFilter {
|
|
|
209
251
|
|
|
210
252
|
export declare interface ICommonAdditionalAxesOptions {
|
|
211
253
|
chartScaleType?: 'linear' | 'logarithmic';
|
|
212
|
-
reverse
|
|
213
|
-
beginAtZero
|
|
254
|
+
reverse?: boolean;
|
|
255
|
+
beginAtZero?: boolean;
|
|
214
256
|
stepSize?: number;
|
|
215
257
|
stacked?: boolean;
|
|
216
258
|
suggestedMin?: number;
|
|
@@ -220,14 +262,14 @@ export declare interface ICommonAdditionalAxesOptions {
|
|
|
220
262
|
}
|
|
221
263
|
|
|
222
264
|
export declare interface ICommonAnnotation {
|
|
223
|
-
showLabel
|
|
224
|
-
text
|
|
225
|
-
position
|
|
226
|
-
fontSize
|
|
227
|
-
xOffset
|
|
228
|
-
yOffset
|
|
229
|
-
maxWidth
|
|
230
|
-
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;
|
|
231
273
|
}
|
|
232
274
|
|
|
233
275
|
export declare interface ICommonAnnotationElement {
|
|
@@ -268,21 +310,21 @@ export declare interface ICommonAnnotationsData {
|
|
|
268
310
|
hideLegend?: boolean;
|
|
269
311
|
labelOffsetPx?: number;
|
|
270
312
|
id?: string;
|
|
271
|
-
adjustScaleRange
|
|
272
|
-
annotationAxis
|
|
273
|
-
rotation
|
|
274
|
-
color
|
|
275
|
-
endValue
|
|
313
|
+
adjustScaleRange?: boolean;
|
|
314
|
+
annotationAxis?: 'x' | 'y';
|
|
315
|
+
rotation?: number;
|
|
316
|
+
color?: string;
|
|
317
|
+
endValue?: number;
|
|
276
318
|
borderWidth?: number;
|
|
277
319
|
backgroundColor?: string;
|
|
278
|
-
label
|
|
279
|
-
labelConfig?:
|
|
280
|
-
type
|
|
281
|
-
value
|
|
282
|
-
xMin
|
|
283
|
-
xMax
|
|
284
|
-
yMin
|
|
285
|
-
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;
|
|
286
328
|
xValue?: number;
|
|
287
329
|
yValue?: number;
|
|
288
330
|
radius?: number;
|
|
@@ -303,18 +345,18 @@ export declare interface ICommonAnnotationsData {
|
|
|
303
345
|
opacity?: number;
|
|
304
346
|
}
|
|
305
347
|
|
|
306
|
-
export declare interface ICommonAxis<PositionType =
|
|
307
|
-
label
|
|
308
|
-
position
|
|
309
|
-
color
|
|
348
|
+
export declare interface ICommonAxis<PositionType = string> {
|
|
349
|
+
label?: string;
|
|
350
|
+
position?: PositionType;
|
|
351
|
+
color?: string | string[];
|
|
310
352
|
unit?: string;
|
|
311
353
|
gridLines?: boolean;
|
|
312
354
|
stepSize?: number;
|
|
313
355
|
}
|
|
314
356
|
|
|
315
357
|
export declare interface ICommonChartOptions {
|
|
316
|
-
enableZoom
|
|
317
|
-
enablePan
|
|
358
|
+
enableZoom?: boolean;
|
|
359
|
+
enablePan?: boolean;
|
|
318
360
|
}
|
|
319
361
|
|
|
320
362
|
export declare interface ICommonChartPlugins {
|
|
@@ -398,8 +440,8 @@ export declare interface ICommonInteractions {
|
|
|
398
440
|
|
|
399
441
|
export declare interface ICommonLegend {
|
|
400
442
|
display: boolean;
|
|
401
|
-
position
|
|
402
|
-
align
|
|
443
|
+
position?: Position;
|
|
444
|
+
align?: AlignOptions;
|
|
403
445
|
}
|
|
404
446
|
|
|
405
447
|
export declare interface ICommonOptions {
|
|
@@ -433,9 +475,9 @@ export declare interface ICommonStyling {
|
|
|
433
475
|
}
|
|
434
476
|
|
|
435
477
|
export declare interface ICommonTooltip {
|
|
436
|
-
tooltips
|
|
437
|
-
showLabelsInTooltips
|
|
438
|
-
scientificNotation
|
|
478
|
+
tooltips?: boolean;
|
|
479
|
+
showLabelsInTooltips?: boolean;
|
|
480
|
+
scientificNotation?: boolean;
|
|
439
481
|
callbacks?: ICommonTooltipCallbacks;
|
|
440
482
|
}
|
|
441
483
|
|
|
@@ -528,21 +570,23 @@ export declare interface IGeneratedScatterChartDataset {
|
|
|
528
570
|
}
|
|
529
571
|
|
|
530
572
|
export declare interface ILChartOptions extends ICommonChartOptions {
|
|
531
|
-
showPoints
|
|
532
|
-
closeOnOutsideClick
|
|
533
|
-
showLine
|
|
573
|
+
showPoints?: boolean;
|
|
574
|
+
closeOnOutsideClick?: boolean;
|
|
575
|
+
showLine?: boolean;
|
|
576
|
+
enableZoom?: boolean;
|
|
577
|
+
enablePan?: boolean;
|
|
534
578
|
enableDragAnnotation?: boolean;
|
|
535
579
|
}
|
|
536
580
|
|
|
537
581
|
export declare interface ILineChartAdditionalAxesOptions {
|
|
538
|
-
chartScaleType
|
|
539
|
-
reverse
|
|
540
|
-
beginAtZero
|
|
582
|
+
chartScaleType?: 'linear' | 'logarithmic';
|
|
583
|
+
reverse?: boolean;
|
|
584
|
+
beginAtZero?: boolean;
|
|
541
585
|
stepSize?: number;
|
|
542
586
|
suggestedMin?: number;
|
|
543
587
|
suggestedMax?: number;
|
|
544
588
|
range?: ILineRange;
|
|
545
|
-
autoAxisPadding
|
|
589
|
+
autoAxisPadding?: boolean;
|
|
546
590
|
}
|
|
547
591
|
|
|
548
592
|
export declare interface ILineChartAxes {
|
|
@@ -551,12 +595,12 @@ export declare interface ILineChartAxes {
|
|
|
551
595
|
[key: string]: ILineChartAxis[];
|
|
552
596
|
}
|
|
553
597
|
|
|
554
|
-
export declare interface ILineChartAxis<PositionType =
|
|
598
|
+
export declare interface ILineChartAxis<PositionType = TAxisPosition> {
|
|
555
599
|
id?: string;
|
|
556
|
-
label
|
|
557
|
-
position
|
|
558
|
-
color
|
|
559
|
-
unit?: IUnitOptions;
|
|
600
|
+
label?: string;
|
|
601
|
+
position?: PositionType;
|
|
602
|
+
color?: string | string[];
|
|
603
|
+
unit?: IUnitOptions | string;
|
|
560
604
|
stepSize?: number;
|
|
561
605
|
gridLines?: ILineChartGraph;
|
|
562
606
|
min?: number | string;
|
|
@@ -572,6 +616,11 @@ export declare interface ILineChartData extends ICommonData {
|
|
|
572
616
|
controlsPortalId?: string;
|
|
573
617
|
}
|
|
574
618
|
|
|
619
|
+
export declare interface ILineChartDataInput extends Omit<ILineChartData, 'data' | 'options'> {
|
|
620
|
+
data?: DeepPartial<ILineChartData['data']>;
|
|
621
|
+
options?: ILineChartOptionsInput;
|
|
622
|
+
}
|
|
623
|
+
|
|
575
624
|
export declare interface ILineChartDataset extends ICommonDataset {
|
|
576
625
|
lineTension?: number;
|
|
577
626
|
pointBackgroundColor?: string;
|
|
@@ -587,10 +636,10 @@ export declare interface ILineChartDataset extends ICommonDataset {
|
|
|
587
636
|
}
|
|
588
637
|
|
|
589
638
|
export declare interface ILineChartGraph {
|
|
590
|
-
lineTension
|
|
591
|
-
spanGaps
|
|
592
|
-
showDataLabels
|
|
593
|
-
showMinorGridlines
|
|
639
|
+
lineTension?: number;
|
|
640
|
+
spanGaps?: boolean;
|
|
641
|
+
showDataLabels?: boolean;
|
|
642
|
+
showMinorGridlines?: boolean;
|
|
594
643
|
}
|
|
595
644
|
|
|
596
645
|
export declare interface ILineChartOptions extends ICommonOptions {
|
|
@@ -609,8 +658,10 @@ export declare interface ILineChartOptions extends ICommonOptions {
|
|
|
609
658
|
depthType?: IDepthType | object;
|
|
610
659
|
}
|
|
611
660
|
|
|
661
|
+
export declare type ILineChartOptionsInput = DeepPartial<ILineChartOptions>;
|
|
662
|
+
|
|
612
663
|
export declare interface ILineChartProps {
|
|
613
|
-
chart:
|
|
664
|
+
chart: ILineChartDataInput;
|
|
614
665
|
table?: ReactNode;
|
|
615
666
|
headerComponent?: ReactNode;
|
|
616
667
|
subheaderComponent?: ReactNode;
|
|
@@ -632,8 +683,8 @@ export declare interface ILineChartStyling extends ICommonStyling {
|
|
|
632
683
|
}
|
|
633
684
|
|
|
634
685
|
export declare interface ILineChartTooltip extends ICommonTooltip {
|
|
635
|
-
hideSimulationName
|
|
636
|
-
scientificNotation
|
|
686
|
+
hideSimulationName?: boolean;
|
|
687
|
+
scientificNotation?: boolean;
|
|
637
688
|
}
|
|
638
689
|
|
|
639
690
|
export declare interface ILineInteractions extends ICommonInteractions {
|
|
@@ -725,13 +776,18 @@ export declare interface IScatterChartData extends ICommonData {
|
|
|
725
776
|
options: IScatterOptions;
|
|
726
777
|
}
|
|
727
778
|
|
|
779
|
+
export declare interface IScatterChartDataInput extends Omit<IScatterChartData, 'data' | 'options'> {
|
|
780
|
+
data?: DeepPartial<IScatterChartData['data']>;
|
|
781
|
+
options?: IScatterOptionsInput;
|
|
782
|
+
}
|
|
783
|
+
|
|
728
784
|
export declare interface IScatterChartDataset extends ICommonDataset {
|
|
729
785
|
data: IScatterDataValue[];
|
|
730
786
|
hideLegend?: boolean;
|
|
731
787
|
}
|
|
732
788
|
|
|
733
789
|
export declare interface IScatterChartProps {
|
|
734
|
-
chart:
|
|
790
|
+
chart: IScatterChartDataInput;
|
|
735
791
|
testId?: string | null;
|
|
736
792
|
}
|
|
737
793
|
|
|
@@ -766,9 +822,11 @@ export declare interface IScatterOptions extends ICommonOptions {
|
|
|
766
822
|
legend?: IScatterLegend;
|
|
767
823
|
axes?: IScatterAxes;
|
|
768
824
|
additionalAxesOptions?: ICommonAdditionalAxesOptions;
|
|
769
|
-
direction
|
|
825
|
+
direction?: ChartDirection;
|
|
770
826
|
}
|
|
771
827
|
|
|
828
|
+
export declare type IScatterOptionsInput = DeepPartial<IScatterOptions>;
|
|
829
|
+
|
|
772
830
|
export declare interface IScatterTooltip {
|
|
773
831
|
enabled?: boolean;
|
|
774
832
|
tooltips?: boolean;
|
|
@@ -893,7 +951,7 @@ export declare type TVerticalMarkerTick = {
|
|
|
893
951
|
labelOffsetPx?: number;
|
|
894
952
|
};
|
|
895
953
|
|
|
896
|
-
export declare type UnusedParameter = unknown
|
|
954
|
+
export declare type UnusedParameter = unknown;
|
|
897
955
|
|
|
898
956
|
export { }
|
|
899
957
|
|
package/dist/index.js
CHANGED
|
@@ -18682,6 +18682,7 @@ 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
18687
|
return ChartType;
|
|
18687
18688
|
}({});
|
|
@@ -20062,10 +20063,34 @@ var defaultAxis = (position) => ({
|
|
|
20062
20063
|
setSelectedUnit: () => {}
|
|
20063
20064
|
}
|
|
20064
20065
|
});
|
|
20065
|
-
var
|
|
20066
|
-
|
|
20067
|
-
|
|
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)
|
|
20068
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
|
+
};
|
|
20069
20094
|
var defaultAdditionalAxesOptions$2 = (options) => ({
|
|
20070
20095
|
chartScaleType: options?.chartScaleType || "linear",
|
|
20071
20096
|
reverse: options?.reverse || false,
|
|
@@ -20073,23 +20098,30 @@ var defaultAdditionalAxesOptions$2 = (options) => ({
|
|
|
20073
20098
|
stepSize: options?.stepSize,
|
|
20074
20099
|
suggestedMin: options?.suggestedMin,
|
|
20075
20100
|
suggestedMax: options?.suggestedMax,
|
|
20076
|
-
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,
|
|
20077
20105
|
autoAxisPadding: options?.autoAxisPadding ?? false
|
|
20078
20106
|
});
|
|
20079
|
-
var defaultChartStyling$3 = (options) =>
|
|
20080
|
-
|
|
20081
|
-
|
|
20082
|
-
|
|
20083
|
-
|
|
20084
|
-
|
|
20085
|
-
|
|
20086
|
-
|
|
20087
|
-
|
|
20088
|
-
|
|
20089
|
-
|
|
20090
|
-
|
|
20091
|
-
|
|
20092
|
-
|
|
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
|
+
};
|
|
20093
20125
|
var defaultTooltip$3 = (tooltip) => ({
|
|
20094
20126
|
tooltips: tooltip?.tooltips ?? true,
|
|
20095
20127
|
showLabelsInTooltips: tooltip?.showLabelsInTooltips ?? false,
|
|
@@ -20104,9 +20136,18 @@ var defaultGraph$3 = (graph) => ({
|
|
|
20104
20136
|
showMinorGridlines: graph?.showMinorGridlines ?? false
|
|
20105
20137
|
});
|
|
20106
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;
|
|
20107
20144
|
return annotationsData ? annotationsData.map((ann) => ({
|
|
20108
20145
|
...ann,
|
|
20109
|
-
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)
|
|
20110
20151
|
})) : [];
|
|
20111
20152
|
};
|
|
20112
20153
|
var defaultAnnotations$2 = (annotations) => ({
|
|
@@ -20145,9 +20186,9 @@ var defaultLegend$3 = (legend) => ({
|
|
|
20145
20186
|
display: legend?.display ?? true,
|
|
20146
20187
|
position: legend?.position ?? Position.BottomLeft,
|
|
20147
20188
|
align: legend?.align ?? AlignOptions.Center,
|
|
20148
|
-
customLegend:
|
|
20149
|
-
customLegendPlugin: null,
|
|
20150
|
-
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 : ""
|
|
20151
20192
|
},
|
|
20152
20193
|
usePointStyle: legend?.usePointStyle ?? true
|
|
20153
20194
|
});
|
|
@@ -20160,9 +20201,9 @@ var defaultChartOptions$3 = (options) => ({
|
|
|
20160
20201
|
closeOnOutsideClick: options?.closeOnOutsideClick ?? false
|
|
20161
20202
|
});
|
|
20162
20203
|
var defaultInteractions$3 = (interactions) => ({
|
|
20163
|
-
onLegendClick: interactions?.onLegendClick,
|
|
20164
|
-
onHover: interactions?.onHover,
|
|
20165
|
-
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,
|
|
20166
20207
|
onAnimationComplete: interactions?.onAnimationComplete
|
|
20167
20208
|
});
|
|
20168
20209
|
var defaultDragData$1 = (dragData) => ({
|
|
@@ -20175,6 +20216,28 @@ var defaultDragData$1 = (dragData) => ({
|
|
|
20175
20216
|
onDrag: dragData?.onDrag,
|
|
20176
20217
|
onDragEnd: dragData?.onDragEnd
|
|
20177
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
|
+
}));
|
|
20178
20241
|
var getDefaultProps$3 = (props) => {
|
|
20179
20242
|
const chart = props?.chart || {};
|
|
20180
20243
|
const options = chart?.options || {};
|
|
@@ -20182,22 +20245,8 @@ var getDefaultProps$3 = (props) => {
|
|
|
20182
20245
|
persistenceId: chart?.persistenceId ?? "",
|
|
20183
20246
|
controlsPortalId: chart?.controlsPortalId ?? "",
|
|
20184
20247
|
testId: chart?.testId ?? void 0,
|
|
20185
|
-
data:
|
|
20186
|
-
options:
|
|
20187
|
-
title: options?.title ?? "",
|
|
20188
|
-
scales: options?.scales ?? {},
|
|
20189
|
-
axes: defaultAxes$2(options?.axes),
|
|
20190
|
-
additionalAxesOptions: defaultAdditionalAxesOptions$2(options?.additionalAxesOptions),
|
|
20191
|
-
chartStyling: defaultChartStyling$3(options?.chartStyling),
|
|
20192
|
-
tooltip: defaultTooltip$3(options?.tooltip),
|
|
20193
|
-
graph: defaultGraph$3(options?.graph),
|
|
20194
|
-
annotations: defaultAnnotations$2(options?.annotations),
|
|
20195
|
-
legend: defaultLegend$3(options?.legend),
|
|
20196
|
-
chartOptions: defaultChartOptions$3(options?.chartOptions),
|
|
20197
|
-
interactions: defaultInteractions$3(options?.interactions),
|
|
20198
|
-
dragData: defaultDragData$1(options?.dragData),
|
|
20199
|
-
depthType: options?.depthType ?? {}
|
|
20200
|
-
}
|
|
20248
|
+
data: { datasets: normalizeLineDatasets(chart?.data?.datasets) },
|
|
20249
|
+
options: normalizeLineChartOptions(options)
|
|
20201
20250
|
};
|
|
20202
20251
|
};
|
|
20203
20252
|
//#endregion
|
|
@@ -20537,6 +20586,7 @@ var getAxesDataFromMetasets = (generatedDatasets, scalesKeys, annotationsData) =
|
|
|
20537
20586
|
};
|
|
20538
20587
|
//#endregion
|
|
20539
20588
|
//#region src/components/line-chart/utils/axis-scales/axis-scales.ts
|
|
20589
|
+
var toScalesMap = (scales) => scales ?? {};
|
|
20540
20590
|
var shouldCalculate = (min, max) => !isNil(min) || !isNil(max);
|
|
20541
20591
|
/**
|
|
20542
20592
|
* Auto scales axis ranges (mix, max) if no explicit range is set
|
|
@@ -20546,7 +20596,7 @@ var shouldCalculate = (min, max) => !isNil(min) || !isNil(max);
|
|
|
20546
20596
|
*/
|
|
20547
20597
|
var autoScale = (options, state, generatedDatasets) => {
|
|
20548
20598
|
const { additionalAxesOptions, annotations: { annotationsData = [], controlAnnotation = false } = {} } = options || {};
|
|
20549
|
-
const scales = getLineChartScales(options, state)
|
|
20599
|
+
const scales = toScalesMap(getLineChartScales(options, state));
|
|
20550
20600
|
const datasets = controlAnnotation ? generatedDatasets.filter(({ isAnnotation }) => !isAnnotation) : generatedDatasets;
|
|
20551
20601
|
if (!additionalAxesOptions?.autoAxisPadding && !estimateDataSeriesHaveCloseValues(datasets)) return scales;
|
|
20552
20602
|
const scalesKeys = Object.keys(scales) ?? [];
|
|
@@ -20555,9 +20605,9 @@ var autoScale = (options, state, generatedDatasets) => {
|
|
|
20555
20605
|
const scale = scales[key];
|
|
20556
20606
|
const { min: propMin = void 0, max: propMax = void 0 } = scale;
|
|
20557
20607
|
const { min: suggestedMin, max: suggestedMax } = getSuggestedAxisRange({
|
|
20558
|
-
data: data[key],
|
|
20559
|
-
beginAtZero: additionalAxesOptions?.beginAtZero,
|
|
20560
|
-
autoAxisPadding: additionalAxesOptions?.autoAxisPadding
|
|
20608
|
+
data: (data[key] ?? []).filter((value) => typeof value === "number"),
|
|
20609
|
+
beginAtZero: additionalAxesOptions?.beginAtZero ?? false,
|
|
20610
|
+
autoAxisPadding: additionalAxesOptions?.autoAxisPadding ?? false
|
|
20561
20611
|
});
|
|
20562
20612
|
const res = { [key]: {
|
|
20563
20613
|
...scale,
|
|
@@ -20657,7 +20707,7 @@ var getLineChartToolTips = (options) => {
|
|
|
20657
20707
|
callbacks: {}
|
|
20658
20708
|
};
|
|
20659
20709
|
}
|
|
20660
|
-
const { scientificNotation } = options?.tooltip ?? {};
|
|
20710
|
+
const { scientificNotation = true } = options?.tooltip ?? {};
|
|
20661
20711
|
const getTooltipLabels = ({ xAxisID = "", yAxisID = "" }) => {
|
|
20662
20712
|
const xIndex = xAxisID?.length > 1 ? Number(xAxisID?.[1]) - 1 : 0;
|
|
20663
20713
|
const yIndex = yAxisID?.length > 1 ? Number(yAxisID?.[1]) - 1 : 0;
|
|
@@ -20682,7 +20732,7 @@ var getLineChartToolTips = (options) => {
|
|
|
20682
20732
|
return `${customFormatNumber$1(titleLabel === TooltipLabel.Y ? tooltipItem?.[0]?.parsed?.y : tooltipItem?.[0]?.parsed?.x, scientificNotation)} ${titleAxisLabel}`;
|
|
20683
20733
|
};
|
|
20684
20734
|
const labelCallback = (tooltipItem) => {
|
|
20685
|
-
const { showLabelsInTooltips } = options?.tooltip ?? {};
|
|
20735
|
+
const { showLabelsInTooltips = false } = options?.tooltip ?? {};
|
|
20686
20736
|
let label = tooltipItem?.dataset?.label || "";
|
|
20687
20737
|
const { valueLabel = "", valueAxisLabel = "" } = getTooltipLabels(tooltipItem?.dataset) ?? {};
|
|
20688
20738
|
const getTooltipItemValue = () => {
|
|
@@ -21185,6 +21235,9 @@ var getCalloutAnnotation = (refAnnotation, index) => {
|
|
|
21185
21235
|
const color = calloutCfg?.color ?? "hsl(60, 10.34482759%, 12.5%)";
|
|
21186
21236
|
const font = calloutCfg?.font ?? `12px "Roobert", "Noto Sans", sans-serif`;
|
|
21187
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;
|
|
21188
21241
|
const strokeStyle = calloutCfg.strokeStyle ?? baseAnnotation.borderColor;
|
|
21189
21242
|
const lineWidth = typeof calloutCfg.lineWidth === "number" ? calloutCfg.lineWidth : 1;
|
|
21190
21243
|
const startOffset = typeof calloutCfg.startOffset === "number" ? calloutCfg.startOffset : 6;
|
|
@@ -21227,14 +21280,14 @@ var getCalloutAnnotation = (refAnnotation, index) => {
|
|
|
21227
21280
|
leave: ({ element }, { chart }) => {
|
|
21228
21281
|
return handleLabelLeave(element, chart, { enableDrag: true });
|
|
21229
21282
|
},
|
|
21230
|
-
onDragStart:
|
|
21231
|
-
return
|
|
21283
|
+
onDragStart: onCalloutDragStart ? () => (coords) => {
|
|
21284
|
+
return onCalloutDragStart(coords, refAnnotation);
|
|
21232
21285
|
} : void 0,
|
|
21233
|
-
onDrag:
|
|
21234
|
-
return
|
|
21286
|
+
onDrag: onCalloutDrag ? () => (coords) => {
|
|
21287
|
+
return onCalloutDrag(coords, refAnnotation);
|
|
21235
21288
|
} : void 0,
|
|
21236
|
-
onDragEnd:
|
|
21237
|
-
return
|
|
21289
|
+
onDragEnd: onCalloutDragEnd ? () => (coords) => {
|
|
21290
|
+
return onCalloutDragEnd(coords, refAnnotation);
|
|
21238
21291
|
} : void 0,
|
|
21239
21292
|
calloutConnector: {
|
|
21240
21293
|
enabled: true,
|
|
@@ -21580,8 +21633,9 @@ var useChartPlugins = ({ options, resetZoom }) => {
|
|
|
21580
21633
|
*/
|
|
21581
21634
|
var useToggleCustomLegendVisibility = (memoState, memoOptions) => {
|
|
21582
21635
|
useEffect(() => {
|
|
21583
|
-
|
|
21584
|
-
|
|
21636
|
+
const containerId = memoOptions?.legend?.customLegend?.customLegendContainerID;
|
|
21637
|
+
if (memoOptions?.legend?.customLegend?.customLegendPlugin && typeof containerId === "string") {
|
|
21638
|
+
const parent = document.getElementById(containerId);
|
|
21585
21639
|
if (parent !== null) parent.style.visibility = memoState.legendEnabled ? "visible" : "hidden";
|
|
21586
21640
|
}
|
|
21587
21641
|
}, [
|
|
@@ -22557,7 +22611,8 @@ var renderLegendItemSymbol = (dataset, chartType, index) => {
|
|
|
22557
22611
|
children: /* @__PURE__ */ jsx(TbSquareFilled, { color })
|
|
22558
22612
|
});
|
|
22559
22613
|
}
|
|
22560
|
-
case ChartType.PIE:
|
|
22614
|
+
case ChartType.PIE:
|
|
22615
|
+
case ChartType.DOUGHNUT: return /* @__PURE__ */ jsx("span", {
|
|
22561
22616
|
className: legend_module_default.legendItemPoint,
|
|
22562
22617
|
children: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgCircle, {}) })
|
|
22563
22618
|
});
|
|
@@ -37217,7 +37272,7 @@ var getBarChartDataLabels = (options) => {
|
|
|
37217
37272
|
*/
|
|
37218
37273
|
var getBarChartToolTips = (options) => {
|
|
37219
37274
|
const getTooltipLabels = (dataset) => {
|
|
37220
|
-
const isDirectionVertical = isVertical(options.direction);
|
|
37275
|
+
const isDirectionVertical = isVertical(options.direction ?? "vertical");
|
|
37221
37276
|
const x = Array.isArray(options.axes?.x) ? options.axes.x : [];
|
|
37222
37277
|
const y = Array.isArray(options.axes?.y) ? options.axes.y : [];
|
|
37223
37278
|
const getAxisIndex = (axisID) => {
|
|
@@ -37335,8 +37390,8 @@ var bar_chart_module_default = {
|
|
|
37335
37390
|
//#endregion
|
|
37336
37391
|
//#region src/components/bar-chart/bar-chart-default-props.ts
|
|
37337
37392
|
var defaultAxes$1 = (axes) => ({
|
|
37338
|
-
x: axes?.x
|
|
37339
|
-
y: axes?.y
|
|
37393
|
+
x: axes?.x ?? [{}],
|
|
37394
|
+
y: axes?.y ?? [{}]
|
|
37340
37395
|
});
|
|
37341
37396
|
var defaultAdditionalAxesOptions$1 = (options) => ({
|
|
37342
37397
|
chartScaleType: options?.chartScaleType || "linear",
|
|
@@ -37368,9 +37423,18 @@ var defaultGraph$1 = (graph) => ({
|
|
|
37368
37423
|
showMinorGridlines: graph?.showMinorGridlines || false
|
|
37369
37424
|
});
|
|
37370
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;
|
|
37371
37431
|
return annotationsData ? annotationsData.map((ann) => ({
|
|
37372
37432
|
...ann,
|
|
37373
|
-
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)
|
|
37374
37438
|
})) : [];
|
|
37375
37439
|
};
|
|
37376
37440
|
var defaultAnnotations$1 = (annotations) => ({
|
|
@@ -37382,9 +37446,9 @@ var defaultLegend$1 = (legend) => ({
|
|
|
37382
37446
|
display: legend?.display ?? true,
|
|
37383
37447
|
position: legend?.position || Position.TopLeft,
|
|
37384
37448
|
align: legend?.align || AlignOptions.Center,
|
|
37385
|
-
customLegend:
|
|
37386
|
-
customLegendPlugin: null,
|
|
37387
|
-
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 : ""
|
|
37388
37452
|
}
|
|
37389
37453
|
});
|
|
37390
37454
|
var defaultChartOptions$1 = (options) => ({
|
|
@@ -37392,9 +37456,9 @@ var defaultChartOptions$1 = (options) => ({
|
|
|
37392
37456
|
enablePan: options?.enablePan || false
|
|
37393
37457
|
});
|
|
37394
37458
|
var defaultInteractions$1 = (interactions) => ({
|
|
37395
|
-
onLegendClick: interactions?.onLegendClick,
|
|
37396
|
-
onHover: interactions?.onHover,
|
|
37397
|
-
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
|
|
37398
37462
|
});
|
|
37399
37463
|
var defaultDragData = (dragData) => ({
|
|
37400
37464
|
enableDragData: dragData?.enableDragData ?? false,
|
|
@@ -37406,27 +37470,35 @@ var defaultDragData = (dragData) => ({
|
|
|
37406
37470
|
onDrag: dragData?.onDrag,
|
|
37407
37471
|
onDragEnd: dragData?.onDragEnd
|
|
37408
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
|
+
}));
|
|
37409
37491
|
var getDefaultProps$1 = (props) => {
|
|
37410
37492
|
const chart = props?.chart || {};
|
|
37411
37493
|
const options = chart?.options || {};
|
|
37412
37494
|
return {
|
|
37413
37495
|
testId: chart?.testId ?? "",
|
|
37414
37496
|
controlsPortalId: chart?.controlsPortalId ?? "",
|
|
37415
|
-
data:
|
|
37416
|
-
|
|
37417
|
-
|
|
37418
|
-
|
|
37419
|
-
|
|
37420
|
-
additionalAxesOptions: defaultAdditionalAxesOptions$1(options?.additionalAxesOptions),
|
|
37421
|
-
chartStyling: defaultChartStyling$1(options?.chartStyling),
|
|
37422
|
-
tooltip: defaultTooltip$1(options?.tooltip),
|
|
37423
|
-
graph: defaultGraph$1(options?.graph),
|
|
37424
|
-
annotations: defaultAnnotations$1(options?.annotations),
|
|
37425
|
-
legend: defaultLegend$1(options?.legend),
|
|
37426
|
-
chartOptions: defaultChartOptions$1(options?.chartOptions),
|
|
37427
|
-
interactions: defaultInteractions$1(options?.interactions),
|
|
37428
|
-
dragData: defaultDragData(options?.dragData)
|
|
37429
|
-
}
|
|
37497
|
+
data: {
|
|
37498
|
+
labels: chart?.data?.labels ?? [],
|
|
37499
|
+
datasets: normalizeBarDatasets(chart?.data?.datasets)
|
|
37500
|
+
},
|
|
37501
|
+
options: normalizeBarOptions(options)
|
|
37430
37502
|
};
|
|
37431
37503
|
};
|
|
37432
37504
|
//#endregion
|
|
@@ -37661,25 +37733,29 @@ var useScatterChartConfig = (chart, chartRef) => {
|
|
|
37661
37733
|
};
|
|
37662
37734
|
//#endregion
|
|
37663
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
|
+
}));
|
|
37664
37740
|
var defaultChartGradient = (gradient) => ({
|
|
37665
37741
|
display: gradient?.display ?? false,
|
|
37666
|
-
gradientColors: gradient?.gradientColors
|
|
37742
|
+
gradientColors: normalizeGradientColors(gradient?.gradientColors),
|
|
37667
37743
|
direction: gradient?.direction ?? GradientDirection.BottomLeftToTopRight
|
|
37668
37744
|
});
|
|
37669
37745
|
var defaultChartStyling = (styling) => ({
|
|
37670
37746
|
width: styling?.width ?? "auto",
|
|
37671
37747
|
height: styling?.height ?? "auto",
|
|
37672
|
-
maintainAspectRatio: styling?.maintainAspectRatio
|
|
37673
|
-
staticChartHeight: styling?.staticChartHeight
|
|
37748
|
+
maintainAspectRatio: styling?.maintainAspectRatio ?? false,
|
|
37749
|
+
staticChartHeight: styling?.staticChartHeight ?? false,
|
|
37674
37750
|
performanceMode: styling?.performanceMode ?? true,
|
|
37675
37751
|
gradient: defaultChartGradient(styling?.gradient)
|
|
37676
37752
|
});
|
|
37677
37753
|
var defaultTooltip = (tooltip) => ({
|
|
37678
37754
|
enabled: tooltip?.enabled ?? true,
|
|
37679
37755
|
tooltips: tooltip?.tooltips ?? true,
|
|
37680
|
-
showLabelsInTooltips: tooltip?.showLabelsInTooltips
|
|
37681
|
-
backgroundColor: tooltip?.backgroundColor
|
|
37682
|
-
displayColors: tooltip?.displayColors
|
|
37756
|
+
showLabelsInTooltips: tooltip?.showLabelsInTooltips ?? false,
|
|
37757
|
+
backgroundColor: tooltip?.backgroundColor ?? "#333",
|
|
37758
|
+
displayColors: tooltip?.displayColors ?? false,
|
|
37683
37759
|
scientificNotation: tooltip?.scientificNotation ?? true
|
|
37684
37760
|
});
|
|
37685
37761
|
var defaultGraph = (graph) => ({
|
|
@@ -37688,44 +37764,51 @@ var defaultGraph = (graph) => ({
|
|
|
37688
37764
|
});
|
|
37689
37765
|
var defaultLegend = (legend) => ({
|
|
37690
37766
|
display: legend?.display ?? true,
|
|
37691
|
-
useDataset: legend?.useDataset
|
|
37692
|
-
position: legend?.position
|
|
37693
|
-
align: legend?.align
|
|
37767
|
+
useDataset: legend?.useDataset ?? false,
|
|
37768
|
+
position: legend?.position ?? Position.BottomLeft,
|
|
37769
|
+
align: legend?.align ?? AlignOptions.Center
|
|
37694
37770
|
});
|
|
37695
37771
|
var defaultChartOptions = (options) => ({
|
|
37696
|
-
enableZoom: options?.enableZoom
|
|
37697
|
-
enablePan: options?.enablePan
|
|
37772
|
+
enableZoom: options?.enableZoom ?? false,
|
|
37773
|
+
enablePan: options?.enablePan ?? false
|
|
37698
37774
|
});
|
|
37699
37775
|
var defaultInteractions = (interactions) => ({
|
|
37700
|
-
onLegendClick: interactions?.onLegendClick,
|
|
37701
|
-
onHover: interactions?.onHover,
|
|
37702
|
-
onUnhover: interactions?.onUnhover,
|
|
37703
|
-
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
|
|
37704
37780
|
});
|
|
37705
|
-
var defaultChartData = (data) => {
|
|
37706
|
-
|
|
37707
|
-
|
|
37708
|
-
|
|
37709
|
-
|
|
37710
|
-
}
|
|
37711
|
-
|
|
37712
|
-
|
|
37713
|
-
|
|
37714
|
-
|
|
37715
|
-
|
|
37716
|
-
|
|
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
|
+
}));
|
|
37717
37800
|
var defaultAnnotations = (annotations) => ({
|
|
37718
37801
|
showAnnotations: annotations?.showAnnotations ?? true,
|
|
37719
|
-
controlAnnotation: annotations?.controlAnnotation
|
|
37802
|
+
controlAnnotation: annotations?.controlAnnotation ?? false,
|
|
37720
37803
|
annotationsData: defaultAnnotationsData(annotations?.annotationsData)
|
|
37721
37804
|
});
|
|
37722
37805
|
var defaultAxes = (axes) => ({
|
|
37723
|
-
x: axes?.x
|
|
37724
|
-
y: axes?.y
|
|
37806
|
+
x: axes?.x ?? [{}],
|
|
37807
|
+
y: axes?.y ?? [{}]
|
|
37725
37808
|
});
|
|
37726
37809
|
var defaultAdditionalAxesOptions = (options) => ({
|
|
37727
|
-
reverse: options?.reverse
|
|
37728
|
-
stacked: options?.stacked
|
|
37810
|
+
reverse: options?.reverse ?? false,
|
|
37811
|
+
stacked: options?.stacked ?? false,
|
|
37729
37812
|
beginAtZero: options?.beginAtZero ?? true,
|
|
37730
37813
|
stepSize: options?.stepSize,
|
|
37731
37814
|
suggestedMin: options?.suggestedMin,
|
|
@@ -37733,25 +37816,26 @@ var defaultAdditionalAxesOptions = (options) => ({
|
|
|
37733
37816
|
min: options?.min,
|
|
37734
37817
|
max: options?.max
|
|
37735
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
|
+
});
|
|
37736
37832
|
var getDefaultProps = (props) => {
|
|
37737
37833
|
const chart = props?.chart || {};
|
|
37738
37834
|
const options = chart?.options || {};
|
|
37739
37835
|
return {
|
|
37740
37836
|
testId: chart?.testId ?? null,
|
|
37741
37837
|
data: defaultChartData(chart?.data),
|
|
37742
|
-
options:
|
|
37743
|
-
title: options?.title || "",
|
|
37744
|
-
axes: defaultAxes(options?.axes),
|
|
37745
|
-
additionalAxesOptions: defaultAdditionalAxesOptions(options?.additionalAxesOptions),
|
|
37746
|
-
direction: options?.direction || ChartDirection.VERTICAL,
|
|
37747
|
-
chartStyling: defaultChartStyling(options?.chartStyling),
|
|
37748
|
-
tooltip: defaultTooltip(options?.tooltip),
|
|
37749
|
-
graph: defaultGraph(options?.graph),
|
|
37750
|
-
legend: defaultLegend(options?.legend),
|
|
37751
|
-
annotations: defaultAnnotations(options?.annotations),
|
|
37752
|
-
chartOptions: defaultChartOptions(options?.chartOptions),
|
|
37753
|
-
interactions: defaultInteractions(options?.interactions)
|
|
37754
|
-
}
|
|
37838
|
+
options: normalizeScatterOptions(options)
|
|
37755
37839
|
};
|
|
37756
37840
|
};
|
|
37757
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"
|