From ce18758cd14a857f51708c0934e15da25b6b0385 Mon Sep 17 00:00:00 2001 From: Yamac K <32689837+yamac-kurtulus@users.noreply.github.com> Date: Sat, 10 Oct 2020 13:11:11 +0300 Subject: [PATCH] Restrict color scaling to min-max values in spectrum mode (#134) * Restrict min-max values in spectrum mode --- src/color_legend.ts | 4 ++-- src/rendering.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/color_legend.ts b/src/color_legend.ts index f15fa5f..257e51b 100644 --- a/src/color_legend.ts +++ b/src/color_legend.ts @@ -68,8 +68,8 @@ coreModule.directive('statusHeatmapLegend', function() { if (ctrl.bucketMatrix) { let rangeFrom = ctrl.bucketMatrix.minValue; let rangeTo = ctrl.bucketMatrix.maxValue; - let maxValue = panel.color.max || rangeTo; - let minValue = panel.color.min || rangeFrom; + let maxValue = panel.color.max != null ? panel.color.max : rangeTo; + let minValue = panel.color.min != null ? panel.color.min : rangeFrom; if (ctrl.bucketMatrix.noDatapoints) { if (!panel.color.max) { diff --git a/src/rendering.ts b/src/rendering.ts index 8c265a5..4ea96e3 100644 --- a/src/rendering.ts +++ b/src/rendering.ts @@ -364,8 +364,8 @@ export class StatusmapRenderer { } addStatusmap():void { - let maxValue = this.panel.color.max || this.bucketMatrix.maxValue; - let minValue = this.panel.color.min || this.bucketMatrix.minValue; + let maxValue = this.panel.color.max != null ? this.panel.color.max : this.bucketMatrix.maxValue; + let minValue = this.panel.color.min != null ? this.panel.color.min : this.bucketMatrix.minValue; if (this.panel.color.mode !== 'discrete') { this.colorScale = this.getColorScale(maxValue, minValue);