Histogram: Fix x-axis going past +Inf when rendering heatmap-rows frames (#81438)

This commit is contained in:
Leon Sorokin 2024-01-28 21:33:34 -06:00 committed by GitHub
parent 1fab107e79
commit 835ded5eec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 192 additions and 28 deletions

File diff suppressed because one or more lines are too long

View File

@ -118,20 +118,13 @@ const prepConfig = (frame: DataFrame, theme: GrafanaTheme2) => {
wantedMax = xScaleMax; wantedMax = xScaleMax;
} }
let fullRangeMin = u.data[0][0];
let fullRangeMax = u.data[0][u.data[0].length - 1]; let fullRangeMax = u.data[0][u.data[0].length - 1];
// snap to bucket divisors... // isOrdinalX is when we have classic histograms, which are LE, ordinal X, and already have 0 dummy bucket prepended
// else we have calculated histograms which are GE and cardinal+linear X, and have no next dummy bucket appended
if (wantedMax === fullRangeMax) { wantedMin = incrRoundUp(wantedMin, bucketSize);
wantedMax += bucketSize; wantedMax =
} else { !isOrdinalX && wantedMax === fullRangeMax ? wantedMax + bucketSize : incrRoundDn(wantedMax, bucketSize);
wantedMax = incrRoundUp(wantedMax, bucketSize);
}
if (wantedMin > fullRangeMin) {
wantedMin = incrRoundDn(wantedMin, bucketSize);
}
return [wantedMin, wantedMax]; return [wantedMin, wantedMax];
}, },