@globalfishingwatch/layer-composer
Advanced tools
Comparing version 0.7.4 to 0.7.5
@@ -56,18 +56,17 @@ "use strict"; | ||
var min = statsByZoom.min, max = statsByZoom.max, avg = statsByZoom.avg; | ||
var precision = Array.from(max.toString()).reduce(function (acc) { return acc * 10; }, 0.1); | ||
var roundedMax = Math.round(max / precision) * precision; | ||
var scale = d3_scale_1.scalePow() | ||
.exponent(10) | ||
.domain([0, 0.5, 1]) | ||
.range([min, avg, roundedMax]); | ||
stops = [0, min, scale(0.25), scale(0.5), scale(0.75), roundedMax]; | ||
var prevStepValues_1 = []; | ||
stops = stops.map(function (stop, index) { | ||
var roundValue = Math.round(stop); | ||
if (prevStepValues_1.indexOf(roundValue) > -1) { | ||
roundValue = prevStepValues_1[index - 1] + 1; | ||
} | ||
prevStepValues_1.push(roundValue); | ||
return roundValue; | ||
}); | ||
if (min && max && avg) { | ||
var precision = Array.from(max.toString()).reduce(function (acc) { return acc * 10; }, 0.1); | ||
var roundedMax = Math.round(max / precision) * precision; | ||
var scale = d3_scale_1.scalePow().exponent(10).domain([0, 0.5, 1]).range([min, avg, roundedMax]); | ||
stops = [0, min, scale(0.25), scale(0.5), scale(0.75), roundedMax]; | ||
var prevStepValues_1 = []; | ||
stops = stops.map(function (stop, index) { | ||
var roundValue = Math.round(stop); | ||
if (prevStepValues_1.indexOf(roundValue) > -1) { | ||
roundValue = prevStepValues_1[index - 1] + 1; | ||
} | ||
prevStepValues_1.push(roundValue); | ||
return roundValue; | ||
}); | ||
} | ||
} | ||
@@ -74,0 +73,0 @@ var pickValueAt = 'value'; |
{ | ||
"name": "@globalfishingwatch/layer-composer", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"description": "Tools to convert layer configuration to data structures needed in Mapbox GL GFW interactive maps ", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -66,19 +66,19 @@ import flatten from 'lodash/flatten' | ||
const { min, max, avg } = statsByZoom | ||
const precision = Array.from(max.toString()).reduce((acc) => acc * 10, 0.1) | ||
const roundedMax = Math.round(max / precision) * precision | ||
const scale = scalePow() | ||
.exponent(10) | ||
.domain([0, 0.5, 1]) | ||
.range([min, avg, roundedMax]) | ||
stops = [0, min, scale(0.25), scale(0.5), scale(0.75), roundedMax] | ||
if (min && max && avg) { | ||
const precision = Array.from(max.toString()).reduce((acc) => acc * 10, 0.1) | ||
const roundedMax = Math.round(max / precision) * precision | ||
const scale = scalePow().exponent(10).domain([0, 0.5, 1]).range([min, avg, roundedMax]) | ||
const prevStepValues: number[] = [] | ||
stops = stops.map((stop, index) => { | ||
let roundValue = Math.round(stop) | ||
if (prevStepValues.indexOf(roundValue) > -1) { | ||
roundValue = prevStepValues[index - 1] + 1 | ||
} | ||
prevStepValues.push(roundValue) | ||
return roundValue | ||
}) | ||
stops = [0, min, scale(0.25), scale(0.5), scale(0.75), roundedMax] | ||
const prevStepValues: number[] = [] | ||
stops = stops.map((stop, index) => { | ||
let roundValue = Math.round(stop) | ||
if (prevStepValues.indexOf(roundValue) > -1) { | ||
roundValue = prevStepValues[index - 1] + 1 | ||
} | ||
prevStepValues.push(roundValue) | ||
return roundValue | ||
}) | ||
} | ||
} | ||
@@ -85,0 +85,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1220638
14061