From 5996c1edb980cf1d231795f00f8fc3a4ab67c068 Mon Sep 17 00:00:00 2001 From: ghfan Date: Mon, 23 Jul 2018 09:39:27 +0800 Subject: [PATCH] Add one variable for max color count and follow the coding style --- .../vislib/visualizations/point_series/heatmap_chart.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ui/public/vislib/visualizations/point_series/heatmap_chart.js b/src/ui/public/vislib/visualizations/point_series/heatmap_chart.js index 5e27890842cc55..9fcf2ed635fe9b 100644 --- a/src/ui/public/vislib/visualizations/point_series/heatmap_chart.js +++ b/src/ui/public/vislib/visualizations/point_series/heatmap_chart.js @@ -69,6 +69,7 @@ export function VislibVisualizationsHeatmapChartProvider(Private) { const zScale = this.getValueAxis().getScale(); const [min, max] = zScale.domain(); const labels = []; + const maxColorCnt = 10; if (cfg.get('setColorRange')) { colorsRange.forEach(range => { const from = isFinite(range.from) ? zAxisFormatter(range.from) : range.from; @@ -90,10 +91,10 @@ export function VislibVisualizationsHeatmapChartProvider(Private) { } else { val = val * (max - min) + min; nextVal = nextVal * (max - min) + min; - if (max - min > 10) { - let valInt = Math.ceil(val); + if (max - min > maxColorCnt) { + const valInt = Math.ceil(val); if (i === 0) { - val = (valInt === val ? val : valInt -1); + val = (valInt === val ? val : valInt - 1); } else{ val = valInt;