@gravity-ui/chartkit 5.3.0 → 5.3.1
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.
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
const VALUES_LIMIT = 1000;
|
|
1
2
|
export const getXAxisThresholdValue = (graphs, operation) => {
|
|
2
3
|
const xAxisValues = graphs.reduce((acc, series) => {
|
|
3
4
|
const data = series.data || [];
|
|
4
5
|
return [...acc, ...data.map((point) => point.x)];
|
|
5
6
|
}, []);
|
|
6
7
|
const fn = operation === 'min' ? Math.min : Math.max;
|
|
7
|
-
|
|
8
|
+
let index = 0;
|
|
9
|
+
let limited = xAxisValues.slice(0, VALUES_LIMIT);
|
|
10
|
+
let xAxisValue;
|
|
11
|
+
do {
|
|
12
|
+
if (typeof xAxisValue === 'number') {
|
|
13
|
+
limited.push(xAxisValue);
|
|
14
|
+
}
|
|
15
|
+
xAxisValue = fn(...limited);
|
|
16
|
+
index += 1;
|
|
17
|
+
limited = xAxisValues.slice(index * VALUES_LIMIT, index * VALUES_LIMIT + VALUES_LIMIT);
|
|
18
|
+
} while (limited.length);
|
|
8
19
|
return isFinite(xAxisValue) ? xAxisValue : null;
|
|
9
20
|
};
|
package/package.json
CHANGED