Skip to content

Commit

Permalink
Add one variable for max color count and follow the coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
ghfan committed Jul 24, 2018
1 parent d2a6d66 commit 5996c1e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 5996c1e

Please sign in to comment.