From 4cf698af102bdd483a4288dd8dc9edee63a988bb Mon Sep 17 00:00:00 2001 From: Sofia Papagiannaki Date: Sat, 9 Mar 2019 13:38:57 +0200 Subject: [PATCH] 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). --- public/app/plugins/panel/graph/histogram.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/app/plugins/panel/graph/histogram.ts b/public/app/plugins/panel/graph/histogram.ts index b09226d15e7..b5c478198c0 100644 --- a/public/app/plugins/panel/graph/histogram.ts +++ b/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; }