From e0a874f6779f28cbc6bcbed9fcd30cd3109fad95 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Thu, 22 Feb 2018 16:33:45 +0300 Subject: [PATCH] heatmap tooltip: fix bucket bounds for 'tsbuckets' mode --- .../app/plugins/panel/heatmap/heatmap_tooltip.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/public/app/plugins/panel/heatmap/heatmap_tooltip.ts b/public/app/plugins/panel/heatmap/heatmap_tooltip.ts index 82041718478..d760539f27d 100644 --- a/public/app/plugins/panel/heatmap/heatmap_tooltip.ts +++ b/public/app/plugins/panel/heatmap/heatmap_tooltip.ts @@ -113,10 +113,15 @@ export class HeatmapTooltip { if (yData) { if (yData.bounds) { - // Display 0 if bucket is a special 'zero' bucket - let bottom = yData.y ? yData.bounds.bottom : 0; - boundBottom = valueFormatter(bottom); - boundTop = valueFormatter(yData.bounds.top); + if (data.tsBuckets) { + boundBottom = data.tsBuckets[yBucketIndex]; + boundTop = yBucketIndex < data.tsBuckets.length - 1 ? data.tsBuckets[yBucketIndex + 1] : ''; + } else { + // Display 0 if bucket is a special 'zero' bucket + let bottom = yData.y ? yData.bounds.bottom : 0; + boundBottom = valueFormatter(bottom); + boundTop = valueFormatter(yData.bounds.top); + } valuesNumber = valueFormatter(yData.count); tooltipHtml += `
bucket: ${boundBottom} - ${boundTop}
@@ -163,6 +168,9 @@ export class HeatmapTooltip { getYBucketIndex(offsetY, data) { let y = this.scope.yScale.invert(offsetY - this.scope.chartTop); + if (data.tsBuckets) { + return Math.floor(y); + } let yBucketIndex = getValueBucketBound(y, data.yBucketSize, this.panel.yAxis.logBase); return yBucketIndex; }