@carto/api-client 0.5.17 → 0.5.18-alpha.colormapfix-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/api-client.cjs +19 -22
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.js +19 -22
- package/build/api-client.js.map +1 -1
- package/package.json +3 -2
- package/src/fetch-map/layer-map.ts +21 -26
package/build/api-client.js
CHANGED
|
@@ -9587,40 +9587,37 @@ function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range
|
|
|
9587
9587
|
};
|
|
9588
9588
|
}
|
|
9589
9589
|
function calculateLayerScale(name, scaleType, range, data) {
|
|
9590
|
-
let domain = [];
|
|
9591
9590
|
let scaleDomain;
|
|
9592
|
-
let
|
|
9591
|
+
let scaleColors = [];
|
|
9593
9592
|
const { colors } = range;
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
if (range.uiCustomScaleType === "logarithmic") {
|
|
9598
|
-
scaleDomain = getLog10ScaleSteps({
|
|
9599
|
-
min: min2,
|
|
9600
|
-
max: max2,
|
|
9601
|
-
steps: colors.length
|
|
9602
|
-
});
|
|
9603
|
-
scaleColor = colors;
|
|
9604
|
-
} else if (range.colorMap) {
|
|
9593
|
+
const domain = calculateDomain(data, name, scaleType, colors.length);
|
|
9594
|
+
if (scaleType !== "identity") {
|
|
9595
|
+
if (range.colorMap) {
|
|
9605
9596
|
const { colorMap } = range;
|
|
9606
9597
|
scaleDomain = [];
|
|
9607
9598
|
colorMap.forEach(([value, color2]) => {
|
|
9608
|
-
scaleDomain.push(
|
|
9609
|
-
|
|
9599
|
+
scaleDomain.push(value);
|
|
9600
|
+
scaleColors.push(color2);
|
|
9610
9601
|
});
|
|
9611
|
-
}
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9602
|
+
} else {
|
|
9603
|
+
if (scaleType === "custom" && range.uiCustomScaleType === "logarithmic") {
|
|
9604
|
+
const [min2, max2] = domain;
|
|
9605
|
+
scaleDomain = getLog10ScaleSteps({
|
|
9606
|
+
min: min2,
|
|
9607
|
+
max: max2,
|
|
9608
|
+
steps: colors.length
|
|
9609
|
+
});
|
|
9610
|
+
scaleColors = colors;
|
|
9611
|
+
} else {
|
|
9612
|
+
scaleColors = colors;
|
|
9613
|
+
}
|
|
9617
9614
|
}
|
|
9618
9615
|
}
|
|
9619
9616
|
return {
|
|
9620
9617
|
scale: createColorScale(
|
|
9621
9618
|
scaleType,
|
|
9622
9619
|
scaleDomain || domain,
|
|
9623
|
-
|
|
9620
|
+
scaleColors.map(hexToRGB),
|
|
9624
9621
|
UNKNOWN_COLOR_RGB
|
|
9625
9622
|
),
|
|
9626
9623
|
domain
|