3
0
mirror of https://github.com/grafana/grafana.git synced 2025-02-25 18:55:37 -06:00

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

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
devenv/dev-dashboards/panel-histogram
public/app/plugins/panel/histogram

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;
}
let fullRangeMin = u.data[0][0];
let fullRangeMax = u.data[0][u.data[0].length - 1];
// snap to bucket divisors...
if (wantedMax === fullRangeMax) {
wantedMax += bucketSize;
} else {
wantedMax = incrRoundUp(wantedMax, bucketSize);
}
if (wantedMin > fullRangeMin) {
wantedMin = incrRoundDn(wantedMin, bucketSize);
}
// 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
wantedMin = incrRoundUp(wantedMin, bucketSize);
wantedMax =
!isOrdinalX && wantedMax === fullRangeMax ? wantedMax + bucketSize : incrRoundDn(wantedMax, bucketSize);
return [wantedMin, wantedMax];
},