@kepler.gl/utils 3.3.0-alpha.21 → 3.3.0-alpha.23

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/dist/esm/plot.js CHANGED
@@ -13,11 +13,12 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
13
13
  // Copyright contributors to the kepler.gl project
14
14
 
15
15
  import { bisectCenter, bisectLeft, bisectRight, extent, histogram as d3Histogram, ticks } from 'd3-array';
16
+ import { format as d3Format } from 'd3-format';
16
17
  import isEqual from 'es-toolkit/compat/isEqual';
17
18
  import { getFilterMappedValue, getInitialInterval, getIntervalByTicks, intervalToFunction } from './time';
18
19
  import { notNullorUndefined, toArray } from '@kepler.gl/common-utils';
19
- import { ANIMATION_WINDOW, BINS, BINS_LARGE, FILTER_TYPES, TIME_AGGREGATION, AGGREGATION_TYPES, PLOT_TYPES, KEPLER_COLOR_PALETTES, colorPaletteToColorRange, DEFAULT_COLOR_UI, DEFAULT_CUSTOM_PALETTE } from '@kepler.gl/constants';
20
- import { isNumber, roundValToStep } from './data-utils';
20
+ import { ANIMATION_WINDOW, ALL_FIELD_TYPES, BINS, BINS_LARGE, FILTER_TYPES, TIME_AGGREGATION, AGGREGATION_TYPES, PLOT_TYPES, KEPLER_COLOR_PALETTES, colorPaletteToColorRange, DEFAULT_COLOR_UI, DEFAULT_CUSTOM_PALETTE } from '@kepler.gl/constants';
21
+ import { formatNumber, isNumber, roundValToStep } from './data-utils';
21
22
  import { aggregate, AGGREGATION_NAME } from './aggregation';
22
23
  import { capitalizeFirstLetter } from './strings';
23
24
  import { getDefaultTimeFormat } from './format';
@@ -341,8 +342,8 @@ function getTimeBinConfig(interval, domain) {
341
342
  var walk = function walk(value, direction) {
342
343
  var includeCurrent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
343
344
  var date = base.floor(value);
344
- for (var index = 0; index < period; index++) {
345
- if (!includeCurrent || index) date = base.offset(date, direction);
345
+ for (var _index = 0; _index < period; _index++) {
346
+ if (!includeCurrent || _index) date = base.offset(date, direction);
346
347
  if (!Number.isFinite(Number(date))) return date;
347
348
  if (field(date) % step === 0) return date;
348
349
  }
@@ -377,7 +378,7 @@ function getTimeBinConfig(interval, domain) {
377
378
  var thresholds = [];
378
379
  // Include the first boundary strictly after max, even when max is aligned.
379
380
  // This preserves the existing inclusive maximum bin and calendar padding.
380
- for (var index = 0; index <= MAX_TIME_BINS; index++) {
381
+ for (var _index2 = 0; _index2 <= MAX_TIME_BINS; _index2++) {
381
382
  if (!Number.isFinite(boundary)) return null;
382
383
  thresholds.push(boundary);
383
384
  if (boundary > domain[1]) return thresholds;
@@ -461,8 +462,8 @@ export function getNumericBinThresholds(domain, interval) {
461
462
  return getNumericBinThresholds(domain, undefined, numBins);
462
463
  }
463
464
  var thresholds = [start];
464
- for (var index = 1; index < count; index++) {
465
- var boundary = start + index * width;
465
+ for (var _index3 = 1; _index3 < count; _index3++) {
466
+ var boundary = start + _index3 * width;
466
467
  if (boundary > thresholds[thresholds.length - 1] && boundary < end) {
467
468
  thresholds.push(boundary);
468
469
  }
@@ -854,7 +855,7 @@ function mergeGroupColorUI(prev, next, numGroups, colorRange) {
854
855
  * `null` clears grouping. Missing fields keep the previous value, then defaults.
855
856
  */
856
857
  export function mergePlotGroupBy(prev, next) {
857
- var _ref2, _source$numGroups, _ref3, _source$colorRange;
858
+ var _ref2, _source$numGroups, _ref3, _source$colorRange, _source$source, _source$layerId;
858
859
  if (next === null) {
859
860
  return null;
860
861
  }
@@ -864,13 +865,19 @@ export function mergePlotGroupBy(prev, next) {
864
865
  var source = next || {};
865
866
  var numGroups = (_ref2 = (_source$numGroups = source.numGroups) !== null && _source$numGroups !== void 0 ? _source$numGroups : prev === null || prev === void 0 ? void 0 : prev.numGroups) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_PLOT_NUM_GROUPS;
866
867
  var colorRange = (_ref3 = (_source$colorRange = source.colorRange) !== null && _source$colorRange !== void 0 ? _source$colorRange : prev === null || prev === void 0 ? void 0 : prev.colorRange) !== null && _ref3 !== void 0 ? _ref3 : defaultPlotGroupColorRange(numGroups);
867
- return {
868
+ var groupingSource = (_source$source = source.source) !== null && _source$source !== void 0 ? _source$source : prev === null || prev === void 0 ? void 0 : prev.source;
869
+ var layerId = (_source$layerId = source.layerId) !== null && _source$layerId !== void 0 ? _source$layerId : prev === null || prev === void 0 ? void 0 : prev.layerId;
870
+ return _objectSpread(_objectSpread(_objectSpread({}, groupingSource !== undefined ? {
871
+ source: groupingSource
872
+ } : {}), layerId !== undefined ? {
873
+ layerId: layerId
874
+ } : {}), {}, {
868
875
  fieldName: source.fieldName !== undefined ? source.fieldName : prev === null || prev === void 0 ? void 0 : prev.fieldName,
869
876
  numGroups: numGroups,
870
877
  groupOthers: Boolean(source.groupOthers !== undefined ? source.groupOthers : prev === null || prev === void 0 ? void 0 : prev.groupOthers),
871
878
  colorRange: colorRange,
872
879
  colorUI: mergeGroupColorUI(prev === null || prev === void 0 ? void 0 : prev.colorUI, source.colorUI, numGroups, colorRange)
873
- };
880
+ });
874
881
  }
875
882
  function groupByCacheValue(plotType) {
876
883
  var _groupBy$numGroups, _groupBy$colorRange$c, _groupBy$colorRange, _groupBy$colorRange$c2, _groupBy$colorRange2;
@@ -984,6 +991,349 @@ function groupLimit(numGroups) {
984
991
  }
985
992
  return Math.min(numGroups, MAX_PLOT_NUM_GROUPS);
986
993
  }
994
+ function histogramCategoryKey(value, numeric) {
995
+ return numeric && typeof value !== 'bigint' && (typeof value !== 'number' || !Number.isFinite(value)) ? null : toGroupKey(value);
996
+ }
997
+ function histogramGroupValueAccessor(dataset, fieldName) {
998
+ var _dataset$fields2;
999
+ var field = dataset === null || dataset === void 0 || (_dataset$fields2 = dataset.fields) === null || _dataset$fields2 === void 0 ? void 0 : _dataset$fields2.find(function (item) {
1000
+ return item.name === fieldName;
1001
+ });
1002
+ if (!(field !== null && field !== void 0 && field.valueAccessor)) return null;
1003
+ var numeric = field.type === ALL_FIELD_TYPES.integer || field.type === ALL_FIELD_TYPES.real;
1004
+ return function (index) {
1005
+ var value = field.valueAccessor({
1006
+ index: index
1007
+ });
1008
+ if (numeric && typeof value === 'number' && Number.isInteger(value) && !Number.isSafeInteger(value)) {
1009
+ var _dataset$dataContaine, _dataset$dataContaine2;
1010
+ // Table accessors convert Int64 cells to Number; categories need the exact raw integer.
1011
+ var rawValue = (_dataset$dataContaine = dataset.dataContainer) === null || _dataset$dataContaine === void 0 || (_dataset$dataContaine2 = _dataset$dataContaine.valueAt) === null || _dataset$dataContaine2 === void 0 ? void 0 : _dataset$dataContaine2.call(_dataset$dataContaine, index, field.fieldIdx);
1012
+ if (typeof rawValue === 'bigint') return rawValue;
1013
+ }
1014
+ return value;
1015
+ };
1016
+ }
1017
+
1018
+ // Filter updates replace dataset wrappers, but keep the accessor and data revision.
1019
+ // Weak keys release the domain when its field is replaced or the dataset is removed.
1020
+ var histogramCategoryDomains = new WeakMap();
1021
+ function histogramCategoryDomain(dataset, field, numeric, getGroup) {
1022
+ var dataContainer = dataset.dataContainer,
1023
+ dataRevision = dataset.dataRevision,
1024
+ allIndexes = dataset.allIndexes;
1025
+ var cached = histogramCategoryDomains.get(field.valueAccessor);
1026
+ if (cached && cached.dataContainer === dataContainer && cached.dataRevision === dataRevision && cached.allIndexes === allIndexes && cached.numeric === numeric) {
1027
+ return cached;
1028
+ }
1029
+ var order = new Map();
1030
+ var canUseNumericRanges = numeric;
1031
+ var lower = Infinity;
1032
+ var upper = -Infinity;
1033
+ var _iterator4 = _createForOfIteratorHelper(allIndexes || []),
1034
+ _step4;
1035
+ try {
1036
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1037
+ var _index4 = _step4.value;
1038
+ var value = getGroup(_index4);
1039
+ var key = histogramCategoryKey(value, numeric);
1040
+ if (key === null) continue;
1041
+ if (!order.has(key)) order.set(key, order.size);
1042
+ if (numeric) {
1043
+ var number = Number(value);
1044
+ lower = Math.min(lower, number);
1045
+ upper = Math.max(upper, number);
1046
+ if (typeof value === 'bigint' && !Number.isSafeInteger(number)) {
1047
+ canUseNumericRanges = false;
1048
+ }
1049
+ }
1050
+ }
1051
+ } catch (err) {
1052
+ _iterator4.e(err);
1053
+ } finally {
1054
+ _iterator4.f();
1055
+ }
1056
+ var domain = {
1057
+ dataContainer: dataContainer,
1058
+ dataRevision: dataRevision,
1059
+ allIndexes: allIndexes,
1060
+ numeric: numeric,
1061
+ order: order,
1062
+ canUseNumericRanges: canUseNumericRanges,
1063
+ lower: lower,
1064
+ upper: upper
1065
+ };
1066
+ // Callers without a revision cannot promise that an accessor's data is unchanged.
1067
+ if (Number.isFinite(dataRevision) && allIndexes) {
1068
+ histogramCategoryDomains.set(field.valueAccessor, domain);
1069
+ }
1070
+ return domain;
1071
+ }
1072
+
1073
+ /** Colors used by the complete domain, without coloring every distinct category. */
1074
+ function histogramDomainColors(colorRange, order) {
1075
+ var _colorRange$colors2;
1076
+ var palette = colorRange !== null && colorRange !== void 0 && (_colorRange$colors2 = colorRange.colors) !== null && _colorRange$colors2 !== void 0 && _colorRange$colors2.length ? colorRange.colors : FALLBACK_SERIES_COLORS;
1077
+ var counts = palette.map(function (_, index) {
1078
+ return Math.max(0, Math.ceil((order.size - index) / palette.length));
1079
+ });
1080
+ var mappedColors = new Map();
1081
+ var _iterator5 = _createForOfIteratorHelper((colorRange === null || colorRange === void 0 ? void 0 : colorRange.colorMap) || []),
1082
+ _step5;
1083
+ try {
1084
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1085
+ var _step5$value = _slicedToArray(_step5.value, 2),
1086
+ values = _step5$value[0],
1087
+ color = _step5$value[1];
1088
+ if (!color || !Array.isArray(values) && (values === null || values === undefined)) continue;
1089
+ var _iterator6 = _createForOfIteratorHelper(Array.isArray(values) ? values : [values]),
1090
+ _step6;
1091
+ try {
1092
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1093
+ var value = _step6.value;
1094
+ var key = String(value);
1095
+ var _index5 = order.get(key);
1096
+ // mappedSeriesColor uses the first matching override.
1097
+ if (_index5 !== undefined && !mappedColors.has(key)) {
1098
+ counts[_index5 % palette.length]--;
1099
+ mappedColors.set(key, color);
1100
+ }
1101
+ }
1102
+ } catch (err) {
1103
+ _iterator6.e(err);
1104
+ } finally {
1105
+ _iterator6.f();
1106
+ }
1107
+ }
1108
+ } catch (err) {
1109
+ _iterator5.e(err);
1110
+ } finally {
1111
+ _iterator5.f();
1112
+ }
1113
+ return [].concat(_toConsumableArray(palette.filter(function (_, index) {
1114
+ return counts[index] > 0;
1115
+ })), _toConsumableArray(mappedColors.values()));
1116
+ }
1117
+
1118
+ /** Split counts by category or numeric range, preserving the original bin totals and indexes. */
1119
+ export function getCategoricalHistogram(bins, datasets, plotType) {
1120
+ var _plotType$groupBy;
1121
+ var groupBy = groupByCacheValue(plotType);
1122
+ if (!groupBy || !bins) {
1123
+ return null;
1124
+ }
1125
+ var accessors = new Map();
1126
+ for (var _i3 = 0, _Object$keys = Object.keys(bins); _i3 < _Object$keys.length; _i3++) {
1127
+ var dataId = _Object$keys[_i3];
1128
+ var getGroup = histogramGroupValueAccessor(datasets === null || datasets === void 0 ? void 0 : datasets[dataId], groupBy.fieldName);
1129
+ if (getGroup) {
1130
+ accessors.set(dataId, getGroup);
1131
+ }
1132
+ }
1133
+ var numericFields = accessors.size > 0 && Array.from(accessors.keys()).every(function (dataId) {
1134
+ var field = datasets[dataId].fields.find(function (item) {
1135
+ return item.name === groupBy.fieldName;
1136
+ });
1137
+ return field.type === ALL_FIELD_TYPES.integer || field.type === ALL_FIELD_TYPES.real;
1138
+ });
1139
+ var canUseNumericRanges = numericFields;
1140
+ var getCategoryKey = function getCategoryKey(value) {
1141
+ if (numericFields && typeof value === 'bigint' && !Number.isSafeInteger(Number(value))) {
1142
+ // Preserve exact categories for Int64 identifiers that Number cannot represent.
1143
+ canUseNumericRanges = false;
1144
+ }
1145
+ return histogramCategoryKey(value, numericFields);
1146
+ };
1147
+ var categoryOrder = new Map();
1148
+ var presentCategories = new Set();
1149
+ var lower = Infinity;
1150
+ var upper = -Infinity;
1151
+ var _iterator7 = _createForOfIteratorHelper(accessors),
1152
+ _step7;
1153
+ try {
1154
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1155
+ var _step7$value = _slicedToArray(_step7.value, 2),
1156
+ _dataId2 = _step7$value[0],
1157
+ _getGroup = _step7$value[1];
1158
+ // Use the complete dataset to keep a category's color stable as other filters change.
1159
+ var dataset = datasets[_dataId2];
1160
+ var field = dataset.fields.find(function (item) {
1161
+ return item.name === groupBy.fieldName;
1162
+ });
1163
+ var domain = histogramCategoryDomain(dataset, field, numericFields, _getGroup);
1164
+ canUseNumericRanges = canUseNumericRanges && domain.canUseNumericRanges;
1165
+ lower = Math.min(lower, domain.lower);
1166
+ upper = Math.max(upper, domain.upper);
1167
+ // Reuse the usual single-dataset order; copy only when adding uncached categories.
1168
+ if (!categoryOrder.size) {
1169
+ categoryOrder = domain.order;
1170
+ } else {
1171
+ categoryOrder = new Map(categoryOrder);
1172
+ var _iterator9 = _createForOfIteratorHelper(domain.order.keys()),
1173
+ _step9;
1174
+ try {
1175
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1176
+ var key = _step9.value;
1177
+ if (!categoryOrder.has(key)) categoryOrder.set(key, categoryOrder.size);
1178
+ }
1179
+ } catch (err) {
1180
+ _iterator9.e(err);
1181
+ } finally {
1182
+ _iterator9.f();
1183
+ }
1184
+ }
1185
+ var _iterator0 = _createForOfIteratorHelper(bins[_dataId2] || []),
1186
+ _step0;
1187
+ try {
1188
+ for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
1189
+ var bin = _step0.value;
1190
+ var _iterator1 = _createForOfIteratorHelper(bin.indexes || []),
1191
+ _step1;
1192
+ try {
1193
+ for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
1194
+ var _index8 = _step1.value;
1195
+ var _key = getCategoryKey(_getGroup(_index8));
1196
+ if (_key !== null) {
1197
+ if (!categoryOrder.has(_key)) {
1198
+ if (categoryOrder === domain.order) categoryOrder = new Map(categoryOrder);
1199
+ categoryOrder.set(_key, categoryOrder.size);
1200
+ }
1201
+ if (numericFields) {
1202
+ lower = Math.min(lower, Number(_key));
1203
+ upper = Math.max(upper, Number(_key));
1204
+ }
1205
+ presentCategories.add(_key);
1206
+ }
1207
+ }
1208
+ } catch (err) {
1209
+ _iterator1.e(err);
1210
+ } finally {
1211
+ _iterator1.f();
1212
+ }
1213
+ }
1214
+ } catch (err) {
1215
+ _iterator0.e(err);
1216
+ } finally {
1217
+ _iterator0.f();
1218
+ }
1219
+ }
1220
+ } catch (err) {
1221
+ _iterator7.e(err);
1222
+ } finally {
1223
+ _iterator7.f();
1224
+ }
1225
+ if (!presentCategories.size) {
1226
+ return null;
1227
+ }
1228
+ var limit = Math.max(1, Math.floor(groupLimit(groupBy.numGroups)));
1229
+ if (canUseNumericRanges && categoryOrder.size > limit) {
1230
+ var boundaries = [lower];
1231
+ for (var _index6 = 1; _index6 < limit; _index6++) {
1232
+ var fraction = _index6 / limit;
1233
+ // Convex interpolation avoids overflowing upper - lower on extreme finite domains.
1234
+ var boundary = lower * (1 - fraction) + upper * fraction;
1235
+ if (Number.isFinite(boundary) && boundary > boundaries[boundaries.length - 1] && boundary < upper) {
1236
+ boundaries.push(boundary);
1237
+ }
1238
+ }
1239
+ boundaries.push(upper);
1240
+ var labels = boundaries.map(function (value) {
1241
+ return formatNumber(value, ALL_FIELD_TYPES.real);
1242
+ });
1243
+ // Keep labels compact, adding precision only when different bounds would look identical.
1244
+ // Membership still uses the original numeric thresholds, never the rounded labels.
1245
+ for (var precision = 5; precision <= 17 && (new Set(labels).size < labels.length || labels.some(function (label) {
1246
+ return label.length > 24;
1247
+ })); precision++) {
1248
+ labels = boundaries.map(d3Format(".".concat(precision, "~g")));
1249
+ }
1250
+ var ranges = boundaries.slice(1).map(function (_, index) {
1251
+ var last = index === boundaries.length - 2;
1252
+ return "".concat(labels[index], " \u2264 x ").concat(last ? '≤' : '<', " ").concat(labels[index + 1]);
1253
+ });
1254
+ var thresholds = boundaries.slice(1, -1);
1255
+ var numericKey = getCategoryKey;
1256
+ getCategoryKey = function getCategoryKey(value) {
1257
+ var key = numericKey(value);
1258
+ return key === null ? null : ranges[bisectRight(thresholds, Number(key))];
1259
+ };
1260
+ presentCategories = new Set(Array.from(presentCategories, function (key) {
1261
+ return ranges[bisectRight(thresholds, Number(key))];
1262
+ }));
1263
+ categoryOrder = new Map(ranges.map(function (name, index) {
1264
+ return [name, index];
1265
+ }));
1266
+ }
1267
+ var colorRange = plotType === null || plotType === void 0 || (_plotType$groupBy = plotType.groupBy) === null || _plotType$groupBy === void 0 ? void 0 : _plotType$groupBy.colorRange;
1268
+ var order = Array.from(categoryOrder.keys()).filter(function (name) {
1269
+ return presentCategories.has(name);
1270
+ });
1271
+ var keep = order.slice(0, limit);
1272
+ var rest = order.slice(keep.length);
1273
+ var legend = keep.map(function (name) {
1274
+ return {
1275
+ name: name,
1276
+ color: seriesColor(colorRange, name, categoryOrder.get(name))
1277
+ };
1278
+ });
1279
+ var keyToGroup = new Map(keep.map(function (name, index) {
1280
+ return [name, index];
1281
+ }));
1282
+ if (groupBy.groupOthers && rest.length) {
1283
+ var othersIndex = legend.length;
1284
+ var othersName = PLOT_GROUP_OTHERS_NAME;
1285
+ var suffix = 1;
1286
+ while (categoryOrder.has(othersName)) {
1287
+ othersName = "".concat(PLOT_GROUP_OTHERS_NAME, " (grouped").concat(suffix > 1 ? " ".concat(suffix) : '', ")");
1288
+ suffix += 1;
1289
+ }
1290
+ legend.push({
1291
+ name: othersName,
1292
+ color: othersSeriesColor(colorRange, histogramDomainColors(colorRange, categoryOrder))
1293
+ });
1294
+ rest.forEach(function (key) {
1295
+ return keyToGroup.set(key, othersIndex);
1296
+ });
1297
+ }
1298
+ var groupedBins = {};
1299
+ var _loop = function _loop() {
1300
+ var dataId = _Object$keys2[_i4];
1301
+ var getGroup = accessors.get(dataId);
1302
+ groupedBins[dataId] = getGroup ? (bins[dataId] || []).map(function (bin) {
1303
+ var counts = new Array(legend.length).fill(0);
1304
+ var _iterator8 = _createForOfIteratorHelper(bin.indexes || []),
1305
+ _step8;
1306
+ try {
1307
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1308
+ var _index7 = _step8.value;
1309
+ var key = getCategoryKey(getGroup(_index7));
1310
+ var groupIndex = key === null ? undefined : keyToGroup.get(key);
1311
+ if (groupIndex !== undefined) {
1312
+ counts[groupIndex] += 1;
1313
+ }
1314
+ }
1315
+ } catch (err) {
1316
+ _iterator8.e(err);
1317
+ } finally {
1318
+ _iterator8.f();
1319
+ }
1320
+ return _objectSpread(_objectSpread({}, bin), {}, {
1321
+ segments: legend.flatMap(function (group, index) {
1322
+ return counts[index] ? [_objectSpread(_objectSpread({}, group), {}, {
1323
+ count: counts[index]
1324
+ })] : [];
1325
+ })
1326
+ });
1327
+ }) : bins[dataId];
1328
+ };
1329
+ for (var _i4 = 0, _Object$keys2 = Object.keys(bins); _i4 < _Object$keys2.length; _i4++) {
1330
+ _loop();
1331
+ }
1332
+ return {
1333
+ bins: groupedBins,
1334
+ legend: legend
1335
+ };
1336
+ }
987
1337
 
988
1338
  /**
989
1339
  * Split time bins into one line per group-by value.
@@ -991,7 +1341,7 @@ function groupLimit(numGroups) {
991
1341
  * Remaining values fold into an Others series when groupOthers is set.
992
1342
  */
993
1343
  function buildGroupedLineSeries(_ref4) {
994
- var _plotType$groupBy;
1344
+ var _plotType$groupBy2;
995
1345
  var bins = _ref4.bins,
996
1346
  dataset = _ref4.dataset,
997
1347
  plotType = _ref4.plotType,
@@ -1007,16 +1357,16 @@ function buildGroupedLineSeries(_ref4) {
1007
1357
  }
1008
1358
  var order = [];
1009
1359
  var seen = new Set();
1010
- var _iterator4 = _createForOfIteratorHelper(bins),
1011
- _step4;
1360
+ var _iterator10 = _createForOfIteratorHelper(bins),
1361
+ _step10;
1012
1362
  try {
1013
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1014
- var bin = _step4.value;
1015
- var _iterator6 = _createForOfIteratorHelper(bin.indexes || []),
1016
- _step6;
1363
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1364
+ var bin = _step10.value;
1365
+ var _iterator12 = _createForOfIteratorHelper(bin.indexes || []),
1366
+ _step12;
1017
1367
  try {
1018
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1019
- var idx = _step6.value;
1368
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
1369
+ var idx = _step12.value;
1020
1370
  var key = toGroupKey(getGroup(idx));
1021
1371
  if (key === null || seen.has(key)) {
1022
1372
  continue;
@@ -1025,15 +1375,15 @@ function buildGroupedLineSeries(_ref4) {
1025
1375
  order.push(key);
1026
1376
  }
1027
1377
  } catch (err) {
1028
- _iterator6.e(err);
1378
+ _iterator12.e(err);
1029
1379
  } finally {
1030
- _iterator6.f();
1380
+ _iterator12.f();
1031
1381
  }
1032
1382
  }
1033
1383
  } catch (err) {
1034
- _iterator4.e(err);
1384
+ _iterator10.e(err);
1035
1385
  } finally {
1036
- _iterator4.f();
1386
+ _iterator10.f();
1037
1387
  }
1038
1388
  if (!order.length) {
1039
1389
  return null;
@@ -1042,7 +1392,7 @@ function buildGroupedLineSeries(_ref4) {
1042
1392
  var keep = order.slice(0, limit);
1043
1393
  var rest = order.slice(keep.length);
1044
1394
  var includeOthers = Boolean(cache.groupOthers) && rest.length > 0;
1045
- var colorRange = plotType === null || plotType === void 0 || (_plotType$groupBy = plotType.groupBy) === null || _plotType$groupBy === void 0 ? void 0 : _plotType$groupBy.colorRange;
1395
+ var colorRange = plotType === null || plotType === void 0 || (_plotType$groupBy2 = plotType.groupBy) === null || _plotType$groupBy2 === void 0 ? void 0 : _plotType$groupBy2.colorRange;
1046
1396
  var groups = keep.map(function (key, index) {
1047
1397
  return {
1048
1398
  name: key,
@@ -1073,20 +1423,20 @@ function buildGroupedLineSeries(_ref4) {
1073
1423
  var seriesPoints = [];
1074
1424
  bins.forEach(function (bin) {
1075
1425
  var indexes = [];
1076
- var _iterator5 = _createForOfIteratorHelper(bin.indexes || []),
1077
- _step5;
1426
+ var _iterator11 = _createForOfIteratorHelper(bin.indexes || []),
1427
+ _step11;
1078
1428
  try {
1079
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1080
- var idx = _step5.value;
1429
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
1430
+ var idx = _step11.value;
1081
1431
  var key = toGroupKey(getGroup(idx));
1082
1432
  if (key !== null && keyToGroup.get(key) === groupIndex) {
1083
1433
  indexes.push(idx);
1084
1434
  }
1085
1435
  }
1086
1436
  } catch (err) {
1087
- _iterator5.e(err);
1437
+ _iterator11.e(err);
1088
1438
  } finally {
1089
- _iterator5.f();
1439
+ _iterator11.f();
1090
1440
  }
1091
1441
  var y = indexes.length ? getYValue(_objectSpread(_objectSpread({}, bin), {}, {
1092
1442
  indexes: indexes,
@@ -1307,19 +1657,19 @@ export function adjustValueToAnimationWindow(state, filter, plotBaseIndexByDataI
1307
1657
  */
1308
1658
  function getFilterPlotColorsByDataId(filter, datasets, oldColorsByDataId) {
1309
1659
  var colorsByDataId = oldColorsByDataId || {};
1310
- var _iterator7 = _createForOfIteratorHelper(filter.dataId),
1311
- _step7;
1660
+ var _iterator13 = _createForOfIteratorHelper(filter.dataId),
1661
+ _step13;
1312
1662
  try {
1313
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1314
- var dataId = _step7.value;
1663
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
1664
+ var dataId = _step13.value;
1315
1665
  if (!colorsByDataId[dataId] && datasets[dataId]) {
1316
1666
  colorsByDataId = _objectSpread(_objectSpread({}, colorsByDataId), {}, _defineProperty({}, dataId, rgbToHex(datasets[dataId].color)));
1317
1667
  }
1318
1668
  }
1319
1669
  } catch (err) {
1320
- _iterator7.e(err);
1670
+ _iterator13.e(err);
1321
1671
  } finally {
1322
- _iterator7.f();
1672
+ _iterator13.f();
1323
1673
  }
1324
1674
  return colorsByDataId;
1325
1675
  }