@oliasoft-open-source/charts-library 2.5.8 → 2.5.9
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
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getAxisPosition,
|
|
4
4
|
} from '../../helpers/chart-utils';
|
|
5
5
|
import { COLORS, LOGARITHMIC_STEPS } from '../../helpers/chart-consts';
|
|
6
|
-
import { truncateDecimals } from './line-chart-utils';
|
|
6
|
+
import { truncateDecimals, validNumber } from './line-chart-utils';
|
|
7
7
|
import { AxisType, ScaleType } from '../../helpers/enums';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -57,12 +57,14 @@ const getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
|
|
|
57
57
|
reverse: axisType === AxisType.Y ? additionalAxesOptions.reverse : false,
|
|
58
58
|
suggestedMax: additionalAxesOptions.suggestedMax,
|
|
59
59
|
suggestedMin: additionalAxesOptions.suggestedMin,
|
|
60
|
-
min:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
min:
|
|
61
|
+
stateAxis.min?.valid && validNumber(stateAxis.min?.value)
|
|
62
|
+
? Number(stateAxis.min?.value)
|
|
63
|
+
: additionalAxesOptions?.range?.[axisType]?.min,
|
|
64
|
+
max:
|
|
65
|
+
stateAxis.max?.valid && validNumber(stateAxis.max?.value)
|
|
66
|
+
? Number(stateAxis.max?.value)
|
|
67
|
+
: additionalAxesOptions?.range?.[axisType]?.max,
|
|
66
68
|
title: {
|
|
67
69
|
display: axisData.label?.length,
|
|
68
70
|
text: axisData.label,
|
|
@@ -144,7 +144,9 @@ export const toNum = (value) => {
|
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
export const isLessThanMax = (value, max) => {
|
|
147
|
-
return
|
|
147
|
+
return (
|
|
148
|
+
value === undefined || max === undefined || Number(value) < Number(max)
|
|
149
|
+
);
|
|
148
150
|
};
|
|
149
151
|
|
|
150
152
|
export const isGreaterThanMin = (value, min) => {
|
|
@@ -79,9 +79,7 @@ export const reducer = (state, action) => {
|
|
|
79
79
|
}
|
|
80
80
|
case SET_AXIS_VALUE: {
|
|
81
81
|
const valiateElement = (name, nextInputValue, id) => {
|
|
82
|
-
const nextValue =
|
|
83
|
-
? cleanNumStr(nextInputValue)
|
|
84
|
-
: toNum(nextInputValue);
|
|
82
|
+
const nextValue = cleanNumStr(nextInputValue);
|
|
85
83
|
|
|
86
84
|
const axis = newState.axes.find((a) => a.id === id);
|
|
87
85
|
axis.min = getAxisValue(name === 'min' ? nextValue : axis.min?.value);
|