@carto/api-client 0.5.18-alpha.colormapfix-1 → 0.5.18
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 +4 -2
- package/build/api-client.cjs +6 -12
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.js +6 -12
- package/build/api-client.js.map +1 -1
- package/package.json +2 -3
- package/src/fetch-map/layer-map.ts +6 -13
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
- fix(fetchMap): getColorAccessor treats colorMap as override of actual domain (#238)
|
|
6
|
-
|
|
7
5
|
## 0.5
|
|
8
6
|
|
|
7
|
+
### 0.5.18
|
|
8
|
+
|
|
9
|
+
- fix(fetchMap): getColorAccessor treats colorMap as override of actual domain (#238)
|
|
10
|
+
|
|
9
11
|
### 0.5.17
|
|
10
12
|
|
|
11
13
|
- feat(fetchMap): Raster layers, update triggers and other fixes (#223)
|
package/build/api-client.cjs
CHANGED
|
@@ -9928,43 +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;
|
|
9934
|
+
const domain = calculateDomain(data, name, scaleType, colors.length);
|
|
9935
9935
|
if (scaleType !== "identity") {
|
|
9936
9936
|
if (range.colorMap) {
|
|
9937
9937
|
const { colorMap } = range;
|
|
9938
9938
|
scaleDomain = [];
|
|
9939
9939
|
colorMap.forEach(([value, color2]) => {
|
|
9940
9940
|
scaleDomain.push(value);
|
|
9941
|
-
|
|
9941
|
+
scaleColors.push(color2);
|
|
9942
9942
|
});
|
|
9943
|
-
domain = scaleDomain;
|
|
9944
9943
|
} else {
|
|
9945
9944
|
if (scaleType === "custom" && range.uiCustomScaleType === "logarithmic") {
|
|
9946
|
-
domain = calculateDomain(data, name, scaleType, colors.length);
|
|
9947
9945
|
const [min2, max2] = domain;
|
|
9948
9946
|
scaleDomain = getLog10ScaleSteps({
|
|
9949
9947
|
min: min2,
|
|
9950
9948
|
max: max2,
|
|
9951
9949
|
steps: colors.length
|
|
9952
9950
|
});
|
|
9953
|
-
|
|
9951
|
+
scaleColors = colors;
|
|
9954
9952
|
} else {
|
|
9955
|
-
|
|
9956
|
-
scaleColor = colors;
|
|
9953
|
+
scaleColors = colors;
|
|
9957
9954
|
}
|
|
9958
9955
|
}
|
|
9959
|
-
if (scaleType === "ordinal") {
|
|
9960
|
-
domain = domain.slice(0, scaleColor.length);
|
|
9961
|
-
}
|
|
9962
9956
|
}
|
|
9963
9957
|
return {
|
|
9964
9958
|
scale: createColorScale(
|
|
9965
9959
|
scaleType,
|
|
9966
9960
|
scaleDomain || domain,
|
|
9967
|
-
|
|
9961
|
+
scaleColors.map(hexToRGB),
|
|
9968
9962
|
UNKNOWN_COLOR_RGB
|
|
9969
9963
|
),
|
|
9970
9964
|
domain
|