@syncfusion/ej2-maps 32.1.19 → 32.1.21

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.
@@ -13590,15 +13590,23 @@ class Legend {
13590
13590
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13591
13591
  Array.prototype.forEach.call(dataSource, (data, dataIndex) => {
13592
13592
  range = false;
13593
- const rangeValue = data[colorValuePath];
13593
+ const colorValue = data[colorValuePath];
13594
+ const isEmpty = colorValue === '' || isNullOrUndefined(colorValue);
13595
+ const rangeValue = !isEmpty ? Number(colorValue) : NaN;
13596
+ const hasNumeric = !isEmpty && Number.isFinite(rangeValue);
13597
+ const equalValue = !isEmpty ? colorValue : null;
13594
13598
  for (let z = 0; z < colorMapping.length; z++) {
13595
- if (!isNullOrUndefined(rangeValue) && !isNaN(rangeValue)) {
13596
- if (rangeValue >= colorMapping[z].from && rangeValue <= colorMapping[z].to) {
13599
+ const colorMap = colorMapping[z];
13600
+ if (hasNumeric && !isNaN(rangeValue) && colorMap.from != null && colorMap.to != null) {
13601
+ if (rangeValue >= colorMap.from && rangeValue <= colorMap.to) {
13597
13602
  range = true;
13603
+ break;
13598
13604
  }
13599
13605
  }
13600
- else if (!range) {
13601
- range = false;
13606
+ else if (!hasNumeric && equalValue !== null && !isNullOrUndefined(colorMap.value)
13607
+ && equalValue === colorMap.value) {
13608
+ range = true;
13609
+ break;
13602
13610
  }
13603
13611
  }
13604
13612
  if (!range) {