@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/FillerGauge.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 = 215);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 237);
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,46 +176,540 @@ 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 */
207
+ /***/ (function(module, exports, __webpack_require__) {
208
+
209
+ "use strict";
210
+
211
+
212
+ Object.defineProperty(exports, "__esModule", {
213
+ value: true
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
+ }
405
+
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 */
200
693
  /***/ (function(module, exports, __webpack_require__) {
201
694
 
202
695
  "use strict";
203
696
 
204
697
 
698
+ var _slicedToArray = __webpack_require__(7);
699
+
205
700
  Object.defineProperty(exports, "__esModule", {
206
701
  value: true
207
702
  });
208
703
 
209
- var React = __webpack_require__(1);
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,63 +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 */
1183
+ /* 29 */
600
1184
  /***/ (function(module, exports) {
601
1185
 
602
1186
  module.exports = require("@splunk/visualizations-shared/configUtils");
603
1187
 
604
1188
  /***/ }),
605
- /* 23 */
1189
+ /* 30 */
606
1190
  /***/ (function(module, exports) {
607
1191
 
608
1192
  module.exports = require("@splunk/themes/pick");
609
1193
 
610
1194
  /***/ }),
611
- /* 24 */,
612
- /* 25 */
1195
+ /* 31 */
613
1196
  /***/ (function(module, exports) {
614
1197
 
615
1198
  module.exports = require("@splunk/ui-utils/id");
616
1199
 
617
1200
  /***/ }),
618
- /* 26 */
1201
+ /* 32 */
619
1202
  /***/ (function(module, exports) {
620
1203
 
621
1204
  module.exports = require("@splunk/visualization-context/TimezoneContext");
622
1205
 
623
- /***/ }),
624
- /* 27 */
625
- /***/ (function(module, exports) {
1206
+ /***/ }),
1207
+ /* 33 */
1208
+ /***/ (function(module, exports, __webpack_require__) {
1209
+
1210
+ "use strict";
1211
+
1212
+
1213
+ Object.defineProperty(exports, "__esModule", {
1214
+ value: true
1215
+ });
626
1216
 
627
- module.exports = require("@splunk/visualizations-shared/hocUtils");
1217
+ var react_1 = __webpack_require__(0);
628
1218
 
629
- /***/ }),
630
- /* 28 */
631
- /***/ (function(module, exports) {
1219
+ function usePrevious(value) {
1220
+ var ref = (0, react_1.useRef)();
1221
+ (0, react_1.useEffect)(function () {
1222
+ ref.current = value;
1223
+ });
1224
+ return ref.current;
1225
+ }
632
1226
 
633
- module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
1227
+ exports.default = usePrevious;
634
1228
 
635
1229
  /***/ }),
636
- /* 29 */,
637
- /* 30 */
1230
+ /* 34 */
638
1231
  /***/ (function(module, exports) {
639
1232
 
640
- module.exports = require("@splunk/visualization-encoding/Options");
1233
+ module.exports = require("@splunk/visualizations-shared/hocUtils");
641
1234
 
642
1235
  /***/ }),
643
- /* 31 */
1236
+ /* 35 */
644
1237
  /***/ (function(module, exports) {
645
1238
 
646
- module.exports = require("@splunk/visualizations-shared/numberUtils");
1239
+ module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
647
1240
 
648
1241
  /***/ }),
649
- /* 32 */
1242
+ /* 36 */,
1243
+ /* 37 */
650
1244
  /***/ (function(module, exports, __webpack_require__) {
651
1245
 
652
1246
  "use strict";
@@ -657,17 +1251,17 @@ Object.defineProperty(exports, "__esModule", {
657
1251
  });
658
1252
  exports.shouldShowIconPlaceholder = void 0;
659
1253
 
660
- var React = __webpack_require__(1);
1254
+ var React = __webpack_require__(0);
661
1255
 
662
- var T = __webpack_require__(0);
1256
+ var T = __webpack_require__(1);
663
1257
 
664
1258
  var lodash_1 = __webpack_require__(3);
665
1259
 
666
1260
  var i18n_1 = __webpack_require__(2);
667
1261
 
668
- var Message_1 = __webpack_require__(10);
1262
+ var Message_1 = __webpack_require__(12);
669
1263
 
670
- var FixedSizeContainer_1 = __webpack_require__(13);
1264
+ var FixedSizeContainer_1 = __webpack_require__(17);
671
1265
  /**
672
1266
  * @method shouldShowIconPlaceholder
673
1267
  * @param {object} dataSources
@@ -738,24 +1332,24 @@ IconPlaceholder.defaultProps = {
738
1332
  exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
739
1333
 
740
1334
  /***/ }),
741
- /* 33 */
1335
+ /* 38 */
742
1336
  /***/ (function(module, exports, __webpack_require__) {
743
1337
 
744
1338
  "use strict";
745
1339
 
746
1340
 
747
- var _defineProperty = __webpack_require__(7);
1341
+ var _defineProperty = __webpack_require__(9);
748
1342
 
749
1343
  Object.defineProperty(exports, "__esModule", {
750
1344
  value: true
751
1345
  });
752
1346
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
753
1347
 
754
- var T = __webpack_require__(0);
1348
+ var T = __webpack_require__(1);
755
1349
 
756
1350
  var lodash_1 = __webpack_require__(3);
757
1351
 
758
- var DataSource_1 = __webpack_require__(34);
1352
+ var DataSource_1 = __webpack_require__(19);
759
1353
 
760
1354
  exports.SortParamsPropTypes = T.shape({
761
1355
  currentSortKey: T.string,
@@ -808,22 +1402,7 @@ var getSortingParams = function getSortingParams(_ref) {
808
1402
  exports.getSortingParams = getSortingParams;
809
1403
 
810
1404
  /***/ }),
811
- /* 34 */
812
- /***/ (function(module, exports, __webpack_require__) {
813
-
814
- "use strict";
815
-
816
-
817
- Object.defineProperty(exports, "__esModule", {
818
- value: true
819
- });
820
- exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
821
- exports.validSortDirs = ['asc', 'desc', 'none'];
822
- exports.validSegmentationModes = ['none', 'inner'];
823
- exports.validOutputModes = ['json_cols', 'json'];
824
-
825
- /***/ }),
826
- /* 35 */
1405
+ /* 39 */
827
1406
  /***/ (function(module, exports, __webpack_require__) {
828
1407
 
829
1408
  "use strict";
@@ -834,7 +1413,7 @@ Object.defineProperty(exports, "__esModule", {
834
1413
  });
835
1414
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
836
1415
 
837
- var T = __webpack_require__(0);
1416
+ var T = __webpack_require__(1);
838
1417
 
839
1418
  var lodash_1 = __webpack_require__(3);
840
1419
 
@@ -887,87 +1466,307 @@ var getPaginationParams = function getPaginationParams(_ref) {
887
1466
  exports.getPaginationParams = getPaginationParams;
888
1467
 
889
1468
  /***/ }),
890
- /* 36 */
1469
+ /* 40 */
891
1470
  /***/ (function(module, exports, __webpack_require__) {
892
1471
 
893
1472
  "use strict";
894
1473
 
895
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
+
896
1500
  Object.defineProperty(exports, "__esModule", {
897
1501
  value: true
898
1502
  });
899
- exports.VizCategory = void 0;
900
- var VizCategory;
901
1503
 
902
- (function (VizCategory) {
903
- VizCategory["SINGLE_VALUE"] = "Single Value";
904
- VizCategory["TRENDS"] = "Trends";
905
- VizCategory["COMPARISONS"] = "Comparisons";
906
- VizCategory["TABLE"] = "Table";
907
- VizCategory["GAUGE"] = "Gauge";
908
- VizCategory["DISTRIBUTIONS"] = "Distributions";
909
- VizCategory["CHOROPLETH"] = "Choropleth Maps";
910
- VizCategory["SHAPES"] = "Shapes";
911
- VizCategory["MISC"] = "misc";
912
- VizCategory["FLOW"] = "Flow";
913
- VizCategory["CORRELATION"] = "Correlation";
914
- VizCategory["SPATIAL"] = "Spatial";
915
- })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
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);
916
1541
 
917
1542
  /***/ }),
918
- /* 37 */
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
+ });
1632
+
1633
+ /***/ }),
1634
+ /* 49 */
1635
+ /***/ (function(module, exports, __webpack_require__) {
1636
+
1637
+ "use strict";
1638
+
1639
+
1640
+ Object.defineProperty(exports, "__esModule", {
1641
+ value: true
1642
+ });
1643
+
1644
+ /***/ }),
1645
+ /* 50 */
1646
+ /***/ (function(module, exports, __webpack_require__) {
1647
+
1648
+ "use strict";
1649
+
1650
+
1651
+ Object.defineProperty(exports, "__esModule", {
1652
+ value: true
1653
+ });
1654
+
1655
+ /***/ }),
1656
+ /* 51 */
1657
+ /***/ (function(module, exports, __webpack_require__) {
1658
+
1659
+ "use strict";
1660
+
1661
+
1662
+ Object.defineProperty(exports, "__esModule", {
1663
+ value: true
1664
+ });
1665
+
1666
+ /***/ }),
1667
+ /* 52 */
1668
+ /***/ (function(module, exports, __webpack_require__) {
1669
+
1670
+ "use strict";
1671
+
1672
+
1673
+ Object.defineProperty(exports, "__esModule", {
1674
+ value: true
1675
+ });
1676
+
1677
+ /***/ }),
1678
+ /* 53 */
1679
+ /***/ (function(module, exports, __webpack_require__) {
1680
+
1681
+ "use strict";
1682
+
1683
+
1684
+ Object.defineProperty(exports, "__esModule", {
1685
+ value: true
1686
+ });
1687
+
1688
+ /***/ }),
1689
+ /* 54 */
1690
+ /***/ (function(module, exports, __webpack_require__) {
1691
+
1692
+ "use strict";
1693
+
1694
+
1695
+ Object.defineProperty(exports, "__esModule", {
1696
+ value: true
1697
+ });
1698
+
1699
+ /***/ }),
1700
+ /* 55 */
1701
+ /***/ (function(module, exports, __webpack_require__) {
1702
+
1703
+ "use strict";
1704
+
1705
+
1706
+ Object.defineProperty(exports, "__esModule", {
1707
+ value: true
1708
+ });
1709
+
1710
+ /***/ }),
1711
+ /* 56 */
919
1712
  /***/ (function(module, exports, __webpack_require__) {
920
1713
 
921
1714
  "use strict";
922
1715
 
923
1716
 
924
- var _slicedToArray = __webpack_require__(17);
1717
+ var _slicedToArray = __webpack_require__(7);
925
1718
 
926
1719
  Object.defineProperty(exports, "__esModule", {
927
1720
  value: true
928
1721
  });
929
1722
 
930
- var React = __webpack_require__(1);
1723
+ var React = __webpack_require__(0);
931
1724
 
932
1725
  var lodash_1 = __webpack_require__(3);
933
1726
 
934
- var getSettingsFromThemedProps_1 = __webpack_require__(38);
1727
+ var getSettingsFromThemedProps_1 = __webpack_require__(57);
935
1728
 
936
- var Options_1 = __webpack_require__(30);
1729
+ var Options_1 = __webpack_require__(16);
937
1730
 
938
- var SanitizeProps_1 = __webpack_require__(39);
1731
+ var SanitizeProps_1 = __webpack_require__(58);
939
1732
 
940
- var TimezoneContext_1 = __webpack_require__(26);
1733
+ var TimezoneContext_1 = __webpack_require__(32);
941
1734
 
942
- var moment_1 = __webpack_require__(40);
1735
+ var moment_1 = __webpack_require__(59);
943
1736
 
944
- var FeatureFlagContext_1 = __webpack_require__(21);
1737
+ var FeatureFlagContext_1 = __webpack_require__(28);
945
1738
 
946
1739
  var styled_components_1 = __webpack_require__(4);
947
1740
 
948
- var hocUtils_1 = __webpack_require__(27);
1741
+ var hocUtils_1 = __webpack_require__(34);
1742
+
1743
+ var JSONSchemaUtils_1 = __webpack_require__(35);
1744
+
1745
+ var async_dynamic_options_evaluator_1 = __webpack_require__(60);
1746
+
1747
+ var id_1 = __webpack_require__(31);
949
1748
 
950
- var JSONSchemaUtils_1 = __webpack_require__(28);
1749
+ var SplunkVisualization_1 = __webpack_require__(61);
951
1750
 
952
- var async_dynamic_options_evaluator_1 = __webpack_require__(41);
1751
+ var VizBehavior_1 = __webpack_require__(6);
953
1752
 
954
- var id_1 = __webpack_require__(25);
1753
+ var getSorting_1 = __webpack_require__(38);
955
1754
 
956
- var SplunkVisualization_1 = __webpack_require__(42);
1755
+ var getPagination_1 = __webpack_require__(39);
957
1756
 
958
- var VizBehavior_1 = __webpack_require__(6);
1757
+ var useDeepMemo_1 = __webpack_require__(62);
959
1758
 
960
- var getSorting_1 = __webpack_require__(33);
1759
+ var MissingPropsMessage_1 = __webpack_require__(63);
961
1760
 
962
- var getPagination_1 = __webpack_require__(35);
1761
+ var withEditModeCover_1 = __webpack_require__(64);
963
1762
 
964
- var useDeepMemo_1 = __webpack_require__(44);
1763
+ var withPlaceholder_1 = __webpack_require__(65);
965
1764
 
966
- var MissingPropsMessage_1 = __webpack_require__(45);
1765
+ var useDownsampleDataSources_1 = __webpack_require__(66);
967
1766
 
968
- var withEditModeCover_1 = __webpack_require__(46);
1767
+ var dataUtils_1 = __webpack_require__(14);
969
1768
 
970
- var withPlaceholder_1 = __webpack_require__(47);
1769
+ var featureFlagUtils_1 = __webpack_require__(68);
971
1770
  /**
972
1771
  * hoc that wraps a pure react visualization in a Dashboard visualization
973
1772
  * @param {DashboardVizOpts} opts
@@ -1058,25 +1857,61 @@ var withDashboardViz = function withDashboardViz(opts) {
1058
1857
  dataFramesInState = _React$useState8[0],
1059
1858
  setDataFramesInState = _React$useState8[1];
1060
1859
 
1061
- 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'))),
1062
1861
  _React$useState10 = _slicedToArray(_React$useState9, 2),
1063
1862
  useAsyncEvaluatedOptions = _React$useState10[0],
1064
1863
  setUseAsyncEvaluatedOptions = _React$useState10[1];
1065
1864
 
1865
+ var isDownsamplingEnabledByFeatureFlag = Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_enableDownsampling);
1066
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
+ });
1067
1904
  evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
1068
1905
  try {
1069
1906
  if (useAsyncEvaluatedOptions) {
1070
- var optionsToEvaluate = {
1071
- context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1072
- options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
1073
- };
1074
1907
  var asyncDynamicOptionsEvaluatorParams = {
1075
1908
  visualizationID: visualizationID,
1076
1909
  props: props,
1077
1910
  options: optionsToEvaluate,
1078
- dataSources: dataSources,
1079
- 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'))
1080
1915
  };
1081
1916
  async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
1082
1917
  setEvaluatedOptionsAsync(results.results);
@@ -1088,16 +1923,14 @@ var withDashboardViz = function withDashboardViz(opts) {
1088
1923
  } else {
1089
1924
  var dataFrames = dataFramesInState;
1090
1925
 
1091
- if (dataSources !== dataSourcesInState) {
1092
- setDataSourcesInState(dataSources);
1093
- 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'));
1094
1929
  setDataFramesInState(dataFrames);
1095
1930
  }
1096
1931
 
1097
- return Options_1.Options.evaluate({
1098
- context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1099
- options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
1100
- }, dataSources, themeFunc, dataFrames);
1932
+ var result = Options_1.Options.evaluate(optionsToEvaluate, downsampledDataSources, themeFunc, dataFrames, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope'));
1933
+ return result;
1101
1934
  }
1102
1935
  } catch (e) {
1103
1936
  // eslint-disable-next-line no-console
@@ -1106,7 +1939,7 @@ var withDashboardViz = function withDashboardViz(opts) {
1106
1939
  }
1107
1940
 
1108
1941
  return {};
1109
- }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
1942
+ }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, optionsToEvaluate, downsampledDataSources, serializedTimezone, useAsyncEvaluatedOptions]);
1110
1943
  var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
1111
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
1112
1945
  // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
@@ -1248,7 +2081,7 @@ var withDashboardViz = function withDashboardViz(opts) {
1248
2081
  mode: mode,
1249
2082
  width: width,
1250
2083
  height: height
1251
- }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
2084
+ }, downsamplingProps, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
1252
2085
  };
1253
2086
 
1254
2087
  DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
@@ -1265,37 +2098,37 @@ var withDashboardViz = function withDashboardViz(opts) {
1265
2098
  exports.default = withDashboardViz;
1266
2099
 
1267
2100
  /***/ }),
1268
- /* 38 */
2101
+ /* 57 */
1269
2102
  /***/ (function(module, exports) {
1270
2103
 
1271
2104
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1272
2105
 
1273
2106
  /***/ }),
1274
- /* 39 */
2107
+ /* 58 */
1275
2108
  /***/ (function(module, exports) {
1276
2109
 
1277
2110
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1278
2111
 
1279
2112
  /***/ }),
1280
- /* 40 */
2113
+ /* 59 */
1281
2114
  /***/ (function(module, exports) {
1282
2115
 
1283
2116
  module.exports = require("@splunk/moment");
1284
2117
 
1285
2118
  /***/ }),
1286
- /* 41 */
2119
+ /* 60 */
1287
2120
  /***/ (function(module, exports) {
1288
2121
 
1289
2122
  module.exports = require("@splunk/async-dynamic-options-evaluator");
1290
2123
 
1291
2124
  /***/ }),
1292
- /* 42 */
2125
+ /* 61 */
1293
2126
  /***/ (function(module, exports, __webpack_require__) {
1294
2127
 
1295
2128
  "use strict";
1296
2129
 
1297
2130
 
1298
- var _classCallCheck = __webpack_require__(9);
2131
+ var _classCallCheck = __webpack_require__(10);
1299
2132
 
1300
2133
  Object.defineProperty(exports, "__esModule", {
1301
2134
  value: true
@@ -1303,11 +2136,11 @@ Object.defineProperty(exports, "__esModule", {
1303
2136
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1304
2137
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1305
2138
 
1306
- var T = __webpack_require__(0);
2139
+ var T = __webpack_require__(1);
1307
2140
 
1308
2141
  var lodash_1 = __webpack_require__(3);
1309
2142
 
1310
- 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
1311
2144
 
1312
2145
 
1313
2146
  exports.INITIAL_WIDTH = 250;
@@ -1440,44 +2273,7 @@ SplunkVisualization.defaultProps = {
1440
2273
  exports.default = SplunkVisualization;
1441
2274
 
1442
2275
  /***/ }),
1443
- /* 43 */
1444
- /***/ (function(module, exports, __webpack_require__) {
1445
-
1446
- "use strict";
1447
-
1448
-
1449
- var _classCallCheck = __webpack_require__(9);
1450
-
1451
- var _createClass = __webpack_require__(18);
1452
-
1453
- Object.defineProperty(exports, "__esModule", {
1454
- value: true
1455
- });
1456
- exports.DefaultVizActionHandler = void 0;
1457
-
1458
- var DefaultVizActionHandler = /*#__PURE__*/function () {
1459
- function DefaultVizActionHandler() {
1460
- _classCallCheck(this, DefaultVizActionHandler);
1461
- }
1462
-
1463
- _createClass(DefaultVizActionHandler, [{
1464
- key: "focus",
1465
- value: function focus() {// noop
1466
- }
1467
- }, {
1468
- key: "snapshot",
1469
- value: function snapshot() {
1470
- return null; // noop
1471
- }
1472
- }]);
1473
-
1474
- return DefaultVizActionHandler;
1475
- }();
1476
-
1477
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
1478
-
1479
- /***/ }),
1480
- /* 44 */
2276
+ /* 62 */
1481
2277
  /***/ (function(module, exports, __webpack_require__) {
1482
2278
 
1483
2279
  "use strict";
@@ -1488,7 +2284,7 @@ Object.defineProperty(exports, "__esModule", {
1488
2284
  });
1489
2285
  exports.useDeepMemo = void 0;
1490
2286
 
1491
- var react_1 = __webpack_require__(1);
2287
+ var react_1 = __webpack_require__(0);
1492
2288
 
1493
2289
  var lodash_1 = __webpack_require__(3);
1494
2290
  /**
@@ -1522,7 +2318,7 @@ var useDeepMemo = function useDeepMemo(fn, dependencies) {
1522
2318
  exports.useDeepMemo = useDeepMemo;
1523
2319
 
1524
2320
  /***/ }),
1525
- /* 45 */
2321
+ /* 63 */
1526
2322
  /***/ (function(module, exports, __webpack_require__) {
1527
2323
 
1528
2324
  "use strict";
@@ -1533,15 +2329,15 @@ Object.defineProperty(exports, "__esModule", {
1533
2329
  });
1534
2330
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1535
2331
 
1536
- var React = __webpack_require__(1);
2332
+ var React = __webpack_require__(0);
1537
2333
 
1538
- var T = __webpack_require__(0);
2334
+ var T = __webpack_require__(1);
1539
2335
 
1540
2336
  var i18n_1 = __webpack_require__(2);
1541
2337
 
1542
- var Message_1 = __webpack_require__(10);
2338
+ var Message_1 = __webpack_require__(12);
1543
2339
 
1544
- var FixedSizeContainer_1 = __webpack_require__(13);
2340
+ var FixedSizeContainer_1 = __webpack_require__(17);
1545
2341
  /**
1546
2342
  * @method isMissing
1547
2343
  * @param {any} v
@@ -1602,7 +2398,7 @@ exports.MissingPropsMessage.defaultProps = {
1602
2398
  exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
1603
2399
 
1604
2400
  /***/ }),
1605
- /* 46 */
2401
+ /* 64 */
1606
2402
  /***/ (function(module, exports, __webpack_require__) {
1607
2403
 
1608
2404
  "use strict";
@@ -1612,18 +2408,18 @@ Object.defineProperty(exports, "__esModule", {
1612
2408
  value: true
1613
2409
  });
1614
2410
 
1615
- var React = __webpack_require__(1);
2411
+ var React = __webpack_require__(0);
1616
2412
 
1617
2413
  var styled_components_1 = __webpack_require__(4);
1618
2414
 
1619
- var hocUtils_1 = __webpack_require__(15);
2415
+ var hocUtils_1 = __webpack_require__(23);
1620
2416
 
1621
2417
  var Cover = styled_components_1.default.div.withConfig({
1622
2418
  displayName: "withEditModeCover__Cover",
1623
2419
  componentId: "sc-1gsbnxb-0"
1624
2420
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1625
2421
  var Blocker = styled_components_1.default.div.attrs({
1626
- 'data-splunk-visualization-version': "26.1.1 - b6df0a015"
2422
+ 'data-splunk-visualization-version': "26.2.0 - 49b909915"
1627
2423
  }).withConfig({
1628
2424
  displayName: "withEditModeCover__Blocker",
1629
2425
  componentId: "sc-1gsbnxb-1"
@@ -1654,7 +2450,7 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
1654
2450
  exports.default = withEditModeCover;
1655
2451
 
1656
2452
  /***/ }),
1657
- /* 47 */
2453
+ /* 65 */
1658
2454
  /***/ (function(module, exports, __webpack_require__) {
1659
2455
 
1660
2456
  "use strict";
@@ -1664,17 +2460,17 @@ Object.defineProperty(exports, "__esModule", {
1664
2460
  value: true
1665
2461
  });
1666
2462
 
1667
- var React = __webpack_require__(1);
2463
+ var React = __webpack_require__(0);
1668
2464
 
1669
- var colorUtils_1 = __webpack_require__(12);
2465
+ var colorUtils_1 = __webpack_require__(15);
1670
2466
 
1671
- var variables_1 = __webpack_require__(11);
2467
+ var variables_1 = __webpack_require__(13);
1672
2468
 
1673
- var IconPlaceholder_1 = __webpack_require__(32);
2469
+ var IconPlaceholder_1 = __webpack_require__(37);
1674
2470
 
1675
2471
  var VizBehavior_1 = __webpack_require__(6);
1676
2472
 
1677
- var hocUtils_1 = __webpack_require__(15);
2473
+ var hocUtils_1 = __webpack_require__(23);
1678
2474
 
1679
2475
  var withPlaceholder = function withPlaceholder(Visualization) {
1680
2476
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
@@ -1718,32 +2514,276 @@ var withPlaceholder = function withPlaceholder(Visualization) {
1718
2514
  exports.default = withPlaceholder;
1719
2515
 
1720
2516
  /***/ }),
1721
- /* 48 */
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;
2601
+ };
2602
+
2603
+ exports.default = useDownsampleDataSources;
2604
+
2605
+ /***/ }),
2606
+ /* 67 */
2607
+ /***/ (function(module, exports, __webpack_require__) {
2608
+
2609
+ "use strict";
2610
+
2611
+
2612
+ var _toConsumableArray = __webpack_require__(8);
2613
+
2614
+ Object.defineProperty(exports, "__esModule", {
2615
+ value: true
2616
+ });
2617
+
2618
+ var react_1 = __webpack_require__(0);
2619
+
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
+ */
2625
+
2626
+
2627
+ var useGetXAndYFields = function useGetXAndYFields(_ref) {
2628
+ var shouldEvaluateDSL = _ref.shouldEvaluateDSL,
2629
+ options = _ref.options,
2630
+ context = _ref.context,
2631
+ dataSources = _ref.dataSources;
2632
+
2633
+ var _ref2 = (0, react_1.useMemo)(function () {
2634
+ var _a, _b, _c;
2635
+
2636
+ if (!shouldEvaluateDSL) {
2637
+ return {
2638
+ dataSourcesWithOnlyOnePoint: null,
2639
+ dataFrameWithOnlyOnePoint: null
2640
+ };
2641
+ }
2642
+
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
+ }
2649
+
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;
2668
+
2669
+ var xAndYFieldsWithTypes = (0, react_1.useMemo)(function () {
2670
+ try {
2671
+ if (!dataSourcesWithOnlyOnePoint || !dataFrameWithOnlyOnePoint) {
2672
+ return options;
2673
+ }
2674
+
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
+ };
2712
+ }
2713
+ }, [options, context, dataSourcesWithOnlyOnePoint, dataFrameWithOnlyOnePoint]);
2714
+ return xAndYFieldsWithTypes;
2715
+ };
2716
+
2717
+ exports.default = useGetXAndYFields;
2718
+
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;
2750
+ };
2751
+
2752
+ exports.getFeatureFlag = getFeatureFlag;
2753
+
2754
+ /***/ }),
2755
+ /* 69 */
2756
+ /***/ (function(module, exports) {
2757
+
2758
+ module.exports = require("@splunk/visualization-context/FeatureFlags");
2759
+
2760
+ /***/ }),
2761
+ /* 70 */
1722
2762
  /***/ (function(module, exports) {
1723
2763
 
1724
2764
  module.exports = require("@babel/runtime/helpers/extends");
1725
2765
 
1726
2766
  /***/ }),
1727
- /* 49 */
2767
+ /* 71 */
1728
2768
  /***/ (function(module, exports) {
1729
2769
 
1730
2770
  module.exports = require("@splunk/visualizations-shared/colorConstants");
1731
2771
 
1732
2772
  /***/ }),
1733
- /* 50 */
2773
+ /* 72 */
1734
2774
  /***/ (function(module, exports) {
1735
2775
 
1736
2776
  module.exports = require("@splunk/visualization-icons/placeholders");
1737
2777
 
1738
2778
  /***/ }),
1739
- /* 51 */
2779
+ /* 73 */
1740
2780
  /***/ (function(module, exports) {
1741
2781
 
1742
2782
  module.exports = require("@splunk/visualization-color-palettes");
1743
2783
 
1744
2784
  /***/ }),
1745
- /* 52 */,
1746
- /* 53 */
2785
+ /* 74 */,
2786
+ /* 75 */
1747
2787
  /***/ (function(module, exports, __webpack_require__) {
1748
2788
 
1749
2789
  "use strict";
@@ -1773,33 +2813,6 @@ var background = function background(_ref) {
1773
2813
  exports.default = background;
1774
2814
 
1775
2815
  /***/ }),
1776
- /* 54 */,
1777
- /* 55 */,
1778
- /* 56 */,
1779
- /* 57 */,
1780
- /* 58 */,
1781
- /* 59 */,
1782
- /* 60 */,
1783
- /* 61 */
1784
- /***/ (function(module, exports) {
1785
-
1786
- module.exports = require("@splunk/visualization-color-palettes/editors/PresetPalettes");
1787
-
1788
- /***/ }),
1789
- /* 62 */,
1790
- /* 63 */,
1791
- /* 64 */,
1792
- /* 65 */,
1793
- /* 66 */,
1794
- /* 67 */,
1795
- /* 68 */,
1796
- /* 69 */,
1797
- /* 70 */,
1798
- /* 71 */,
1799
- /* 72 */,
1800
- /* 73 */,
1801
- /* 74 */,
1802
- /* 75 */,
1803
2816
  /* 76 */,
1804
2817
  /* 77 */,
1805
2818
  /* 78 */,
@@ -1807,7 +2820,12 @@ module.exports = require("@splunk/visualization-color-palettes/editors/PresetPal
1807
2820
  /* 80 */,
1808
2821
  /* 81 */,
1809
2822
  /* 82 */,
1810
- /* 83 */,
2823
+ /* 83 */
2824
+ /***/ (function(module, exports) {
2825
+
2826
+ module.exports = require("@splunk/visualization-color-palettes/editors/PresetPalettes");
2827
+
2828
+ /***/ }),
1811
2829
  /* 84 */,
1812
2830
  /* 85 */,
1813
2831
  /* 86 */,
@@ -1822,7 +2840,30 @@ module.exports = require("@splunk/visualization-color-palettes/editors/PresetPal
1822
2840
  /* 95 */,
1823
2841
  /* 96 */,
1824
2842
  /* 97 */,
1825
- /* 98 */
2843
+ /* 98 */,
2844
+ /* 99 */,
2845
+ /* 100 */,
2846
+ /* 101 */,
2847
+ /* 102 */,
2848
+ /* 103 */,
2849
+ /* 104 */,
2850
+ /* 105 */,
2851
+ /* 106 */,
2852
+ /* 107 */,
2853
+ /* 108 */,
2854
+ /* 109 */,
2855
+ /* 110 */,
2856
+ /* 111 */,
2857
+ /* 112 */,
2858
+ /* 113 */,
2859
+ /* 114 */,
2860
+ /* 115 */,
2861
+ /* 116 */,
2862
+ /* 117 */,
2863
+ /* 118 */,
2864
+ /* 119 */,
2865
+ /* 120 */,
2866
+ /* 121 */
1826
2867
  /***/ (function(module, exports, __webpack_require__) {
1827
2868
 
1828
2869
  "use strict";
@@ -1837,7 +2878,7 @@ exports.convertToGaugeProperties = exports.mapValueLabelDisplay = exports.mapToO
1837
2878
 
1838
2879
  var lodash_1 = __webpack_require__(3);
1839
2880
 
1840
- var colorConstants_1 = __webpack_require__(49);
2881
+ var colorConstants_1 = __webpack_require__(71);
1841
2882
 
1842
2883
  var i18n_1 = __webpack_require__(2);
1843
2884
 
@@ -2590,34 +3631,33 @@ var convertToGaugeProperties = function convertToGaugeProperties(originalOptions
2590
3631
  exports.convertToGaugeProperties = convertToGaugeProperties;
2591
3632
 
2592
3633
  /***/ }),
2593
- /* 99 */,
2594
- /* 100 */,
2595
- /* 101 */,
2596
- /* 102 */,
2597
- /* 103 */,
2598
- /* 104 */,
2599
- /* 105 */,
2600
- /* 106 */,
2601
- /* 107 */,
2602
- /* 108 */,
2603
- /* 109 */,
2604
- /* 110 */,
2605
- /* 111 */,
2606
- /* 112 */,
2607
- /* 113 */,
2608
- /* 114 */,
2609
- /* 115 */,
2610
- /* 116 */,
2611
- /* 117 */,
2612
- /* 118 */,
2613
- /* 119 */,
2614
- /* 120 */,
2615
- /* 121 */,
2616
3634
  /* 122 */,
2617
3635
  /* 123 */,
2618
3636
  /* 124 */,
2619
3637
  /* 125 */,
2620
- /* 126 */
3638
+ /* 126 */,
3639
+ /* 127 */,
3640
+ /* 128 */,
3641
+ /* 129 */,
3642
+ /* 130 */,
3643
+ /* 131 */,
3644
+ /* 132 */,
3645
+ /* 133 */,
3646
+ /* 134 */,
3647
+ /* 135 */,
3648
+ /* 136 */,
3649
+ /* 137 */,
3650
+ /* 138 */,
3651
+ /* 139 */,
3652
+ /* 140 */,
3653
+ /* 141 */,
3654
+ /* 142 */,
3655
+ /* 143 */,
3656
+ /* 144 */,
3657
+ /* 145 */,
3658
+ /* 146 */,
3659
+ /* 147 */,
3660
+ /* 148 */
2621
3661
  /***/ (function(module, exports, __webpack_require__) {
2622
3662
 
2623
3663
  "use strict";
@@ -2681,22 +3721,22 @@ var gauge = {
2681
3721
  exports.default = gauge;
2682
3722
 
2683
3723
  /***/ }),
2684
- /* 127 */
3724
+ /* 149 */
2685
3725
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2686
3726
 
2687
3727
  "use strict";
2688
3728
  __webpack_require__.r(__webpack_exports__);
2689
3729
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MajorTick", function() { return MajorTick; });
2690
3730
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionMajorTick", function() { return positionMajorTick; });
2691
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(48);
3731
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70);
2692
3732
  /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
2693
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
3733
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
2694
3734
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
2695
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0);
3735
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
2696
3736
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
2697
3737
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
2698
3738
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
2699
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31);
3739
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11);
2700
3740
  /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
2701
3741
 
2702
3742
 
@@ -2733,6 +3773,7 @@ var MajorTick = function MajorTick(_ref) {
2733
3773
  majorTickStrokeColor = _ref.majorTickStrokeColor,
2734
3774
  majorTickFillColor = _ref.majorTickFillColor;
2735
3775
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLine, {
3776
+ "data-test": "major-tick-line",
2736
3777
  index: index,
2737
3778
  x1: x1,
2738
3779
  y1: y1,
@@ -2742,7 +3783,8 @@ var MajorTick = function MajorTick(_ref) {
2742
3783
  }), showLabels && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLabel, {
2743
3784
  x: labelX,
2744
3785
  y: labelY,
2745
- majorTickFillColor: majorTickFillColor
3786
+ majorTickFillColor: majorTickFillColor,
3787
+ "data-test": "major-tick-label"
2746
3788
  }, Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["isNumerial"])(label) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["formatNumber"])(label, 0, {
2747
3789
  useThousandSeparators: true,
2748
3790
  useTrendUnits: true
@@ -2935,22 +3977,22 @@ MajorTicks.defaultProps = {
2935
3977
  /* harmony default export */ __webpack_exports__["default"] = (MajorTicks);
2936
3978
 
2937
3979
  /***/ }),
2938
- /* 128 */
3980
+ /* 150 */
2939
3981
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2940
3982
 
2941
3983
  "use strict";
2942
3984
  __webpack_require__.r(__webpack_exports__);
2943
3985
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionValueMarkerRect", function() { return positionValueMarkerRect; });
2944
3986
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionLabel", function() { return positionLabel; });
2945
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(48);
3987
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70);
2946
3988
  /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
2947
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
3989
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
2948
3990
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
2949
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0);
3991
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
2950
3992
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
2951
3993
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
2952
3994
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
2953
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31);
3995
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11);
2954
3996
  /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
2955
3997
 
2956
3998
 
@@ -3146,28 +4188,6 @@ ValueMarker.defaultProps = {
3146
4188
  /* harmony default export */ __webpack_exports__["default"] = (ValueMarker);
3147
4189
 
3148
4190
  /***/ }),
3149
- /* 129 */,
3150
- /* 130 */,
3151
- /* 131 */,
3152
- /* 132 */,
3153
- /* 133 */,
3154
- /* 134 */,
3155
- /* 135 */,
3156
- /* 136 */,
3157
- /* 137 */,
3158
- /* 138 */,
3159
- /* 139 */,
3160
- /* 140 */,
3161
- /* 141 */,
3162
- /* 142 */,
3163
- /* 143 */,
3164
- /* 144 */,
3165
- /* 145 */,
3166
- /* 146 */,
3167
- /* 147 */,
3168
- /* 148 */,
3169
- /* 149 */,
3170
- /* 150 */,
3171
4191
  /* 151 */,
3172
4192
  /* 152 */,
3173
4193
  /* 153 */,
@@ -3232,7 +4252,29 @@ ValueMarker.defaultProps = {
3232
4252
  /* 212 */,
3233
4253
  /* 213 */,
3234
4254
  /* 214 */,
3235
- /* 215 */
4255
+ /* 215 */,
4256
+ /* 216 */,
4257
+ /* 217 */,
4258
+ /* 218 */,
4259
+ /* 219 */,
4260
+ /* 220 */,
4261
+ /* 221 */,
4262
+ /* 222 */,
4263
+ /* 223 */,
4264
+ /* 224 */,
4265
+ /* 225 */,
4266
+ /* 226 */,
4267
+ /* 227 */,
4268
+ /* 228 */,
4269
+ /* 229 */,
4270
+ /* 230 */,
4271
+ /* 231 */,
4272
+ /* 232 */,
4273
+ /* 233 */,
4274
+ /* 234 */,
4275
+ /* 235 */,
4276
+ /* 236 */,
4277
+ /* 237 */
3236
4278
  /***/ (function(module, exports, __webpack_require__) {
3237
4279
 
3238
4280
  "use strict";
@@ -3258,13 +4300,13 @@ exports.themes = exports.computeVizProps = exports.PureFillerGauge = exports.con
3258
4300
 
3259
4301
  var lodash_1 = __webpack_require__(3);
3260
4302
 
3261
- var config_1 = __webpack_require__(216);
4303
+ var config_1 = __webpack_require__(238);
3262
4304
 
3263
- var withDashboardViz_1 = __webpack_require__(37);
4305
+ var withDashboardViz_1 = __webpack_require__(56);
3264
4306
 
3265
- var FillerGauge_1 = __webpack_require__(220);
4307
+ var FillerGauge_1 = __webpack_require__(242);
3266
4308
 
3267
- var gaugeUtils_1 = __webpack_require__(98);
4309
+ var gaugeUtils_1 = __webpack_require__(121);
3268
4310
 
3269
4311
  exports.config = config_1.default;
3270
4312
  exports.PureFillerGauge = FillerGauge_1.default;
@@ -3294,7 +4336,7 @@ exports.themes = config_1.default.themes;
3294
4336
  exports.default = viz;
3295
4337
 
3296
4338
  /***/ }),
3297
- /* 216 */
4339
+ /* 238 */
3298
4340
  /***/ (function(module, exports, __webpack_require__) {
3299
4341
 
3300
4342
  "use strict";
@@ -3306,33 +4348,33 @@ Object.defineProperty(exports, "__esModule", {
3306
4348
 
3307
4349
  var i18n_1 = __webpack_require__(2);
3308
4350
 
3309
- var schemaUtils_1 = __webpack_require__(16);
4351
+ var schemaUtils_1 = __webpack_require__(24);
3310
4352
 
3311
- var pick_1 = __webpack_require__(23);
4353
+ var pick_1 = __webpack_require__(30);
3312
4354
 
3313
- var variables_1 = __webpack_require__(11);
4355
+ var variables_1 = __webpack_require__(13);
3314
4356
 
3315
- var visualization_color_palettes_1 = __webpack_require__(51);
4357
+ var visualization_color_palettes_1 = __webpack_require__(73);
3316
4358
 
3317
- var PresetPalettes_1 = __webpack_require__(61);
4359
+ var PresetPalettes_1 = __webpack_require__(83);
3318
4360
 
3319
- var GaugeFiller_1 = __webpack_require__(217);
4361
+ var GaugeFiller_1 = __webpack_require__(239);
3320
4362
 
3321
- var placeholders_1 = __webpack_require__(50);
4363
+ var placeholders_1 = __webpack_require__(72);
3322
4364
 
3323
4365
  var VizBehavior_1 = __webpack_require__(6);
3324
4366
 
3325
- var VizCategory_1 = __webpack_require__(36);
4367
+ var VizCategory_1 = __webpack_require__(22);
3326
4368
 
3327
- var configUtils_1 = __webpack_require__(20);
4369
+ var configUtils_1 = __webpack_require__(27);
3328
4370
 
3329
- var Gauge_1 = __webpack_require__(126);
4371
+ var Gauge_1 = __webpack_require__(148);
3330
4372
 
3331
- var BackgroundColor_1 = __webpack_require__(53);
4373
+ var BackgroundColor_1 = __webpack_require__(75);
3332
4374
 
3333
- var DynamicGaugeColorEditor_1 = __webpack_require__(218);
4375
+ var DynamicGaugeColorEditor_1 = __webpack_require__(240);
3334
4376
 
3335
- var StaticGaugeColorEditor_1 = __webpack_require__(219);
4377
+ var StaticGaugeColorEditor_1 = __webpack_require__(241);
3336
4378
 
3337
4379
  var dataContract = {
3338
4380
  requiredDataSources: [{
@@ -3579,13 +4621,13 @@ var config = {
3579
4621
  exports.default = (0, configUtils_1.enhanceConfig)(config);
3580
4622
 
3581
4623
  /***/ }),
3582
- /* 217 */
4624
+ /* 239 */
3583
4625
  /***/ (function(module, exports) {
3584
4626
 
3585
4627
  module.exports = require("@splunk/react-icons/enterprise/GaugeFiller");
3586
4628
 
3587
4629
  /***/ }),
3588
- /* 218 */
4630
+ /* 240 */
3589
4631
  /***/ (function(module, exports, __webpack_require__) {
3590
4632
 
3591
4633
  "use strict";
@@ -3598,7 +4640,7 @@ exports.getDynamicGaugeColorEditor = void 0;
3598
4640
 
3599
4641
  var i18n_1 = __webpack_require__(2);
3600
4642
 
3601
- var configUtils_1 = __webpack_require__(22);
4643
+ var configUtils_1 = __webpack_require__(29);
3602
4644
 
3603
4645
  var getDynamicGaugeColorEditor = function getDynamicGaugeColorEditor(_ref) {
3604
4646
  var defaultContext = _ref.defaultContext,
@@ -3634,7 +4676,7 @@ var getDynamicGaugeColorEditor = function getDynamicGaugeColorEditor(_ref) {
3634
4676
  exports.getDynamicGaugeColorEditor = getDynamicGaugeColorEditor;
3635
4677
 
3636
4678
  /***/ }),
3637
- /* 219 */
4679
+ /* 241 */
3638
4680
  /***/ (function(module, exports, __webpack_require__) {
3639
4681
 
3640
4682
  "use strict";
@@ -3646,7 +4688,7 @@ Object.defineProperty(exports, "__esModule", {
3646
4688
 
3647
4689
  var i18n_1 = __webpack_require__(2);
3648
4690
 
3649
- var configUtils_1 = __webpack_require__(22);
4691
+ var configUtils_1 = __webpack_require__(29);
3650
4692
 
3651
4693
  var StaticGaugeColorEditor = {
3652
4694
  label: (0, i18n_1._)('Gauge'),
@@ -3660,12 +4702,14 @@ var StaticGaugeColorEditor = {
3660
4702
  exports.default = StaticGaugeColorEditor;
3661
4703
 
3662
4704
  /***/ }),
3663
- /* 220 */
4705
+ /* 242 */
3664
4706
  /***/ (function(module, exports, __webpack_require__) {
3665
4707
 
3666
4708
  "use strict";
3667
4709
 
3668
4710
 
4711
+ var _slicedToArray = __webpack_require__(7);
4712
+
3669
4713
  var __rest = this && this.__rest || function (s, e) {
3670
4714
  var t = {};
3671
4715
 
@@ -3684,9 +4728,9 @@ Object.defineProperty(exports, "__esModule", {
3684
4728
  });
3685
4729
  exports.AXIS_ORIENTATION_TYPES = void 0;
3686
4730
 
3687
- var React = __webpack_require__(1);
4731
+ var React = __webpack_require__(0);
3688
4732
 
3689
- var T = __webpack_require__(0);
4733
+ var T = __webpack_require__(1);
3690
4734
 
3691
4735
  var styled_components_1 = __webpack_require__(4);
3692
4736
 
@@ -3694,17 +4738,17 @@ var lodash_1 = __webpack_require__(3);
3694
4738
 
3695
4739
  var i18n_1 = __webpack_require__(2);
3696
4740
 
3697
- var style_1 = __webpack_require__(14);
4741
+ var style_1 = __webpack_require__(18);
3698
4742
 
3699
- var SizeAwareWrapper_1 = __webpack_require__(19);
4743
+ var SizeAwareWrapper_1 = __webpack_require__(26);
3700
4744
 
3701
- var Message_1 = __webpack_require__(10);
4745
+ var Message_1 = __webpack_require__(12);
3702
4746
 
3703
- var gaugeUtils_1 = __webpack_require__(98);
4747
+ var gaugeUtils_1 = __webpack_require__(121);
3704
4748
 
3705
- var GaugeMajorTicks_1 = __webpack_require__(127);
4749
+ var GaugeMajorTicks_1 = __webpack_require__(149);
3706
4750
 
3707
- var GaugeValueMarker_1 = __webpack_require__(128);
4751
+ var GaugeValueMarker_1 = __webpack_require__(150);
3708
4752
 
3709
4753
  var Container = styled_components_1.default.div.withConfig({
3710
4754
  displayName: "FillerGauge__Container",
@@ -3780,13 +4824,28 @@ var FillerGauge = function FillerGauge(_a) {
3780
4824
  majorTickStrokeColor = props.majorTickStrokeColor,
3781
4825
  valueMarkerFillColor = props.valueMarkerFillColor,
3782
4826
  valueMarkerLabelFillColor = props.valueMarkerLabelFillColor;
4827
+ var cachedHandleResize = React.useCallback(function (w, h) {
4828
+ setContainerWidth(w);
4829
+ setContainerHeight(h);
4830
+ }, []);
4831
+
4832
+ var _React$useState = React.useState(Number(width)),
4833
+ _React$useState2 = _slicedToArray(_React$useState, 2),
4834
+ containerWidth = _React$useState2[0],
4835
+ setContainerWidth = _React$useState2[1];
4836
+
4837
+ var _React$useState3 = React.useState(Number(height)),
4838
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
4839
+ containerHeight = _React$useState4[0],
4840
+ setContainerHeight = _React$useState4[1];
4841
+
4842
+ var renderVisualization = function renderVisualization() {
4843
+ if (!containerWidth || !containerHeight) {
4844
+ return null;
4845
+ } // todo: need change the size when get design for smaller space
4846
+ // 58 is the title & description header height in dashboard visualization
3783
4847
 
3784
- var renderVisualization = function renderVisualization(_ref) {
3785
- var containerWidth = _ref.width,
3786
- containerHeight = _ref.height;
3787
4848
 
3788
- // todo: need change the size when get design for smaller space
3789
- // 58 is the title & description header height in dashboard visualization
3790
4849
  if ((containerWidth < MAX_VERTICAL_CONTAINER_WIDTH || containerHeight + 58 < MIN_VERTICAL_CONTAINER_HEIGHT) && orientation === 'vertical' || (containerWidth < MIN_HORIZONTAL_CONTAINER_WIDTH || containerHeight < MIN_HORIZONTAL_CONTAINER_HEIGHT) && orientation === 'horizontal') {
3791
4850
  return React.createElement(Message_1.default, {
3792
4851
  width: containerWidth,
@@ -3796,18 +4855,18 @@ var FillerGauge = function FillerGauge(_a) {
3796
4855
  });
3797
4856
  }
3798
4857
 
3799
- var _ref2 = (0, gaugeUtils_1.getGaugeDimensions)({
4858
+ var _ref = (0, gaugeUtils_1.getGaugeDimensions)({
3800
4859
  containerWidth: containerWidth,
3801
4860
  containerHeight: containerHeight,
3802
4861
  orientation: orientation
3803
4862
  }),
3804
- gaugeLength = _ref2.gaugeLength,
3805
- gaugeStartX = _ref2.gaugeStartX,
3806
- gaugeStartY = _ref2.gaugeStartY,
3807
- gaugeWidth = _ref2.gaugeWidth,
3808
- gaugeHeight = _ref2.gaugeHeight;
4863
+ gaugeLength = _ref.gaugeLength,
4864
+ gaugeStartX = _ref.gaugeStartX,
4865
+ gaugeStartY = _ref.gaugeStartY,
4866
+ gaugeWidth = _ref.gaugeWidth,
4867
+ gaugeHeight = _ref.gaugeHeight;
3809
4868
 
3810
- var _ref3 = (0, gaugeUtils_1.getFillBarDimensions)({
4869
+ var _ref2 = (0, gaugeUtils_1.getFillBarDimensions)({
3811
4870
  gaugeLength: gaugeLength,
3812
4871
  gaugeStartX: gaugeStartX,
3813
4872
  gaugeStartY: gaugeStartY,
@@ -3818,20 +4877,20 @@ var FillerGauge = function FillerGauge(_a) {
3818
4877
  max: max,
3819
4878
  orientation: orientation
3820
4879
  }),
3821
- fillBarLength = _ref3.fillBarLength,
3822
- fillBarX = _ref3.fillBarX,
3823
- fillBarY = _ref3.fillBarY,
3824
- fillBarWidth = _ref3.fillBarWidth,
3825
- fillBarHeight = _ref3.fillBarHeight;
4880
+ fillBarLength = _ref2.fillBarLength,
4881
+ fillBarX = _ref2.fillBarX,
4882
+ fillBarY = _ref2.fillBarY,
4883
+ fillBarWidth = _ref2.fillBarWidth,
4884
+ fillBarHeight = _ref2.fillBarHeight;
3826
4885
 
3827
- var _ref4 = (0, gaugeUtils_1.getFillerGaugeValueMarkerPositions)({
4886
+ var _ref3 = (0, gaugeUtils_1.getFillerGaugeValueMarkerPositions)({
3828
4887
  fillBarX: fillBarX,
3829
4888
  fillBarY: fillBarY,
3830
4889
  fillBarLength: fillBarLength,
3831
4890
  orientation: orientation
3832
4891
  }),
3833
- valueMarkerX = _ref4.valueMarkerX,
3834
- valueMarkerY = _ref4.valueMarkerY;
4892
+ valueMarkerX = _ref3.valueMarkerX,
4893
+ valueMarkerY = _ref3.valueMarkerY;
3835
4894
 
3836
4895
  return React.createElement(FillerGaugeWrapper, {
3837
4896
  backgroundColor: backgroundColor,
@@ -3894,9 +4953,11 @@ var FillerGauge = function FillerGauge(_a) {
3894
4953
  width: width,
3895
4954
  height: height,
3896
4955
  backgroundColor: backgroundColor
3897
- }, React.createElement(SizeAwareWrapper_1.default, null, function (containerDimension) {
3898
- return renderVisualization(containerDimension);
3899
- }));
4956
+ }, React.createElement(SizeAwareWrapper_1.default, {
4957
+ width: width,
4958
+ height: height,
4959
+ onResize: cachedHandleResize
4960
+ }), renderVisualization());
3900
4961
  };
3901
4962
 
3902
4963
  var propTypes = {