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
This commit is contained in:
sv5d
2020-01-28 13:58:28 +01:00
committed by Marcus Efraimsson
parent e95bcc4ba2
commit ae3d25986d

View File

@ -109,7 +109,7 @@ function drawColorLegend(
const widthFactor = legendWidth / (rangeTo - rangeFrom); const widthFactor = legendWidth / (rangeTo - rangeFrom);
const valuesRange = d3.range(rangeFrom, rangeTo, rangeStep); 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 legend
.append('g') .append('g')
.attr('class', 'legend-color-bar') .attr('class', 'legend-color-bar')
@ -147,7 +147,7 @@ function drawOpacityLegend(
const widthFactor = legendWidth / (rangeTo - rangeFrom); const widthFactor = legendWidth / (rangeTo - rangeFrom);
const valuesRange = d3.range(rangeFrom, rangeTo, rangeStep); const valuesRange = d3.range(rangeFrom, rangeTo, rangeStep);
const opacityScale = getOpacityScale(options, maxValue, minValue); const opacityScale = getOpacityScale(options, rangeTo, rangeFrom);
legend legend
.append('g') .append('g')
.attr('class', 'legend-color-bar') .attr('class', 'legend-color-bar')