@oliasoft-open-source/charts-library 2.5.9 → 2.5.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/package.json
CHANGED
package/release-notes.md
CHANGED
|
@@ -25,6 +25,7 @@ const AxesOptionsPopover = ({
|
|
|
25
25
|
axes.filter((axis) => axis.max.displayValue || axis.min.displayValue)
|
|
26
26
|
.length > 0;
|
|
27
27
|
const handleInputFocus = (e) => e.target.select();
|
|
28
|
+
const zoomOrPanEnabled = zoomEnabled || panEnabled;
|
|
28
29
|
return (
|
|
29
30
|
<>
|
|
30
31
|
{axes.map((axis, i) => {
|
|
@@ -36,7 +37,11 @@ const AxesOptionsPopover = ({
|
|
|
36
37
|
<Input
|
|
37
38
|
name="min"
|
|
38
39
|
// TODO: Fix input values not updating first time when scales reset
|
|
39
|
-
value={
|
|
40
|
+
value={
|
|
41
|
+
(zoomOrPanEnabled
|
|
42
|
+
? axis.min.displayValue
|
|
43
|
+
: axis.min.inputValue) || scalesMaxMin[axis?.id]?.min
|
|
44
|
+
}
|
|
40
45
|
error={
|
|
41
46
|
!axis.min.valid
|
|
42
47
|
? 'Invalid value' //t(InputWarningType.MustBeNumericAndLessThanMax)
|
|
@@ -61,7 +66,11 @@ const AxesOptionsPopover = ({
|
|
|
61
66
|
<Input
|
|
62
67
|
name="max"
|
|
63
68
|
// TODO: Fix input values not updating first time when scales reset
|
|
64
|
-
value={
|
|
69
|
+
value={
|
|
70
|
+
(zoomOrPanEnabled
|
|
71
|
+
? axis.max.displayValue
|
|
72
|
+
: axis.max.inputValue) || scalesMaxMin[axis?.id]?.max
|
|
73
|
+
}
|
|
65
74
|
error={
|
|
66
75
|
!axis.max.valid
|
|
67
76
|
? 'Invalid value' //t(InputWarningType.MustBeNumericAndGreaterThanMin)
|
|
@@ -150,7 +150,9 @@ export const isLessThanMax = (value, max) => {
|
|
|
150
150
|
};
|
|
151
151
|
|
|
152
152
|
export const isGreaterThanMin = (value, min) => {
|
|
153
|
-
return
|
|
153
|
+
return (
|
|
154
|
+
value === undefined || min === undefined || Number(value) > Number(min)
|
|
155
|
+
);
|
|
154
156
|
};
|
|
155
157
|
|
|
156
158
|
/**
|
|
@@ -346,22 +346,22 @@ const LineChart = (props) => {
|
|
|
346
346
|
payload: [
|
|
347
347
|
{
|
|
348
348
|
name: 'min',
|
|
349
|
-
value: chart.scales?.x?.min ? chart.scales.x.min
|
|
349
|
+
value: chart.scales?.x?.min ? chart.scales.x.min : 0,
|
|
350
350
|
id: 'x',
|
|
351
351
|
},
|
|
352
352
|
{
|
|
353
353
|
name: 'max',
|
|
354
|
-
value: chart.scales?.x?.max ? chart.scales.x.max
|
|
354
|
+
value: chart.scales?.x?.max ? chart.scales.x.max : 0,
|
|
355
355
|
id: 'x',
|
|
356
356
|
},
|
|
357
357
|
{
|
|
358
358
|
name: 'min',
|
|
359
|
-
value: chart.scales?.y?.min ? chart.scales.y.min
|
|
359
|
+
value: chart.scales?.y?.min ? chart.scales.y.min : 0,
|
|
360
360
|
id: 'y',
|
|
361
361
|
},
|
|
362
362
|
{
|
|
363
363
|
name: 'max',
|
|
364
|
-
value: chart.scales?.y?.max ? chart.scales.y.max
|
|
364
|
+
value: chart.scales?.y?.max ? chart.scales.y.max : 0,
|
|
365
365
|
id: 'y',
|
|
366
366
|
},
|
|
367
367
|
],
|
|
@@ -87,11 +87,18 @@ export const reducer = (state, action) => {
|
|
|
87
87
|
axis.min.valid =
|
|
88
88
|
validNumber(axis.min.inputValue ?? '') &&
|
|
89
89
|
isLessThanMax(axis.min.value, axis.max.value);
|
|
90
|
-
axis.min.displayValue =
|
|
90
|
+
axis.min.displayValue =
|
|
91
|
+
axis.min.valid && axis.min.value
|
|
92
|
+
? Number(axis.min.value).toFixed(1)
|
|
93
|
+
: undefined;
|
|
94
|
+
|
|
91
95
|
axis.max.valid =
|
|
92
96
|
validNumber(axis.max.inputValue ?? '') &&
|
|
93
97
|
isGreaterThanMin(axis.max.value, axis.min.value);
|
|
94
|
-
axis.max.displayValue =
|
|
98
|
+
axis.max.displayValue =
|
|
99
|
+
axis.max.valid && axis.max.value
|
|
100
|
+
? Number(axis.max.value).toFixed(1)
|
|
101
|
+
: undefined;
|
|
95
102
|
|
|
96
103
|
const elementValue = axis[name];
|
|
97
104
|
if (elementValue.valid) {
|