@splunk/visualizations 26.1.1 → 26.2.0

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.
Files changed (159) hide show
  1. package/Area.config.js +2 -1
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +1562 -433
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +1 -0
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +1555 -430
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +1 -0
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +1580 -455
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +1 -0
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +1418 -351
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +2 -1
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +1564 -435
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +1 -0
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +1342 -297
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +4 -0
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +1503 -489
  28. package/Events.js.map +1 -1
  29. package/FEATUREFLAGS.md +3 -0
  30. package/FillerGauge.config.js +1 -0
  31. package/FillerGauge.config.js.map +1 -1
  32. package/FillerGauge.js +1406 -345
  33. package/FillerGauge.js.map +1 -1
  34. package/Image.config.js +1 -0
  35. package/Image.config.js.map +1 -1
  36. package/Image.js +2355 -1183
  37. package/Image.js.map +1 -1
  38. package/Line.config.js +2 -1
  39. package/Line.config.js.map +1 -1
  40. package/Line.js +1562 -433
  41. package/Line.js.map +1 -1
  42. package/LinkGraph.config.js +1 -0
  43. package/LinkGraph.config.js.map +1 -1
  44. package/LinkGraph.js +2013 -968
  45. package/LinkGraph.js.map +1 -1
  46. package/Map.config.js +1 -0
  47. package/Map.config.js.map +1 -1
  48. package/Map.js +2556 -1527
  49. package/Map.js.map +1 -1
  50. package/Markdown.config.js +1 -0
  51. package/Markdown.config.js.map +1 -1
  52. package/Markdown.js +1952 -883
  53. package/Markdown.js.map +1 -1
  54. package/MarkerGauge.config.js +1 -0
  55. package/MarkerGauge.config.js.map +1 -1
  56. package/MarkerGauge.js +4049 -2965
  57. package/MarkerGauge.js.map +1 -1
  58. package/ParallelCoordinates.config.js +1 -0
  59. package/ParallelCoordinates.config.js.map +1 -1
  60. package/ParallelCoordinates.js +3286 -2215
  61. package/ParallelCoordinates.js.map +1 -1
  62. package/Pie.config.js +1 -0
  63. package/Pie.config.js.map +1 -1
  64. package/Pie.js +2187 -1036
  65. package/Pie.js.map +1 -1
  66. package/Punchcard.config.js +1 -0
  67. package/Punchcard.config.js.map +1 -1
  68. package/Punchcard.js +3397 -2299
  69. package/Punchcard.js.map +1 -1
  70. package/Rectangle.config.js +1 -0
  71. package/Rectangle.config.js.map +1 -1
  72. package/Rectangle.js +2181 -1112
  73. package/Rectangle.js.map +1 -1
  74. package/Sankey.config.js +1 -0
  75. package/Sankey.config.js.map +1 -1
  76. package/Sankey.js +3275 -2199
  77. package/Sankey.js.map +1 -1
  78. package/Scatter.config.js +1 -0
  79. package/Scatter.config.js.map +1 -1
  80. package/Scatter.js +3551 -2400
  81. package/Scatter.js.map +1 -1
  82. package/SingleValue.config.js +27 -0
  83. package/SingleValue.config.js.map +1 -1
  84. package/SingleValue.js +5551 -4397
  85. package/SingleValue.js.map +1 -1
  86. package/SingleValueBasic.js +1227 -1209
  87. package/SingleValueBasic.js.map +1 -1
  88. package/SingleValueIcon.config.js +27 -0
  89. package/SingleValueIcon.config.js.map +1 -1
  90. package/SingleValueIcon.js +2850 -1696
  91. package/SingleValueIcon.js.map +1 -1
  92. package/SingleValueRadial.config.js +1 -0
  93. package/SingleValueRadial.config.js.map +1 -1
  94. package/SingleValueRadial.js +6334 -5215
  95. package/SingleValueRadial.js.map +1 -1
  96. package/SparkLine.js +96 -96
  97. package/SparkLine.js.map +1 -1
  98. package/Table.config.js +172 -7
  99. package/Table.config.js.map +1 -1
  100. package/Table.js +3517 -2212
  101. package/Table.js.map +1 -1
  102. package/common/Charting.js +1009 -82
  103. package/common/Charting.js.map +1 -1
  104. package/common/ChartingApi.js +4 -4
  105. package/common/ChartingApi.js.map +1 -1
  106. package/common/DocExampleWithVizSandbox.js +54 -57
  107. package/common/DocExampleWithVizSandbox.js.map +1 -1
  108. package/common/EventsDoc.js +40 -40
  109. package/common/EventsDoc.js.map +1 -1
  110. package/common/GaugeMajorTicks.js +15 -13
  111. package/common/GaugeMajorTicks.js.map +1 -1
  112. package/common/GaugeValueMarker.js +12 -12
  113. package/common/GaugeValueMarker.js.map +1 -1
  114. package/common/OptionsDoc.js +34 -34
  115. package/common/OptionsDoc.js.map +1 -1
  116. package/common/OverviewDoc.js +124 -103
  117. package/common/OverviewDoc.js.map +1 -1
  118. package/common/SplunkVisualization.js +49 -49
  119. package/common/SplunkVisualization.js.map +1 -1
  120. package/common/SplunkVisualizationApi.js +4 -4
  121. package/common/SplunkVisualizationApi.js.map +1 -1
  122. package/common/ThemesDoc.js +31 -31
  123. package/common/ThemesDoc.js.map +1 -1
  124. package/common/chartingUtils.js +24 -8
  125. package/common/chartingUtils.js.map +1 -1
  126. package/common/docUtils.js +4 -4
  127. package/common/docUtils.js.map +1 -1
  128. package/common/gaugeUtils.js +16 -16
  129. package/common/gaugeUtils.js.map +1 -1
  130. package/common/shapeUtils.js +36 -36
  131. package/common/shapeUtils.js.map +1 -1
  132. package/common/utils/configUtils.js +48 -47
  133. package/common/utils/configUtils.js.map +1 -1
  134. package/common/utils/dataUtils.js +832 -6
  135. package/common/utils/dataUtils.js.map +1 -1
  136. package/common/utils/featureFlagUtils.js +139 -0
  137. package/common/utils/featureFlagUtils.js.map +1 -0
  138. package/common/utils/hocUtils.js +2 -2
  139. package/common/utils/hocUtils.js.map +1 -1
  140. package/common/utils/layoutUtils.js +2 -2
  141. package/common/utils/layoutUtils.js.map +1 -1
  142. package/common/utils/mapUtils.js +77 -54
  143. package/common/utils/mapUtils.js.map +1 -1
  144. package/common/utils/singleValueUtils.js +28 -19
  145. package/common/utils/singleValueUtils.js.map +1 -1
  146. package/common/utils/testHelper.js +10 -10
  147. package/common/utils/testHelper.js.map +1 -1
  148. package/common/utils/trellisUtils.js +6 -6
  149. package/common/utils/trellisUtils.js.map +1 -1
  150. package/common/utils/urlUtils.js +2 -2
  151. package/common/utils/urlUtils.js.map +1 -1
  152. package/common/withDashboardViz.js +1313 -235
  153. package/common/withDashboardViz.js.map +1 -1
  154. package/package.json +13 -12
  155. package/__mocks__/fileMock.js +0 -2
  156. package/__mocks__/styleMock.js +0 -2
  157. package/babel.config.js +0 -11
  158. package/jest.config.js +0 -8
  159. package/loki.config.js +0 -14
package/Line.js CHANGED
@@ -87,20 +87,20 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 224);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 246);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
94
94
  /* 0 */
95
95
  /***/ (function(module, exports) {
96
96
 
97
- module.exports = require("prop-types");
97
+ module.exports = require("react");
98
98
 
99
99
  /***/ }),
100
100
  /* 1 */
101
101
  /***/ (function(module, exports) {
102
102
 
103
- module.exports = require("react");
103
+ module.exports = require("prop-types");
104
104
 
105
105
  /***/ }),
106
106
  /* 2 */
@@ -148,6 +148,7 @@ var VizBehavior;
148
148
  */
149
149
  VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
150
150
  VizBehavior["EVENTS"] = "events";
151
+ VizBehavior["DOWNSAMPLING"] = "downsampling";
151
152
  /**
152
153
  * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
153
154
  * missing.
@@ -163,7 +164,7 @@ var VizBehavior;
163
164
  /* 7 */
164
165
  /***/ (function(module, exports) {
165
166
 
166
- module.exports = require("@babel/runtime/helpers/defineProperty");
167
+ module.exports = require("@babel/runtime/helpers/slicedToArray");
167
168
 
168
169
  /***/ }),
169
170
  /* 8 */
@@ -175,28 +176,34 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
175
176
  /* 9 */
176
177
  /***/ (function(module, exports) {
177
178
 
178
- module.exports = require("@babel/runtime/helpers/classCallCheck");
179
+ module.exports = require("@babel/runtime/helpers/defineProperty");
179
180
 
180
181
  /***/ }),
181
182
  /* 10 */
182
183
  /***/ (function(module, exports) {
183
184
 
184
- module.exports = require("@splunk/visualizations-shared/Message");
185
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
185
186
 
186
187
  /***/ }),
187
188
  /* 11 */
188
189
  /***/ (function(module, exports) {
189
190
 
190
- module.exports = require("@splunk/themes/variables");
191
+ module.exports = require("@splunk/visualizations-shared/numberUtils");
191
192
 
192
193
  /***/ }),
193
194
  /* 12 */
194
195
  /***/ (function(module, exports) {
195
196
 
196
- module.exports = require("@splunk/visualizations-shared/colorUtils");
197
+ module.exports = require("@splunk/visualizations-shared/Message");
197
198
 
198
199
  /***/ }),
199
200
  /* 13 */
201
+ /***/ (function(module, exports) {
202
+
203
+ module.exports = require("@splunk/themes/variables");
204
+
205
+ /***/ }),
206
+ /* 14 */
200
207
  /***/ (function(module, exports, __webpack_require__) {
201
208
 
202
209
  "use strict";
@@ -205,16 +212,504 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
205
212
  Object.defineProperty(exports, "__esModule", {
206
213
  value: true
207
214
  });
215
+ exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
216
+
217
+ var numberUtils_1 = __webpack_require__(11);
218
+
219
+ var interfaces_1 = __webpack_require__(40); // TODO: utilize this fn in ParallelCoordinates
220
+
221
+
222
+ var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
223
+ if (!columns || !columns[0] || !columns[0].length) return [];
224
+ var data = [];
225
+
226
+ var _loop = function _loop(i) {
227
+ var newObj = {};
228
+ fields.forEach(function (field, index) {
229
+ var fieldName = typeof field === 'string' ? field : field.name;
230
+
231
+ if (columns[index][i] === '') {
232
+ newObj[fieldName] = null;
233
+ } else {
234
+ newObj[fieldName] = columns[index][i];
235
+ }
236
+ });
237
+ data.push(newObj);
238
+ };
239
+
240
+ for (var i = 0; i < columns[0].length; i += 1) {
241
+ _loop(i);
242
+ }
243
+
244
+ return data;
245
+ };
246
+
247
+ exports.convertToArrOfObjects = convertToArrOfObjects; // LTTB algorithm which can be used to downsample time series data while striving to maintain
248
+ // the spikes and overall shape of the chart
249
+ // Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js
250
+ // Modifications include:
251
+ // 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)
252
+ // 2) Convert to camel case
253
+ // 3) Convert to TS and also return the indices of the points that are in the downsampled result.
254
+ // 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points
255
+ // that should be used in case of a tie of the max area in a bucket
256
+
257
+ var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, threshold, preferredDownsampleIndices) {
258
+ var dataLength = data.length;
259
+ var downsampledIndices = [];
260
+
261
+ if (threshold >= dataLength || threshold === 0) {
262
+ var allIndices = data.map(function (values, index) {
263
+ return index;
264
+ });
265
+ return {
266
+ downsampledData: data,
267
+ downsampledIndices: allIndices
268
+ }; // Nothing to do
269
+ }
270
+
271
+ var sampled = [];
272
+ var sampledIndex = 0; // Bucket size. Leave room for start and end data points
273
+
274
+ var every = (dataLength - 2) / (threshold - 2);
275
+ var a = 0; // Initially a is the first point in the triangle
276
+
277
+ var maxAreaPoint;
278
+ var maxArea;
279
+ var area;
280
+ var nextA;
281
+ sampled.push(data[a]); // Always add the first point
282
+
283
+ downsampledIndices.push(0); // eslint-disable-next-line no-plusplus
284
+
285
+ for (var i = 0; i < threshold - 2; i++) {
286
+ // Calculate point average for next bucket (containing c)
287
+ var avgX = 0;
288
+ var avgY = 0;
289
+ var avgRangeStart = Math.floor((i + 1) * every) + 1;
290
+ var avgRangeEnd = Math.floor((i + 2) * every) + 1;
291
+ avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
292
+ var avgRangeLength = avgRangeEnd - avgRangeStart; // eslint-disable-next-line no-plusplus
293
+
294
+ for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
295
+ avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)
296
+
297
+ avgY += data[avgRangeStart][1] * 1;
298
+ }
299
+
300
+ avgX /= avgRangeLength;
301
+ avgY /= avgRangeLength; // Get the range for this bucket
302
+
303
+ var rangeOffs = Math.floor((i + 0) * every) + 1;
304
+ var rangeTo = Math.floor((i + 1) * every) + 1; // Point a
305
+
306
+ var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
307
+
308
+ var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
309
+
310
+ maxArea = area = -1;
311
+ var maxAreaIndex = rangeOffs; // eslint-disable-next-line no-plusplus
312
+
313
+ for (; rangeOffs < rangeTo; rangeOffs++) {
314
+ // Calculate triangle area over three buckets
315
+ area = Math.abs((pointAX - avgX) * (data[rangeOffs][1] - pointAY) - (pointAX - Number(data[rangeOffs][0])) * (avgY - pointAY)) * 0.5; // Modification: try to downsample the least amount of points possible when there are multiple series
316
+ // If all points in a bucket have the same area, prioritize the one with an x index
317
+ // that also existed from another series so we don't add another point unnecessarily.
318
+ // By default LTTB picks the leftmost point in the bucket
319
+
320
+ if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
321
+ maxArea = area;
322
+ maxAreaPoint = data[rangeOffs];
323
+ nextA = rangeOffs; // Next a is this b
324
+ // Modification: save the index of the point with the most area
325
+
326
+ maxAreaIndex = rangeOffs;
327
+ }
328
+ } // eslint-disable-next-line no-plusplus
329
+
330
+
331
+ sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
332
+
333
+ downsampledIndices.push(maxAreaIndex);
334
+ a = nextA; // This a is the next a (chosen b)
335
+ } // eslint-disable-next-line no-plusplus
336
+
337
+
338
+ sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
339
+
340
+ downsampledIndices.push(dataLength - 1);
341
+ return {
342
+ downsampledData: sampled,
343
+ downsampledIndices: downsampledIndices
344
+ };
345
+ };
346
+ /**
347
+ * Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines
348
+ * if at least one of the values in the column can be loosely coerced to a number.
349
+ * If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and
350
+ * returns that it cannot downsample the column.
351
+ */
352
+
353
+
354
+ var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
355
+ // Splunk charting allows for numbers in formats such as negative hex that
356
+ // Number() does not support and also allows loose coercion of hex numbers (but not other formats)
357
+ // We want to identify columns which contain at least one value that can be loosely coerced
358
+ var canLooselyCoerceSomeValues = column.findIndex(function (value) {
359
+ return (0, numberUtils_1.startsWithNumber)("".concat(value));
360
+ }) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
361
+
362
+ var coercedColumn = [];
363
+ var canDownsampleColumn = !column.some(function (value) {
364
+ var coercedValue = Number(value); // if it can't be parsed or isn't safe, fail
365
+
366
+ if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
367
+ return true;
368
+ } // save value and continue to next
369
+
370
+
371
+ coercedColumn.push(coercedValue);
372
+ return false;
373
+ });
374
+ return {
375
+ canDownsampleColumn: canDownsampleColumn,
376
+ canLooselyCoerceSomeValues: canLooselyCoerceSomeValues,
377
+ coercedColumn: canDownsampleColumn ? coercedColumn : []
378
+ };
379
+ };
380
+ /**
381
+ * Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.
382
+ * Only strictly increasing x-columns are eligible for downsampling.
383
+ * If the column is not eligible for downsampling, returns an empty array.
384
+ */
385
+
386
+
387
+ var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
388
+ if (fieldType === 'number') {
389
+ var coercedXColumn = column.map(function (xValue) {
390
+ return Number(xValue);
391
+ });
392
+
393
+ if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
394
+ return coercedXColumn;
395
+ }
396
+ } else if (fieldType === 'time') {
397
+ var _coercedXColumn = column.map(function (xValue) {
398
+ return new Date(xValue);
399
+ });
400
+
401
+ if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
402
+ return _coercedXColumn;
403
+ }
404
+ }
208
405
 
209
- var React = __webpack_require__(1);
406
+ return [];
407
+ };
408
+
409
+ var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
410
+ var vizConfig = _ref.vizConfig;
411
+
412
+ var _a;
413
+
414
+ return (_a = vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(interfaces_1.VizBehavior.DOWNSAMPLING);
415
+ };
416
+
417
+ exports.isDownsamplingEnabledForViz = isDownsamplingEnabledForViz;
418
+
419
+ var calculateThresholdOnRangeSelect = function calculateThresholdOnRangeSelect(_ref2) {
420
+ var firstIndex = _ref2.firstIndex,
421
+ lastIndex = _ref2.lastIndex,
422
+ dataSources = _ref2.dataSources,
423
+ width = _ref2.width;
424
+
425
+ var _a, _b, _c;
426
+
427
+ var window = lastIndex - firstIndex + 1;
428
+ var ratio = Math.round(Number(((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns[0]) === null || _c === void 0 ? void 0 : _c.length) / window) * 10) / 10;
429
+ return Math.round(ratio * Number(width));
430
+ };
431
+
432
+ exports.calculateThresholdOnRangeSelect = calculateThresholdOnRangeSelect;
433
+ /**
434
+ * Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,
435
+ * then returns the width of the visualization.
436
+ *
437
+ * Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled
438
+ * data sources. Returns null if the chart event's dataset does not match the passed in primary data source or if the chart is zoomed
439
+ * in for a categorical chart.
440
+ */
441
+
442
+ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
443
+ var enableSearchZoom = _ref3.enableSearchZoom,
444
+ dataSources = _ref3.dataSources,
445
+ selectChartEvent = _ref3.selectChartEvent,
446
+ width = _ref3.width,
447
+ xField = _ref3.xField,
448
+ y2Fields = _ref3.y2Fields;
449
+
450
+ var _a, _b, _c;
451
+
452
+ if (enableSearchZoom || !selectChartEvent) {
453
+ return Number(width);
454
+ }
455
+
456
+ var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
457
+
458
+ if (!primaryDataSource) {
459
+ return null;
460
+ }
461
+
462
+ var startXIndex = selectChartEvent.startXIndex,
463
+ endXIndex = selectChartEvent.endXIndex,
464
+ currentTarget = selectChartEvent.currentTarget;
465
+
466
+ try {
467
+ var xFieldIndex = (_a = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _a === void 0 ? void 0 : _a.fields.findIndex(function (field) {
468
+ return field.name === xField;
469
+ });
470
+ var downsampledXFieldIndex = (_b = currentTarget.dataSet) === null || _b === void 0 ? void 0 : _b.fields.findIndex(function (field) {
471
+ return field === xField;
472
+ });
473
+
474
+ if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
475
+ return null;
476
+ }
477
+
478
+ var fullSeries = (_c = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _c === void 0 ? void 0 : _c.columns[xFieldIndex];
479
+ var downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
480
+ var firstIndex = fullSeries.findIndex(function (x) {
481
+ return downsampledSeries[startXIndex] === x;
482
+ });
483
+ var lastIndex = fullSeries.findIndex(function (x) {
484
+ return downsampledSeries[endXIndex] === x;
485
+ }); // For charts with categorical x-axis (charts with an xField that isn't _time), do not support
486
+ // re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
487
+ // Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
488
+ // until SPL-259611 is fixed
489
+
490
+ if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
491
+ return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
492
+ }
493
+
494
+ if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
495
+ return (0, exports.calculateThresholdOnRangeSelect)({
496
+ firstIndex: firstIndex,
497
+ lastIndex: lastIndex,
498
+ dataSources: dataSources,
499
+ width: width
500
+ });
501
+ }
502
+ } catch (e) {
503
+ console.error('Error occurred while setting downsample threshold on range select event', e);
504
+ }
505
+
506
+ return null;
507
+ };
508
+
509
+ exports.calculateDownsamplingThreshold = calculateDownsamplingThreshold;
510
+
511
+ var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fieldType) {
512
+ return column.every(function (value, index) {
513
+ if (fieldType === 'number') {
514
+ if (Number.isNaN(value)) {
515
+ return false;
516
+ }
517
+ }
518
+
519
+ if (fieldType === 'time') {
520
+ if (Number.isNaN(value.getTime())) {
521
+ return false;
522
+ }
523
+ }
524
+
525
+ if (index === 0) {
526
+ return true;
527
+ }
528
+
529
+ return value > column[index - 1];
530
+ });
531
+ };
532
+ /**
533
+ * Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be
534
+ * displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.
535
+ *
536
+ * If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
537
+ * If not all columns can be downsampled, then returns empty arrays for both x and y
538
+ */
539
+
540
+
541
+ var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
542
+ var xColumn = [];
543
+ var yColumns = [];
544
+ var canDownsample = !ds.data.fields.some(function (field, index) {
545
+ var _a, _b;
546
+
547
+ var fieldName = (_a = field.name) !== null && _a !== void 0 ? _a : field;
548
+ var fieldType = (_b = fieldTypes[index]) !== null && _b !== void 0 ? _b : 'unknown';
549
+ var column = ds.data.columns[index];
550
+ var hasDisplayedColumnThatCantBeDownsampled = false;
551
+
552
+ if (fieldName === xField) {
553
+ xColumn = strictlyCoerceXColumn(column, fieldType);
554
+ } else if (yFields.has(fieldName)) {
555
+ var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
556
+ coercedColumn = _strictlyCoerceYColum.coercedColumn,
557
+ canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
558
+ canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
559
+ // be downsampled using LTTB
560
+
561
+
562
+ hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
563
+
564
+ if (hasDisplayedColumnThatCantBeDownsampled) {
565
+ return true;
566
+ }
567
+
568
+ if (canDownsampleColumn) {
569
+ yColumns.push(coercedColumn);
570
+ }
571
+ }
572
+
573
+ return false;
574
+ });
575
+
576
+ if (canDownsample) {
577
+ return {
578
+ xColumn: xColumn,
579
+ yColumns: yColumns
580
+ };
581
+ }
582
+
583
+ return {
584
+ xColumn: [],
585
+ yColumns: []
586
+ };
587
+ };
588
+
589
+ var pickIndicesFromDataSource = function pickIndicesFromDataSource(ds, indices) {
590
+ var sortedIndices = Array.from(indices).sort(function (a, b) {
591
+ return a - b;
592
+ });
593
+ var slicedColumns = [];
594
+ ds.data.columns.forEach(function (column) {
595
+ var slicedColumn = [];
596
+ sortedIndices.forEach(function (index) {
597
+ slicedColumn.push(column[index]);
598
+ });
599
+ slicedColumns.push(slicedColumn);
600
+ }); // update data columns with downsampled columns
601
+
602
+ return Object.assign(Object.assign({}, ds), {
603
+ data: Object.assign(Object.assign({}, ds.data), {
604
+ columns: slicedColumns
605
+ })
606
+ });
607
+ };
608
+
609
+ var downsampleDataSources = function downsampleDataSources(_ref4) {
610
+ var dataSources = _ref4.dataSources,
611
+ threshold = _ref4.threshold,
612
+ options = _ref4.options;
613
+
614
+ var _a, _b, _c;
615
+
616
+ var primaryDS = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary; // only downsample time series when number of data points are over threshold
617
+
618
+ var numPoints = (_c = (_b = (_a = primaryDS === null || primaryDS === void 0 ? void 0 : primaryDS.data) === null || _a === void 0 ? void 0 : _a.columns[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
619
+
620
+ if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
621
+ return dataSources;
622
+ }
623
+
624
+ var xField = options.xField,
625
+ yFields = options.yFields,
626
+ fieldTypes = options.fieldTypes;
627
+
628
+ if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
629
+ return dataSources;
630
+ }
631
+
632
+ var nonInternalYFields = new Set(yFields.filter(function (yField) {
633
+ return !yField.startsWith('_');
634
+ }));
635
+ var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
636
+ // At the worst case, each series has non-overlapping downsampled pts
637
+ // which will mean that all points will be included in the downsampled result
638
+ // This will just lead to additional overhead due to coercing each
639
+ // x and y field to number
640
+
641
+ if (maxPointsInDownsample >= numPoints) {
642
+ return dataSources;
643
+ }
644
+
645
+ var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
646
+ xColumn = _tryToCoerceAllDispla.xColumn,
647
+ yColumns = _tryToCoerceAllDispla.yColumns;
648
+
649
+ if (!yColumns.length || !xColumn.length) {
650
+ return dataSources;
651
+ }
652
+
653
+ var downsampledDataSources = Object.assign({}, dataSources);
654
+ var downsampledIndices = new Set();
655
+ yColumns.forEach(function (yColumn, columnIndex) {
656
+ // perform LTTB downsampling for current series, LTTB takes an [x, y] pair
657
+ var xyPair = yColumn.map(function (yValue, index) {
658
+ return [xColumn[index], yValue];
659
+ });
660
+
661
+ try {
662
+ var _largestTriangleThree = largestTriangleThreeBuckets(xyPair, threshold, downsampledIndices),
663
+ downsampledIndicesForSeries = _largestTriangleThree.downsampledIndices;
664
+
665
+ downsampledIndicesForSeries.forEach(function (downsampleIndex) {
666
+ return downsampledIndices.add(downsampleIndex);
667
+ });
668
+ } catch (e) {
669
+ console.error("Error occurred while downsampling column ".concat(columnIndex), e);
670
+ }
671
+ }); // update data columns with downsampled columns
672
+
673
+ downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
674
+ return downsampledDataSources;
675
+ };
676
+
677
+ exports.downsampleDataSources = downsampleDataSources;
678
+
679
+ /***/ }),
680
+ /* 15 */
681
+ /***/ (function(module, exports) {
682
+
683
+ module.exports = require("@splunk/visualizations-shared/colorUtils");
684
+
685
+ /***/ }),
686
+ /* 16 */
687
+ /***/ (function(module, exports) {
688
+
689
+ module.exports = require("@splunk/visualization-encoding/Options");
690
+
691
+ /***/ }),
692
+ /* 17 */
693
+ /***/ (function(module, exports, __webpack_require__) {
694
+
695
+ "use strict";
696
+
697
+
698
+ var _slicedToArray = __webpack_require__(7);
699
+
700
+ Object.defineProperty(exports, "__esModule", {
701
+ value: true
702
+ });
703
+
704
+ var React = __webpack_require__(0);
210
705
 
211
706
  var styled_components_1 = __webpack_require__(4);
212
707
 
213
- var SizeAwareWrapper_1 = __webpack_require__(19);
708
+ var style_1 = __webpack_require__(18);
214
709
 
215
- var style_1 = __webpack_require__(14);
710
+ var colorUtils_1 = __webpack_require__(15);
216
711
 
217
- var colorUtils_1 = __webpack_require__(12);
712
+ var SizeAwareWrapper_1 = __webpack_require__(26);
218
713
 
219
714
  var Item = styled_components_1.default.div.attrs(function (_ref) {
220
715
  var width = _ref.width;
@@ -260,6 +755,20 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
260
755
  var width = props.width,
261
756
  height = props.height,
262
757
  backgroundColor = props.backgroundColor;
758
+ var cachedHandleResize = React.useCallback(function (w, h) {
759
+ setContainerWidth(w);
760
+ setContainerHeight(h);
761
+ }, []);
762
+
763
+ var _React$useState = React.useState(Number(props.width)),
764
+ _React$useState2 = _slicedToArray(_React$useState, 2),
765
+ containerWidth = _React$useState2[0],
766
+ setContainerWidth = _React$useState2[1];
767
+
768
+ var _React$useState3 = React.useState(Number(props.height)),
769
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
770
+ containerHeight = _React$useState4[0],
771
+ setContainerHeight = _React$useState4[1];
263
772
 
264
773
  if (!height) {
265
774
  return React.createElement(Item, {
@@ -271,18 +780,18 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
271
780
 
272
781
  return React.createElement(FixSizeItem, {
273
782
  "data-test": "fix-size-item",
274
- "data-splunk-visualization-version": "26.1.1 - b6df0a015",
783
+ "data-splunk-visualization-version": "26.2.0 - 49b909915",
275
784
  width: width,
276
785
  height: height,
277
786
  backgroundColor: backgroundColor
278
- }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
279
- var newWidth = _ref3.width,
280
- newHeight = _ref3.height;
281
- return React.createElement(Viz, Object.assign({}, props, {
282
- width: newWidth,
283
- height: newHeight
284
- }));
285
- })));
787
+ }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, {
788
+ width: width,
789
+ height: height,
790
+ onResize: cachedHandleResize
791
+ }), React.createElement(Viz, Object.assign({}, props, {
792
+ width: containerWidth,
793
+ height: containerHeight
794
+ }))));
286
795
  };
287
796
 
288
797
  FixedSizeContainer.displayName = 'withFixedSizeContainer';
@@ -292,13 +801,94 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
292
801
  exports.default = withFixedSizeContainer;
293
802
 
294
803
  /***/ }),
295
- /* 14 */
804
+ /* 18 */
296
805
  /***/ (function(module, exports) {
297
806
 
298
807
  module.exports = require("@splunk/visualizations-shared/style");
299
808
 
300
809
  /***/ }),
301
- /* 15 */
810
+ /* 19 */
811
+ /***/ (function(module, exports, __webpack_require__) {
812
+
813
+ "use strict";
814
+
815
+
816
+ Object.defineProperty(exports, "__esModule", {
817
+ value: true
818
+ });
819
+ exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
820
+ exports.validSortDirs = ['asc', 'desc', 'none'];
821
+ exports.validSegmentationModes = ['none', 'inner'];
822
+ exports.validOutputModes = ['json_cols', 'json'];
823
+
824
+ /***/ }),
825
+ /* 20 */,
826
+ /* 21 */
827
+ /***/ (function(module, exports, __webpack_require__) {
828
+
829
+ "use strict";
830
+
831
+
832
+ var _classCallCheck = __webpack_require__(10);
833
+
834
+ var _createClass = __webpack_require__(25);
835
+
836
+ Object.defineProperty(exports, "__esModule", {
837
+ value: true
838
+ });
839
+ exports.DefaultVizActionHandler = void 0;
840
+
841
+ var DefaultVizActionHandler = /*#__PURE__*/function () {
842
+ function DefaultVizActionHandler() {
843
+ _classCallCheck(this, DefaultVizActionHandler);
844
+ }
845
+
846
+ _createClass(DefaultVizActionHandler, [{
847
+ key: "focus",
848
+ value: function focus() {// noop
849
+ }
850
+ }, {
851
+ key: "snapshot",
852
+ value: function snapshot() {
853
+ return null; // noop
854
+ }
855
+ }]);
856
+
857
+ return DefaultVizActionHandler;
858
+ }();
859
+
860
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
861
+
862
+ /***/ }),
863
+ /* 22 */
864
+ /***/ (function(module, exports, __webpack_require__) {
865
+
866
+ "use strict";
867
+
868
+
869
+ Object.defineProperty(exports, "__esModule", {
870
+ value: true
871
+ });
872
+ exports.VizCategory = void 0;
873
+ var VizCategory;
874
+
875
+ (function (VizCategory) {
876
+ VizCategory["SINGLE_VALUE"] = "Single Value";
877
+ VizCategory["TRENDS"] = "Trends";
878
+ VizCategory["COMPARISONS"] = "Comparisons";
879
+ VizCategory["TABLE"] = "Table";
880
+ VizCategory["GAUGE"] = "Gauge";
881
+ VizCategory["DISTRIBUTIONS"] = "Distributions";
882
+ VizCategory["CHOROPLETH"] = "Choropleth Maps";
883
+ VizCategory["SHAPES"] = "Shapes";
884
+ VizCategory["MISC"] = "misc";
885
+ VizCategory["FLOW"] = "Flow";
886
+ VizCategory["CORRELATION"] = "Correlation";
887
+ VizCategory["SPATIAL"] = "Spatial";
888
+ })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
889
+
890
+ /***/ }),
891
+ /* 23 */
302
892
  /***/ (function(module, exports, __webpack_require__) {
303
893
 
304
894
  "use strict";
@@ -330,31 +920,25 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
330
920
  exports.extendStaticWrapperProps = extendStaticWrapperProps;
331
921
 
332
922
  /***/ }),
333
- /* 16 */
923
+ /* 24 */
334
924
  /***/ (function(module, exports) {
335
925
 
336
926
  module.exports = require("@splunk/visualizations-shared/schemaUtils");
337
927
 
338
928
  /***/ }),
339
- /* 17 */
340
- /***/ (function(module, exports) {
341
-
342
- module.exports = require("@babel/runtime/helpers/slicedToArray");
343
-
344
- /***/ }),
345
- /* 18 */
929
+ /* 25 */
346
930
  /***/ (function(module, exports) {
347
931
 
348
932
  module.exports = require("@babel/runtime/helpers/createClass");
349
933
 
350
934
  /***/ }),
351
- /* 19 */
935
+ /* 26 */
352
936
  /***/ (function(module, exports) {
353
937
 
354
938
  module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
355
939
 
356
940
  /***/ }),
357
- /* 20 */
941
+ /* 27 */
358
942
  /***/ (function(module, exports, __webpack_require__) {
359
943
 
360
944
  "use strict";
@@ -362,7 +946,7 @@ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
362
946
 
363
947
  var _toConsumableArray = __webpack_require__(8);
364
948
 
365
- var _defineProperty = __webpack_require__(7);
949
+ var _defineProperty = __webpack_require__(9);
366
950
 
367
951
  var __rest = this && this.__rest || function (s, e) {
368
952
  var t = {};
@@ -384,7 +968,7 @@ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig
384
968
 
385
969
  var lodash_1 = __webpack_require__(3);
386
970
 
387
- var schemaUtils_1 = __webpack_require__(16);
971
+ var schemaUtils_1 = __webpack_require__(24);
388
972
 
389
973
  var VizBehavior_1 = __webpack_require__(6);
390
974
 
@@ -590,58 +1174,73 @@ var insertLayout = function insertLayout(layout, index) {
590
1174
  exports.insertLayout = insertLayout;
591
1175
 
592
1176
  /***/ }),
593
- /* 21 */
1177
+ /* 28 */
594
1178
  /***/ (function(module, exports) {
595
1179
 
596
1180
  module.exports = require("@splunk/visualization-context/FeatureFlagContext");
597
1181
 
598
1182
  /***/ }),
599
- /* 22 */,
600
- /* 23 */
1183
+ /* 29 */,
1184
+ /* 30 */
601
1185
  /***/ (function(module, exports) {
602
1186
 
603
1187
  module.exports = require("@splunk/themes/pick");
604
1188
 
605
1189
  /***/ }),
606
- /* 24 */,
607
- /* 25 */
1190
+ /* 31 */
608
1191
  /***/ (function(module, exports) {
609
1192
 
610
1193
  module.exports = require("@splunk/ui-utils/id");
611
1194
 
612
1195
  /***/ }),
613
- /* 26 */
1196
+ /* 32 */
614
1197
  /***/ (function(module, exports) {
615
1198
 
616
1199
  module.exports = require("@splunk/visualization-context/TimezoneContext");
617
1200
 
618
1201
  /***/ }),
619
- /* 27 */
620
- /***/ (function(module, exports) {
1202
+ /* 33 */
1203
+ /***/ (function(module, exports, __webpack_require__) {
621
1204
 
622
- module.exports = require("@splunk/visualizations-shared/hocUtils");
1205
+ "use strict";
1206
+
1207
+
1208
+ Object.defineProperty(exports, "__esModule", {
1209
+ value: true
1210
+ });
1211
+
1212
+ var react_1 = __webpack_require__(0);
1213
+
1214
+ function usePrevious(value) {
1215
+ var ref = (0, react_1.useRef)();
1216
+ (0, react_1.useEffect)(function () {
1217
+ ref.current = value;
1218
+ });
1219
+ return ref.current;
1220
+ }
1221
+
1222
+ exports.default = usePrevious;
623
1223
 
624
1224
  /***/ }),
625
- /* 28 */
1225
+ /* 34 */
626
1226
  /***/ (function(module, exports) {
627
1227
 
628
- module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
1228
+ module.exports = require("@splunk/visualizations-shared/hocUtils");
629
1229
 
630
1230
  /***/ }),
631
- /* 29 */
1231
+ /* 35 */
632
1232
  /***/ (function(module, exports) {
633
1233
 
634
- module.exports = require("@splunk/visualizations-shared/propUtils");
1234
+ module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
635
1235
 
636
1236
  /***/ }),
637
- /* 30 */
1237
+ /* 36 */
638
1238
  /***/ (function(module, exports) {
639
1239
 
640
- module.exports = require("@splunk/visualization-encoding/Options");
1240
+ module.exports = require("@splunk/visualizations-shared/propUtils");
641
1241
 
642
1242
  /***/ }),
643
- /* 31 */,
644
- /* 32 */
1243
+ /* 37 */
645
1244
  /***/ (function(module, exports, __webpack_require__) {
646
1245
 
647
1246
  "use strict";
@@ -652,17 +1251,17 @@ Object.defineProperty(exports, "__esModule", {
652
1251
  });
653
1252
  exports.shouldShowIconPlaceholder = void 0;
654
1253
 
655
- var React = __webpack_require__(1);
1254
+ var React = __webpack_require__(0);
656
1255
 
657
- var T = __webpack_require__(0);
1256
+ var T = __webpack_require__(1);
658
1257
 
659
1258
  var lodash_1 = __webpack_require__(3);
660
1259
 
661
1260
  var i18n_1 = __webpack_require__(2);
662
1261
 
663
- var Message_1 = __webpack_require__(10);
1262
+ var Message_1 = __webpack_require__(12);
664
1263
 
665
- var FixedSizeContainer_1 = __webpack_require__(13);
1264
+ var FixedSizeContainer_1 = __webpack_require__(17);
666
1265
  /**
667
1266
  * @method shouldShowIconPlaceholder
668
1267
  * @param {object} dataSources
@@ -733,24 +1332,24 @@ IconPlaceholder.defaultProps = {
733
1332
  exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
734
1333
 
735
1334
  /***/ }),
736
- /* 33 */
1335
+ /* 38 */
737
1336
  /***/ (function(module, exports, __webpack_require__) {
738
1337
 
739
1338
  "use strict";
740
1339
 
741
1340
 
742
- var _defineProperty = __webpack_require__(7);
1341
+ var _defineProperty = __webpack_require__(9);
743
1342
 
744
1343
  Object.defineProperty(exports, "__esModule", {
745
1344
  value: true
746
1345
  });
747
1346
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
748
1347
 
749
- var T = __webpack_require__(0);
1348
+ var T = __webpack_require__(1);
750
1349
 
751
1350
  var lodash_1 = __webpack_require__(3);
752
1351
 
753
- var DataSource_1 = __webpack_require__(34);
1352
+ var DataSource_1 = __webpack_require__(19);
754
1353
 
755
1354
  exports.SortParamsPropTypes = T.shape({
756
1355
  currentSortKey: T.string,
@@ -800,10 +1399,239 @@ var getSortingParams = function getSortingParams(_ref) {
800
1399
  };
801
1400
  };
802
1401
 
803
- exports.getSortingParams = getSortingParams;
1402
+ exports.getSortingParams = getSortingParams;
1403
+
1404
+ /***/ }),
1405
+ /* 39 */
1406
+ /***/ (function(module, exports, __webpack_require__) {
1407
+
1408
+ "use strict";
1409
+
1410
+
1411
+ Object.defineProperty(exports, "__esModule", {
1412
+ value: true
1413
+ });
1414
+ exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1415
+
1416
+ var T = __webpack_require__(1);
1417
+
1418
+ var lodash_1 = __webpack_require__(3);
1419
+
1420
+ exports.PaginatorParamsPropTypes = T.shape({
1421
+ isPaging: T.bool,
1422
+ current: T.number,
1423
+ totalPages: T.number,
1424
+ onChange: T.func
1425
+ });
1426
+
1427
+ var getPaginationParams = function getPaginationParams(_ref) {
1428
+ var requestParams = _ref.requestParams,
1429
+ meta = _ref.meta,
1430
+ onRequestParamsChange = _ref.onRequestParamsChange;
1431
+ var totalCount = meta && meta.totalCount || 0;
1432
+ var offset = requestParams && requestParams.offset || 0;
1433
+ var count = requestParams && requestParams.count;
1434
+ var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
1435
+ var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
1436
+ var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
1437
+
1438
+ var onChangeHandler = function onChangeHandler(e, _ref2) {
1439
+ var page = _ref2.page,
1440
+ countArg = _ref2.count;
1441
+ var newParams = (0, lodash_1.cloneDeep)(requestParams);
1442
+
1443
+ if (typeof countArg === 'number') {
1444
+ newParams.count = countArg;
1445
+ newParams.offset = 0;
1446
+ }
1447
+
1448
+ var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
1449
+
1450
+ if (typeof page === 'number' && page > 0) {
1451
+ newParams.count = pageCount;
1452
+ newParams.offset = (page - 1) * pageCount;
1453
+ }
1454
+
1455
+ onRequestParamsChange(newParams);
1456
+ };
1457
+
1458
+ return {
1459
+ isPaging: isPaging,
1460
+ current: current,
1461
+ totalPages: totalPages,
1462
+ onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
1463
+ };
1464
+ };
1465
+
1466
+ exports.getPaginationParams = getPaginationParams;
1467
+
1468
+ /***/ }),
1469
+ /* 40 */
1470
+ /***/ (function(module, exports, __webpack_require__) {
1471
+
1472
+ "use strict";
1473
+
1474
+
1475
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1476
+ if (k2 === undefined) k2 = k;
1477
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1478
+
1479
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1480
+ desc = {
1481
+ enumerable: true,
1482
+ get: function get() {
1483
+ return m[k];
1484
+ }
1485
+ };
1486
+ }
1487
+
1488
+ Object.defineProperty(o, k2, desc);
1489
+ } : function (o, m, k, k2) {
1490
+ if (k2 === undefined) k2 = k;
1491
+ o[k2] = m[k];
1492
+ });
1493
+
1494
+ var __exportStar = this && this.__exportStar || function (m, exports) {
1495
+ for (var p in m) {
1496
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1497
+ }
1498
+ };
1499
+
1500
+ Object.defineProperty(exports, "__esModule", {
1501
+ value: true
1502
+ });
1503
+
1504
+ __exportStar(__webpack_require__(41), exports);
1505
+
1506
+ __exportStar(__webpack_require__(42), exports);
1507
+
1508
+ __exportStar(__webpack_require__(19), exports);
1509
+
1510
+ __exportStar(__webpack_require__(43), exports);
1511
+
1512
+ __exportStar(__webpack_require__(44), exports);
1513
+
1514
+ __exportStar(__webpack_require__(45), exports);
1515
+
1516
+ __exportStar(__webpack_require__(46), exports);
1517
+
1518
+ __exportStar(__webpack_require__(47), exports);
1519
+
1520
+ __exportStar(__webpack_require__(48), exports);
1521
+
1522
+ __exportStar(__webpack_require__(49), exports);
1523
+
1524
+ __exportStar(__webpack_require__(21), exports);
1525
+
1526
+ __exportStar(__webpack_require__(6), exports);
1527
+
1528
+ __exportStar(__webpack_require__(22), exports);
1529
+
1530
+ __exportStar(__webpack_require__(50), exports);
1531
+
1532
+ __exportStar(__webpack_require__(51), exports);
1533
+
1534
+ __exportStar(__webpack_require__(52), exports);
1535
+
1536
+ __exportStar(__webpack_require__(53), exports);
1537
+
1538
+ __exportStar(__webpack_require__(54), exports);
1539
+
1540
+ __exportStar(__webpack_require__(55), exports);
1541
+
1542
+ /***/ }),
1543
+ /* 41 */
1544
+ /***/ (function(module, exports, __webpack_require__) {
1545
+
1546
+ "use strict";
1547
+
1548
+
1549
+ Object.defineProperty(exports, "__esModule", {
1550
+ value: true
1551
+ });
1552
+
1553
+ /***/ }),
1554
+ /* 42 */
1555
+ /***/ (function(module, exports, __webpack_require__) {
1556
+
1557
+ "use strict";
1558
+
1559
+ /**
1560
+ * A data structure used at runtime to wire up a visualization.
1561
+ */
1562
+
1563
+ Object.defineProperty(exports, "__esModule", {
1564
+ value: true
1565
+ });
1566
+
1567
+ /***/ }),
1568
+ /* 43 */
1569
+ /***/ (function(module, exports, __webpack_require__) {
1570
+
1571
+ "use strict";
1572
+
1573
+
1574
+ Object.defineProperty(exports, "__esModule", {
1575
+ value: true
1576
+ });
1577
+
1578
+ /***/ }),
1579
+ /* 44 */
1580
+ /***/ (function(module, exports, __webpack_require__) {
1581
+
1582
+ "use strict";
1583
+
1584
+
1585
+ Object.defineProperty(exports, "__esModule", {
1586
+ value: true
1587
+ });
1588
+
1589
+ /***/ }),
1590
+ /* 45 */
1591
+ /***/ (function(module, exports, __webpack_require__) {
1592
+
1593
+ "use strict";
1594
+
1595
+
1596
+ Object.defineProperty(exports, "__esModule", {
1597
+ value: true
1598
+ });
1599
+
1600
+ /***/ }),
1601
+ /* 46 */
1602
+ /***/ (function(module, exports, __webpack_require__) {
1603
+
1604
+ "use strict";
1605
+
1606
+
1607
+ Object.defineProperty(exports, "__esModule", {
1608
+ value: true
1609
+ });
1610
+
1611
+ /***/ }),
1612
+ /* 47 */
1613
+ /***/ (function(module, exports, __webpack_require__) {
1614
+
1615
+ "use strict";
1616
+
1617
+
1618
+ Object.defineProperty(exports, "__esModule", {
1619
+ value: true
1620
+ });
1621
+
1622
+ /***/ }),
1623
+ /* 48 */
1624
+ /***/ (function(module, exports, __webpack_require__) {
1625
+
1626
+ "use strict";
1627
+
1628
+
1629
+ Object.defineProperty(exports, "__esModule", {
1630
+ value: true
1631
+ });
804
1632
 
805
1633
  /***/ }),
806
- /* 34 */
1634
+ /* 49 */
807
1635
  /***/ (function(module, exports, __webpack_require__) {
808
1636
 
809
1637
  "use strict";
@@ -812,13 +1640,9 @@ exports.getSortingParams = getSortingParams;
812
1640
  Object.defineProperty(exports, "__esModule", {
813
1641
  value: true
814
1642
  });
815
- exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
816
- exports.validSortDirs = ['asc', 'desc', 'none'];
817
- exports.validSegmentationModes = ['none', 'inner'];
818
- exports.validOutputModes = ['json_cols', 'json'];
819
1643
 
820
1644
  /***/ }),
821
- /* 35 */
1645
+ /* 50 */
822
1646
  /***/ (function(module, exports, __webpack_require__) {
823
1647
 
824
1648
  "use strict";
@@ -827,62 +1651,42 @@ exports.validOutputModes = ['json_cols', 'json'];
827
1651
  Object.defineProperty(exports, "__esModule", {
828
1652
  value: true
829
1653
  });
830
- exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
831
1654
 
832
- var T = __webpack_require__(0);
1655
+ /***/ }),
1656
+ /* 51 */
1657
+ /***/ (function(module, exports, __webpack_require__) {
833
1658
 
834
- var lodash_1 = __webpack_require__(3);
1659
+ "use strict";
835
1660
 
836
- exports.PaginatorParamsPropTypes = T.shape({
837
- isPaging: T.bool,
838
- current: T.number,
839
- totalPages: T.number,
840
- onChange: T.func
1661
+
1662
+ Object.defineProperty(exports, "__esModule", {
1663
+ value: true
841
1664
  });
842
1665
 
843
- var getPaginationParams = function getPaginationParams(_ref) {
844
- var requestParams = _ref.requestParams,
845
- meta = _ref.meta,
846
- onRequestParamsChange = _ref.onRequestParamsChange;
847
- var totalCount = meta && meta.totalCount || 0;
848
- var offset = requestParams && requestParams.offset || 0;
849
- var count = requestParams && requestParams.count;
850
- var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
851
- var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
852
- var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
1666
+ /***/ }),
1667
+ /* 52 */
1668
+ /***/ (function(module, exports, __webpack_require__) {
853
1669
 
854
- var onChangeHandler = function onChangeHandler(e, _ref2) {
855
- var page = _ref2.page,
856
- countArg = _ref2.count;
857
- var newParams = (0, lodash_1.cloneDeep)(requestParams);
1670
+ "use strict";
858
1671
 
859
- if (typeof countArg === 'number') {
860
- newParams.count = countArg;
861
- newParams.offset = 0;
862
- }
863
1672
 
864
- var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
1673
+ Object.defineProperty(exports, "__esModule", {
1674
+ value: true
1675
+ });
865
1676
 
866
- if (typeof page === 'number' && page > 0) {
867
- newParams.count = pageCount;
868
- newParams.offset = (page - 1) * pageCount;
869
- }
1677
+ /***/ }),
1678
+ /* 53 */
1679
+ /***/ (function(module, exports, __webpack_require__) {
870
1680
 
871
- onRequestParamsChange(newParams);
872
- };
1681
+ "use strict";
873
1682
 
874
- return {
875
- isPaging: isPaging,
876
- current: current,
877
- totalPages: totalPages,
878
- onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
879
- };
880
- };
881
1683
 
882
- exports.getPaginationParams = getPaginationParams;
1684
+ Object.defineProperty(exports, "__esModule", {
1685
+ value: true
1686
+ });
883
1687
 
884
1688
  /***/ }),
885
- /* 36 */
1689
+ /* 54 */
886
1690
  /***/ (function(module, exports, __webpack_require__) {
887
1691
 
888
1692
  "use strict";
@@ -891,78 +1695,78 @@ exports.getPaginationParams = getPaginationParams;
891
1695
  Object.defineProperty(exports, "__esModule", {
892
1696
  value: true
893
1697
  });
894
- exports.VizCategory = void 0;
895
- var VizCategory;
896
1698
 
897
- (function (VizCategory) {
898
- VizCategory["SINGLE_VALUE"] = "Single Value";
899
- VizCategory["TRENDS"] = "Trends";
900
- VizCategory["COMPARISONS"] = "Comparisons";
901
- VizCategory["TABLE"] = "Table";
902
- VizCategory["GAUGE"] = "Gauge";
903
- VizCategory["DISTRIBUTIONS"] = "Distributions";
904
- VizCategory["CHOROPLETH"] = "Choropleth Maps";
905
- VizCategory["SHAPES"] = "Shapes";
906
- VizCategory["MISC"] = "misc";
907
- VizCategory["FLOW"] = "Flow";
908
- VizCategory["CORRELATION"] = "Correlation";
909
- VizCategory["SPATIAL"] = "Spatial";
910
- })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
1699
+ /***/ }),
1700
+ /* 55 */
1701
+ /***/ (function(module, exports, __webpack_require__) {
1702
+
1703
+ "use strict";
1704
+
1705
+
1706
+ Object.defineProperty(exports, "__esModule", {
1707
+ value: true
1708
+ });
911
1709
 
912
1710
  /***/ }),
913
- /* 37 */
1711
+ /* 56 */
914
1712
  /***/ (function(module, exports, __webpack_require__) {
915
1713
 
916
1714
  "use strict";
917
1715
 
918
1716
 
919
- var _slicedToArray = __webpack_require__(17);
1717
+ var _slicedToArray = __webpack_require__(7);
920
1718
 
921
1719
  Object.defineProperty(exports, "__esModule", {
922
1720
  value: true
923
1721
  });
924
1722
 
925
- var React = __webpack_require__(1);
1723
+ var React = __webpack_require__(0);
926
1724
 
927
1725
  var lodash_1 = __webpack_require__(3);
928
1726
 
929
- var getSettingsFromThemedProps_1 = __webpack_require__(38);
1727
+ var getSettingsFromThemedProps_1 = __webpack_require__(57);
930
1728
 
931
- var Options_1 = __webpack_require__(30);
1729
+ var Options_1 = __webpack_require__(16);
932
1730
 
933
- var SanitizeProps_1 = __webpack_require__(39);
1731
+ var SanitizeProps_1 = __webpack_require__(58);
934
1732
 
935
- var TimezoneContext_1 = __webpack_require__(26);
1733
+ var TimezoneContext_1 = __webpack_require__(32);
936
1734
 
937
- var moment_1 = __webpack_require__(40);
1735
+ var moment_1 = __webpack_require__(59);
938
1736
 
939
- var FeatureFlagContext_1 = __webpack_require__(21);
1737
+ var FeatureFlagContext_1 = __webpack_require__(28);
940
1738
 
941
1739
  var styled_components_1 = __webpack_require__(4);
942
1740
 
943
- var hocUtils_1 = __webpack_require__(27);
1741
+ var hocUtils_1 = __webpack_require__(34);
944
1742
 
945
- var JSONSchemaUtils_1 = __webpack_require__(28);
1743
+ var JSONSchemaUtils_1 = __webpack_require__(35);
946
1744
 
947
- var async_dynamic_options_evaluator_1 = __webpack_require__(41);
1745
+ var async_dynamic_options_evaluator_1 = __webpack_require__(60);
948
1746
 
949
- var id_1 = __webpack_require__(25);
1747
+ var id_1 = __webpack_require__(31);
950
1748
 
951
- var SplunkVisualization_1 = __webpack_require__(42);
1749
+ var SplunkVisualization_1 = __webpack_require__(61);
952
1750
 
953
1751
  var VizBehavior_1 = __webpack_require__(6);
954
1752
 
955
- var getSorting_1 = __webpack_require__(33);
1753
+ var getSorting_1 = __webpack_require__(38);
1754
+
1755
+ var getPagination_1 = __webpack_require__(39);
1756
+
1757
+ var useDeepMemo_1 = __webpack_require__(62);
1758
+
1759
+ var MissingPropsMessage_1 = __webpack_require__(63);
956
1760
 
957
- var getPagination_1 = __webpack_require__(35);
1761
+ var withEditModeCover_1 = __webpack_require__(64);
958
1762
 
959
- var useDeepMemo_1 = __webpack_require__(44);
1763
+ var withPlaceholder_1 = __webpack_require__(65);
960
1764
 
961
- var MissingPropsMessage_1 = __webpack_require__(45);
1765
+ var useDownsampleDataSources_1 = __webpack_require__(66);
962
1766
 
963
- var withEditModeCover_1 = __webpack_require__(46);
1767
+ var dataUtils_1 = __webpack_require__(14);
964
1768
 
965
- var withPlaceholder_1 = __webpack_require__(47);
1769
+ var featureFlagUtils_1 = __webpack_require__(68);
966
1770
  /**
967
1771
  * hoc that wraps a pure react visualization in a Dashboard visualization
968
1772
  * @param {DashboardVizOpts} opts
@@ -1053,25 +1857,61 @@ var withDashboardViz = function withDashboardViz(opts) {
1053
1857
  dataFramesInState = _React$useState8[0],
1054
1858
  setDataFramesInState = _React$useState8[1];
1055
1859
 
1056
- var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
1860
+ var _React$useState9 = React.useState(Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_useWebWorkersForDSL'))),
1057
1861
  _React$useState10 = _slicedToArray(_React$useState9, 2),
1058
1862
  useAsyncEvaluatedOptions = _React$useState10[0],
1059
1863
  setUseAsyncEvaluatedOptions = _React$useState10[1];
1060
1864
 
1865
+ var isDownsamplingEnabledByFeatureFlag = Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_enableDownsampling);
1061
1866
  var isMounted = React.useRef(true);
1867
+ var optionsToEvaluate = React.useMemo(function () {
1868
+ return {
1869
+ context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1870
+ options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
1871
+ };
1872
+ }, [options, context]);
1873
+
1874
+ var _React$useState11 = React.useState(Number(width)),
1875
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
1876
+ threshold = _React$useState12[0],
1877
+ setThreshold = _React$useState12[1];
1878
+
1879
+ var onDownsamplingThresholdChange = React.useCallback(function (newThreshold) {
1880
+ setThreshold(newThreshold);
1881
+ }, []);
1882
+ var isDownsamplingEnabled = React.useMemo(function () {
1883
+ return isDownsamplingEnabledByFeatureFlag && (0, dataUtils_1.isDownsamplingEnabledForViz)({
1884
+ vizConfig: vizConfig
1885
+ });
1886
+ }, [isDownsamplingEnabledByFeatureFlag]);
1887
+ var downsamplingProps = React.useMemo(function () {
1888
+ if (!isDownsamplingEnabled) {
1889
+ return {};
1890
+ }
1891
+
1892
+ return {
1893
+ onDownsamplingThresholdChange: onDownsamplingThresholdChange,
1894
+ originalDataSources: dataSources
1895
+ };
1896
+ }, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
1897
+ var downsampledDataSources = (0, useDownsampleDataSources_1.default)({
1898
+ options: optionsToEvaluate.options,
1899
+ context: optionsToEvaluate.context,
1900
+ dataSources: dataSources,
1901
+ threshold: threshold,
1902
+ isDownsamplingEnabled: isDownsamplingEnabled
1903
+ });
1062
1904
  evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
1063
1905
  try {
1064
1906
  if (useAsyncEvaluatedOptions) {
1065
- var optionsToEvaluate = {
1066
- context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1067
- options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
1068
- };
1069
1907
  var asyncDynamicOptionsEvaluatorParams = {
1070
1908
  visualizationID: visualizationID,
1071
1909
  props: props,
1072
1910
  options: optionsToEvaluate,
1073
- dataSources: dataSources,
1074
- theme: vizConfig.themes
1911
+ dataSources: downsampledDataSources,
1912
+ theme: vizConfig.themes,
1913
+ bypassCloneDeepOptionScope: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope')),
1914
+ lazyLoadingDataFrame: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'))
1075
1915
  };
1076
1916
  async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
1077
1917
  setEvaluatedOptionsAsync(results.results);
@@ -1083,16 +1923,14 @@ var withDashboardViz = function withDashboardViz(opts) {
1083
1923
  } else {
1084
1924
  var dataFrames = dataFramesInState;
1085
1925
 
1086
- if (dataSources !== dataSourcesInState) {
1087
- setDataSourcesInState(dataSources);
1088
- dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
1926
+ if (downsampledDataSources !== dataSourcesInState) {
1927
+ setDataSourcesInState(downsampledDataSources);
1928
+ dataFrames = Options_1.Options.dataFrameFromDataSource(downsampledDataSources, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'));
1089
1929
  setDataFramesInState(dataFrames);
1090
1930
  }
1091
1931
 
1092
- return Options_1.Options.evaluate({
1093
- context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1094
- options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
1095
- }, dataSources, themeFunc, dataFrames);
1932
+ var result = Options_1.Options.evaluate(optionsToEvaluate, downsampledDataSources, themeFunc, dataFrames, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope'));
1933
+ return result;
1096
1934
  }
1097
1935
  } catch (e) {
1098
1936
  // eslint-disable-next-line no-console
@@ -1101,7 +1939,7 @@ var withDashboardViz = function withDashboardViz(opts) {
1101
1939
  }
1102
1940
 
1103
1941
  return {};
1104
- }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
1942
+ }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, optionsToEvaluate, downsampledDataSources, serializedTimezone, useAsyncEvaluatedOptions]);
1105
1943
  var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
1106
1944
  // if trellis is enabled following these three criteria - 1) trellis feature flag is enabled 2) vizConfig supports array has 'trellis' 3) option 'splitByLayout' is set to 'trellis
1107
1945
  // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
@@ -1243,7 +2081,7 @@ var withDashboardViz = function withDashboardViz(opts) {
1243
2081
  mode: mode,
1244
2082
  width: width,
1245
2083
  height: height
1246
- }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
2084
+ }, downsamplingProps, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
1247
2085
  };
1248
2086
 
1249
2087
  DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
@@ -1260,37 +2098,37 @@ var withDashboardViz = function withDashboardViz(opts) {
1260
2098
  exports.default = withDashboardViz;
1261
2099
 
1262
2100
  /***/ }),
1263
- /* 38 */
2101
+ /* 57 */
1264
2102
  /***/ (function(module, exports) {
1265
2103
 
1266
2104
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1267
2105
 
1268
2106
  /***/ }),
1269
- /* 39 */
2107
+ /* 58 */
1270
2108
  /***/ (function(module, exports) {
1271
2109
 
1272
2110
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1273
2111
 
1274
2112
  /***/ }),
1275
- /* 40 */
2113
+ /* 59 */
1276
2114
  /***/ (function(module, exports) {
1277
2115
 
1278
2116
  module.exports = require("@splunk/moment");
1279
2117
 
1280
2118
  /***/ }),
1281
- /* 41 */
2119
+ /* 60 */
1282
2120
  /***/ (function(module, exports) {
1283
2121
 
1284
2122
  module.exports = require("@splunk/async-dynamic-options-evaluator");
1285
2123
 
1286
2124
  /***/ }),
1287
- /* 42 */
2125
+ /* 61 */
1288
2126
  /***/ (function(module, exports, __webpack_require__) {
1289
2127
 
1290
2128
  "use strict";
1291
2129
 
1292
2130
 
1293
- var _classCallCheck = __webpack_require__(9);
2131
+ var _classCallCheck = __webpack_require__(10);
1294
2132
 
1295
2133
  Object.defineProperty(exports, "__esModule", {
1296
2134
  value: true
@@ -1298,11 +2136,11 @@ Object.defineProperty(exports, "__esModule", {
1298
2136
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1299
2137
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1300
2138
 
1301
- var T = __webpack_require__(0);
2139
+ var T = __webpack_require__(1);
1302
2140
 
1303
2141
  var lodash_1 = __webpack_require__(3);
1304
2142
 
1305
- var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
2143
+ var VizActionHandler_1 = __webpack_require__(21); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1306
2144
 
1307
2145
 
1308
2146
  exports.INITIAL_WIDTH = 250;
@@ -1435,44 +2273,7 @@ SplunkVisualization.defaultProps = {
1435
2273
  exports.default = SplunkVisualization;
1436
2274
 
1437
2275
  /***/ }),
1438
- /* 43 */
1439
- /***/ (function(module, exports, __webpack_require__) {
1440
-
1441
- "use strict";
1442
-
1443
-
1444
- var _classCallCheck = __webpack_require__(9);
1445
-
1446
- var _createClass = __webpack_require__(18);
1447
-
1448
- Object.defineProperty(exports, "__esModule", {
1449
- value: true
1450
- });
1451
- exports.DefaultVizActionHandler = void 0;
1452
-
1453
- var DefaultVizActionHandler = /*#__PURE__*/function () {
1454
- function DefaultVizActionHandler() {
1455
- _classCallCheck(this, DefaultVizActionHandler);
1456
- }
1457
-
1458
- _createClass(DefaultVizActionHandler, [{
1459
- key: "focus",
1460
- value: function focus() {// noop
1461
- }
1462
- }, {
1463
- key: "snapshot",
1464
- value: function snapshot() {
1465
- return null; // noop
1466
- }
1467
- }]);
1468
-
1469
- return DefaultVizActionHandler;
1470
- }();
1471
-
1472
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
1473
-
1474
- /***/ }),
1475
- /* 44 */
2276
+ /* 62 */
1476
2277
  /***/ (function(module, exports, __webpack_require__) {
1477
2278
 
1478
2279
  "use strict";
@@ -1483,7 +2284,7 @@ Object.defineProperty(exports, "__esModule", {
1483
2284
  });
1484
2285
  exports.useDeepMemo = void 0;
1485
2286
 
1486
- var react_1 = __webpack_require__(1);
2287
+ var react_1 = __webpack_require__(0);
1487
2288
 
1488
2289
  var lodash_1 = __webpack_require__(3);
1489
2290
  /**
@@ -1517,7 +2318,7 @@ var useDeepMemo = function useDeepMemo(fn, dependencies) {
1517
2318
  exports.useDeepMemo = useDeepMemo;
1518
2319
 
1519
2320
  /***/ }),
1520
- /* 45 */
2321
+ /* 63 */
1521
2322
  /***/ (function(module, exports, __webpack_require__) {
1522
2323
 
1523
2324
  "use strict";
@@ -1528,15 +2329,15 @@ Object.defineProperty(exports, "__esModule", {
1528
2329
  });
1529
2330
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1530
2331
 
1531
- var React = __webpack_require__(1);
2332
+ var React = __webpack_require__(0);
1532
2333
 
1533
- var T = __webpack_require__(0);
2334
+ var T = __webpack_require__(1);
1534
2335
 
1535
2336
  var i18n_1 = __webpack_require__(2);
1536
2337
 
1537
- var Message_1 = __webpack_require__(10);
2338
+ var Message_1 = __webpack_require__(12);
1538
2339
 
1539
- var FixedSizeContainer_1 = __webpack_require__(13);
2340
+ var FixedSizeContainer_1 = __webpack_require__(17);
1540
2341
  /**
1541
2342
  * @method isMissing
1542
2343
  * @param {any} v
@@ -1597,7 +2398,7 @@ exports.MissingPropsMessage.defaultProps = {
1597
2398
  exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
1598
2399
 
1599
2400
  /***/ }),
1600
- /* 46 */
2401
+ /* 64 */
1601
2402
  /***/ (function(module, exports, __webpack_require__) {
1602
2403
 
1603
2404
  "use strict";
@@ -1607,18 +2408,18 @@ Object.defineProperty(exports, "__esModule", {
1607
2408
  value: true
1608
2409
  });
1609
2410
 
1610
- var React = __webpack_require__(1);
2411
+ var React = __webpack_require__(0);
1611
2412
 
1612
2413
  var styled_components_1 = __webpack_require__(4);
1613
2414
 
1614
- var hocUtils_1 = __webpack_require__(15);
2415
+ var hocUtils_1 = __webpack_require__(23);
1615
2416
 
1616
2417
  var Cover = styled_components_1.default.div.withConfig({
1617
2418
  displayName: "withEditModeCover__Cover",
1618
2419
  componentId: "sc-1gsbnxb-0"
1619
2420
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1620
2421
  var Blocker = styled_components_1.default.div.attrs({
1621
- 'data-splunk-visualization-version': "26.1.1 - b6df0a015"
2422
+ 'data-splunk-visualization-version': "26.2.0 - 49b909915"
1622
2423
  }).withConfig({
1623
2424
  displayName: "withEditModeCover__Blocker",
1624
2425
  componentId: "sc-1gsbnxb-1"
@@ -1639,101 +2440,345 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
1639
2440
  }));
1640
2441
  };
1641
2442
 
1642
- (0, hocUtils_1.extendStaticWrapperProps)({
1643
- Wrapper: Wrapper,
1644
- Visualization: Visualization
1645
- });
1646
- return Wrapper;
2443
+ (0, hocUtils_1.extendStaticWrapperProps)({
2444
+ Wrapper: Wrapper,
2445
+ Visualization: Visualization
2446
+ });
2447
+ return Wrapper;
2448
+ };
2449
+
2450
+ exports.default = withEditModeCover;
2451
+
2452
+ /***/ }),
2453
+ /* 65 */
2454
+ /***/ (function(module, exports, __webpack_require__) {
2455
+
2456
+ "use strict";
2457
+
2458
+
2459
+ Object.defineProperty(exports, "__esModule", {
2460
+ value: true
2461
+ });
2462
+
2463
+ var React = __webpack_require__(0);
2464
+
2465
+ var colorUtils_1 = __webpack_require__(15);
2466
+
2467
+ var variables_1 = __webpack_require__(13);
2468
+
2469
+ var IconPlaceholder_1 = __webpack_require__(37);
2470
+
2471
+ var VizBehavior_1 = __webpack_require__(6);
2472
+
2473
+ var hocUtils_1 = __webpack_require__(23);
2474
+
2475
+ var withPlaceholder = function withPlaceholder(Visualization) {
2476
+ var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
2477
+ var config = Visualization.config;
2478
+ var themes = config.themes;
2479
+
2480
+ var Wrapper = function Wrapper(props) {
2481
+ var _a, _b;
2482
+
2483
+ var dataSources = props.dataSources,
2484
+ loading = props.loading,
2485
+ options = props.options,
2486
+ height = props.height,
2487
+ width = props.width;
2488
+ var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
2489
+ var bgColorFromTheme = (0, colorUtils_1.isColor)(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
2490
+ var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
2491
+ var iconColor = variables_1.default.contentColorActive(props);
2492
+
2493
+ if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
2494
+ return React.createElement(IconPlaceholder_1.default, {
2495
+ "data-test": "icon-placeholder",
2496
+ icon: icon,
2497
+ width: width,
2498
+ height: height,
2499
+ backgroundColor: bgColorFromTheme,
2500
+ iconColor: iconColor
2501
+ });
2502
+ }
2503
+
2504
+ return React.createElement(Visualization, Object.assign({}, props));
2505
+ };
2506
+
2507
+ (0, hocUtils_1.extendStaticWrapperProps)({
2508
+ Wrapper: Wrapper,
2509
+ Visualization: Visualization
2510
+ });
2511
+ return Wrapper;
2512
+ };
2513
+
2514
+ exports.default = withPlaceholder;
2515
+
2516
+ /***/ }),
2517
+ /* 66 */
2518
+ /***/ (function(module, exports, __webpack_require__) {
2519
+
2520
+ "use strict";
2521
+
2522
+
2523
+ var _slicedToArray = __webpack_require__(7);
2524
+
2525
+ Object.defineProperty(exports, "__esModule", {
2526
+ value: true
2527
+ });
2528
+
2529
+ var react_1 = __webpack_require__(0);
2530
+
2531
+ var lodash_1 = __webpack_require__(3);
2532
+
2533
+ var dataUtils_1 = __webpack_require__(14);
2534
+
2535
+ var usePrevious_1 = __webpack_require__(33);
2536
+
2537
+ var useGetXAndYFields_1 = __webpack_require__(67);
2538
+
2539
+ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
2540
+ var dataSources = _ref.dataSources,
2541
+ options = _ref.options,
2542
+ context = _ref.context,
2543
+ threshold = _ref.threshold,
2544
+ isDownsamplingEnabled = _ref.isDownsamplingEnabled;
2545
+ var isFirstUseEffectCall = (0, react_1.useRef)(true);
2546
+ var xAndYFieldsWithTypes = (0, useGetXAndYFields_1.default)({
2547
+ shouldEvaluateDSL: isDownsamplingEnabled,
2548
+ options: options,
2549
+ context: context,
2550
+ dataSources: dataSources
2551
+ });
2552
+ var previousXAndYFieldsWithTypes = (0, usePrevious_1.default)(xAndYFieldsWithTypes);
2553
+ var previousDataSources = (0, usePrevious_1.default)(dataSources);
2554
+ var previousThreshold = (0, usePrevious_1.default)(threshold);
2555
+
2556
+ var _ref2 = (0, react_1.useState)(function () {
2557
+ return isDownsamplingEnabled ? (0, dataUtils_1.downsampleDataSources)({
2558
+ dataSources: dataSources,
2559
+ threshold: threshold,
2560
+ options: xAndYFieldsWithTypes
2561
+ }) : dataSources;
2562
+ }),
2563
+ _ref3 = _slicedToArray(_ref2, 2),
2564
+ downsampledDataSources = _ref3[0],
2565
+ setDownsampledDataSources = _ref3[1];
2566
+
2567
+ var debouncedDownsampleDataSources = (0, react_1.useMemo)(function () {
2568
+ return (0, lodash_1.debounce)(function (downsampleOptions) {
2569
+ var downsampledResult = (0, dataUtils_1.downsampleDataSources)(downsampleOptions);
2570
+ setDownsampledDataSources(downsampledResult);
2571
+ }, 100, {
2572
+ trailing: true
2573
+ });
2574
+ }, []);
2575
+ (0, react_1.useEffect)(function () {
2576
+ // don't downsample again on the use effect call that happened due to the initial render
2577
+ // this is since we already downsampled as part of the useState call
2578
+ if (isFirstUseEffectCall.current) {
2579
+ isFirstUseEffectCall.current = false;
2580
+ return;
2581
+ }
2582
+
2583
+ if (!isDownsamplingEnabled) {
2584
+ setDownsampledDataSources(dataSources);
2585
+ return;
2586
+ }
2587
+
2588
+ if ((0, lodash_1.isEqual)(previousXAndYFieldsWithTypes, xAndYFieldsWithTypes) && previousDataSources === dataSources && previousThreshold === threshold) {
2589
+ return;
2590
+ } // Debounce the downsampling so we don't have to downsample and execute DSL multiple times
2591
+ // while the viz is being resized
2592
+
2593
+
2594
+ debouncedDownsampleDataSources({
2595
+ dataSources: dataSources,
2596
+ options: xAndYFieldsWithTypes,
2597
+ threshold: threshold
2598
+ }); // need to detect if this runs as part of the initial render
2599
+ }, [dataSources, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousXAndYFieldsWithTypes, previousDataSources, previousThreshold]);
2600
+ return downsampledDataSources;
1647
2601
  };
1648
2602
 
1649
- exports.default = withEditModeCover;
2603
+ exports.default = useDownsampleDataSources;
1650
2604
 
1651
2605
  /***/ }),
1652
- /* 47 */
2606
+ /* 67 */
1653
2607
  /***/ (function(module, exports, __webpack_require__) {
1654
2608
 
1655
2609
  "use strict";
1656
2610
 
1657
2611
 
2612
+ var _toConsumableArray = __webpack_require__(8);
2613
+
1658
2614
  Object.defineProperty(exports, "__esModule", {
1659
2615
  value: true
1660
2616
  });
1661
2617
 
1662
- var React = __webpack_require__(1);
2618
+ var react_1 = __webpack_require__(0);
1663
2619
 
1664
- var colorUtils_1 = __webpack_require__(12);
2620
+ var Options_1 = __webpack_require__(16);
2621
+ /**
2622
+ * Hook that evaluates the DSL for subset of a viz's options needed to determine
2623
+ * its x and y fields as well as the types of all its fields.
2624
+ */
1665
2625
 
1666
- var variables_1 = __webpack_require__(11);
1667
2626
 
1668
- var IconPlaceholder_1 = __webpack_require__(32);
2627
+ var useGetXAndYFields = function useGetXAndYFields(_ref) {
2628
+ var shouldEvaluateDSL = _ref.shouldEvaluateDSL,
2629
+ options = _ref.options,
2630
+ context = _ref.context,
2631
+ dataSources = _ref.dataSources;
1669
2632
 
1670
- var VizBehavior_1 = __webpack_require__(6);
2633
+ var _ref2 = (0, react_1.useMemo)(function () {
2634
+ var _a, _b, _c;
1671
2635
 
1672
- var hocUtils_1 = __webpack_require__(15);
2636
+ if (!shouldEvaluateDSL) {
2637
+ return {
2638
+ dataSourcesWithOnlyOnePoint: null,
2639
+ dataFrameWithOnlyOnePoint: null
2640
+ };
2641
+ }
1673
2642
 
1674
- var withPlaceholder = function withPlaceholder(Visualization) {
1675
- var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
1676
- var config = Visualization.config;
1677
- var themes = config.themes;
2643
+ if (!((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns) === null || _c === void 0 ? void 0 : _c.length)) {
2644
+ return {
2645
+ dataSourcesWithOnlyOnePoint: null,
2646
+ dataFrameWithOnlyOnePoint: null
2647
+ };
2648
+ }
1678
2649
 
1679
- var Wrapper = function Wrapper(props) {
1680
- var _a, _b;
2650
+ var primaryDS = dataSources.primary;
2651
+ var columnsWithOnlyOnePoint = primaryDS.data.columns.map(function (column) {
2652
+ return [column[0]];
2653
+ });
2654
+ var filteredDataSources = {
2655
+ primary: Object.assign(Object.assign({}, primaryDS), {
2656
+ data: Object.assign(Object.assign({}, primaryDS.data), {
2657
+ columns: columnsWithOnlyOnePoint
2658
+ })
2659
+ })
2660
+ };
2661
+ return {
2662
+ dataSourcesWithOnlyOnePoint: filteredDataSources,
2663
+ dataFrameWithOnlyOnePoint: Options_1.Options.dataFrameFromDataSource(filteredDataSources)
2664
+ };
2665
+ }, [dataSources, shouldEvaluateDSL]),
2666
+ dataSourcesWithOnlyOnePoint = _ref2.dataSourcesWithOnlyOnePoint,
2667
+ dataFrameWithOnlyOnePoint = _ref2.dataFrameWithOnlyOnePoint;
1681
2668
 
1682
- var dataSources = props.dataSources,
1683
- loading = props.loading,
1684
- options = props.options,
1685
- height = props.height,
1686
- width = props.width;
1687
- var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
1688
- var bgColorFromTheme = (0, colorUtils_1.isColor)(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
1689
- var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
1690
- var iconColor = variables_1.default.contentColorActive(props);
2669
+ var xAndYFieldsWithTypes = (0, react_1.useMemo)(function () {
2670
+ try {
2671
+ if (!dataSourcesWithOnlyOnePoint || !dataFrameWithOnlyOnePoint) {
2672
+ return options;
2673
+ }
1691
2674
 
1692
- if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
1693
- return React.createElement(IconPlaceholder_1.default, {
1694
- "data-test": "icon-placeholder",
1695
- icon: icon,
1696
- width: width,
1697
- height: height,
1698
- backgroundColor: bgColorFromTheme,
1699
- iconColor: iconColor
1700
- });
2675
+ if (!(options === null || options === void 0 ? void 0 : options.x) || !(options === null || options === void 0 ? void 0 : options.y) && !(options === null || options === void 0 ? void 0 : options.y2)) {
2676
+ return options;
2677
+ }
2678
+
2679
+ var optionsToEvaluate = {
2680
+ x: options.x,
2681
+ xField: '> x | getField()',
2682
+ y: options.y,
2683
+ yFields: options.y ? '> y | getField()' : undefined,
2684
+ y2: options.y2,
2685
+ y2Fields: options.y2 ? '> y2 | getField()' : undefined,
2686
+ fieldTypes: '> primary | getType()'
2687
+ };
2688
+
2689
+ var _Options_1$Options$ev = Options_1.Options.evaluate({
2690
+ options: optionsToEvaluate,
2691
+ context: context
2692
+ }, dataSourcesWithOnlyOnePoint, function () {}, dataFrameWithOnlyOnePoint),
2693
+ _Options_1$Options$ev2 = _Options_1$Options$ev.xField,
2694
+ xField = _Options_1$Options$ev2 === void 0 ? '' : _Options_1$Options$ev2,
2695
+ _Options_1$Options$ev3 = _Options_1$Options$ev.yFields,
2696
+ yFields = _Options_1$Options$ev3 === void 0 ? [] : _Options_1$Options$ev3,
2697
+ _Options_1$Options$ev4 = _Options_1$Options$ev.y2Fields,
2698
+ y2Fields = _Options_1$Options$ev4 === void 0 ? [] : _Options_1$Options$ev4,
2699
+ fieldTypes = _Options_1$Options$ev.fieldTypes;
2700
+
2701
+ return {
2702
+ xField: xField,
2703
+ yFields: [].concat(_toConsumableArray(yFields), _toConsumableArray(y2Fields)),
2704
+ fieldTypes: fieldTypes
2705
+ };
2706
+ } catch (e) {
2707
+ return {
2708
+ xField: undefined,
2709
+ yFields: [],
2710
+ fieldTypes: []
2711
+ };
1701
2712
  }
2713
+ }, [options, context, dataSourcesWithOnlyOnePoint, dataFrameWithOnlyOnePoint]);
2714
+ return xAndYFieldsWithTypes;
2715
+ };
1702
2716
 
1703
- return React.createElement(Visualization, Object.assign({}, props));
1704
- };
2717
+ exports.default = useGetXAndYFields;
1705
2718
 
1706
- (0, hocUtils_1.extendStaticWrapperProps)({
1707
- Wrapper: Wrapper,
1708
- Visualization: Visualization
1709
- });
1710
- return Wrapper;
2719
+ /***/ }),
2720
+ /* 68 */
2721
+ /***/ (function(module, exports, __webpack_require__) {
2722
+
2723
+ "use strict";
2724
+
2725
+
2726
+ Object.defineProperty(exports, "__esModule", {
2727
+ value: true
2728
+ });
2729
+ exports.getFeatureFlag = void 0;
2730
+
2731
+ var FeatureFlags_1 = __webpack_require__(69);
2732
+
2733
+ var getFeatureFlag = function getFeatureFlag(context, flagName) {
2734
+ // look for feature flag in context first
2735
+ if (context && Object.keys(context).find(function (key) {
2736
+ return key === flagName;
2737
+ })) {
2738
+ return context[flagName];
2739
+ } // fall back to defaults
2740
+
2741
+
2742
+ if (Object.keys(FeatureFlags_1.default).find(function (key) {
2743
+ return key === flagName;
2744
+ })) {
2745
+ return FeatureFlags_1.default[flagName];
2746
+ } // fall back to false
2747
+
2748
+
2749
+ return false;
1711
2750
  };
1712
2751
 
1713
- exports.default = withPlaceholder;
2752
+ exports.getFeatureFlag = getFeatureFlag;
1714
2753
 
1715
2754
  /***/ }),
1716
- /* 48 */,
1717
- /* 49 */,
1718
- /* 50 */
2755
+ /* 69 */
2756
+ /***/ (function(module, exports) {
2757
+
2758
+ module.exports = require("@splunk/visualization-context/FeatureFlags");
2759
+
2760
+ /***/ }),
2761
+ /* 70 */,
2762
+ /* 71 */,
2763
+ /* 72 */
1719
2764
  /***/ (function(module, exports) {
1720
2765
 
1721
2766
  module.exports = require("@splunk/visualization-icons/placeholders");
1722
2767
 
1723
2768
  /***/ }),
1724
- /* 51 */
2769
+ /* 73 */
1725
2770
  /***/ (function(module, exports) {
1726
2771
 
1727
2772
  module.exports = require("@splunk/visualization-color-palettes");
1728
2773
 
1729
2774
  /***/ }),
1730
- /* 52 */
2775
+ /* 74 */
1731
2776
  /***/ (function(module, exports) {
1732
2777
 
1733
2778
  module.exports = require("@splunk/visualization-icons");
1734
2779
 
1735
2780
  /***/ }),
1736
- /* 53 */
2781
+ /* 75 */
1737
2782
  /***/ (function(module, exports, __webpack_require__) {
1738
2783
 
1739
2784
  "use strict";
@@ -1763,20 +2808,20 @@ var background = function background(_ref) {
1763
2808
  exports.default = background;
1764
2809
 
1765
2810
  /***/ }),
1766
- /* 54 */,
1767
- /* 55 */
2811
+ /* 76 */,
2812
+ /* 77 */
1768
2813
  /***/ (function(module, exports) {
1769
2814
 
1770
2815
  module.exports = require("@splunk/charting-bundle");
1771
2816
 
1772
2817
  /***/ }),
1773
- /* 56 */
2818
+ /* 78 */
1774
2819
  /***/ (function(module, exports) {
1775
2820
 
1776
2821
  module.exports = require("@splunk/themes/useSplunkTheme");
1777
2822
 
1778
2823
  /***/ }),
1779
- /* 57 */
2824
+ /* 79 */
1780
2825
  /***/ (function(module, exports, __webpack_require__) {
1781
2826
 
1782
2827
  "use strict";
@@ -1800,7 +2845,7 @@ var __rest = this && this.__rest || function (s, e) {
1800
2845
  Object.defineProperty(exports, "__esModule", {
1801
2846
  value: true
1802
2847
  });
1803
- exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
2848
+ exports.shouldEnableSearchZoom = exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
1804
2849
 
1805
2850
  var lodash_1 = __webpack_require__(3);
1806
2851
  /**
@@ -1996,15 +3041,31 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
1996
3041
 
1997
3042
  exports.constructFieldsAndColumns = constructFieldsAndColumns;
1998
3043
 
3044
+ var shouldEnableSearchZoom = function shouldEnableSearchZoom() {
3045
+ var eventHandlers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
3046
+ var xField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
3047
+ var rangeSelectEventHandler = eventHandlers.find(function (eventHandler) {
3048
+ var _a;
3049
+
3050
+ return (_a = eventHandler.options.events) === null || _a === void 0 ? void 0 : _a.includes('range.select');
3051
+ }); // Check if xField is _time. This is how splunk-charting distinguishes a time chart from categorical.
3052
+ // Note: search zoom will be buggy if the x axis uses timestamp values but is not _time
3053
+
3054
+ var xAxisIsTime = xField === '_time';
3055
+ return !!rangeSelectEventHandler && xAxisIsTime;
3056
+ };
3057
+
3058
+ exports.shouldEnableSearchZoom = shouldEnableSearchZoom;
3059
+
1999
3060
  /***/ }),
2000
- /* 58 */,
2001
- /* 59 */,
2002
- /* 60 */,
2003
- /* 61 */,
2004
- /* 62 */,
2005
- /* 63 */,
2006
- /* 64 */,
2007
- /* 65 */
3061
+ /* 80 */,
3062
+ /* 81 */,
3063
+ /* 82 */,
3064
+ /* 83 */,
3065
+ /* 84 */,
3066
+ /* 85 */,
3067
+ /* 86 */,
3068
+ /* 87 */
2008
3069
  /***/ (function(module, exports, __webpack_require__) {
2009
3070
 
2010
3071
  "use strict";
@@ -2020,34 +3081,40 @@ var lodash_1 = __webpack_require__(3);
2020
3081
 
2021
3082
  var i18n_1 = __webpack_require__(2);
2022
3083
 
2023
- var visualization_color_palettes_1 = __webpack_require__(51);
3084
+ var visualization_color_palettes_1 = __webpack_require__(73);
2024
3085
 
2025
- var react_1 = __webpack_require__(1);
3086
+ var react_1 = __webpack_require__(0);
2026
3087
 
2027
- var React = __webpack_require__(1);
3088
+ var React = __webpack_require__(0);
2028
3089
 
2029
- var T = __webpack_require__(0);
3090
+ var T = __webpack_require__(1);
2030
3091
 
2031
- var react_event_listener_1 = __webpack_require__(66);
3092
+ var react_event_listener_1 = __webpack_require__(88);
2032
3093
 
2033
- __webpack_require__(67); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
3094
+ __webpack_require__(89); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
2034
3095
 
2035
3096
 
2036
- var charting_bundle_1 = __webpack_require__(55);
3097
+ var charting_bundle_1 = __webpack_require__(77);
2037
3098
 
2038
- var TimezoneContext_1 = __webpack_require__(26);
3099
+ var TimezoneContext_1 = __webpack_require__(32);
2039
3100
 
2040
- var style_1 = __webpack_require__(14);
3101
+ var style_1 = __webpack_require__(18);
2041
3102
 
2042
3103
  var styled_components_1 = __webpack_require__(4);
2043
3104
 
2044
- var Message_1 = __webpack_require__(10);
3105
+ var Message_1 = __webpack_require__(12);
3106
+
3107
+ var useSplunkTheme_1 = __webpack_require__(78);
3108
+
3109
+ var themeUtils_1 = __webpack_require__(90);
3110
+
3111
+ var ChartingApi_1 = __webpack_require__(91);
2045
3112
 
2046
- var useSplunkTheme_1 = __webpack_require__(56);
3113
+ var usePrevious_1 = __webpack_require__(33);
2047
3114
 
2048
- var themeUtils_1 = __webpack_require__(68);
3115
+ var useEventCallback_1 = __webpack_require__(92);
2049
3116
 
2050
- var ChartingApi_1 = __webpack_require__(69);
3117
+ var dataUtils_1 = __webpack_require__(14);
2051
3118
 
2052
3119
  exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
2053
3120
 
@@ -2061,14 +3128,6 @@ var changedOptions = function changedOptions(curOptions, nextOptions) {
2061
3128
 
2062
3129
  exports.changedOptions = changedOptions;
2063
3130
 
2064
- function usePrevious(value) {
2065
- var ref = (0, react_1.useRef)();
2066
- (0, react_1.useEffect)(function () {
2067
- ref.current = value;
2068
- });
2069
- return ref.current;
2070
- }
2071
-
2072
3131
  var canUpdateInPlace = function canUpdateInPlace(curOptions, nextOptions) {
2073
3132
  // if either of the options are undefined
2074
3133
  // it cannot update in place.
@@ -2133,16 +3192,23 @@ var propTypes = {
2133
3192
  style: T.object,
2134
3193
  colorPalette: T.array,
2135
3194
  visualizationApiRef: T.func,
2136
- themeKey: T.string
3195
+ themeKey: T.string,
3196
+ originalDataSources: T.object,
3197
+ onDownsamplingThresholdChange: T.func,
3198
+ xField: T.string,
3199
+ y2Fields: T.array
2137
3200
  };
2138
3201
 
2139
3202
  var Charting = function Charting(props) {
3203
+ var _a, _b;
3204
+
2140
3205
  var container = (0, react_1.useRef)(null);
2141
3206
  var needsInit = (0, react_1.useRef)(true);
2142
3207
  var chart = (0, react_1.useRef)();
2143
3208
  var needsRedraw = (0, react_1.useRef)(true);
2144
3209
  var api = (0, react_1.useRef)(new ChartingApi_1.ChartingApiFunctional(chart));
2145
3210
  var timezone = (0, react_1.useContext)(TimezoneContext_1.default);
3211
+ var selectChartEvent = (0, react_1.useRef)(null);
2146
3212
 
2147
3213
  var computeChartingSize = function computeChartingSize() {
2148
3214
  if (container.current) {
@@ -2170,9 +3236,13 @@ var Charting = function Charting(props) {
2170
3236
  onSelect = props.onSelect,
2171
3237
  onPointMouseOut = props.onPointMouseOut,
2172
3238
  onPointMouseOver = props.onPointMouseOver,
2173
- onEventTrigger = props.onEventTrigger;
2174
- var prevOptions = usePrevious(options);
2175
- var prevTimezone = usePrevious(timezone);
3239
+ onEventTrigger = props.onEventTrigger,
3240
+ originalDataSources = props.originalDataSources,
3241
+ onDownsamplingThresholdChange = props.onDownsamplingThresholdChange,
3242
+ xField = props.xField,
3243
+ y2Fields = props.y2Fields;
3244
+ var prevOptions = (0, usePrevious_1.default)(options);
3245
+ var prevTimezone = (0, usePrevious_1.default)(timezone);
2176
3246
 
2177
3247
  var handleClick = function handleClick(chartEvent, type) {
2178
3248
  var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
@@ -2202,8 +3272,37 @@ var Charting = function Charting(props) {
2202
3272
  needsInit.current = true;
2203
3273
  };
2204
3274
 
2205
- var handleSelect = function handleSelect(chartEvent) {
2206
- // todo: need change this after breaking all visualizations
3275
+ var enableSearchZoom = (_b = (_a = chartData === null || chartData === void 0 ? void 0 : chartData.chartDataOptions) === null || _a === void 0 ? void 0 : _a.enableSearchZoom) !== null && _b !== void 0 ? _b : false;
3276
+ var recalculateDownsamplingThreshold = React.useCallback(function () {
3277
+ if (!onDownsamplingThresholdChange || !xField) {
3278
+ return;
3279
+ }
3280
+
3281
+ var newThreshold = (0, dataUtils_1.calculateDownsamplingThreshold)({
3282
+ enableSearchZoom: enableSearchZoom,
3283
+ dataSources: originalDataSources,
3284
+ width: Number(width),
3285
+ selectChartEvent: selectChartEvent.current,
3286
+ xField: xField,
3287
+ y2Fields: y2Fields
3288
+ });
3289
+
3290
+ if (Number.isFinite(newThreshold)) {
3291
+ onDownsamplingThresholdChange(newThreshold);
3292
+ }
3293
+ }, [enableSearchZoom, originalDataSources, onDownsamplingThresholdChange, width, xField, y2Fields]);
3294
+ React.useEffect(function () {
3295
+ recalculateDownsamplingThreshold();
3296
+ }, [recalculateDownsamplingThreshold]); // useEventCallback is used for these handlers to make sure that they are a stable reference and
3297
+ // we always use the latest version of the callback
3298
+ // Since chart drawing is debounced, there is a race condition where a stale callback may be called
3299
+ // if a prop changes and the event handler is called before the chart redraws. This means that
3300
+ // it will use the old callback rather than the newer one, which can lead to inaccurate results
3301
+
3302
+ var handleSelect = (0, useEventCallback_1.default)(function (chartEvent) {
3303
+ selectChartEvent.current = chartEvent;
3304
+ recalculateDownsamplingThreshold(); // todo: need change this after breaking all visualizations
3305
+
2207
3306
  if (onSelect && typeof onSelect === 'function') {
2208
3307
  onSelect({
2209
3308
  type: 'range.select',
@@ -2219,9 +3318,8 @@ var Charting = function Charting(props) {
2219
3318
  originalEvent: chartEvent,
2220
3319
  payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
2221
3320
  });
2222
- };
2223
-
2224
- var handlePointMouseOut = function handlePointMouseOut(chartEvent, type) {
3321
+ });
3322
+ var handlePointMouseOut = (0, useEventCallback_1.default)(function (chartEvent, type) {
2225
3323
  var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
2226
3324
  payload.name = payload.name2;
2227
3325
  delete payload.name2;
@@ -2233,9 +3331,8 @@ var Charting = function Charting(props) {
2233
3331
  originalEvent: chartEvent,
2234
3332
  payload: payload
2235
3333
  });
2236
- };
2237
-
2238
- var handlePointMouseOver = function handlePointMouseOver(chartEvent, type) {
3334
+ });
3335
+ var handlePointMouseOver = (0, useEventCallback_1.default)(function (chartEvent, type) {
2239
3336
  var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
2240
3337
  payload.name = payload.name2;
2241
3338
  delete payload.name2;
@@ -2247,7 +3344,7 @@ var Charting = function Charting(props) {
2247
3344
  originalEvent: chartEvent,
2248
3345
  payload: payload
2249
3346
  });
2250
- };
3347
+ });
2251
3348
 
2252
3349
  var drawChart = function drawChart() {
2253
3350
  var updatedOptions = Object.assign(Object.assign({}, options), {
@@ -2273,7 +3370,7 @@ var Charting = function Charting(props) {
2273
3370
 
2274
3371
  if (prevOptions) {
2275
3372
  Object.keys(prevOptions).forEach(function (key) {
2276
- if (updatedOptions[key] === undefined) {
3373
+ if (prevOptions[key] && updatedOptions[key] === undefined) {
2277
3374
  updatedOptions[key] = '';
2278
3375
  }
2279
3376
  });
@@ -2343,8 +3440,8 @@ var Charting = function Charting(props) {
2343
3440
  debouncedDrawChart();
2344
3441
  };
2345
3442
 
2346
- var prevTheme = usePrevious(themeKey);
2347
- var prevOnClick = usePrevious(onClick);
3443
+ var prevTheme = (0, usePrevious_1.default)(themeKey);
3444
+ var prevOnClick = (0, usePrevious_1.default)(onClick);
2348
3445
  (0, react_1.useEffect)(function () {
2349
3446
  debouncedDrawChart();
2350
3447
  props.visualizationApiRef(api.current);
@@ -2359,11 +3456,11 @@ var Charting = function Charting(props) {
2359
3456
  if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) || // timezone is a simple object so this comparison should be fast
2360
3457
  JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
2361
3458
  needsInit.current = true;
2362
- }
2363
-
2364
- needsRedraw.current = true; // need to immediately call drawChart upon an option or chartData change
3459
+ } // need to immediately call drawChart upon an option or chartData change
2365
3460
  // otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
2366
3461
 
3462
+
3463
+ needsRedraw.current = true;
2367
3464
  drawChart();
2368
3465
  }, [JSON.stringify(options), JSON.stringify(chartData.toJSON()), JSON.stringify(chartData.annotations), timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone, timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset, timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone, themeKey, onClick]);
2369
3466
  return React.createElement(ChartingContainer, {
@@ -2391,7 +3488,11 @@ var defaultProps = {
2391
3488
  colorPalette: visualization_color_palettes_1.VIZ_CATEGORICAL,
2392
3489
  visualizationApiRef: lodash_1.noop,
2393
3490
  chartData: null,
2394
- themeKey: null
3491
+ themeKey: null,
3492
+ onDownsamplingThresholdChange: null,
3493
+ originalDataSources: null,
3494
+ xField: null,
3495
+ y2Fields: []
2395
3496
  };
2396
3497
  Charting.propTypes = propTypes;
2397
3498
  Charting.defaultProps = defaultProps; // allow for early return in case of empty chartData while still following hook rules
@@ -2427,33 +3528,33 @@ var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
2427
3528
  exports.default = withEmptyChartMessage(Charting);
2428
3529
 
2429
3530
  /***/ }),
2430
- /* 66 */
3531
+ /* 88 */
2431
3532
  /***/ (function(module, exports) {
2432
3533
 
2433
3534
  module.exports = require("react-event-listener");
2434
3535
 
2435
3536
  /***/ }),
2436
- /* 67 */
3537
+ /* 89 */
2437
3538
  /***/ (function(module, exports) {
2438
3539
 
2439
3540
  module.exports = require("@splunk/visualizations-shared/i18n");
2440
3541
 
2441
3542
  /***/ }),
2442
- /* 68 */
3543
+ /* 90 */
2443
3544
  /***/ (function(module, exports) {
2444
3545
 
2445
3546
  module.exports = require("@splunk/visualizations-shared/themeUtils");
2446
3547
 
2447
3548
  /***/ }),
2448
- /* 69 */
3549
+ /* 91 */
2449
3550
  /***/ (function(module, exports, __webpack_require__) {
2450
3551
 
2451
3552
  "use strict";
2452
3553
 
2453
3554
 
2454
- var _classCallCheck = __webpack_require__(9);
3555
+ var _classCallCheck = __webpack_require__(10);
2455
3556
 
2456
- var _createClass = __webpack_require__(18);
3557
+ var _createClass = __webpack_require__(25);
2457
3558
 
2458
3559
  Object.defineProperty(exports, "__esModule", {
2459
3560
  value: true
@@ -2513,16 +3614,41 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
2513
3614
  exports.ChartingApiFunctional = ChartingApiFunctional;
2514
3615
 
2515
3616
  /***/ }),
2516
- /* 70 */
3617
+ /* 92 */
3618
+ /***/ (function(module, exports, __webpack_require__) {
3619
+
3620
+ "use strict";
3621
+
3622
+
3623
+ Object.defineProperty(exports, "__esModule", {
3624
+ value: true
3625
+ });
3626
+
3627
+ var react_1 = __webpack_require__(0);
3628
+
3629
+ var useEventCallback = function useEventCallback(fn) {
3630
+ var ref = (0, react_1.useRef)(fn);
3631
+ (0, react_1.useLayoutEffect)(function () {
3632
+ ref.current = fn;
3633
+ });
3634
+ return (0, react_1.useCallback)(function () {
3635
+ return ref.current.apply(ref, arguments);
3636
+ }, []);
3637
+ };
3638
+
3639
+ exports.default = useEventCallback;
3640
+
3641
+ /***/ }),
3642
+ /* 93 */
2517
3643
  /***/ (function(module, exports) {
2518
3644
 
2519
3645
  module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
2520
3646
 
2521
3647
  /***/ }),
2522
- /* 71 */,
2523
- /* 72 */,
2524
- /* 73 */,
2525
- /* 74 */
3648
+ /* 94 */,
3649
+ /* 95 */,
3650
+ /* 96 */,
3651
+ /* 97 */
2526
3652
  /***/ (function(module, exports, __webpack_require__) {
2527
3653
 
2528
3654
  "use strict";
@@ -2537,7 +3663,7 @@ exports.AxesChartDataConfigAreaColumnLine = exports.AxesChartDataConfigBubble =
2537
3663
 
2538
3664
  var i18n_1 = __webpack_require__(2);
2539
3665
 
2540
- var configUtils_1 = __webpack_require__(20);
3666
+ var configUtils_1 = __webpack_require__(27);
2541
3667
 
2542
3668
  var AxesChartDataConfig = {
2543
3669
  label: (0, i18n_1._)('Data configurations'),
@@ -2662,7 +3788,7 @@ exports.AxesChartDataConfigAreaColumnLine = {
2662
3788
  exports.default = AxesChartDataConfig;
2663
3789
 
2664
3790
  /***/ }),
2665
- /* 75 */
3791
+ /* 98 */
2666
3792
  /***/ (function(module, exports, __webpack_require__) {
2667
3793
 
2668
3794
  "use strict";
@@ -2674,11 +3800,11 @@ Object.defineProperty(exports, "__esModule", {
2674
3800
 
2675
3801
  var i18n_1 = __webpack_require__(2);
2676
3802
 
2677
- var pick_1 = __webpack_require__(23);
3803
+ var pick_1 = __webpack_require__(30);
2678
3804
 
2679
- var variables_1 = __webpack_require__(11);
3805
+ var variables_1 = __webpack_require__(13);
2680
3806
 
2681
- var BackgroundColor_1 = __webpack_require__(53);
3807
+ var BackgroundColor_1 = __webpack_require__(75);
2682
3808
 
2683
3809
  var themes = {
2684
3810
  defaultBackgroundColor: function defaultBackgroundColor(props) {
@@ -2708,7 +3834,7 @@ var AxesChartColorAndStyle = {
2708
3834
  exports.default = AxesChartColorAndStyle;
2709
3835
 
2710
3836
  /***/ }),
2711
- /* 76 */
3837
+ /* 99 */
2712
3838
  /***/ (function(module, exports, __webpack_require__) {
2713
3839
 
2714
3840
  "use strict";
@@ -2772,7 +3898,7 @@ var AxesChartLegend = {
2772
3898
  exports.default = AxesChartLegend;
2773
3899
 
2774
3900
  /***/ }),
2775
- /* 77 */
3901
+ /* 100 */
2776
3902
  /***/ (function(module, exports, __webpack_require__) {
2777
3903
 
2778
3904
  "use strict";
@@ -2787,7 +3913,7 @@ exports.AxesChartXGridAndLabelsBubbleScatter = exports.AxesChartXGridAndLabelsCo
2787
3913
 
2788
3914
  var i18n_1 = __webpack_require__(2);
2789
3915
 
2790
- var configUtils_1 = __webpack_require__(20);
3916
+ var configUtils_1 = __webpack_require__(27);
2791
3917
 
2792
3918
  exports.AxesChartXGridAndLabelsCommon = {
2793
3919
  label: (0, i18n_1._)('X-axis grid and labels'),
@@ -3060,7 +4186,7 @@ exports.AxesChartXGridAndLabelsBubbleScatter = {
3060
4186
  exports.default = AxesChartXGridAndLabels;
3061
4187
 
3062
4188
  /***/ }),
3063
- /* 78 */
4189
+ /* 101 */
3064
4190
  /***/ (function(module, exports, __webpack_require__) {
3065
4191
 
3066
4192
  "use strict";
@@ -3222,17 +4348,17 @@ var AxesChartYGridAndLabels = {
3222
4348
  exports.default = AxesChartYGridAndLabels;
3223
4349
 
3224
4350
  /***/ }),
3225
- /* 79 */,
3226
- /* 80 */,
3227
- /* 81 */,
3228
- /* 82 */,
3229
- /* 83 */,
3230
- /* 84 */,
3231
- /* 85 */,
3232
- /* 86 */,
3233
- /* 87 */,
3234
- /* 88 */,
3235
- /* 89 */
4351
+ /* 102 */,
4352
+ /* 103 */,
4353
+ /* 104 */,
4354
+ /* 105 */,
4355
+ /* 106 */,
4356
+ /* 107 */,
4357
+ /* 108 */,
4358
+ /* 109 */,
4359
+ /* 110 */,
4360
+ /* 111 */,
4361
+ /* 112 */
3236
4362
  /***/ (function(module, exports, __webpack_require__) {
3237
4363
 
3238
4364
  "use strict";
@@ -3249,7 +4375,7 @@ var i18n_1 = __webpack_require__(2);
3249
4375
 
3250
4376
  var lodash_1 = __webpack_require__(3);
3251
4377
 
3252
- var configUtils_1 = __webpack_require__(20);
4378
+ var configUtils_1 = __webpack_require__(27);
3253
4379
 
3254
4380
  exports.AxesChartDataDisplayLine = {
3255
4381
  label: (0, i18n_1._)('Data display'),
@@ -3370,7 +4496,7 @@ exports.AxesChartDataDisplayColumn = {
3370
4496
  exports.default = AxesChartDataDisplay;
3371
4497
 
3372
4498
  /***/ }),
3373
- /* 90 */
4499
+ /* 113 */
3374
4500
  /***/ (function(module, exports, __webpack_require__) {
3375
4501
 
3376
4502
  "use strict";
@@ -3544,29 +4670,6 @@ var axesChartY2GridAndLabels = {
3544
4670
  exports.default = axesChartY2GridAndLabels;
3545
4671
 
3546
4672
  /***/ }),
3547
- /* 91 */,
3548
- /* 92 */,
3549
- /* 93 */,
3550
- /* 94 */,
3551
- /* 95 */,
3552
- /* 96 */,
3553
- /* 97 */,
3554
- /* 98 */,
3555
- /* 99 */,
3556
- /* 100 */,
3557
- /* 101 */,
3558
- /* 102 */,
3559
- /* 103 */,
3560
- /* 104 */,
3561
- /* 105 */,
3562
- /* 106 */,
3563
- /* 107 */,
3564
- /* 108 */,
3565
- /* 109 */,
3566
- /* 110 */,
3567
- /* 111 */,
3568
- /* 112 */,
3569
- /* 113 */,
3570
4673
  /* 114 */,
3571
4674
  /* 115 */,
3572
4675
  /* 116 */,
@@ -3608,7 +4711,29 @@ exports.default = axesChartY2GridAndLabels;
3608
4711
  /* 152 */,
3609
4712
  /* 153 */,
3610
4713
  /* 154 */,
3611
- /* 155 */
4714
+ /* 155 */,
4715
+ /* 156 */,
4716
+ /* 157 */,
4717
+ /* 158 */,
4718
+ /* 159 */,
4719
+ /* 160 */,
4720
+ /* 161 */,
4721
+ /* 162 */,
4722
+ /* 163 */,
4723
+ /* 164 */,
4724
+ /* 165 */,
4725
+ /* 166 */,
4726
+ /* 167 */,
4727
+ /* 168 */,
4728
+ /* 169 */,
4729
+ /* 170 */,
4730
+ /* 171 */,
4731
+ /* 172 */,
4732
+ /* 173 */,
4733
+ /* 174 */,
4734
+ /* 175 */,
4735
+ /* 176 */,
4736
+ /* 177 */
3612
4737
  /***/ (function(module, exports, __webpack_require__) {
3613
4738
 
3614
4739
  "use strict";
@@ -3632,20 +4757,20 @@ Object.defineProperty(exports, "__esModule", {
3632
4757
  });
3633
4758
  exports.config = exports.themes = exports.computeVizProps = void 0; // Charting imports i18n which needs to be run to instantiate window globals in the tests
3634
4759
 
3635
- var Charting_1 = __webpack_require__(65); // eslint-disable-next-line import/order
4760
+ var Charting_1 = __webpack_require__(87); // eslint-disable-next-line import/order
3636
4761
 
3637
4762
 
3638
- var charting_bundle_1 = __webpack_require__(55);
4763
+ var charting_bundle_1 = __webpack_require__(77);
3639
4764
 
3640
- var config_1 = __webpack_require__(156);
4765
+ var config_1 = __webpack_require__(178);
3641
4766
 
3642
4767
  exports.config = config_1.default;
3643
4768
 
3644
- var withDashboardViz_1 = __webpack_require__(37);
4769
+ var withDashboardViz_1 = __webpack_require__(56);
3645
4770
 
3646
- var chartingUtils_1 = __webpack_require__(57);
4771
+ var chartingUtils_1 = __webpack_require__(79);
3647
4772
 
3648
- var lineUtils_1 = __webpack_require__(225);
4773
+ var lineUtils_1 = __webpack_require__(247);
3649
4774
 
3650
4775
  var computeVizProps = function computeVizProps(_a) {
3651
4776
  var dataSources = _a.dataSources,
@@ -3666,7 +4791,8 @@ var computeVizProps = function computeVizProps(_a) {
3666
4791
  };
3667
4792
  var y2 = otherOptions.y2,
3668
4793
  y2Fields = otherOptions.y2Fields,
3669
- hasEventHandlers = otherOptions.hasEventHandlers;
4794
+ hasEventHandlers = otherOptions.hasEventHandlers,
4795
+ eventHandlers = otherOptions.eventHandlers;
3670
4796
  computedProps.options = (0, lineUtils_1.transformOptions)(otherOptions);
3671
4797
  var chartingAnnotations = (0, chartingUtils_1.getAnnotations)({
3672
4798
  annotationX: annotationX,
@@ -3696,7 +4822,10 @@ var computeVizProps = function computeVizProps(_a) {
3696
4822
 
3697
4823
  computedProps.chartData = charting_bundle_1.default.extractChartReadyData(Object.assign(Object.assign({}, primaryData), {
3698
4824
  annotations: chartingAnnotations
3699
- }));
4825
+ }), {
4826
+ removeRangeSelectOnLoad: true,
4827
+ enableSearchZoom: (0, chartingUtils_1.shouldEnableSearchZoom)(eventHandlers, xField)
4828
+ });
3700
4829
 
3701
4830
  if (hasEventHandlers) {
3702
4831
  computedProps.onClick = onEventTrigger;
@@ -3719,7 +4848,7 @@ exports.themes = themes;
3719
4848
  exports.default = Line;
3720
4849
 
3721
4850
  /***/ }),
3722
- /* 156 */
4851
+ /* 178 */
3723
4852
  /***/ (function(module, exports, __webpack_require__) {
3724
4853
 
3725
4854
  "use strict";
@@ -3731,39 +4860,39 @@ Object.defineProperty(exports, "__esModule", {
3731
4860
  value: true
3732
4861
  });
3733
4862
 
3734
- var schemaUtils_1 = __webpack_require__(16);
4863
+ var schemaUtils_1 = __webpack_require__(24);
3735
4864
 
3736
- var visualization_color_palettes_1 = __webpack_require__(51);
4865
+ var visualization_color_palettes_1 = __webpack_require__(73);
3737
4866
 
3738
- var visualization_icons_1 = __webpack_require__(52);
4867
+ var visualization_icons_1 = __webpack_require__(74);
3739
4868
 
3740
- var placeholders_1 = __webpack_require__(50);
4869
+ var placeholders_1 = __webpack_require__(72);
3741
4870
 
3742
4871
  var i18n_1 = __webpack_require__(2);
3743
4872
 
3744
- var pick_1 = __webpack_require__(23);
4873
+ var pick_1 = __webpack_require__(30);
3745
4874
 
3746
- var variables_1 = __webpack_require__(11);
4875
+ var variables_1 = __webpack_require__(13);
3747
4876
 
3748
- var AxesChartDataConfig_1 = __webpack_require__(74);
4877
+ var AxesChartDataConfig_1 = __webpack_require__(97);
3749
4878
 
3750
- var AxesChartDataDisplay_1 = __webpack_require__(89);
4879
+ var AxesChartDataDisplay_1 = __webpack_require__(112);
3751
4880
 
3752
- var AxesChartColorAndStyle_1 = __webpack_require__(75);
4881
+ var AxesChartColorAndStyle_1 = __webpack_require__(98);
3753
4882
 
3754
- var AxesChartLegend_1 = __webpack_require__(76);
4883
+ var AxesChartLegend_1 = __webpack_require__(99);
3755
4884
 
3756
- var AxesChartXGridAndLabels_1 = __webpack_require__(77);
4885
+ var AxesChartXGridAndLabels_1 = __webpack_require__(100);
3757
4886
 
3758
- var AxesChartYGridAndLabels_1 = __webpack_require__(78);
4887
+ var AxesChartYGridAndLabels_1 = __webpack_require__(101);
3759
4888
 
3760
- var AxesChartY2GridAndLabels_1 = __webpack_require__(90);
4889
+ var AxesChartY2GridAndLabels_1 = __webpack_require__(113);
3761
4890
 
3762
4891
  var VizBehavior_1 = __webpack_require__(6);
3763
4892
 
3764
- var VizCategory_1 = __webpack_require__(36);
4893
+ var VizCategory_1 = __webpack_require__(22);
3765
4894
 
3766
- var configUtils_1 = __webpack_require__(20);
4895
+ var configUtils_1 = __webpack_require__(27);
3767
4896
 
3768
4897
  var dataContract = {
3769
4898
  requiredDataSources: [{
@@ -4386,34 +5515,12 @@ var config = {
4386
5515
  description: 'triggered when user moves out of a data point'
4387
5516
  }
4388
5517
  },
4389
- supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER],
5518
+ supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.DOWNSAMPLING],
4390
5519
  themes: themes
4391
5520
  };
4392
5521
  exports.default = (0, configUtils_1.enhanceConfig)(config);
4393
5522
 
4394
5523
  /***/ }),
4395
- /* 157 */,
4396
- /* 158 */,
4397
- /* 159 */,
4398
- /* 160 */,
4399
- /* 161 */,
4400
- /* 162 */,
4401
- /* 163 */,
4402
- /* 164 */,
4403
- /* 165 */,
4404
- /* 166 */,
4405
- /* 167 */,
4406
- /* 168 */,
4407
- /* 169 */,
4408
- /* 170 */,
4409
- /* 171 */,
4410
- /* 172 */,
4411
- /* 173 */,
4412
- /* 174 */,
4413
- /* 175 */,
4414
- /* 176 */,
4415
- /* 177 */,
4416
- /* 178 */,
4417
5524
  /* 179 */,
4418
5525
  /* 180 */,
4419
5526
  /* 181 */,
@@ -4459,7 +5566,29 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
4459
5566
  /* 221 */,
4460
5567
  /* 222 */,
4461
5568
  /* 223 */,
4462
- /* 224 */
5569
+ /* 224 */,
5570
+ /* 225 */,
5571
+ /* 226 */,
5572
+ /* 227 */,
5573
+ /* 228 */,
5574
+ /* 229 */,
5575
+ /* 230 */,
5576
+ /* 231 */,
5577
+ /* 232 */,
5578
+ /* 233 */,
5579
+ /* 234 */,
5580
+ /* 235 */,
5581
+ /* 236 */,
5582
+ /* 237 */,
5583
+ /* 238 */,
5584
+ /* 239 */,
5585
+ /* 240 */,
5586
+ /* 241 */,
5587
+ /* 242 */,
5588
+ /* 243 */,
5589
+ /* 244 */,
5590
+ /* 245 */,
5591
+ /* 246 */
4463
5592
  /***/ (function(module, exports, __webpack_require__) {
4464
5593
 
4465
5594
  "use strict";
@@ -4495,9 +5624,9 @@ Object.defineProperty(exports, "__esModule", {
4495
5624
  });
4496
5625
  exports.default = void 0;
4497
5626
 
4498
- __exportStar(__webpack_require__(155), exports);
5627
+ __exportStar(__webpack_require__(177), exports);
4499
5628
 
4500
- var Line_1 = __webpack_require__(155);
5629
+ var Line_1 = __webpack_require__(177);
4501
5630
 
4502
5631
  Object.defineProperty(exports, "default", {
4503
5632
  enumerable: true,
@@ -4507,7 +5636,7 @@ Object.defineProperty(exports, "default", {
4507
5636
  });
4508
5637
 
4509
5638
  /***/ }),
4510
- /* 225 */
5639
+ /* 247 */
4511
5640
  /***/ (function(module, exports, __webpack_require__) {
4512
5641
 
4513
5642
  "use strict";
@@ -4518,13 +5647,13 @@ Object.defineProperty(exports, "__esModule", {
4518
5647
  });
4519
5648
  exports.convertToLineSCProperties = exports.convertMarkerOptions = exports.transformOptions = void 0;
4520
5649
 
4521
- var propUtils_1 = __webpack_require__(29);
5650
+ var propUtils_1 = __webpack_require__(36);
4522
5651
 
4523
- var simpleXMLOptions_1 = __webpack_require__(70);
5652
+ var simpleXMLOptions_1 = __webpack_require__(93);
4524
5653
 
4525
5654
  var lodash_1 = __webpack_require__(3);
4526
5655
 
4527
- var config_1 = __webpack_require__(156);
5656
+ var config_1 = __webpack_require__(178);
4528
5657
 
4529
5658
  var transformOptions = function transformOptions(originalOptions) {
4530
5659
  var returnOptions = (0, propUtils_1.adjustOptionsToSchema)(originalOptions, config_1.default.optionsSchema);