@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/CHANGELOG.md
CHANGED
package/build/api-client.cjs
CHANGED
|
@@ -9928,40 +9928,37 @@ function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range
|
|
|
9928
9928
|
};
|
|
9929
9929
|
}
|
|
9930
9930
|
function calculateLayerScale(name, scaleType, range, data) {
|
|
9931
|
-
let domain = [];
|
|
9932
9931
|
let scaleDomain;
|
|
9933
|
-
let
|
|
9932
|
+
let scaleColors = [];
|
|
9934
9933
|
const { colors } = range;
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
if (range.uiCustomScaleType === "logarithmic") {
|
|
9939
|
-
scaleDomain = getLog10ScaleSteps({
|
|
9940
|
-
min: min2,
|
|
9941
|
-
max: max2,
|
|
9942
|
-
steps: colors.length
|
|
9943
|
-
});
|
|
9944
|
-
scaleColor = colors;
|
|
9945
|
-
} else if (range.colorMap) {
|
|
9934
|
+
const domain = calculateDomain(data, name, scaleType, colors.length);
|
|
9935
|
+
if (scaleType !== "identity") {
|
|
9936
|
+
if (range.colorMap) {
|
|
9946
9937
|
const { colorMap } = range;
|
|
9947
9938
|
scaleDomain = [];
|
|
9948
9939
|
colorMap.forEach(([value, color2]) => {
|
|
9949
|
-
scaleDomain.push(
|
|
9950
|
-
|
|
9940
|
+
scaleDomain.push(value);
|
|
9941
|
+
scaleColors.push(color2);
|
|
9951
9942
|
});
|
|
9952
|
-
}
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9943
|
+
} else {
|
|
9944
|
+
if (scaleType === "custom" && range.uiCustomScaleType === "logarithmic") {
|
|
9945
|
+
const [min2, max2] = domain;
|
|
9946
|
+
scaleDomain = getLog10ScaleSteps({
|
|
9947
|
+
min: min2,
|
|
9948
|
+
max: max2,
|
|
9949
|
+
steps: colors.length
|
|
9950
|
+
});
|
|
9951
|
+
scaleColors = colors;
|
|
9952
|
+
} else {
|
|
9953
|
+
scaleColors = colors;
|
|
9954
|
+
}
|
|
9958
9955
|
}
|
|
9959
9956
|
}
|
|
9960
9957
|
return {
|
|
9961
9958
|
scale: createColorScale(
|
|
9962
9959
|
scaleType,
|
|
9963
9960
|
scaleDomain || domain,
|
|
9964
|
-
|
|
9961
|
+
scaleColors.map(hexToRGB),
|
|
9965
9962
|
UNKNOWN_COLOR_RGB
|
|
9966
9963
|
),
|
|
9967
9964
|
domain
|