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

This commit is contained in:
Alexander Zobnin 2017-06-27 17:42:21 +03:00 committed by Daniel Lee
parent 1da98f5e1e
commit c1c1bcb874
2 changed files with 5 additions and 2 deletions

View File

@ -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 = [];

View File

@ -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 {