Commit c1c1bcb8 by Alexander Zobnin Committed by Daniel Lee

histogram: don't cut negative values, issue #8628

parent 1da98f5e
...@@ -427,7 +427,7 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) { ...@@ -427,7 +427,7 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) {
ticks = _.map(data[0].data, point => point[0]); ticks = _.map(data[0].data, point => point[0]);
// Expand ticks for pretty view // Expand ticks for pretty view
min = Math.max(0, _.min(ticks) - bucketSize); min = _.min(ticks) - bucketSize;
max = _.max(ticks) + bucketSize; max = _.max(ticks) + bucketSize;
ticks = []; ticks = [];
......
...@@ -38,9 +38,12 @@ export function convertValuesToHistogram(values: number[], bucketSize: number): ...@@ -38,9 +38,12 @@ export function convertValuesToHistogram(values: number[], bucketSize: number):
} }
} }
return _.map(histogram, (count, bound) => { let histogam_series = _.map(histogram, (count, bound) => {
return [Number(bound), count]; return [Number(bound), count];
}); });
// Sort by Y axis values
return _.sortBy(histogam_series, point => point[0]);
} }
function getBucketBound(value: number, bucketSize: number): number { function getBucketBound(value: number, bucketSize: number): number {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment