From 1f4140057b32c2b86ee855231245e5a73719dad7 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sun, 18 Jun 2017 20:58:13 +0300 Subject: [PATCH] heatmap-tooltip: normalize histogram Y axis --- public/app/plugins/panel/heatmap/heatmap_tooltip.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/heatmap/heatmap_tooltip.ts b/public/app/plugins/panel/heatmap/heatmap_tooltip.ts index 6d577ab9d37..3af78156536 100644 --- a/public/app/plugins/panel/heatmap/heatmap_tooltip.ts +++ b/public/app/plugins/panel/heatmap/heatmap_tooltip.ts @@ -172,9 +172,11 @@ export class HeatmapTooltip { } barWidth = Math.max(barWidth, 1); + // Normalize histogram Y axis + let histogramDomain = _.reduce(_.map(histogramData, d => d[1]), (sum, val) => sum + val, 0); let histYScale = d3.scaleLinear() - .domain([0, _.max(_.map(histogramData, d => d[1]))]) - .range([0, HISTOGRAM_HEIGHT]); + .domain([0, histogramDomain]) + .range([0, HISTOGRAM_HEIGHT]); let histogram = this.tooltip.select(".heatmap-histogram") .append("svg")