Skip to content

Commit

Permalink
histogram: don't cut negative values, issue grafana#8628
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderzobnin committed Jun 27, 2017
1 parent 1deeef9 commit 44b47f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/app/plugins/panel/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) {
ticks = _.map(data[0].data, point => point[0]);

// Expand ticks for pretty view
min = Math.max(0, _.min(ticks) - bucketSize);
min = _.min(ticks) - bucketSize;
max = _.max(ticks) + bucketSize;

ticks = [];
Expand Down
5 changes: 4 additions & 1 deletion public/app/plugins/panel/graph/histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
});

// Sort by Y axis values
return _.sortBy(histogam_series, point => point[0]);
}

function getBucketBound(value: number, bucketSize: number): number {
Expand Down

0 comments on commit 44b47f9

Please sign in to comment.