浏览代码

Minor fix in values to histogram conversion

Filter out values outside the min and max boundaries
because they are assigned to uninitialized buckets
(outside min and max bounds).
Sofia Papagiannaki 6 年之前
父节点
当前提交
4cf698af10
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      public/app/plugins/panel/graph/histogram.ts

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

@@ -43,6 +43,10 @@ export function convertValuesToHistogram(values: number[], bucketSize: number, m
   }
 
   for (let i = 0; i < values.length; i++) {
+    // filter out values outside the min and max boundaries
+    if (values[i] < min || values[i] > max) {
+      continue;
+    }
     const bound = getBucketBound(values[i], bucketSize);
     histogram[bound] = histogram[bound] + 1;
   }