From ae3d25986d1240e18a04f9795aa86f3bf819f73d Mon Sep 17 00:00:00 2001 From: sv5d Date: Tue, 28 Jan 2020 13:58:28 +0100 Subject: [PATCH] Heatmap: Legend color range is incorrect when using custom min/max (#21748) Fix opacity and color scales initializations which took wrong range arguments (current data min/max instead of custom range min/max). Fixes #18139 --- public/app/plugins/panel/heatmap/color_legend.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/heatmap/color_legend.ts b/public/app/plugins/panel/heatmap/color_legend.ts index 633d4278401..a4fe0e03560 100644 --- a/public/app/plugins/panel/heatmap/color_legend.ts +++ b/public/app/plugins/panel/heatmap/color_legend.ts @@ -109,7 +109,7 @@ function drawColorLegend( const widthFactor = legendWidth / (rangeTo - rangeFrom); const valuesRange = d3.range(rangeFrom, rangeTo, rangeStep); - const colorScale = getColorScale(colorScheme, contextSrv.user.lightTheme, maxValue, minValue); + const colorScale = getColorScale(colorScheme, contextSrv.user.lightTheme, rangeTo, rangeFrom); legend .append('g') .attr('class', 'legend-color-bar') @@ -147,7 +147,7 @@ function drawOpacityLegend( const widthFactor = legendWidth / (rangeTo - rangeFrom); const valuesRange = d3.range(rangeFrom, rangeTo, rangeStep); - const opacityScale = getOpacityScale(options, maxValue, minValue); + const opacityScale = getOpacityScale(options, rangeTo, rangeFrom); legend .append('g') .attr('class', 'legend-color-bar')