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

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/cjs/plot.js CHANGED
@@ -10,6 +10,7 @@ exports.binByTime = binByTime;
10
10
  exports.defaultPlotGroupColorRange = defaultPlotGroupColorRange;
11
11
  exports.getAggregationOptiosnBasedOnField = void 0;
12
12
  exports.getBinThresholds = getBinThresholds;
13
+ exports.getCategoricalHistogram = getCategoricalHistogram;
13
14
  exports.getChartTitle = getChartTitle;
14
15
  exports.getDefaultPlotType = getDefaultPlotType;
15
16
  exports.getFilterBinThresholds = getFilterBinThresholds;
@@ -49,6 +50,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
49
50
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
50
51
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
51
52
  var _d3Array = require("d3-array");
53
+ var _d3Format = require("d3-format");
52
54
  var _isEqual = _interopRequireDefault(require("es-toolkit/compat/isEqual"));
53
55
  var _time = require("./time");
54
56
  var _commonUtils = require("@kepler.gl/common-utils");
@@ -383,8 +385,8 @@ function getTimeBinConfig(interval, domain) {
383
385
  var walk = function walk(value, direction) {
384
386
  var includeCurrent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
385
387
  var date = base.floor(value);
386
- for (var index = 0; index < period; index++) {
387
- if (!includeCurrent || index) date = base.offset(date, direction);
388
+ for (var _index = 0; _index < period; _index++) {
389
+ if (!includeCurrent || _index) date = base.offset(date, direction);
388
390
  if (!Number.isFinite(Number(date))) return date;
389
391
  if (field(date) % step === 0) return date;
390
392
  }
@@ -419,7 +421,7 @@ function getTimeBinConfig(interval, domain) {
419
421
  var thresholds = [];
420
422
  // Include the first boundary strictly after max, even when max is aligned.
421
423
  // This preserves the existing inclusive maximum bin and calendar padding.
422
- for (var index = 0; index <= MAX_TIME_BINS; index++) {
424
+ for (var _index2 = 0; _index2 <= MAX_TIME_BINS; _index2++) {
423
425
  if (!Number.isFinite(boundary)) return null;
424
426
  thresholds.push(boundary);
425
427
  if (boundary > domain[1]) return thresholds;
@@ -503,8 +505,8 @@ function getNumericBinThresholds(domain, interval) {
503
505
  return getNumericBinThresholds(domain, undefined, numBins);
504
506
  }
505
507
  var thresholds = [start];
506
- for (var index = 1; index < count; index++) {
507
- var boundary = start + index * width;
508
+ for (var _index3 = 1; _index3 < count; _index3++) {
509
+ var boundary = start + _index3 * width;
508
510
  if (boundary > thresholds[thresholds.length - 1] && boundary < end) {
509
511
  thresholds.push(boundary);
510
512
  }
@@ -896,7 +898,7 @@ function mergeGroupColorUI(prev, next, numGroups, colorRange) {
896
898
  * `null` clears grouping. Missing fields keep the previous value, then defaults.
897
899
  */
898
900
  function mergePlotGroupBy(prev, next) {
899
- var _ref2, _source$numGroups, _ref3, _source$colorRange;
901
+ var _ref2, _source$numGroups, _ref3, _source$colorRange, _source$source, _source$layerId;
900
902
  if (next === null) {
901
903
  return null;
902
904
  }
@@ -906,13 +908,19 @@ function mergePlotGroupBy(prev, next) {
906
908
  var source = next || {};
907
909
  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;
908
910
  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);
909
- return {
911
+ var groupingSource = (_source$source = source.source) !== null && _source$source !== void 0 ? _source$source : prev === null || prev === void 0 ? void 0 : prev.source;
912
+ var layerId = (_source$layerId = source.layerId) !== null && _source$layerId !== void 0 ? _source$layerId : prev === null || prev === void 0 ? void 0 : prev.layerId;
913
+ return _objectSpread(_objectSpread(_objectSpread({}, groupingSource !== undefined ? {
914
+ source: groupingSource
915
+ } : {}), layerId !== undefined ? {
916
+ layerId: layerId
917
+ } : {}), {}, {
910
918
  fieldName: source.fieldName !== undefined ? source.fieldName : prev === null || prev === void 0 ? void 0 : prev.fieldName,
911
919
  numGroups: numGroups,
912
920
  groupOthers: Boolean(source.groupOthers !== undefined ? source.groupOthers : prev === null || prev === void 0 ? void 0 : prev.groupOthers),
913
921
  colorRange: colorRange,
914
922
  colorUI: mergeGroupColorUI(prev === null || prev === void 0 ? void 0 : prev.colorUI, source.colorUI, numGroups, colorRange)
915
- };
923
+ });
916
924
  }
917
925
  function groupByCacheValue(plotType) {
918
926
  var _groupBy$numGroups, _groupBy$colorRange$c, _groupBy$colorRange, _groupBy$colorRange$c2, _groupBy$colorRange2;
@@ -1026,6 +1034,349 @@ function groupLimit(numGroups) {
1026
1034
  }
1027
1035
  return Math.min(numGroups, MAX_PLOT_NUM_GROUPS);
1028
1036
  }
1037
+ function histogramCategoryKey(value, numeric) {
1038
+ return numeric && typeof value !== 'bigint' && (typeof value !== 'number' || !Number.isFinite(value)) ? null : toGroupKey(value);
1039
+ }
1040
+ function histogramGroupValueAccessor(dataset, fieldName) {
1041
+ var _dataset$fields2;
1042
+ var field = dataset === null || dataset === void 0 || (_dataset$fields2 = dataset.fields) === null || _dataset$fields2 === void 0 ? void 0 : _dataset$fields2.find(function (item) {
1043
+ return item.name === fieldName;
1044
+ });
1045
+ if (!(field !== null && field !== void 0 && field.valueAccessor)) return null;
1046
+ var numeric = field.type === _constants.ALL_FIELD_TYPES.integer || field.type === _constants.ALL_FIELD_TYPES.real;
1047
+ return function (index) {
1048
+ var value = field.valueAccessor({
1049
+ index: index
1050
+ });
1051
+ if (numeric && typeof value === 'number' && Number.isInteger(value) && !Number.isSafeInteger(value)) {
1052
+ var _dataset$dataContaine, _dataset$dataContaine2;
1053
+ // Table accessors convert Int64 cells to Number; categories need the exact raw integer.
1054
+ 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);
1055
+ if (typeof rawValue === 'bigint') return rawValue;
1056
+ }
1057
+ return value;
1058
+ };
1059
+ }
1060
+
1061
+ // Filter updates replace dataset wrappers, but keep the accessor and data revision.
1062
+ // Weak keys release the domain when its field is replaced or the dataset is removed.
1063
+ var histogramCategoryDomains = new WeakMap();
1064
+ function histogramCategoryDomain(dataset, field, numeric, getGroup) {
1065
+ var dataContainer = dataset.dataContainer,
1066
+ dataRevision = dataset.dataRevision,
1067
+ allIndexes = dataset.allIndexes;
1068
+ var cached = histogramCategoryDomains.get(field.valueAccessor);
1069
+ if (cached && cached.dataContainer === dataContainer && cached.dataRevision === dataRevision && cached.allIndexes === allIndexes && cached.numeric === numeric) {
1070
+ return cached;
1071
+ }
1072
+ var order = new Map();
1073
+ var canUseNumericRanges = numeric;
1074
+ var lower = Infinity;
1075
+ var upper = -Infinity;
1076
+ var _iterator4 = _createForOfIteratorHelper(allIndexes || []),
1077
+ _step4;
1078
+ try {
1079
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1080
+ var _index4 = _step4.value;
1081
+ var value = getGroup(_index4);
1082
+ var key = histogramCategoryKey(value, numeric);
1083
+ if (key === null) continue;
1084
+ if (!order.has(key)) order.set(key, order.size);
1085
+ if (numeric) {
1086
+ var number = Number(value);
1087
+ lower = Math.min(lower, number);
1088
+ upper = Math.max(upper, number);
1089
+ if (typeof value === 'bigint' && !Number.isSafeInteger(number)) {
1090
+ canUseNumericRanges = false;
1091
+ }
1092
+ }
1093
+ }
1094
+ } catch (err) {
1095
+ _iterator4.e(err);
1096
+ } finally {
1097
+ _iterator4.f();
1098
+ }
1099
+ var domain = {
1100
+ dataContainer: dataContainer,
1101
+ dataRevision: dataRevision,
1102
+ allIndexes: allIndexes,
1103
+ numeric: numeric,
1104
+ order: order,
1105
+ canUseNumericRanges: canUseNumericRanges,
1106
+ lower: lower,
1107
+ upper: upper
1108
+ };
1109
+ // Callers without a revision cannot promise that an accessor's data is unchanged.
1110
+ if (Number.isFinite(dataRevision) && allIndexes) {
1111
+ histogramCategoryDomains.set(field.valueAccessor, domain);
1112
+ }
1113
+ return domain;
1114
+ }
1115
+
1116
+ /** Colors used by the complete domain, without coloring every distinct category. */
1117
+ function histogramDomainColors(colorRange, order) {
1118
+ var _colorRange$colors2;
1119
+ var palette = colorRange !== null && colorRange !== void 0 && (_colorRange$colors2 = colorRange.colors) !== null && _colorRange$colors2 !== void 0 && _colorRange$colors2.length ? colorRange.colors : FALLBACK_SERIES_COLORS;
1120
+ var counts = palette.map(function (_, index) {
1121
+ return Math.max(0, Math.ceil((order.size - index) / palette.length));
1122
+ });
1123
+ var mappedColors = new Map();
1124
+ var _iterator5 = _createForOfIteratorHelper((colorRange === null || colorRange === void 0 ? void 0 : colorRange.colorMap) || []),
1125
+ _step5;
1126
+ try {
1127
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1128
+ var _step5$value = (0, _slicedToArray2["default"])(_step5.value, 2),
1129
+ values = _step5$value[0],
1130
+ color = _step5$value[1];
1131
+ if (!color || !Array.isArray(values) && (values === null || values === undefined)) continue;
1132
+ var _iterator6 = _createForOfIteratorHelper(Array.isArray(values) ? values : [values]),
1133
+ _step6;
1134
+ try {
1135
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1136
+ var value = _step6.value;
1137
+ var key = String(value);
1138
+ var _index5 = order.get(key);
1139
+ // mappedSeriesColor uses the first matching override.
1140
+ if (_index5 !== undefined && !mappedColors.has(key)) {
1141
+ counts[_index5 % palette.length]--;
1142
+ mappedColors.set(key, color);
1143
+ }
1144
+ }
1145
+ } catch (err) {
1146
+ _iterator6.e(err);
1147
+ } finally {
1148
+ _iterator6.f();
1149
+ }
1150
+ }
1151
+ } catch (err) {
1152
+ _iterator5.e(err);
1153
+ } finally {
1154
+ _iterator5.f();
1155
+ }
1156
+ return [].concat((0, _toConsumableArray2["default"])(palette.filter(function (_, index) {
1157
+ return counts[index] > 0;
1158
+ })), (0, _toConsumableArray2["default"])(mappedColors.values()));
1159
+ }
1160
+
1161
+ /** Split counts by category or numeric range, preserving the original bin totals and indexes. */
1162
+ function getCategoricalHistogram(bins, datasets, plotType) {
1163
+ var _plotType$groupBy;
1164
+ var groupBy = groupByCacheValue(plotType);
1165
+ if (!groupBy || !bins) {
1166
+ return null;
1167
+ }
1168
+ var accessors = new Map();
1169
+ for (var _i3 = 0, _Object$keys = Object.keys(bins); _i3 < _Object$keys.length; _i3++) {
1170
+ var dataId = _Object$keys[_i3];
1171
+ var getGroup = histogramGroupValueAccessor(datasets === null || datasets === void 0 ? void 0 : datasets[dataId], groupBy.fieldName);
1172
+ if (getGroup) {
1173
+ accessors.set(dataId, getGroup);
1174
+ }
1175
+ }
1176
+ var numericFields = accessors.size > 0 && Array.from(accessors.keys()).every(function (dataId) {
1177
+ var field = datasets[dataId].fields.find(function (item) {
1178
+ return item.name === groupBy.fieldName;
1179
+ });
1180
+ return field.type === _constants.ALL_FIELD_TYPES.integer || field.type === _constants.ALL_FIELD_TYPES.real;
1181
+ });
1182
+ var canUseNumericRanges = numericFields;
1183
+ var getCategoryKey = function getCategoryKey(value) {
1184
+ if (numericFields && typeof value === 'bigint' && !Number.isSafeInteger(Number(value))) {
1185
+ // Preserve exact categories for Int64 identifiers that Number cannot represent.
1186
+ canUseNumericRanges = false;
1187
+ }
1188
+ return histogramCategoryKey(value, numericFields);
1189
+ };
1190
+ var categoryOrder = new Map();
1191
+ var presentCategories = new Set();
1192
+ var lower = Infinity;
1193
+ var upper = -Infinity;
1194
+ var _iterator7 = _createForOfIteratorHelper(accessors),
1195
+ _step7;
1196
+ try {
1197
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1198
+ var _step7$value = (0, _slicedToArray2["default"])(_step7.value, 2),
1199
+ _dataId2 = _step7$value[0],
1200
+ _getGroup = _step7$value[1];
1201
+ // Use the complete dataset to keep a category's color stable as other filters change.
1202
+ var dataset = datasets[_dataId2];
1203
+ var field = dataset.fields.find(function (item) {
1204
+ return item.name === groupBy.fieldName;
1205
+ });
1206
+ var domain = histogramCategoryDomain(dataset, field, numericFields, _getGroup);
1207
+ canUseNumericRanges = canUseNumericRanges && domain.canUseNumericRanges;
1208
+ lower = Math.min(lower, domain.lower);
1209
+ upper = Math.max(upper, domain.upper);
1210
+ // Reuse the usual single-dataset order; copy only when adding uncached categories.
1211
+ if (!categoryOrder.size) {
1212
+ categoryOrder = domain.order;
1213
+ } else {
1214
+ categoryOrder = new Map(categoryOrder);
1215
+ var _iterator9 = _createForOfIteratorHelper(domain.order.keys()),
1216
+ _step9;
1217
+ try {
1218
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1219
+ var key = _step9.value;
1220
+ if (!categoryOrder.has(key)) categoryOrder.set(key, categoryOrder.size);
1221
+ }
1222
+ } catch (err) {
1223
+ _iterator9.e(err);
1224
+ } finally {
1225
+ _iterator9.f();
1226
+ }
1227
+ }
1228
+ var _iterator0 = _createForOfIteratorHelper(bins[_dataId2] || []),
1229
+ _step0;
1230
+ try {
1231
+ for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
1232
+ var bin = _step0.value;
1233
+ var _iterator1 = _createForOfIteratorHelper(bin.indexes || []),
1234
+ _step1;
1235
+ try {
1236
+ for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
1237
+ var _index8 = _step1.value;
1238
+ var _key = getCategoryKey(_getGroup(_index8));
1239
+ if (_key !== null) {
1240
+ if (!categoryOrder.has(_key)) {
1241
+ if (categoryOrder === domain.order) categoryOrder = new Map(categoryOrder);
1242
+ categoryOrder.set(_key, categoryOrder.size);
1243
+ }
1244
+ if (numericFields) {
1245
+ lower = Math.min(lower, Number(_key));
1246
+ upper = Math.max(upper, Number(_key));
1247
+ }
1248
+ presentCategories.add(_key);
1249
+ }
1250
+ }
1251
+ } catch (err) {
1252
+ _iterator1.e(err);
1253
+ } finally {
1254
+ _iterator1.f();
1255
+ }
1256
+ }
1257
+ } catch (err) {
1258
+ _iterator0.e(err);
1259
+ } finally {
1260
+ _iterator0.f();
1261
+ }
1262
+ }
1263
+ } catch (err) {
1264
+ _iterator7.e(err);
1265
+ } finally {
1266
+ _iterator7.f();
1267
+ }
1268
+ if (!presentCategories.size) {
1269
+ return null;
1270
+ }
1271
+ var limit = Math.max(1, Math.floor(groupLimit(groupBy.numGroups)));
1272
+ if (canUseNumericRanges && categoryOrder.size > limit) {
1273
+ var boundaries = [lower];
1274
+ for (var _index6 = 1; _index6 < limit; _index6++) {
1275
+ var fraction = _index6 / limit;
1276
+ // Convex interpolation avoids overflowing upper - lower on extreme finite domains.
1277
+ var boundary = lower * (1 - fraction) + upper * fraction;
1278
+ if (Number.isFinite(boundary) && boundary > boundaries[boundaries.length - 1] && boundary < upper) {
1279
+ boundaries.push(boundary);
1280
+ }
1281
+ }
1282
+ boundaries.push(upper);
1283
+ var labels = boundaries.map(function (value) {
1284
+ return (0, _dataUtils.formatNumber)(value, _constants.ALL_FIELD_TYPES.real);
1285
+ });
1286
+ // Keep labels compact, adding precision only when different bounds would look identical.
1287
+ // Membership still uses the original numeric thresholds, never the rounded labels.
1288
+ for (var precision = 5; precision <= 17 && (new Set(labels).size < labels.length || labels.some(function (label) {
1289
+ return label.length > 24;
1290
+ })); precision++) {
1291
+ labels = boundaries.map((0, _d3Format.format)(".".concat(precision, "~g")));
1292
+ }
1293
+ var ranges = boundaries.slice(1).map(function (_, index) {
1294
+ var last = index === boundaries.length - 2;
1295
+ return "".concat(labels[index], " \u2264 x ").concat(last ? '≤' : '<', " ").concat(labels[index + 1]);
1296
+ });
1297
+ var thresholds = boundaries.slice(1, -1);
1298
+ var numericKey = getCategoryKey;
1299
+ getCategoryKey = function getCategoryKey(value) {
1300
+ var key = numericKey(value);
1301
+ return key === null ? null : ranges[(0, _d3Array.bisectRight)(thresholds, Number(key))];
1302
+ };
1303
+ presentCategories = new Set(Array.from(presentCategories, function (key) {
1304
+ return ranges[(0, _d3Array.bisectRight)(thresholds, Number(key))];
1305
+ }));
1306
+ categoryOrder = new Map(ranges.map(function (name, index) {
1307
+ return [name, index];
1308
+ }));
1309
+ }
1310
+ var colorRange = plotType === null || plotType === void 0 || (_plotType$groupBy = plotType.groupBy) === null || _plotType$groupBy === void 0 ? void 0 : _plotType$groupBy.colorRange;
1311
+ var order = Array.from(categoryOrder.keys()).filter(function (name) {
1312
+ return presentCategories.has(name);
1313
+ });
1314
+ var keep = order.slice(0, limit);
1315
+ var rest = order.slice(keep.length);
1316
+ var legend = keep.map(function (name) {
1317
+ return {
1318
+ name: name,
1319
+ color: seriesColor(colorRange, name, categoryOrder.get(name))
1320
+ };
1321
+ });
1322
+ var keyToGroup = new Map(keep.map(function (name, index) {
1323
+ return [name, index];
1324
+ }));
1325
+ if (groupBy.groupOthers && rest.length) {
1326
+ var othersIndex = legend.length;
1327
+ var othersName = PLOT_GROUP_OTHERS_NAME;
1328
+ var suffix = 1;
1329
+ while (categoryOrder.has(othersName)) {
1330
+ othersName = "".concat(PLOT_GROUP_OTHERS_NAME, " (grouped").concat(suffix > 1 ? " ".concat(suffix) : '', ")");
1331
+ suffix += 1;
1332
+ }
1333
+ legend.push({
1334
+ name: othersName,
1335
+ color: othersSeriesColor(colorRange, histogramDomainColors(colorRange, categoryOrder))
1336
+ });
1337
+ rest.forEach(function (key) {
1338
+ return keyToGroup.set(key, othersIndex);
1339
+ });
1340
+ }
1341
+ var groupedBins = {};
1342
+ var _loop = function _loop() {
1343
+ var dataId = _Object$keys2[_i4];
1344
+ var getGroup = accessors.get(dataId);
1345
+ groupedBins[dataId] = getGroup ? (bins[dataId] || []).map(function (bin) {
1346
+ var counts = new Array(legend.length).fill(0);
1347
+ var _iterator8 = _createForOfIteratorHelper(bin.indexes || []),
1348
+ _step8;
1349
+ try {
1350
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1351
+ var _index7 = _step8.value;
1352
+ var key = getCategoryKey(getGroup(_index7));
1353
+ var groupIndex = key === null ? undefined : keyToGroup.get(key);
1354
+ if (groupIndex !== undefined) {
1355
+ counts[groupIndex] += 1;
1356
+ }
1357
+ }
1358
+ } catch (err) {
1359
+ _iterator8.e(err);
1360
+ } finally {
1361
+ _iterator8.f();
1362
+ }
1363
+ return _objectSpread(_objectSpread({}, bin), {}, {
1364
+ segments: legend.flatMap(function (group, index) {
1365
+ return counts[index] ? [_objectSpread(_objectSpread({}, group), {}, {
1366
+ count: counts[index]
1367
+ })] : [];
1368
+ })
1369
+ });
1370
+ }) : bins[dataId];
1371
+ };
1372
+ for (var _i4 = 0, _Object$keys2 = Object.keys(bins); _i4 < _Object$keys2.length; _i4++) {
1373
+ _loop();
1374
+ }
1375
+ return {
1376
+ bins: groupedBins,
1377
+ legend: legend
1378
+ };
1379
+ }
1029
1380
 
1030
1381
  /**
1031
1382
  * Split time bins into one line per group-by value.
@@ -1033,7 +1384,7 @@ function groupLimit(numGroups) {
1033
1384
  * Remaining values fold into an Others series when groupOthers is set.
1034
1385
  */
1035
1386
  function buildGroupedLineSeries(_ref4) {
1036
- var _plotType$groupBy;
1387
+ var _plotType$groupBy2;
1037
1388
  var bins = _ref4.bins,
1038
1389
  dataset = _ref4.dataset,
1039
1390
  plotType = _ref4.plotType,
@@ -1049,16 +1400,16 @@ function buildGroupedLineSeries(_ref4) {
1049
1400
  }
1050
1401
  var order = [];
1051
1402
  var seen = new Set();
1052
- var _iterator4 = _createForOfIteratorHelper(bins),
1053
- _step4;
1403
+ var _iterator10 = _createForOfIteratorHelper(bins),
1404
+ _step10;
1054
1405
  try {
1055
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1056
- var bin = _step4.value;
1057
- var _iterator6 = _createForOfIteratorHelper(bin.indexes || []),
1058
- _step6;
1406
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1407
+ var bin = _step10.value;
1408
+ var _iterator12 = _createForOfIteratorHelper(bin.indexes || []),
1409
+ _step12;
1059
1410
  try {
1060
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1061
- var idx = _step6.value;
1411
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
1412
+ var idx = _step12.value;
1062
1413
  var key = toGroupKey(getGroup(idx));
1063
1414
  if (key === null || seen.has(key)) {
1064
1415
  continue;
@@ -1067,15 +1418,15 @@ function buildGroupedLineSeries(_ref4) {
1067
1418
  order.push(key);
1068
1419
  }
1069
1420
  } catch (err) {
1070
- _iterator6.e(err);
1421
+ _iterator12.e(err);
1071
1422
  } finally {
1072
- _iterator6.f();
1423
+ _iterator12.f();
1073
1424
  }
1074
1425
  }
1075
1426
  } catch (err) {
1076
- _iterator4.e(err);
1427
+ _iterator10.e(err);
1077
1428
  } finally {
1078
- _iterator4.f();
1429
+ _iterator10.f();
1079
1430
  }
1080
1431
  if (!order.length) {
1081
1432
  return null;
@@ -1084,7 +1435,7 @@ function buildGroupedLineSeries(_ref4) {
1084
1435
  var keep = order.slice(0, limit);
1085
1436
  var rest = order.slice(keep.length);
1086
1437
  var includeOthers = Boolean(cache.groupOthers) && rest.length > 0;
1087
- var colorRange = plotType === null || plotType === void 0 || (_plotType$groupBy = plotType.groupBy) === null || _plotType$groupBy === void 0 ? void 0 : _plotType$groupBy.colorRange;
1438
+ var colorRange = plotType === null || plotType === void 0 || (_plotType$groupBy2 = plotType.groupBy) === null || _plotType$groupBy2 === void 0 ? void 0 : _plotType$groupBy2.colorRange;
1088
1439
  var groups = keep.map(function (key, index) {
1089
1440
  return {
1090
1441
  name: key,
@@ -1115,20 +1466,20 @@ function buildGroupedLineSeries(_ref4) {
1115
1466
  var seriesPoints = [];
1116
1467
  bins.forEach(function (bin) {
1117
1468
  var indexes = [];
1118
- var _iterator5 = _createForOfIteratorHelper(bin.indexes || []),
1119
- _step5;
1469
+ var _iterator11 = _createForOfIteratorHelper(bin.indexes || []),
1470
+ _step11;
1120
1471
  try {
1121
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1122
- var idx = _step5.value;
1472
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
1473
+ var idx = _step11.value;
1123
1474
  var key = toGroupKey(getGroup(idx));
1124
1475
  if (key !== null && keyToGroup.get(key) === groupIndex) {
1125
1476
  indexes.push(idx);
1126
1477
  }
1127
1478
  }
1128
1479
  } catch (err) {
1129
- _iterator5.e(err);
1480
+ _iterator11.e(err);
1130
1481
  } finally {
1131
- _iterator5.f();
1482
+ _iterator11.f();
1132
1483
  }
1133
1484
  var y = indexes.length ? getYValue(_objectSpread(_objectSpread({}, bin), {}, {
1134
1485
  indexes: indexes,
@@ -1349,19 +1700,19 @@ function adjustValueToAnimationWindow(state, filter, plotBaseIndexByDataId) {
1349
1700
  */
1350
1701
  function getFilterPlotColorsByDataId(filter, datasets, oldColorsByDataId) {
1351
1702
  var colorsByDataId = oldColorsByDataId || {};
1352
- var _iterator7 = _createForOfIteratorHelper(filter.dataId),
1353
- _step7;
1703
+ var _iterator13 = _createForOfIteratorHelper(filter.dataId),
1704
+ _step13;
1354
1705
  try {
1355
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1356
- var dataId = _step7.value;
1706
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
1707
+ var dataId = _step13.value;
1357
1708
  if (!colorsByDataId[dataId] && datasets[dataId]) {
1358
1709
  colorsByDataId = _objectSpread(_objectSpread({}, colorsByDataId), {}, (0, _defineProperty2["default"])({}, dataId, (0, _colorUtils.rgbToHex)(datasets[dataId].color)));
1359
1710
  }
1360
1711
  }
1361
1712
  } catch (err) {
1362
- _iterator7.e(err);
1713
+ _iterator13.e(err);
1363
1714
  } finally {
1364
- _iterator7.f();
1715
+ _iterator13.f();
1365
1716
  }
1366
1717
  return colorsByDataId;
1367
1718
  }