Browse Source

heatmap-tooltip: normalize histogram Y axis

Alexander Zobnin 8 years ago
parent
commit
1f4140057b
1 changed files with 4 additions and 2 deletions
  1. 4 2
      public/app/plugins/panel/heatmap/heatmap_tooltip.ts

+ 4 - 2
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")