@splunk/visualizations 25.13.1 → 26.1.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 (150) hide show
  1. package/Area.config.js +318 -234
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +1131 -766
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +317 -233
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +1007 -594
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +234 -160
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +912 -509
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +80 -29
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +691 -319
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +308 -223
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +1011 -587
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +127 -62
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +576 -286
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +111 -29
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +998 -527
  28. package/Events.js.map +1 -1
  29. package/FillerGauge.config.js +142 -73
  30. package/FillerGauge.config.js.map +1 -1
  31. package/FillerGauge.js +962 -572
  32. package/FillerGauge.js.map +1 -1
  33. package/Image.config.js +70 -26
  34. package/Image.config.js.map +1 -1
  35. package/Image.js +524 -253
  36. package/Image.js.map +1 -1
  37. package/Line.config.js +326 -242
  38. package/Line.config.js.map +1 -1
  39. package/Line.js +1022 -606
  40. package/Line.js.map +1 -1
  41. package/LinkGraph.config.js +99 -49
  42. package/LinkGraph.config.js.map +1 -1
  43. package/LinkGraph.js +1184 -762
  44. package/LinkGraph.js.map +1 -1
  45. package/MIGRATION.md +1082 -0
  46. package/Map.config.js +311 -167
  47. package/Map.config.js.map +1 -1
  48. package/Map.js +1479 -873
  49. package/Map.js.map +1 -1
  50. package/Markdown.config.js +93 -43
  51. package/Markdown.config.js.map +1 -1
  52. package/Markdown.js +603 -332
  53. package/Markdown.js.map +1 -1
  54. package/MarkerGauge.config.js +163 -105
  55. package/MarkerGauge.config.js.map +1 -1
  56. package/MarkerGauge.js +1025 -628
  57. package/MarkerGauge.js.map +1 -1
  58. package/ParallelCoordinates.config.js +95 -41
  59. package/ParallelCoordinates.config.js.map +1 -1
  60. package/ParallelCoordinates.js +993 -622
  61. package/ParallelCoordinates.js.map +1 -1
  62. package/Pie.config.js +99 -46
  63. package/Pie.config.js.map +1 -1
  64. package/Pie.js +847 -442
  65. package/Pie.js.map +1 -1
  66. package/Punchcard.config.js +114 -62
  67. package/Punchcard.config.js.map +1 -1
  68. package/Punchcard.js +1097 -633
  69. package/Punchcard.js.map +1 -1
  70. package/Rectangle.config.js +131 -65
  71. package/Rectangle.config.js.map +1 -1
  72. package/Rectangle.js +580 -288
  73. package/Rectangle.js.map +1 -1
  74. package/Sankey.config.js +103 -41
  75. package/Sankey.config.js.map +1 -1
  76. package/Sankey.js +1128 -586
  77. package/Sankey.js.map +1 -1
  78. package/Scatter.config.js +231 -157
  79. package/Scatter.config.js.map +1 -1
  80. package/Scatter.js +904 -504
  81. package/Scatter.js.map +1 -1
  82. package/SingleValue.config.js +212 -142
  83. package/SingleValue.config.js.map +1 -1
  84. package/SingleValue.js +1506 -956
  85. package/SingleValue.js.map +1 -1
  86. package/SingleValueBasic.js +294 -233
  87. package/SingleValueBasic.js.map +1 -1
  88. package/SingleValueIcon.config.js +208 -138
  89. package/SingleValueIcon.config.js.map +1 -1
  90. package/SingleValueIcon.js +1375 -914
  91. package/SingleValueIcon.js.map +1 -1
  92. package/SingleValueRadial.config.js +252 -137
  93. package/SingleValueRadial.config.js.map +1 -1
  94. package/SingleValueRadial.js +2194 -1069
  95. package/SingleValueRadial.js.map +1 -1
  96. package/SparkLine.js +172 -83
  97. package/SparkLine.js.map +1 -1
  98. package/Table.config.js +123 -70
  99. package/Table.config.js.map +1 -1
  100. package/Table.js +1094 -590
  101. package/Table.js.map +1 -1
  102. package/common/Charting.js +147 -75
  103. package/common/Charting.js.map +1 -1
  104. package/common/ChartingApi.js +18 -7
  105. package/common/ChartingApi.js.map +1 -1
  106. package/common/EventsDoc.js +91 -36
  107. package/common/EventsDoc.js.map +1 -1
  108. package/common/GaugeMajorTicks.js +70 -60
  109. package/common/GaugeMajorTicks.js.map +1 -1
  110. package/common/GaugeValueMarker.js +45 -36
  111. package/common/GaugeValueMarker.js.map +1 -1
  112. package/common/OptionsDoc.js +177 -86
  113. package/common/OptionsDoc.js.map +1 -1
  114. package/common/OverviewDoc.js +65 -32
  115. package/common/OverviewDoc.js.map +1 -1
  116. package/common/SplunkVisualization.js +34 -7
  117. package/common/SplunkVisualization.js.map +1 -1
  118. package/common/SplunkVisualizationApi.js +10 -4
  119. package/common/SplunkVisualizationApi.js.map +1 -1
  120. package/common/ThemesDoc.js +41 -28
  121. package/common/ThemesDoc.js.map +1 -1
  122. package/common/chartingUtils.js +56 -24
  123. package/common/chartingUtils.js.map +1 -1
  124. package/common/docUtils.js +15 -5
  125. package/common/docUtils.js.map +1 -1
  126. package/common/gaugeUtils.js +238 -155
  127. package/common/gaugeUtils.js.map +1 -1
  128. package/common/shapeUtils.js +34 -16
  129. package/common/shapeUtils.js.map +1 -1
  130. package/common/utils/configUtils.js +59 -23
  131. package/common/utils/configUtils.js.map +1 -1
  132. package/common/utils/dataUtils.js +9 -4
  133. package/common/utils/dataUtils.js.map +1 -1
  134. package/common/utils/hocUtils.js +5 -3
  135. package/common/utils/hocUtils.js.map +1 -1
  136. package/common/utils/layoutUtils.js +3 -2
  137. package/common/utils/layoutUtils.js.map +1 -1
  138. package/common/utils/mapUtils.js +370 -206
  139. package/common/utils/mapUtils.js.map +1 -1
  140. package/common/utils/singleValueUtils.js +243 -198
  141. package/common/utils/singleValueUtils.js.map +1 -1
  142. package/common/utils/testHelper.js +36 -9
  143. package/common/utils/testHelper.js.map +1 -1
  144. package/common/utils/trellisUtils.js +87 -26
  145. package/common/utils/trellisUtils.js.map +1 -1
  146. package/common/utils/urlUtils.js +4 -2
  147. package/common/utils/urlUtils.js.map +1 -1
  148. package/common/withDashboardViz.js +375 -193
  149. package/common/withDashboardViz.js.map +1 -1
  150. package/package.json +25 -27
package/SparkLine.js CHANGED
@@ -113,6 +113,20 @@ module.exports = require("@babel/runtime/helpers/createClass");
113
113
 
114
114
  /***/ }),
115
115
 
116
+ /***/ 2:
117
+ /***/ (function(module, exports) {
118
+
119
+ module.exports = require("@splunk/ui-utils/i18n");
120
+
121
+ /***/ }),
122
+
123
+ /***/ 25:
124
+ /***/ (function(module, exports) {
125
+
126
+ module.exports = require("@splunk/ui-utils/id");
127
+
128
+ /***/ }),
129
+
116
130
  /***/ 3:
117
131
  /***/ (function(module, exports) {
118
132
 
@@ -134,14 +148,14 @@ module.exports = require("@babel/runtime/helpers/extends");
134
148
 
135
149
  /***/ }),
136
150
 
137
- /***/ 61:
151
+ /***/ 62:
138
152
  /***/ (function(module, exports) {
139
153
 
140
154
  module.exports = require("@splunk/react-ui/Popover");
141
155
 
142
156
  /***/ }),
143
157
 
144
- /***/ 62:
158
+ /***/ 63:
145
159
  /***/ (function(module, exports) {
146
160
 
147
161
  module.exports = require("@babel/runtime/helpers/getPrototypeOf");
@@ -155,21 +169,21 @@ module.exports = require("@babel/runtime/helpers/defineProperty");
155
169
 
156
170
  /***/ }),
157
171
 
158
- /***/ 70:
172
+ /***/ 71:
159
173
  /***/ (function(module, exports) {
160
174
 
161
175
  module.exports = require("@babel/runtime/helpers/inherits");
162
176
 
163
177
  /***/ }),
164
178
 
165
- /***/ 71:
179
+ /***/ 72:
166
180
  /***/ (function(module, exports) {
167
181
 
168
182
  module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
169
183
 
170
184
  /***/ }),
171
185
 
172
- /***/ 86:
186
+ /***/ 88:
173
187
  /***/ (function(module, exports) {
174
188
 
175
189
  module.exports = require("@babel/runtime/helpers/assertThisInitialized");
@@ -194,13 +208,13 @@ __webpack_require__.r(__webpack_exports__);
194
208
  /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
195
209
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18);
196
210
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);
197
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(86);
211
+ /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(88);
198
212
  /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__);
199
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(70);
213
+ /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71);
200
214
  /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__);
201
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(71);
215
+ /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(72);
202
216
  /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__);
203
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(62);
217
+ /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(63);
204
218
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__);
205
219
  /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7);
206
220
  /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__);
@@ -210,10 +224,15 @@ __webpack_require__.r(__webpack_exports__);
210
224
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_9__);
211
225
  /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(3);
212
226
  /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_10__);
213
- /* harmony import */ var _splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(61);
214
- /* harmony import */ var _splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_11__);
215
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(4);
216
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_12__);
227
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(4);
228
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_11__);
229
+ /* harmony import */ var _splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62);
230
+ /* harmony import */ var _splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_12__);
231
+ /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(2);
232
+ /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13__);
233
+ /* harmony import */ var _splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(25);
234
+ /* harmony import */ var _splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14__);
235
+
217
236
 
218
237
 
219
238
 
@@ -224,22 +243,28 @@ __webpack_require__.r(__webpack_exports__);
224
243
 
225
244
  function _createSuper(Derived) {
226
245
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
246
+
227
247
  return function _createSuperInternal() {
228
248
  var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(Derived),
229
- result;
249
+ result;
250
+
230
251
  if (hasNativeReflectConstruct) {
231
252
  var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor;
253
+
232
254
  result = Reflect.construct(Super, arguments, NewTarget);
233
255
  } else {
234
256
  result = Super.apply(this, arguments);
235
257
  }
258
+
236
259
  return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, result);
237
260
  };
238
261
  }
262
+
239
263
  function _isNativeReflectConstruct() {
240
264
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
241
265
  if (Reflect.construct.sham) return false;
242
266
  if (typeof Proxy === "function") return true;
267
+
243
268
  try {
244
269
  Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
245
270
  return true;
@@ -252,29 +277,40 @@ function _isNativeReflectConstruct() {
252
277
 
253
278
 
254
279
 
255
- var StyledSvg = styled_components__WEBPACK_IMPORTED_MODULE_12___default.a.svg.withConfig({
280
+
281
+
282
+
283
+ var StyledSvg = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.svg.withConfig({
256
284
  displayName: "SparkLine__StyledSvg",
257
285
  componentId: "sc-5oplra-0"
258
286
  })(["overflow:hidden;"]);
259
- var StyledTooltip = styled_components__WEBPACK_IMPORTED_MODULE_12___default.a.div.withConfig({
287
+ var StyledTooltip = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.div.withConfig({
260
288
  displayName: "SparkLine__StyledTooltip",
261
289
  componentId: "sc-5oplra-1"
262
290
  })(["padding:3px 8px;font-size:12px;"]);
291
+
263
292
  var SparkLine = /*#__PURE__*/function (_Component) {
264
293
  _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(SparkLine, _Component);
294
+
265
295
  var _super = _createSuper(SparkLine);
296
+
266
297
  function SparkLine(props) {
267
298
  var _this;
299
+
268
300
  _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SparkLine);
301
+
269
302
  for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
270
303
  rest[_key - 1] = arguments[_key];
271
304
  }
305
+
272
306
  _this = _super.call.apply(_super, [this, props].concat(rest));
307
+
273
308
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(_this), "handleCursorMount", function (el) {
274
309
  _this.setState({
275
310
  anchor: el
276
311
  });
277
312
  });
313
+
278
314
  _this.state = {
279
315
  anchor: null,
280
316
  currentPointX: null,
@@ -282,71 +318,78 @@ var SparkLine = /*#__PURE__*/function (_Component) {
282
318
  rectArea: null,
283
319
  tooltip: null
284
320
  };
321
+ _this.titleId = Object(_splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14__["createDOMID"])();
285
322
  return _this;
286
323
  }
324
+
287
325
  _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(SparkLine, [{
288
326
  key: "getMax",
289
327
  value: function getMax() {
290
328
  var _this2 = this;
329
+
291
330
  var _this$props = this.props,
292
- data = _this$props.data,
293
- acceptNull = _this$props.acceptNull,
294
- yMax = _this$props.yMax;
331
+ data = _this$props.data,
332
+ acceptNull = _this$props.acceptNull,
333
+ yMax = _this$props.yMax;
334
+
295
335
  var dataMax = function dataMax() {
296
336
  return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(_this2.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(data);
297
337
  };
338
+
298
339
  return yMax !== undefined ? yMax : dataMax();
299
340
  }
300
341
  }, {
301
342
  key: "getMin",
302
343
  value: function getMin() {
303
344
  var _this3 = this;
345
+
304
346
  var _this$props2 = this.props,
305
- data = _this$props2.data,
306
- acceptNull = _this$props2.acceptNull,
307
- yMin = _this$props2.yMin;
347
+ data = _this$props2.data,
348
+ acceptNull = _this$props2.acceptNull,
349
+ yMin = _this$props2.yMin;
350
+
308
351
  var dataMin = function dataMin() {
309
352
  return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(_this3.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(data);
310
353
  };
354
+
311
355
  return yMin !== undefined ? yMin : dataMin();
312
356
  }
313
-
314
357
  /**
315
358
  * Gets unit value of x axis.
316
359
  * @param {Number} xMargin - margin of x axis.
317
360
  * @return {Number} unit value of x axis.
318
361
  * @private
319
362
  */
363
+
320
364
  }, {
321
365
  key: "getXUnit",
322
366
  value: function getXUnit(xMargin) {
323
367
  var _this$props3 = this.props,
324
- data = _this$props3.data,
325
- width = _this$props3.width; // Calculate xUnit. Width substract the left margin and right margin, then divide by data length.
368
+ data = _this$props3.data,
369
+ width = _this$props3.width; // Calculate xUnit. Width substract the left margin and right margin, then divide by data length.
370
+
326
371
  var xUnit = (width - xMargin * 2) / (data.length > 1 ? data.length - 1 : 1);
327
372
  return Math.max(0, xUnit);
328
373
  }
329
-
330
374
  /**
331
375
  * Gets unit value of y axis.
332
376
  * @param {String} yMargin - margin of y axis.
333
377
  * @return {Number} unit value of y axis.
334
378
  * @private
335
379
  */
380
+
336
381
  }, {
337
382
  key: "getYUnit",
338
383
  value: function getYUnit(yMargin) {
339
384
  var height = this.props.height;
340
385
  var maxValue = this.getMax();
341
- var minValue = this.getMin();
342
-
343
- // Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
386
+ var minValue = this.getMin(); // Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
344
387
  // if the maxValue equals minValue, means all values in data are the same, then, we need to set the YUnit at the mid value of Height.
345
388
  // So, draws sparkline right in the mid of the container.
389
+
346
390
  var yUnit = (height - yMargin * 2) / (maxValue - minValue || 2);
347
391
  return Math.max(0, yUnit);
348
392
  }
349
-
350
393
  /**
351
394
  * Get a list of arrays of points for drawing lines, based on acceptNull property
352
395
  * @method getSegmentSets
@@ -354,6 +397,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
354
397
  * @param {Array} points
355
398
  * @returns {Array} List of datapoint sets used for drawing lines
356
399
  */
400
+
357
401
  }, {
358
402
  key: "getSegmentSets",
359
403
  value: function getSegmentSets(data, points) {
@@ -366,19 +410,20 @@ var SparkLine = /*#__PURE__*/function (_Component) {
366
410
  // need at least 2 points to draw a segment
367
411
  if (currentLine.length > 1) {
368
412
  lines.push(currentLine);
369
- }
370
- // reset for the next segment
413
+ } // reset for the next segment
414
+
415
+
371
416
  currentLine = [];
372
417
  } else {
373
418
  // data is good, add point data
374
419
  currentLine.push(points[idx]);
375
420
  }
376
- });
421
+ }); // Add the last line
377
422
 
378
- // Add the last line
379
423
  if (currentLine.length > 1) {
380
424
  lines.push(currentLine);
381
425
  }
426
+
382
427
  return lines;
383
428
  }
384
429
  }, {
@@ -394,7 +439,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
394
439
  return value === null ? 0 : value;
395
440
  });
396
441
  }
397
-
398
442
  /**
399
443
  * Converts data to points in svg
400
444
  * @param {Number} xMargin - margin of x axis.
@@ -402,6 +446,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
402
446
  * @return {Array} points coordination.
403
447
  * @private
404
448
  */
449
+
405
450
  }, {
406
451
  key: "dataToPoints",
407
452
  value: function dataToPoints(xMargin, yMargin) {
@@ -419,7 +464,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
419
464
  return [p.x, p.y];
420
465
  });
421
466
  }
422
-
423
467
  /**
424
468
  * Renders rect area for helping figure out which is the nearest point so that
425
469
  * render related cursor and tooltip.
@@ -428,16 +472,20 @@ var SparkLine = /*#__PURE__*/function (_Component) {
428
472
  * @return {Array} array of svg rect objects
429
473
  * @private
430
474
  */
475
+
431
476
  }, {
432
477
  key: "renderRect",
433
478
  value: function renderRect(points, xMargin) {
434
479
  var _this4 = this;
480
+
435
481
  var _this$props4 = this.props,
436
- data = _this$props4.data,
437
- height = _this$props4.height;
482
+ data = _this$props4.data,
483
+ height = _this$props4.height;
438
484
  var xUnit = this.getXUnit(xMargin);
439
485
  return points.map(function (p, i) {
440
- return /*#__PURE__*/(
486
+ return (
487
+ /*#__PURE__*/
488
+
441
489
  /* eslint-disable react/no-array-index-key */
442
490
  react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("rect", {
443
491
  // eslint-disable-line jsx-a11y/mouse-events-have-key-events
@@ -460,33 +508,32 @@ var SparkLine = /*#__PURE__*/function (_Component) {
460
508
  }
461
509
  })
462
510
  /* eslint-enable react/no-array-index-key */
511
+
463
512
  );
464
513
  });
465
- }
514
+ } // Renders area chart
466
515
 
467
- // Renders area chart
468
516
  }, {
469
517
  key: "renderArea",
470
518
  value: function renderArea(points) {
471
519
  var _this$props5 = this.props,
472
- data = _this$props5.data,
473
- fillColor = _this$props5.fillColor,
474
- fillOpacity = _this$props5.fillOpacity,
475
- height = _this$props5.height,
476
- isArea = _this$props5.isArea;
520
+ data = _this$props5.data,
521
+ fillColor = _this$props5.fillColor,
522
+ fillOpacity = _this$props5.fillOpacity,
523
+ height = _this$props5.height,
524
+ isArea = _this$props5.isArea;
525
+
477
526
  if (!isArea || points.length === 0) {
478
527
  return null;
479
528
  }
529
+
480
530
  var segments = this.getSegmentSets(data, points);
481
531
  segments = segments.map(function (s) {
482
- return s.concat([[s[s.length - 1][0], height],
483
- // down to bottom of graph
484
- [s[0][0], height],
485
- // over to below first data point
532
+ return s.concat([[s[s.length - 1][0], height], // down to bottom of graph
533
+ [s[0][0], height], // over to below first data point
486
534
  s[0] // up to first data point to close the box
487
535
  ]);
488
536
  });
489
-
490
537
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
491
538
  "data-test": "area"
492
539
  }, segments.map(function (s) {
@@ -506,11 +553,11 @@ var SparkLine = /*#__PURE__*/function (_Component) {
506
553
  key: "renderCursor",
507
554
  value: function renderCursor() {
508
555
  var _this$props6 = this.props,
509
- cursorStroke = _this$props6.cursorStroke,
510
- cursorStrokeWidth = _this$props6.cursorStrokeWidth,
511
- cursorStrokeLinecap = _this$props6.cursorStrokeLinecap,
512
- cursorStrokeDasharray = _this$props6.cursorStrokeDasharray,
513
- height = _this$props6.height;
556
+ cursorStroke = _this$props6.cursorStroke,
557
+ cursorStrokeWidth = _this$props6.cursorStrokeWidth,
558
+ cursorStrokeLinecap = _this$props6.cursorStrokeLinecap,
559
+ cursorStrokeDasharray = _this$props6.cursorStrokeDasharray,
560
+ height = _this$props6.height;
514
561
  return this.state.rectArea !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("line", {
515
562
  "data-test": "cursor",
516
563
  ref: this.handleCursorMount,
@@ -529,7 +576,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
529
576
  }, {
530
577
  key: "renderTooltip",
531
578
  value: function renderTooltip() {
532
- return this.state.anchor !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(_splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_11___default.a, {
579
+ return this.state.anchor !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(_splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_12___default.a, {
533
580
  "data-test": "tooltip",
534
581
  open: this.state.open,
535
582
  anchor: this.state.anchor,
@@ -539,7 +586,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
539
586
  animation: false
540
587
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(StyledTooltip, null, this.state.anchor !== null ? this.state.tooltip : undefined));
541
588
  }
542
-
543
589
  /**
544
590
  * Renders one or more svg circles to highlight values on the sparkline
545
591
  * @method renderEndDots
@@ -549,14 +595,15 @@ var SparkLine = /*#__PURE__*/function (_Component) {
549
595
  * @returns {Object} React representation of SVG group
550
596
  * @private
551
597
  */
598
+
552
599
  }, {
553
600
  key: "renderEndDots",
554
601
  value: function renderEndDots(points, dotsToShow, xMargin) {
555
602
  var _this$props7 = this.props,
556
- endDotFillColor = _this$props7.endDotFillColor,
557
- endDotRadius = _this$props7.endDotRadius,
558
- endDotStroke = _this$props7.endDotStroke,
559
- endDotStrokeWidth = _this$props7.endDotStrokeWidth;
603
+ endDotFillColor = _this$props7.endDotFillColor,
604
+ endDotRadius = _this$props7.endDotRadius,
605
+ endDotStroke = _this$props7.endDotStroke,
606
+ endDotStrokeWidth = _this$props7.endDotStrokeWidth;
560
607
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, points.slice(-dotsToShow).map(function (point) {
561
608
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("circle", {
562
609
  key: "end-dot".concat(point[0]).concat(point[1]),
@@ -572,21 +619,21 @@ var SparkLine = /*#__PURE__*/function (_Component) {
572
619
  });
573
620
  }));
574
621
  }
575
-
576
622
  /**
577
623
  * Renders the line(s) above the area graph
578
624
  * @method renderPolyline
579
625
  * @param {Array} points
580
626
  * @returns {Object} SVG Group of polylines
581
627
  */
628
+
582
629
  }, {
583
630
  key: "renderPolyline",
584
631
  value: function renderPolyline(points) {
585
632
  var _this$props8 = this.props,
586
- data = _this$props8.data,
587
- lineColor = _this$props8.lineColor,
588
- lineLength = _this$props8.lineLength,
589
- lineStrokeWidth = _this$props8.lineStrokeWidth;
633
+ data = _this$props8.data,
634
+ lineColor = _this$props8.lineColor,
635
+ lineLength = _this$props8.lineLength,
636
+ lineStrokeWidth = _this$props8.lineStrokeWidth;
590
637
  var linePoints = Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(lineLength) && lineLength > 0 ? lineLength : points.length;
591
638
  var lines = this.getSegmentSets(data.slice(-linePoints), points.slice(-linePoints));
592
639
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
@@ -610,23 +657,26 @@ var SparkLine = /*#__PURE__*/function (_Component) {
610
657
  key: "render",
611
658
  value: function render() {
612
659
  var _this5 = this;
660
+
613
661
  var _this$props9 = this.props,
614
- data = _this$props9.data,
615
- elementRef = _this$props9.elementRef,
616
- showTooltip = _this$props9.showTooltip,
617
- showEndDot = _this$props9.showEndDot,
618
- endDotRadius = _this$props9.endDotRadius,
619
- endDotStrokeWidth = _this$props9.endDotStrokeWidth,
620
- endDotCount = _this$props9.endDotCount,
621
- height = _this$props9.height,
622
- isArea = _this$props9.isArea,
623
- lineStrokeWidth = _this$props9.lineStrokeWidth,
624
- width = _this$props9.width;
662
+ data = _this$props9.data,
663
+ elementRef = _this$props9.elementRef,
664
+ showTooltip = _this$props9.showTooltip,
665
+ showEndDot = _this$props9.showEndDot,
666
+ endDotRadius = _this$props9.endDotRadius,
667
+ endDotStrokeWidth = _this$props9.endDotStrokeWidth,
668
+ endDotCount = _this$props9.endDotCount,
669
+ height = _this$props9.height,
670
+ isArea = _this$props9.isArea,
671
+ lineStrokeWidth = _this$props9.lineStrokeWidth,
672
+ width = _this$props9.width,
673
+ title = _this$props9.title;
674
+
625
675
  if (data.length === 0) {
626
676
  return null;
627
- }
677
+ } // Calculate horizontal and vertical margin so that fit line or end dot.
678
+
628
679
 
629
- // Calculate horizontal and vertical margin so that fit line or end dot.
630
680
  var xMargin = endDotRadius + endDotStrokeWidth / 2;
631
681
  var yMargin = Math.max(lineStrokeWidth / 2, endDotRadius + endDotStrokeWidth / 2);
632
682
  var points = this.dataToPoints(xMargin, yMargin);
@@ -646,86 +696,124 @@ var SparkLine = /*#__PURE__*/function (_Component) {
646
696
  ref: elementRef
647
697
  }, Object(lodash__WEBPACK_IMPORTED_MODULE_10__["omit"])(this.props, Object(lodash__WEBPACK_IMPORTED_MODULE_10__["keys"])(SparkLine.propTypes))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(StyledSvg, {
648
698
  height: height,
649
- width: width
650
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, this.renderCursor(), this.renderPolyline(points), this.renderArea(points), dotsToShow ? this.renderEndDots(points, dotsToShow, xMargin) : null, showTooltip ? this.renderRect(points, xMargin) : null, showTooltip ? this.renderTooltip() : null)));
699
+ width: width,
700
+ role: "img",
701
+ "aria-labelledby": this.titleId,
702
+ "data-test": "sparkline-svg"
703
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("title", {
704
+ id: this.titleId,
705
+ "data-test": "sparkline-title"
706
+ }, title || Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13__["_"])('Source count over time sparkline trend')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, this.renderCursor(), this.renderPolyline(points), this.renderArea(points), dotsToShow ? this.renderEndDots(points, dotsToShow, xMargin) : null, showTooltip ? this.renderRect(points, xMargin) : null, showTooltip ? this.renderTooltip() : null)));
651
707
  }
652
708
  }]);
709
+
653
710
  return SparkLine;
654
711
  }(react__WEBPACK_IMPORTED_MODULE_9__["Component"]);
712
+
655
713
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "propTypes", {
656
714
  /**
657
715
  * If true, data can contain `null` as a value and is treated as `0`. If false, this throws error when data contains `null`.
658
716
  */
659
717
  acceptNull: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
718
+
660
719
  /** Array of numbers. These data numbers are converted to points and show on sparkline. */
661
720
  data: function data(props) {
662
721
  if (!Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isArray"])(props.data)) {
663
722
  return new Error('Data provided to Sparkline must be an array.');
664
723
  }
724
+
665
725
  if (props.acceptNull && !props.data.every(function (value) {
666
726
  return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isNull"])(value) || Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
667
727
  })) {
668
728
  return new Error('Data provided to Sparkline must be finite numbers or null.');
669
729
  }
730
+
670
731
  if (!props.acceptNull && !props.data.every(function (value) {
671
732
  return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
672
733
  })) {
673
734
  return new Error('Data provided to Sparkline must be finite numbers.');
674
735
  }
736
+
675
737
  return null;
676
738
  },
739
+
677
740
  /** A React ref which is set to the DOM element when the component mounts and `null` when it unmounts. */
678
741
  elementRef: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.object]),
742
+
679
743
  /** Sets the number of end dots to display. When showEndDot is set to `true`, endDotCount is at least 1. If set to a positive value, this overrides showEndDot. */
680
744
  endDotCount: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
745
+
681
746
  /** Fills color to the end dot. */
682
747
  endDotFillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
748
+
683
749
  /**
684
750
  * Sets end dot radius. End dot radius must be less than or equal to the margin. By default, its value equals the margin.
685
751
  */
686
752
  endDotRadius: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
753
+
687
754
  /** Sets end dot circle stroke color. */
688
755
  endDotStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
756
+
689
757
  /** Sets end dot circle stroke width in pixels. */
690
758
  endDotStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
759
+
691
760
  /** Fills color to area. */
692
761
  fillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
762
+
693
763
  /** Fills opacity to area. Value must be in 0 ~ 1. */
694
764
  fillOpacity: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
765
+
695
766
  /** Sets cursor stroke color. */
696
767
  cursorStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
768
+
697
769
  /** Sets cursor stroke width in pixels. */
698
770
  cursorStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
771
+
699
772
  /** Sets cursor line cap style. */
700
773
  cursorStrokeLinecap: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOf(['butt', 'round', 'square']),
774
+
701
775
  /** Sets cursor dash array style. */
702
776
  cursorStrokeDasharray: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
777
+
703
778
  /**
704
779
  * Container height. If this value is specified, sparkline calculates the size using this height. If height isn't specified,
705
780
  * sparkline figures out the container height by itself.
706
781
  */
707
782
  height: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
783
+
708
784
  /** When set to `true`, sparkline shows as area. */
709
785
  isArea: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
786
+
710
787
  /** The sparkline line color. */
711
788
  lineColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
789
+
712
790
  /** Allows user to draw only the last data points for the line. */
713
791
  lineLength: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
792
+
714
793
  /** The sparkline line stroke width in pixels. */
715
794
  lineStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
795
+
716
796
  /** Enable to show end dot. */
717
797
  showEndDot: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
798
+
718
799
  /** Enable to show tooltip. */
719
800
  showTooltip: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
801
+
720
802
  /** Sets the data value range and maximum value shown on sparkline. */
721
803
  yMax: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
804
+
722
805
  /** Sets the data value range and minimum value shown on sparkline. */
723
806
  yMin: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
807
+
724
808
  /**
725
809
  * The width of the container.
726
810
  */
727
- width: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired
811
+ width: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
812
+
813
+ /** Sets the a11y title text on sparkline. */
814
+ title: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string
728
815
  });
816
+
729
817
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "defaultProps", {
730
818
  acceptNull: false,
731
819
  data: [],
@@ -746,6 +834,7 @@ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(Spa
746
834
  lineColor: '#65a637',
747
835
  lineStrokeWidth: 1
748
836
  });
837
+
749
838
  /* harmony default export */ __webpack_exports__["default"] = (SparkLine);
750
839
 
751
840
  /***/ })