@splunk/visualizations 26.0.0 → 26.1.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 (152) hide show
  1. package/Area.config.js +103 -19
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +646 -243
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +105 -21
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +653 -237
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +95 -21
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +635 -229
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +66 -15
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +589 -211
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +104 -19
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +666 -239
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +83 -18
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +444 -156
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +101 -19
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +792 -322
  28. package/Events.js.map +1 -1
  29. package/FillerGauge.config.js +97 -28
  30. package/FillerGauge.config.js.map +1 -1
  31. package/FillerGauge.js +786 -390
  32. package/FillerGauge.js.map +1 -1
  33. package/Image.config.js +63 -19
  34. package/Image.config.js.map +1 -1
  35. package/Image.js +439 -164
  36. package/Image.js.map +1 -1
  37. package/Line.config.js +107 -23
  38. package/Line.config.js.map +1 -1
  39. package/Line.js +841 -456
  40. package/Line.js.map +1 -1
  41. package/LinkGraph.config.js +73 -23
  42. package/LinkGraph.config.js.map +1 -1
  43. package/LinkGraph.js +653 -230
  44. package/LinkGraph.js.map +1 -1
  45. package/MIGRATION.md +1082 -0
  46. package/Map.config.js +244 -99
  47. package/Map.config.js.map +1 -1
  48. package/Map.js +1223 -612
  49. package/Map.js.map +1 -1
  50. package/Markdown.config.js +71 -21
  51. package/Markdown.config.js.map +1 -1
  52. package/Markdown.js +477 -202
  53. package/Markdown.js.map +1 -1
  54. package/MarkerGauge.config.js +80 -22
  55. package/MarkerGauge.config.js.map +1 -1
  56. package/MarkerGauge.js +819 -418
  57. package/MarkerGauge.js.map +1 -1
  58. package/ParallelCoordinates.config.js +73 -19
  59. package/ParallelCoordinates.config.js.map +1 -1
  60. package/ParallelCoordinates.js +870 -491
  61. package/ParallelCoordinates.js.map +1 -1
  62. package/Pie.config.js +76 -23
  63. package/Pie.config.js.map +1 -1
  64. package/Pie.js +643 -233
  65. package/Pie.js.map +1 -1
  66. package/Punchcard.config.js +82 -30
  67. package/Punchcard.config.js.map +1 -1
  68. package/Punchcard.js +863 -387
  69. package/Punchcard.js.map +1 -1
  70. package/Rectangle.config.js +86 -20
  71. package/Rectangle.config.js.map +1 -1
  72. package/Rectangle.js +449 -159
  73. package/Rectangle.js.map +1 -1
  74. package/Sankey.config.js +85 -23
  75. package/Sankey.config.js.map +1 -1
  76. package/Sankey.js +895 -349
  77. package/Sankey.js.map +1 -1
  78. package/Scatter.config.js +97 -23
  79. package/Scatter.config.js.map +1 -1
  80. package/Scatter.js +639 -234
  81. package/Scatter.js.map +1 -1
  82. package/SingleValue.config.js +95 -25
  83. package/SingleValue.config.js.map +1 -1
  84. package/SingleValue.js +1198 -656
  85. package/SingleValue.js.map +1 -1
  86. package/SingleValueBasic.js +287 -226
  87. package/SingleValueBasic.js.map +1 -1
  88. package/SingleValueIcon.config.js +93 -23
  89. package/SingleValueIcon.config.js.map +1 -1
  90. package/SingleValueIcon.js +991 -522
  91. package/SingleValueIcon.js.map +1 -1
  92. package/SingleValueRadial.config.js +100 -27
  93. package/SingleValueRadial.config.js.map +1 -1
  94. package/SingleValueRadial.js +1185 -624
  95. package/SingleValueRadial.js.map +1 -1
  96. package/SparkLine.js +127 -68
  97. package/SparkLine.js.map +1 -1
  98. package/Table.config.js +74 -21
  99. package/Table.config.js.map +1 -1
  100. package/Table.js +827 -329
  101. package/Table.js.map +1 -1
  102. package/common/Charting.js +152 -69
  103. package/common/Charting.js.map +1 -1
  104. package/common/ChartingApi.js +25 -14
  105. package/common/ChartingApi.js.map +1 -1
  106. package/common/DocExampleWithVizSandbox.js +530 -0
  107. package/common/DocExampleWithVizSandbox.js.map +1 -0
  108. package/common/EventsDoc.js +139 -104
  109. package/common/EventsDoc.js.map +1 -1
  110. package/common/GaugeMajorTicks.js +79 -69
  111. package/common/GaugeMajorTicks.js.map +1 -1
  112. package/common/GaugeValueMarker.js +54 -45
  113. package/common/GaugeValueMarker.js.map +1 -1
  114. package/common/OptionsDoc.js +178 -87
  115. package/common/OptionsDoc.js.map +1 -1
  116. package/common/OverviewDoc.js +530 -68
  117. package/common/OverviewDoc.js.map +1 -1
  118. package/common/SplunkVisualization.js +47 -20
  119. package/common/SplunkVisualization.js.map +1 -1
  120. package/common/SplunkVisualizationApi.js +15 -9
  121. package/common/SplunkVisualizationApi.js.map +1 -1
  122. package/common/ThemesDoc.js +57 -44
  123. package/common/ThemesDoc.js.map +1 -1
  124. package/common/chartingUtils.js +52 -20
  125. package/common/chartingUtils.js.map +1 -1
  126. package/common/docUtils.js +139 -7
  127. package/common/docUtils.js.map +1 -1
  128. package/common/gaugeUtils.js +185 -102
  129. package/common/gaugeUtils.js.map +1 -1
  130. package/common/shapeUtils.js +28 -16
  131. package/common/shapeUtils.js.map +1 -1
  132. package/common/utils/configUtils.js +50 -15
  133. package/common/utils/configUtils.js.map +1 -1
  134. package/common/utils/dataUtils.js +8 -3
  135. package/common/utils/dataUtils.js.map +1 -1
  136. package/common/utils/hocUtils.js +4 -2
  137. package/common/utils/hocUtils.js.map +1 -1
  138. package/common/utils/layoutUtils.js +2 -1
  139. package/common/utils/layoutUtils.js.map +1 -1
  140. package/common/utils/mapUtils.js +288 -128
  141. package/common/utils/mapUtils.js.map +1 -1
  142. package/common/utils/singleValueUtils.js +242 -197
  143. package/common/utils/singleValueUtils.js.map +1 -1
  144. package/common/utils/testHelper.js +10 -1
  145. package/common/utils/testHelper.js.map +1 -1
  146. package/common/utils/trellisUtils.js +62 -1
  147. package/common/utils/trellisUtils.js.map +1 -1
  148. package/common/utils/urlUtils.js +3 -1
  149. package/common/utils/urlUtils.js.map +1 -1
  150. package/common/withDashboardViz.js +389 -192
  151. package/common/withDashboardViz.js.map +1 -1
  152. package/package.json +18 -26
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright © 2018 Splunk Inc.
2
+ * Copyright © 2024 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
5
  */
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 42);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 53);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -118,20 +118,20 @@ module.exports = require("lodash");
118
118
  /* 4 */
119
119
  /***/ (function(module, exports) {
120
120
 
121
- module.exports = require("@babel/runtime/helpers/classCallCheck");
121
+ module.exports = require("@splunk/ui-utils/i18n");
122
122
 
123
123
  /***/ }),
124
- /* 5 */,
125
- /* 6 */
124
+ /* 5 */
126
125
  /***/ (function(module, exports) {
127
126
 
128
- module.exports = require("@babel/runtime/helpers/createClass");
127
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
129
128
 
130
129
  /***/ }),
130
+ /* 6 */,
131
131
  /* 7 */
132
132
  /***/ (function(module, exports) {
133
133
 
134
- module.exports = require("@splunk/ui-utils/i18n");
134
+ module.exports = require("@babel/runtime/helpers/createClass");
135
135
 
136
136
  /***/ }),
137
137
  /* 8 */,
@@ -144,41 +144,47 @@ module.exports = require("@splunk/ui-utils/i18n");
144
144
  /* 15 */,
145
145
  /* 16 */,
146
146
  /* 17 */,
147
- /* 18 */
147
+ /* 18 */,
148
+ /* 19 */,
149
+ /* 20 */
148
150
  /***/ (function(module, exports) {
149
151
 
150
152
  module.exports = require("@splunk/visualizations-shared/Message");
151
153
 
152
154
  /***/ }),
153
- /* 19 */,
154
- /* 20 */
155
+ /* 21 */,
156
+ /* 22 */
155
157
  /***/ (function(module, exports) {
156
158
 
157
159
  module.exports = require("@splunk/visualization-context/TimezoneContext");
158
160
 
159
161
  /***/ }),
160
- /* 21 */
162
+ /* 23 */
161
163
  /***/ (function(module, exports) {
162
164
 
163
165
  module.exports = require("@splunk/visualizations-shared/style");
164
166
 
165
167
  /***/ }),
166
- /* 22 */
168
+ /* 24 */
167
169
  /***/ (function(module, exports, __webpack_require__) {
168
170
 
169
171
  "use strict";
170
172
 
171
173
 
172
- var _classCallCheck = __webpack_require__(4);
173
- var _createClass = __webpack_require__(6);
174
+ var _classCallCheck = __webpack_require__(5);
175
+
176
+ var _createClass = __webpack_require__(7);
177
+
174
178
  Object.defineProperty(exports, "__esModule", {
175
179
  value: true
176
180
  });
177
181
  exports.ChartingApiFunctional = void 0;
182
+
178
183
  var ChartingApiFunctional = /*#__PURE__*/function () {
179
184
  // eslint-disable-next-line no-useless-constructor
180
185
  function ChartingApiFunctional(chartRef) {
181
186
  _classCallCheck(this, ChartingApiFunctional);
187
+
182
188
  this.chartRef = chartRef;
183
189
  }
184
190
  /**
@@ -186,15 +192,18 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
186
192
  *
187
193
  * @memberof ChartingApiFunctional
188
194
  */
195
+
196
+
189
197
  _createClass(ChartingApiFunctional, [{
190
198
  key: "highlight",
191
199
  value: function highlight() {
192
200
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
193
- xValue: '',
194
- seriesName: ''
195
- },
196
- xValue = _ref.xValue,
197
- seriesName = _ref.seriesName;
201
+ xValue: '',
202
+ seriesName: ''
203
+ },
204
+ xValue = _ref.xValue,
205
+ seriesName = _ref.seriesName;
206
+
198
207
  this.getChart().highlight(xValue, seriesName);
199
208
  }
200
209
  /**
@@ -202,26 +211,28 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
202
211
  *
203
212
  * @memberof ChartingApiFunctional
204
213
  */
214
+
205
215
  }, {
206
216
  key: "unHighlight",
207
217
  value: function unHighlight() {
208
218
  this.getChart().unHighlight();
209
- }
210
- // returns chart object
219
+ } // returns chart object
220
+
211
221
  }, {
212
222
  key: "getChart",
213
223
  value: function getChart() {
214
224
  var _a;
225
+
215
226
  return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
216
227
  }
217
228
  }]);
229
+
218
230
  return ChartingApiFunctional;
219
231
  }();
232
+
220
233
  exports.ChartingApiFunctional = ChartingApiFunctional;
221
234
 
222
235
  /***/ }),
223
- /* 23 */,
224
- /* 24 */,
225
236
  /* 25 */,
226
237
  /* 26 */,
227
238
  /* 27 */,
@@ -239,7 +250,18 @@ exports.ChartingApiFunctional = ChartingApiFunctional;
239
250
  /* 39 */,
240
251
  /* 40 */,
241
252
  /* 41 */,
242
- /* 42 */
253
+ /* 42 */,
254
+ /* 43 */,
255
+ /* 44 */,
256
+ /* 45 */,
257
+ /* 46 */,
258
+ /* 47 */,
259
+ /* 48 */,
260
+ /* 49 */,
261
+ /* 50 */,
262
+ /* 51 */,
263
+ /* 52 */,
264
+ /* 53 */
243
265
  /***/ (function(module, exports, __webpack_require__) {
244
266
 
245
267
  "use strict";
@@ -250,23 +272,42 @@ Object.defineProperty(exports, "__esModule", {
250
272
  });
251
273
  exports.updateRowPayload = exports.canUpdateInPlace = exports.changedOptions = exports.NO_INPLACE_PROPS = void 0;
252
274
  /* eslint-disable react/no-unused-prop-types */
275
+
253
276
  var lodash_1 = __webpack_require__(3);
254
- var i18n_1 = __webpack_require__(7);
255
- var visualization_color_palettes_1 = __webpack_require__(43);
277
+
278
+ var i18n_1 = __webpack_require__(4);
279
+
280
+ var visualization_color_palettes_1 = __webpack_require__(54);
281
+
256
282
  var react_1 = __webpack_require__(0);
283
+
257
284
  var React = __webpack_require__(0);
285
+
258
286
  var T = __webpack_require__(1);
259
- var react_event_listener_1 = __webpack_require__(44);
260
- __webpack_require__(45); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
261
- var charting_bundle_1 = __webpack_require__(46);
262
- var TimezoneContext_1 = __webpack_require__(20);
263
- var style_1 = __webpack_require__(21);
287
+
288
+ var react_event_listener_1 = __webpack_require__(55);
289
+
290
+ __webpack_require__(56); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
291
+
292
+
293
+ var charting_bundle_1 = __webpack_require__(57);
294
+
295
+ var TimezoneContext_1 = __webpack_require__(22);
296
+
297
+ var style_1 = __webpack_require__(23);
298
+
264
299
  var styled_components_1 = __webpack_require__(2);
265
- var Message_1 = __webpack_require__(18);
266
- var useSplunkTheme_1 = __webpack_require__(47);
267
- var themeUtils_1 = __webpack_require__(48);
268
- var ChartingApi_1 = __webpack_require__(22);
300
+
301
+ var Message_1 = __webpack_require__(20);
302
+
303
+ var useSplunkTheme_1 = __webpack_require__(58);
304
+
305
+ var themeUtils_1 = __webpack_require__(59);
306
+
307
+ var ChartingApi_1 = __webpack_require__(24);
308
+
269
309
  exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
310
+
270
311
  var changedOptions = function changedOptions(curOptions, nextOptions) {
271
312
  return Object.keys(curOptions).filter(function (key) {
272
313
  return !(key in nextOptions);
@@ -274,7 +315,9 @@ var changedOptions = function changedOptions(curOptions, nextOptions) {
274
315
  return !(key in curOptions) || curOptions[key] !== nextOptions[key];
275
316
  }));
276
317
  };
318
+
277
319
  exports.changedOptions = changedOptions;
320
+
278
321
  function usePrevious(value) {
279
322
  var ref = (0, react_1.useRef)();
280
323
  (0, react_1.useEffect)(function () {
@@ -282,21 +325,24 @@ function usePrevious(value) {
282
325
  });
283
326
  return ref.current;
284
327
  }
328
+
285
329
  var canUpdateInPlace = function canUpdateInPlace(curOptions, nextOptions) {
286
330
  // if either of the options are undefined
287
331
  // it cannot update in place.
288
332
  if (!curOptions || !nextOptions) {
289
333
  return false;
290
334
  }
335
+
291
336
  return !exports.NO_INPLACE_PROPS.some(function (p) {
292
337
  return curOptions[p] !== nextOptions[p];
293
338
  }) && !(0, exports.changedOptions)(curOptions, nextOptions).some(function (p) {
294
339
  return p.toLowerCase().endsWith('color');
295
340
  });
296
341
  };
297
- exports.canUpdateInPlace = canUpdateInPlace;
298
- // create 'row' payloads from 'rowContext' in the flattened format:
342
+
343
+ exports.canUpdateInPlace = canUpdateInPlace; // create 'row' payloads from 'rowContext' in the flattened format:
299
344
  // row.<fieldname>.value
345
+
300
346
  var updateRowPayload = function updateRowPayload(chartEventRowContext, payload) {
301
347
  Object.keys(chartEventRowContext || {}).forEach(function (key) {
302
348
  // eslint-disable-next-line no-param-reassign
@@ -304,18 +350,21 @@ var updateRowPayload = function updateRowPayload(chartEventRowContext, payload)
304
350
  });
305
351
  return payload;
306
352
  };
353
+
307
354
  exports.updateRowPayload = updateRowPayload;
308
355
  var VizChartEventType;
356
+
309
357
  (function (VizChartEventType) {
310
358
  VizChartEventType["POINT_CLICK"] = "point.click";
311
359
  VizChartEventType["POINT_MOUSE_OUT"] = "point.mouseout";
312
360
  VizChartEventType["POINT_MOUSE_OVER"] = "point.mouseover";
313
361
  VizChartEventType["LEGEND_CLICK"] = "legend.click";
314
- })(VizChartEventType || (VizChartEventType = {}));
315
- // @TODO(pwied): remove after HC upgrade to 8+
362
+ })(VizChartEventType || (VizChartEventType = {})); // @TODO(pwied): remove after HC upgrade to 8+
316
363
  // .highcharts-a11y-proxy-container rule addresses a HighCharts < 8 bug
317
364
  // caused by the accessibility plugin
318
365
  // https://github.com/highcharts/highcharts/issues/12883
366
+
367
+
319
368
  var ChartingContainer = styled_components_1.default.div.attrs(function (props) {
320
369
  return {
321
370
  'data-test': 'charting-container',
@@ -343,6 +392,7 @@ var propTypes = {
343
392
  visualizationApiRef: T.func,
344
393
  themeKey: T.string
345
394
  };
395
+
346
396
  var Charting = function Charting(props) {
347
397
  var container = (0, react_1.useRef)(null);
348
398
  var needsInit = (0, react_1.useRef)(true);
@@ -350,6 +400,7 @@ var Charting = function Charting(props) {
350
400
  var needsRedraw = (0, react_1.useRef)(true);
351
401
  var api = (0, react_1.useRef)(new ChartingApi_1.ChartingApiFunctional(chart));
352
402
  var timezone = (0, react_1.useContext)(TimezoneContext_1.default);
403
+
353
404
  var computeChartingSize = function computeChartingSize() {
354
405
  if (container.current) {
355
406
  var rect = container.current.getBoundingClientRect();
@@ -358,48 +409,56 @@ var Charting = function Charting(props) {
358
409
  width: rect.width
359
410
  };
360
411
  }
412
+
361
413
  return {};
362
414
  };
415
+
363
416
  var splunkTheme = (0, useSplunkTheme_1.default)();
364
417
  var themeKey = props.themeKey ? props.themeKey : (0, themeUtils_1.getChartingThemeKey)({
365
418
  splunkThemeV1: splunkTheme
366
419
  });
367
420
  var width = props.width,
368
- height = props.height,
369
- style = props.style,
370
- chartData = props.chartData,
371
- options = props.options,
372
- colorPalette = props.colorPalette,
373
- onClick = props.onClick,
374
- onSelect = props.onSelect,
375
- onPointMouseOut = props.onPointMouseOut,
376
- onPointMouseOver = props.onPointMouseOver,
377
- onEventTrigger = props.onEventTrigger;
421
+ height = props.height,
422
+ style = props.style,
423
+ chartData = props.chartData,
424
+ options = props.options,
425
+ colorPalette = props.colorPalette,
426
+ onClick = props.onClick,
427
+ onSelect = props.onSelect,
428
+ onPointMouseOut = props.onPointMouseOut,
429
+ onPointMouseOver = props.onPointMouseOver,
430
+ onEventTrigger = props.onEventTrigger;
378
431
  var prevOptions = usePrevious(options);
379
432
  var prevTimezone = usePrevious(timezone);
433
+
380
434
  var handleClick = function handleClick(chartEvent, type) {
381
435
  var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
382
436
  payload.name = payload.name2;
383
437
  delete payload.name2;
438
+
384
439
  if (type === VizChartEventType.POINT_CLICK) {
385
440
  payload.value = payload.value2;
386
441
  delete payload.value2;
387
442
  payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
388
443
  }
444
+
389
445
  onClick({
390
446
  type: type,
391
447
  originalEvent: chartEvent,
392
448
  payload: payload
393
449
  });
394
450
  };
451
+
395
452
  var destroyChart = function destroyChart() {
396
453
  if (chart.current) {
397
454
  chart.current.destroy();
398
455
  chart.current = null;
399
456
  }
457
+
400
458
  needsRedraw.current = true;
401
459
  needsInit.current = true;
402
460
  };
461
+
403
462
  var handleSelect = function handleSelect(chartEvent) {
404
463
  // todo: need change this after breaking all visualizations
405
464
  if (onSelect && typeof onSelect === 'function') {
@@ -409,14 +468,16 @@ var Charting = function Charting(props) {
409
468
  payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
410
469
  });
411
470
  return;
412
- }
413
- // the chartEvent here is a jQuery event
471
+ } // the chartEvent here is a jQuery event
472
+
473
+
414
474
  onEventTrigger({
415
475
  type: 'range.select',
416
476
  originalEvent: chartEvent,
417
477
  payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
418
478
  });
419
479
  };
480
+
420
481
  var handlePointMouseOut = function handlePointMouseOut(chartEvent, type) {
421
482
  var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
422
483
  payload.name = payload.name2;
@@ -430,6 +491,7 @@ var Charting = function Charting(props) {
430
491
  payload: payload
431
492
  });
432
493
  };
494
+
433
495
  var handlePointMouseOver = function handlePointMouseOver(chartEvent, type) {
434
496
  var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
435
497
  payload.name = payload.name2;
@@ -443,6 +505,7 @@ var Charting = function Charting(props) {
443
505
  payload: payload
444
506
  });
445
507
  };
508
+
446
509
  var drawChart = function drawChart() {
447
510
  var updatedOptions = Object.assign(Object.assign({}, options), {
448
511
  shouldColorizeTooltipData: false
@@ -453,15 +516,18 @@ var Charting = function Charting(props) {
453
516
  var serializedTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone;
454
517
  var ianaTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone;
455
518
  var utcOffset = timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset;
519
+
456
520
  if (!computedWidth || !computedHeight) {
457
521
  return;
458
522
  }
523
+
459
524
  if (!chartData || !Object.keys(chartData).length) {
460
525
  return;
461
- }
462
- // splunk-charting layers configuration option updates.
526
+ } // splunk-charting layers configuration option updates.
463
527
  // when an option is removed it needs to be set to an empty string
464
528
  // to override the previous configuration
529
+
530
+
465
531
  if (prevOptions) {
466
532
  Object.keys(prevOptions).forEach(function (key) {
467
533
  if (updatedOptions[key] === undefined) {
@@ -469,13 +535,16 @@ var Charting = function Charting(props) {
469
535
  }
470
536
  });
471
537
  }
538
+
472
539
  try {
473
540
  if (needsInit.current) {
474
541
  destroyChart();
475
542
  charting_bundle_1.default.setTheme(themeKey);
543
+
476
544
  if (colorPalette.length > 0) {
477
545
  charting_bundle_1.default.setColorPalette(colorPalette);
478
546
  }
547
+
479
548
  chart.current = charting_bundle_1.default.createChart(container.current, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, updatedOptions), {
480
549
  drilldown: 'all'
481
550
  }), typeof serializedTimezone === 'string' && {
@@ -484,8 +553,8 @@ var Charting = function Charting(props) {
484
553
  'time.ianaTimezone': ianaTimezone
485
554
  }), typeof utcOffset === 'number' && {
486
555
  'time.timezoneOffset': utcOffset
487
- }));
488
- // bind event handlers
556
+ })); // bind event handlers
557
+
489
558
  chart.current.on('pointClick', function (e) {
490
559
  handleClick(e, VizChartEventType.POINT_CLICK);
491
560
  });
@@ -500,29 +569,37 @@ var Charting = function Charting(props) {
500
569
  });
501
570
  chart.current.on('chartRangeSelect', handleSelect);
502
571
  }
572
+
503
573
  if (needsRedraw.current) {
504
574
  charting_bundle_1.default.setTheme(themeKey);
575
+
505
576
  if (colorPalette.length > 0) {
506
577
  charting_bundle_1.default.setColorPalette(colorPalette);
507
578
  }
579
+
508
580
  chart.current.prepareAndDraw(chartData, updatedOptions, function () {});
509
581
  }
582
+
510
583
  if (chart.current) {
511
584
  if (Math.round(chart.current.height) !== Math.round(computedHeight) || Math.round(chart.current.width) !== Math.round(computedWidth)) {
512
585
  chart.current.resize(computedWidth, computedHeight);
513
586
  }
514
587
  }
588
+
515
589
  needsInit.current = false;
516
590
  needsRedraw.current = false;
517
591
  } catch (e) {
518
592
  window.console.error('Caught error rendering chart:', e);
519
593
  }
520
594
  };
595
+
521
596
  var debouncedDrawChart = (0, lodash_1.debounce)(drawChart, 5);
597
+
522
598
  var onContainerMount = function onContainerMount(chartingContainer) {
523
599
  container.current = chartingContainer;
524
600
  debouncedDrawChart();
525
601
  };
602
+
526
603
  var prevTheme = usePrevious(themeKey);
527
604
  var prevOnClick = usePrevious(onClick);
528
605
  (0, react_1.useEffect)(function () {
@@ -536,14 +613,14 @@ var Charting = function Charting(props) {
536
613
  (0, react_1.useEffect)(function () {
537
614
  // TODO: figure out why re-init is needed for functional components (i.e. PlatformViz) when changing theme
538
615
  // seems like redraw doesn't suffice to update the background colors
539
- if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) ||
540
- // timezone is a simple object so this comparison should be fast
616
+ if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) || // timezone is a simple object so this comparison should be fast
541
617
  JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
542
618
  needsInit.current = true;
543
619
  }
544
- needsRedraw.current = true;
545
- // need to immediately call drawChart upon an option or chartData change
620
+
621
+ needsRedraw.current = true; // need to immediately call drawChart upon an option or chartData change
546
622
  // otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
623
+
547
624
  drawChart();
548
625
  }, [JSON.stringify(options), JSON.stringify(chartData.toJSON()), JSON.stringify(chartData.annotations), timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone, timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset, timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone, themeKey, onClick]);
549
626
  return React.createElement(ChartingContainer, {
@@ -556,6 +633,7 @@ var Charting = function Charting(props) {
556
633
  onResize: debouncedDrawChart
557
634
  }));
558
635
  };
636
+
559
637
  var defaultProps = {
560
638
  width: '100%',
561
639
  height: 250,
@@ -573,65 +651,70 @@ var defaultProps = {
573
651
  themeKey: null
574
652
  };
575
653
  Charting.propTypes = propTypes;
576
- Charting.defaultProps = defaultProps;
577
- // allow for early return in case of empty chartData while still following hook rules
654
+ Charting.defaultProps = defaultProps; // allow for early return in case of empty chartData while still following hook rules
655
+
578
656
  var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
579
657
  var Wrapper = function Wrapper(props) {
580
658
  var chartData = props.chartData;
659
+
581
660
  if (!chartData) {
582
661
  return React.createElement(Message_1.default, {
583
662
  message: (0, i18n_1._)('No DataSource'),
584
663
  level: "warning"
585
664
  });
586
665
  }
666
+
587
667
  if (chartData && !Object.keys(chartData).length) {
588
668
  return React.createElement(Message_1.default, {
589
669
  message: (0, i18n_1._)('No Result'),
590
670
  level: "info"
591
671
  });
592
672
  }
673
+
593
674
  return React.createElement(Chart, Object.assign({}, props));
594
675
  };
676
+
595
677
  Wrapper.displayName = 'ChartingWrapper';
596
678
  Wrapper.propTypes = propTypes;
597
679
  Wrapper.defaultProps = defaultProps;
598
680
  return Wrapper;
599
- };
600
- // export default Charting;
681
+ }; // export default Charting;
682
+
683
+
601
684
  exports.default = withEmptyChartMessage(Charting);
602
685
 
603
686
  /***/ }),
604
- /* 43 */
687
+ /* 54 */
605
688
  /***/ (function(module, exports) {
606
689
 
607
690
  module.exports = require("@splunk/visualization-color-palettes");
608
691
 
609
692
  /***/ }),
610
- /* 44 */
693
+ /* 55 */
611
694
  /***/ (function(module, exports) {
612
695
 
613
696
  module.exports = require("react-event-listener");
614
697
 
615
698
  /***/ }),
616
- /* 45 */
699
+ /* 56 */
617
700
  /***/ (function(module, exports) {
618
701
 
619
702
  module.exports = require("@splunk/visualizations-shared/i18n");
620
703
 
621
704
  /***/ }),
622
- /* 46 */
705
+ /* 57 */
623
706
  /***/ (function(module, exports) {
624
707
 
625
708
  module.exports = require("@splunk/charting-bundle");
626
709
 
627
710
  /***/ }),
628
- /* 47 */
711
+ /* 58 */
629
712
  /***/ (function(module, exports) {
630
713
 
631
714
  module.exports = require("@splunk/themes/useSplunkTheme");
632
715
 
633
716
  /***/ }),
634
- /* 48 */
717
+ /* 59 */
635
718
  /***/ (function(module, exports) {
636
719
 
637
720
  module.exports = require("@splunk/visualizations-shared/themeUtils");