@carto/api-client 0.5.17 → 0.5.18-alpha.colormapfix-1

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.
@@ -9591,27 +9591,30 @@ function calculateLayerScale(name, scaleType, range, data) {
9591
9591
  let scaleDomain;
9592
9592
  let scaleColor = [];
9593
9593
  const { colors } = range;
9594
- if (scaleType === "custom") {
9595
- domain = calculateDomain(data, name, scaleType, colors.length);
9596
- const [min2, max2] = domain;
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) {
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(Number(value));
9599
+ scaleDomain.push(value);
9609
9600
  scaleColor.push(color2);
9610
9601
  });
9602
+ domain = scaleDomain;
9603
+ } else {
9604
+ if (scaleType === "custom" && range.uiCustomScaleType === "logarithmic") {
9605
+ domain = calculateDomain(data, name, scaleType, colors.length);
9606
+ const [min2, max2] = domain;
9607
+ scaleDomain = getLog10ScaleSteps({
9608
+ min: min2,
9609
+ max: max2,
9610
+ steps: colors.length
9611
+ });
9612
+ scaleColor = colors;
9613
+ } else {
9614
+ domain = calculateDomain(data, name, scaleType, colors.length);
9615
+ scaleColor = colors;
9616
+ }
9611
9617
  }
9612
- } else if (scaleType !== "identity") {
9613
- domain = calculateDomain(data, name, scaleType, colors.length);
9614
- scaleColor = colors;
9615
9618
  if (scaleType === "ordinal") {
9616
9619
  domain = domain.slice(0, scaleColor.length);
9617
9620
  }