mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-08 14:29:05 +08:00
[Fix]: range issue in uplot charts (#4262)
* fix: range issue in uplot charts * refactor: updated logic to strickly check is parsed value is number * refactor: safe check for number value
This commit is contained in:
parent
6b2f03d43f
commit
f487c1956b
@ -1,5 +1,6 @@
|
||||
import { ThresholdProps } from 'container/NewWidget/RightContainer/Threshold/types';
|
||||
import { convertValue } from 'lib/getConvertedValue';
|
||||
import { isFinite } from 'lodash-es';
|
||||
import { QueryDataV3 } from 'types/api/widgets/getQuery';
|
||||
|
||||
function findMinMaxValues(data: QueryDataV3[]): [number, number] {
|
||||
@ -9,9 +10,10 @@ function findMinMaxValues(data: QueryDataV3[]): [number, number] {
|
||||
entry.series?.forEach((series) => {
|
||||
series.values.forEach((valueObj) => {
|
||||
const value = parseFloat(valueObj.value);
|
||||
if (!value) return;
|
||||
min = Math.min(min, value);
|
||||
max = Math.max(max, value);
|
||||
if (isFinite(value)) {
|
||||
min = Math.min(min, value);
|
||||
max = Math.max(max, value);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -82,5 +84,10 @@ export const getYAxisScale = (
|
||||
if (areAllSeriesEmpty(series)) return { auto: true };
|
||||
|
||||
const [min, max] = getRange(thresholds, series, yAxisUnit);
|
||||
|
||||
// Min and Max value can be same if the value is same for all the series
|
||||
if (min === max) {
|
||||
return { auto: true };
|
||||
}
|
||||
return { auto: false, range: [min, max] };
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user