@splunk/visualizations 26.3.0 → 26.4.1

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 (102) hide show
  1. package/Area.config.js +1 -1
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +300 -290
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +1 -1
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +303 -293
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +1 -1
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +292 -282
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +1 -1
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +262 -260
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +1 -1
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +303 -293
  20. package/Column.js.map +1 -1
  21. package/Ellipse.js +220 -218
  22. package/Ellipse.js.map +1 -1
  23. package/Events.config.js +1 -1
  24. package/Events.config.js.map +1 -1
  25. package/Events.js +285 -283
  26. package/Events.js.map +1 -1
  27. package/FillerGauge.config.js +1 -1
  28. package/FillerGauge.config.js.map +1 -1
  29. package/FillerGauge.js +250 -248
  30. package/FillerGauge.js.map +1 -1
  31. package/Image.js +212 -210
  32. package/Image.js.map +1 -1
  33. package/Line.config.js +1 -1
  34. package/Line.config.js.map +1 -1
  35. package/Line.js +301 -291
  36. package/Line.js.map +1 -1
  37. package/LinkGraph.config.js +1 -1
  38. package/LinkGraph.config.js.map +1 -1
  39. package/LinkGraph.js +1725 -17201
  40. package/LinkGraph.js.map +1 -1
  41. package/MIGRATION.md +12 -0
  42. package/Map.config.js +1 -1
  43. package/Map.config.js.map +1 -1
  44. package/Map.js +465 -406
  45. package/Map.js.map +1 -1
  46. package/Markdown.config.js +1 -1
  47. package/Markdown.config.js.map +1 -1
  48. package/Markdown.js +281 -277
  49. package/Markdown.js.map +1 -1
  50. package/MarkerGauge.config.js +1 -1
  51. package/MarkerGauge.config.js.map +1 -1
  52. package/MarkerGauge.js +926 -922
  53. package/MarkerGauge.js.map +1 -1
  54. package/ParallelCoordinates.config.js +1 -1
  55. package/ParallelCoordinates.config.js.map +1 -1
  56. package/ParallelCoordinates.js +336 -320
  57. package/ParallelCoordinates.js.map +1 -1
  58. package/Pie.config.js +5 -1
  59. package/Pie.config.js.map +1 -1
  60. package/Pie.js +374 -332
  61. package/Pie.js.map +1 -1
  62. package/Punchcard.config.js +1 -1
  63. package/Punchcard.config.js.map +1 -1
  64. package/Punchcard.js +342 -338
  65. package/Punchcard.js.map +1 -1
  66. package/Rectangle.js +260 -256
  67. package/Rectangle.js.map +1 -1
  68. package/Sankey.config.js +1 -1
  69. package/Sankey.config.js.map +1 -1
  70. package/Sankey.js +339 -335
  71. package/Sankey.js.map +1 -1
  72. package/Scatter.config.js +1 -1
  73. package/Scatter.config.js.map +1 -1
  74. package/Scatter.js +351 -339
  75. package/Scatter.js.map +1 -1
  76. package/SingleValue.config.js +10 -2
  77. package/SingleValue.config.js.map +1 -1
  78. package/SingleValue.js +455 -427
  79. package/SingleValue.js.map +1 -1
  80. package/SingleValueBasic.js +65 -53
  81. package/SingleValueBasic.js.map +1 -1
  82. package/SingleValueIcon.config.js +10 -2
  83. package/SingleValueIcon.config.js.map +1 -1
  84. package/SingleValueIcon.js +449 -421
  85. package/SingleValueIcon.js.map +1 -1
  86. package/SingleValueRadial.config.js +11 -3
  87. package/SingleValueRadial.config.js.map +1 -1
  88. package/SingleValueRadial.js +1580 -1552
  89. package/SingleValueRadial.js.map +1 -1
  90. package/SparkLine.js +33 -33
  91. package/SparkLine.js.map +1 -1
  92. package/Table.js +354 -350
  93. package/Table.js.map +1 -1
  94. package/common/Charting.js +25 -24
  95. package/common/Charting.js.map +1 -1
  96. package/common/utils/dataUtils.js +12 -18
  97. package/common/utils/dataUtils.js.map +1 -1
  98. package/common/utils/singleValueUtils.js +23 -11
  99. package/common/utils/singleValueUtils.js.map +1 -1
  100. package/common/withDashboardViz.js +31 -27
  101. package/common/withDashboardViz.js.map +1 -1
  102. package/package.json +17 -16
@@ -430,19 +430,21 @@ var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, thr
430
430
  */
431
431
 
432
432
 
433
- var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
434
- // Splunk charting allows for numbers in formats such as negative hex that
433
+ var strictlyCoerceYColumn = function strictlyCoerceYColumn(column, options) {
434
+ var isNullCoercionEnabled = options.nullValueDisplay === 'zero'; // Splunk charting allows for numbers in formats such as negative hex that
435
435
  // Number() does not support and also allows loose coercion of hex numbers (but not other formats)
436
436
  // We want to identify columns which contain at least one value that can be loosely coerced
437
+
437
438
  var canLooselyCoerceSomeValues = column.findIndex(function (value) {
438
- return (0, numberUtils_1.startsWithNumber)("".concat(value));
439
+ return (0, numberUtils_1.startsWithNumber)("".concat(value)) || isNullCoercionEnabled && value === null;
439
440
  }) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
440
441
 
441
442
  var coercedColumn = [];
442
443
  var canDownsampleColumn = !column.some(function (value) {
443
- var coercedValue = Number(value); // if it can't be parsed or isn't safe, fail
444
+ var coercedValue = Number(value);
445
+ var coerceValueToZero = isNullCoercionEnabled && value === null; // if it can't be parsed or isn't safe, fail
444
446
 
445
- if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
447
+ if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number' && !coerceValueToZero) {
446
448
  return true;
447
449
  } // save value and continue to next
448
450
 
@@ -523,8 +525,7 @@ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_re
523
525
  dataSources = _ref3.dataSources,
524
526
  selectChartEvent = _ref3.selectChartEvent,
525
527
  width = _ref3.width,
526
- xField = _ref3.xField,
527
- y2Fields = _ref3.y2Fields;
528
+ xField = _ref3.xField;
528
529
 
529
530
  var _a, _b, _c;
530
531
 
@@ -561,14 +562,7 @@ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_re
561
562
  });
562
563
  var lastIndex = fullSeries.findIndex(function (x) {
563
564
  return downsampledSeries[endXIndex] === x;
564
- }); // For charts with categorical x-axis (charts with an xField that isn't _time), do not support
565
- // re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
566
- // Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
567
- // until SPL-259611 is fixed
568
-
569
- if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
570
- return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
571
- }
565
+ });
572
566
 
573
567
  if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
574
568
  return (0, exports.calculateThresholdOnRangeSelect)({
@@ -618,7 +612,7 @@ var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fie
618
612
  */
619
613
 
620
614
 
621
- var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
615
+ var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes, options) {
622
616
  var xColumn = [];
623
617
  var yColumns = [];
624
618
  var canDownsample = !ds.data.fields.some(function (field, index) {
@@ -632,7 +626,7 @@ var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, x
632
626
  if (fieldName === xField) {
633
627
  xColumn = strictlyCoerceXColumn(column, fieldType);
634
628
  } else if (yFields.has(fieldName)) {
635
- var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
629
+ var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index], options),
636
630
  coercedColumn = _strictlyCoerceYColum.coercedColumn,
637
631
  canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
638
632
  canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
@@ -722,7 +716,7 @@ var downsampleDataSources = function downsampleDataSources(_ref4) {
722
716
  return dataSources;
723
717
  }
724
718
 
725
- var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
719
+ var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes, options),
726
720
  xColumn = _tryToCoerceAllDispla.xColumn,
727
721
  yColumns = _tryToCoerceAllDispla.yColumns;
728
722
 
@@ -1305,7 +1299,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
1305
1299
 
1306
1300
  return React.createElement(FixSizeItem, {
1307
1301
  "data-test": "fix-size-item",
1308
- "data-splunk-visualization-version": "26.3.0 - a1ef240a6",
1302
+ "data-splunk-visualization-version": "26.4.1 - 2b7482c08",
1309
1303
  width: width,
1310
1304
  height: height,
1311
1305
  backgroundColor: backgroundColor
@@ -2120,7 +2114,7 @@ var Cover = styled_components_1.default.div.withConfig({
2120
2114
  componentId: "sc-1gsbnxb-0"
2121
2115
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
2122
2116
  var Blocker = styled_components_1.default.div.attrs({
2123
- 'data-splunk-visualization-version': "26.3.0 - a1ef240a6"
2117
+ 'data-splunk-visualization-version': "26.4.1 - 2b7482c08"
2124
2118
  }).withConfig({
2125
2119
  displayName: "withEditModeCover__Blocker",
2126
2120
  componentId: "sc-1gsbnxb-1"
@@ -2327,7 +2321,10 @@ var dataUtils_1 = __webpack_require__(25);
2327
2321
 
2328
2322
  var usePrevious_1 = __webpack_require__(31);
2329
2323
 
2330
- var useGetXAndYFields_1 = __webpack_require__(121);
2324
+ var useGetXAndYFields_1 = __webpack_require__(121); // Options properties which impact/require re-downsample on change.
2325
+
2326
+
2327
+ var downsampleVizOptionProperties = ['nullValueDisplay'];
2331
2328
 
2332
2329
  var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
2333
2330
  var dataSources = _ref.dataSources,
@@ -2341,8 +2338,15 @@ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
2341
2338
  options: options,
2342
2339
  context: context,
2343
2340
  dataSources: dataSources
2344
- });
2345
- var previousXAndYFieldsWithTypes = (0, usePrevious_1.default)(xAndYFieldsWithTypes);
2341
+ }); // Extract viz options that impact downsampling.
2342
+
2343
+ var downsampleVizOptions = (0, react_1.useMemo)(function () {
2344
+ return (0, lodash_1.pick)(options, downsampleVizOptionProperties);
2345
+ }, [options]);
2346
+ var downsampleDSOptions = (0, react_1.useMemo)(function () {
2347
+ return Object.assign(Object.assign({}, downsampleVizOptions), xAndYFieldsWithTypes);
2348
+ }, [xAndYFieldsWithTypes, downsampleVizOptions]);
2349
+ var previousDownsampleDSOptions = (0, usePrevious_1.default)(downsampleDSOptions);
2346
2350
  var previousDataSources = (0, usePrevious_1.default)(dataSources);
2347
2351
  var previousThreshold = (0, usePrevious_1.default)(threshold);
2348
2352
 
@@ -2350,7 +2354,7 @@ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
2350
2354
  return isDownsamplingEnabled ? (0, dataUtils_1.downsampleDataSources)({
2351
2355
  dataSources: dataSources,
2352
2356
  threshold: threshold,
2353
- options: xAndYFieldsWithTypes
2357
+ options: downsampleDSOptions
2354
2358
  }) : dataSources;
2355
2359
  }),
2356
2360
  _ref3 = _slicedToArray(_ref2, 2),
@@ -2378,7 +2382,7 @@ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
2378
2382
  return;
2379
2383
  }
2380
2384
 
2381
- if ((0, lodash_1.isEqual)(previousXAndYFieldsWithTypes, xAndYFieldsWithTypes) && previousDataSources === dataSources && previousThreshold === threshold) {
2385
+ if ((0, lodash_1.isEqual)(previousDownsampleDSOptions, downsampleDSOptions) && previousDataSources === dataSources && previousThreshold === threshold) {
2382
2386
  return;
2383
2387
  } // Debounce the downsampling so we don't have to downsample and execute DSL multiple times
2384
2388
  // while the viz is being resized
@@ -2386,10 +2390,10 @@ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
2386
2390
 
2387
2391
  debouncedDownsampleDataSources({
2388
2392
  dataSources: dataSources,
2389
- options: xAndYFieldsWithTypes,
2393
+ options: downsampleDSOptions,
2390
2394
  threshold: threshold
2391
2395
  }); // need to detect if this runs as part of the initial render
2392
- }, [dataSources, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousXAndYFieldsWithTypes, previousDataSources, previousThreshold]);
2396
+ }, [dataSources, downsampleDSOptions, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousDataSources, previousThreshold, previousDownsampleDSOptions]);
2393
2397
  return downsampledDataSources;
2394
2398
  };
2395
2399