Просмотр исходного кода

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

Alexander Zobnin 8 лет назад
Родитель
Сommit
c1c1bcb874

+ 1 - 1
public/app/plugins/panel/graph/graph.ts

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

+ 4 - 1
public/app/plugins/panel/graph/histogram.ts

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