@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,46 +87,51 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 70);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 78);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
94
94
 
95
- /***/ 26:
95
+ /***/ 3:
96
96
  /***/ (function(module, exports) {
97
97
 
98
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
98
+ module.exports = require("lodash");
99
99
 
100
100
  /***/ }),
101
101
 
102
- /***/ 3:
102
+ /***/ 37:
103
103
  /***/ (function(module, exports) {
104
104
 
105
- module.exports = require("lodash");
105
+ module.exports = require("@babel/runtime/helpers/toConsumableArray");
106
106
 
107
107
  /***/ }),
108
108
 
109
- /***/ 7:
109
+ /***/ 4:
110
110
  /***/ (function(module, exports) {
111
111
 
112
112
  module.exports = require("@splunk/ui-utils/i18n");
113
113
 
114
114
  /***/ }),
115
115
 
116
- /***/ 70:
116
+ /***/ 78:
117
117
  /***/ (function(module, exports, __webpack_require__) {
118
118
 
119
119
  "use strict";
120
120
 
121
121
 
122
- var _toConsumableArray = __webpack_require__(26);
122
+ var _toConsumableArray = __webpack_require__(37);
123
+
123
124
  Object.defineProperty(exports, "__esModule", {
124
125
  value: true
125
126
  });
126
127
  exports.convertToGaugeProperties = exports.mapValueLabelDisplay = exports.mapToOldKey = exports.getGradientDimensions = exports.getGradientStops = exports.getGradientStopColors = exports.getGradientStopOffsets = exports.getGaugeRange = exports.validateRanges = exports.getSortedRanges = exports.getMarkerGaugeValueMarkerPositions = exports.getMarkerBarDimensions = exports.getFillerGaugeValueMarkerPositions = exports.getFillBarDimensions = exports.getGaugeBarHeight = exports.getGaugeBarWidth = exports.getGaugeBarStartPositions = exports.getGaugeBarLength = exports.assignGaugeColor = exports.getGaugeDimensions = exports.getGaugeStartPosition = exports.getGaugeLength = exports.getGaugeHeight = exports.getGaugeWidth = exports.FILL_THICKNESS = exports.GAUGE_THICKNESS = void 0;
128
+
127
129
  var lodash_1 = __webpack_require__(3);
128
- var colorConstants_1 = __webpack_require__(71);
129
- var i18n_1 = __webpack_require__(7);
130
+
131
+ var colorConstants_1 = __webpack_require__(79);
132
+
133
+ var i18n_1 = __webpack_require__(4);
134
+
130
135
  exports.GAUGE_THICKNESS = 50;
131
136
  exports.FILL_THICKNESS = 38;
132
137
  var GRADIENT_STOP_OFFSET_MIN = 0;
@@ -139,11 +144,13 @@ var GRADIENT_STOP_OFFSET_MAX = 100;
139
144
  * @param {String} orientation
140
145
  * @return {Number} width
141
146
  */
147
+
142
148
  var getGaugeWidth = function getGaugeWidth(_ref) {
143
149
  var containerWidth = _ref.containerWidth,
144
- orientation = _ref.orientation;
150
+ orientation = _ref.orientation;
145
151
  return orientation === 'vertical' ? exports.GAUGE_THICKNESS : containerWidth * 0.8;
146
152
  };
153
+
147
154
  exports.getGaugeWidth = getGaugeWidth;
148
155
  /**
149
156
  * get height for the whole gauge viz for horizontal or vertical view
@@ -153,11 +160,13 @@ exports.getGaugeWidth = getGaugeWidth;
153
160
  * @param {String} orientation
154
161
  * @return {Number} height
155
162
  */
163
+
156
164
  var getGaugeHeight = function getGaugeHeight(_ref2) {
157
165
  var containerHeight = _ref2.containerHeight,
158
- orientation = _ref2.orientation;
166
+ orientation = _ref2.orientation;
159
167
  return orientation === 'vertical' ? containerHeight * 0.8 : exports.GAUGE_THICKNESS;
160
168
  };
169
+
161
170
  exports.getGaugeHeight = getGaugeHeight;
162
171
  /**
163
172
  * get how long the gauge shoud be.
@@ -169,10 +178,11 @@ exports.getGaugeHeight = getGaugeHeight;
169
178
  * @param {String} input.orientation
170
179
  * @return {Number} gaugeLength
171
180
  */
181
+
172
182
  var getGaugeLength = function getGaugeLength(_ref3) {
173
183
  var containerWidth = _ref3.containerWidth,
174
- containerHeight = _ref3.containerHeight,
175
- orientation = _ref3.orientation;
184
+ containerHeight = _ref3.containerHeight,
185
+ orientation = _ref3.orientation;
176
186
  return orientation === 'vertical' ? (0, exports.getGaugeHeight)({
177
187
  containerHeight: containerHeight,
178
188
  orientation: orientation
@@ -181,6 +191,7 @@ var getGaugeLength = function getGaugeLength(_ref3) {
181
191
  orientation: orientation
182
192
  });
183
193
  };
194
+
184
195
  exports.getGaugeLength = getGaugeLength;
185
196
  /**
186
197
  * get start x and y for rendering gauge
@@ -194,23 +205,27 @@ exports.getGaugeLength = getGaugeLength;
194
205
  * @return {Number} position.gaugeStartX
195
206
  * @return {Number} position.gaugeStartY
196
207
  */
208
+
197
209
  var getGaugeStartPosition = function getGaugeStartPosition(_ref4) {
198
210
  var containerWidth = _ref4.containerWidth,
199
- containerHeight = _ref4.containerHeight,
200
- gaugeLength = _ref4.gaugeLength,
201
- orientation = _ref4.orientation;
211
+ containerHeight = _ref4.containerHeight,
212
+ gaugeLength = _ref4.gaugeLength,
213
+ orientation = _ref4.orientation;
202
214
  // for horizontal view
203
215
  var gaugeStartX = (containerWidth - gaugeLength) / 2.0;
204
216
  var gaugeStartY = (containerHeight - exports.GAUGE_THICKNESS) / 2.0;
217
+
205
218
  if (orientation === 'vertical') {
206
219
  gaugeStartX = (containerWidth - exports.GAUGE_THICKNESS) / 2.0;
207
220
  gaugeStartY = (containerHeight - gaugeLength) / 2.0;
208
221
  }
222
+
209
223
  return {
210
224
  gaugeStartX: gaugeStartX,
211
225
  gaugeStartY: gaugeStartY
212
226
  };
213
227
  };
228
+
214
229
  exports.getGaugeStartPosition = getGaugeStartPosition;
215
230
  /**
216
231
  * get dimensions for the whole gauge viz,
@@ -227,23 +242,26 @@ exports.getGaugeStartPosition = getGaugeStartPosition;
227
242
  * @return {Number} gaugeDimensions.gaugeWidth natural width of gauge
228
243
  * @return {Number} gaugeDimensions.gaugeHeight natural height of gauge
229
244
  */
245
+
230
246
  var getGaugeDimensions = function getGaugeDimensions(_ref5) {
231
247
  var containerWidth = _ref5.containerWidth,
232
- containerHeight = _ref5.containerHeight,
233
- orientation = _ref5.orientation;
248
+ containerHeight = _ref5.containerHeight,
249
+ orientation = _ref5.orientation;
234
250
  var gaugeLength = (0, exports.getGaugeLength)({
235
251
  containerWidth: containerWidth,
236
252
  containerHeight: containerHeight,
237
253
  orientation: orientation
238
254
  });
255
+
239
256
  var _ref6 = (0, exports.getGaugeStartPosition)({
240
- containerWidth: containerWidth,
241
- containerHeight: containerHeight,
242
- gaugeLength: gaugeLength,
243
- orientation: orientation
244
- }),
245
- gaugeStartX = _ref6.gaugeStartX,
246
- gaugeStartY = _ref6.gaugeStartY;
257
+ containerWidth: containerWidth,
258
+ containerHeight: containerHeight,
259
+ gaugeLength: gaugeLength,
260
+ orientation: orientation
261
+ }),
262
+ gaugeStartX = _ref6.gaugeStartX,
263
+ gaugeStartY = _ref6.gaugeStartY;
264
+
247
265
  var gaugeWidth = (0, exports.getGaugeWidth)({
248
266
  containerWidth: containerWidth,
249
267
  orientation: orientation
@@ -260,6 +278,7 @@ var getGaugeDimensions = function getGaugeDimensions(_ref5) {
260
278
  gaugeHeight: gaugeHeight
261
279
  };
262
280
  };
281
+
263
282
  exports.getGaugeDimensions = getGaugeDimensions;
264
283
  /**
265
284
  * if gaugeColor is not specified, auto assign a gauge color to the fill bar
@@ -267,19 +286,24 @@ exports.getGaugeDimensions = getGaugeDimensions;
267
286
  * @method assignGaugeColor
268
287
  * @params
269
288
  * */
289
+
270
290
  var assignGaugeColor = function assignGaugeColor(_ref7) {
271
291
  var value = _ref7.value,
272
- min = _ref7.min,
273
- max = _ref7.max;
292
+ min = _ref7.min,
293
+ max = _ref7.max;
274
294
  var rate = (value - min) / (max - min);
295
+
275
296
  if (rate <= 0.3) {
276
297
  return colorConstants_1.SEMANTIC_SUCCESS;
277
298
  }
299
+
278
300
  if (rate > 0.3 && rate <= 0.6) {
279
301
  return colorConstants_1.SEMANTIC_WARNING;
280
302
  }
303
+
281
304
  return colorConstants_1.SEMANTIC_ERROR;
282
305
  };
306
+
283
307
  exports.assignGaugeColor = assignGaugeColor;
284
308
  /**
285
309
  * get inner bar length in gauge
@@ -291,22 +315,28 @@ exports.assignGaugeColor = assignGaugeColor;
291
315
  * @param {Number} input.max
292
316
  * @return {Number} gaugeBarLength
293
317
  */
318
+
294
319
  var getGaugeBarLength = function getGaugeBarLength(_ref8) {
295
320
  var gaugeLength = _ref8.gaugeLength,
296
- value = _ref8.value,
297
- min = _ref8.min,
298
- max = _ref8.max;
321
+ value = _ref8.value,
322
+ min = _ref8.min,
323
+ max = _ref8.max;
324
+
299
325
  if (max < min) {
300
326
  return null;
301
327
  }
328
+
302
329
  if (value >= max) {
303
330
  return gaugeLength;
304
331
  }
332
+
305
333
  if (value < min) {
306
334
  return 0;
307
335
  }
336
+
308
337
  return gaugeLength * (value - min) / (max - min);
309
338
  };
339
+
310
340
  exports.getGaugeBarLength = getGaugeBarLength;
311
341
  /**
312
342
  * get x and y position for rendering inner bar in gauge
@@ -322,26 +352,30 @@ exports.getGaugeBarLength = getGaugeBarLength;
322
352
  * @return {Number} position.gaugeBarX
323
353
  * @return {Number} position.gaugeBarY
324
354
  */
355
+
325
356
  var getGaugeBarStartPositions = function getGaugeBarStartPositions(_ref9) {
326
357
  var gaugeStartX = _ref9.gaugeStartX,
327
- gaugeStartY = _ref9.gaugeStartY,
328
- gaugeWidth = _ref9.gaugeWidth,
329
- gaugeHeight = _ref9.gaugeHeight,
330
- gaugeBarLength = _ref9.gaugeBarLength,
331
- orientation = _ref9.orientation;
358
+ gaugeStartY = _ref9.gaugeStartY,
359
+ gaugeWidth = _ref9.gaugeWidth,
360
+ gaugeHeight = _ref9.gaugeHeight,
361
+ gaugeBarLength = _ref9.gaugeBarLength,
362
+ orientation = _ref9.orientation;
332
363
  var gaugeBarX = gaugeStartX;
333
364
  var gaugeBarY = gaugeStartY;
365
+
334
366
  if (orientation === 'vertical') {
335
367
  gaugeBarX += (gaugeWidth - exports.FILL_THICKNESS) / 2;
336
368
  gaugeBarY += gaugeHeight - gaugeBarLength;
337
369
  } else {
338
370
  gaugeBarY += (gaugeHeight - exports.FILL_THICKNESS) / 2;
339
371
  }
372
+
340
373
  return {
341
374
  gaugeBarX: gaugeBarX,
342
375
  gaugeBarY: gaugeBarY
343
376
  };
344
377
  };
378
+
345
379
  exports.getGaugeBarStartPositions = getGaugeBarStartPositions;
346
380
  /**
347
381
  * get width of inner bar in gauge
@@ -351,11 +385,13 @@ exports.getGaugeBarStartPositions = getGaugeBarStartPositions;
351
385
  * @param {String} orientation
352
386
  * @return {Number} gaugeBarWidth
353
387
  */
388
+
354
389
  var getGaugeBarWidth = function getGaugeBarWidth(_ref10) {
355
390
  var gaugeBarLength = _ref10.gaugeBarLength,
356
- orientation = _ref10.orientation;
391
+ orientation = _ref10.orientation;
357
392
  return orientation === 'vertical' ? exports.FILL_THICKNESS : gaugeBarLength;
358
393
  };
394
+
359
395
  exports.getGaugeBarWidth = getGaugeBarWidth;
360
396
  /**
361
397
  * get height of inner bar in gauge
@@ -365,11 +401,13 @@ exports.getGaugeBarWidth = getGaugeBarWidth;
365
401
  * @param {String} orientation
366
402
  * @return {Number} gaugeBarHeight
367
403
  */
404
+
368
405
  var getGaugeBarHeight = function getGaugeBarHeight(_ref11) {
369
406
  var gaugeBarLength = _ref11.gaugeBarLength,
370
- orientation = _ref11.orientation;
407
+ orientation = _ref11.orientation;
371
408
  return orientation === 'vertical' ? gaugeBarLength : exports.FILL_THICKNESS;
372
409
  };
410
+
373
411
  exports.getGaugeBarHeight = getGaugeBarHeight;
374
412
  /**
375
413
  * get dimensions for the fill bar in the gauge
@@ -391,32 +429,35 @@ exports.getGaugeBarHeight = getGaugeBarHeight;
391
429
  * @return {Number} fillBarDimensions.fillBarWidth
392
430
  * @return {Number} fillBarDimensions.fillBarHeight
393
431
  */
432
+
394
433
  var getFillBarDimensions = function getFillBarDimensions(_ref12) {
395
434
  var gaugeLength = _ref12.gaugeLength,
396
- gaugeStartX = _ref12.gaugeStartX,
397
- gaugeStartY = _ref12.gaugeStartY,
398
- gaugeWidth = _ref12.gaugeWidth,
399
- gaugeHeight = _ref12.gaugeHeight,
400
- value = _ref12.value,
401
- min = _ref12.min,
402
- max = _ref12.max,
403
- orientation = _ref12.orientation;
435
+ gaugeStartX = _ref12.gaugeStartX,
436
+ gaugeStartY = _ref12.gaugeStartY,
437
+ gaugeWidth = _ref12.gaugeWidth,
438
+ gaugeHeight = _ref12.gaugeHeight,
439
+ value = _ref12.value,
440
+ min = _ref12.min,
441
+ max = _ref12.max,
442
+ orientation = _ref12.orientation;
404
443
  var gaugeBarLength = (0, exports.getGaugeBarLength)({
405
444
  gaugeLength: gaugeLength,
406
445
  value: value,
407
446
  max: max,
408
447
  min: min
409
448
  });
449
+
410
450
  var _ref13 = (0, exports.getGaugeBarStartPositions)({
411
- gaugeStartX: gaugeStartX,
412
- gaugeStartY: gaugeStartY,
413
- gaugeWidth: gaugeWidth,
414
- gaugeHeight: gaugeHeight,
415
- gaugeBarLength: gaugeBarLength,
416
- orientation: orientation
417
- }),
418
- fillBarX = _ref13.gaugeBarX,
419
- fillBarY = _ref13.gaugeBarY;
451
+ gaugeStartX: gaugeStartX,
452
+ gaugeStartY: gaugeStartY,
453
+ gaugeWidth: gaugeWidth,
454
+ gaugeHeight: gaugeHeight,
455
+ gaugeBarLength: gaugeBarLength,
456
+ orientation: orientation
457
+ }),
458
+ fillBarX = _ref13.gaugeBarX,
459
+ fillBarY = _ref13.gaugeBarY;
460
+
420
461
  var fillBarWidth = (0, exports.getGaugeBarWidth)({
421
462
  gaugeBarLength: gaugeBarLength,
422
463
  orientation: orientation
@@ -433,6 +474,7 @@ var getFillBarDimensions = function getFillBarDimensions(_ref12) {
433
474
  fillBarHeight: fillBarHeight
434
475
  };
435
476
  };
477
+
436
478
  exports.getFillBarDimensions = getFillBarDimensions;
437
479
  /**
438
480
  * get position x and y for value marker in filler gauge
@@ -446,24 +488,28 @@ exports.getFillBarDimensions = getFillBarDimensions;
446
488
  * @return {Number} position.valueMarkerX
447
489
  * @return {Number} position.valueMarkerY
448
490
  */
491
+
449
492
  var getFillerGaugeValueMarkerPositions = function getFillerGaugeValueMarkerPositions(_ref14) {
450
493
  var fillBarX = _ref14.fillBarX,
451
- fillBarY = _ref14.fillBarY,
452
- fillBarLength = _ref14.fillBarLength,
453
- orientation = _ref14.orientation;
494
+ fillBarY = _ref14.fillBarY,
495
+ fillBarLength = _ref14.fillBarLength,
496
+ orientation = _ref14.orientation;
454
497
  var valueMarkerX = fillBarX;
455
498
  var valueMarkerY = fillBarY;
499
+
456
500
  if (orientation === 'vertical') {
457
501
  valueMarkerX -= (exports.GAUGE_THICKNESS - exports.FILL_THICKNESS) / 4;
458
502
  } else {
459
503
  valueMarkerX += fillBarLength;
460
504
  valueMarkerY -= (exports.GAUGE_THICKNESS - exports.FILL_THICKNESS) / 4;
461
505
  }
506
+
462
507
  return {
463
508
  valueMarkerX: valueMarkerX,
464
509
  valueMarkerY: valueMarkerY
465
510
  };
466
511
  };
512
+
467
513
  exports.getFillerGaugeValueMarkerPositions = getFillerGaugeValueMarkerPositions;
468
514
  /**
469
515
  * get dimensions for the marker bar in the gauge
@@ -482,24 +528,27 @@ exports.getFillerGaugeValueMarkerPositions = getFillerGaugeValueMarkerPositions;
482
528
  * @return {Number} markerBarDimensions.markerBarWidth
483
529
  * @return {Number} markerBarDimensions.markerBarHeight
484
530
  */
531
+
485
532
  var getMarkerBarDimensions = function getMarkerBarDimensions(_ref15) {
486
533
  var gaugeLength = _ref15.gaugeLength,
487
- gaugeStartX = _ref15.gaugeStartX,
488
- gaugeStartY = _ref15.gaugeStartY,
489
- gaugeWidth = _ref15.gaugeWidth,
490
- gaugeHeight = _ref15.gaugeHeight,
491
- orientation = _ref15.orientation;
534
+ gaugeStartX = _ref15.gaugeStartX,
535
+ gaugeStartY = _ref15.gaugeStartY,
536
+ gaugeWidth = _ref15.gaugeWidth,
537
+ gaugeHeight = _ref15.gaugeHeight,
538
+ orientation = _ref15.orientation;
492
539
  var gaugeBarLength = gaugeLength; // For marker gauge, inner marker bar spans the entire gauge
540
+
493
541
  var _ref16 = (0, exports.getGaugeBarStartPositions)({
494
- gaugeStartX: gaugeStartX,
495
- gaugeStartY: gaugeStartY,
496
- gaugeWidth: gaugeWidth,
497
- gaugeHeight: gaugeHeight,
498
- gaugeBarLength: gaugeBarLength,
499
- orientation: orientation
500
- }),
501
- markerBarX = _ref16.gaugeBarX,
502
- markerBarY = _ref16.gaugeBarY;
542
+ gaugeStartX: gaugeStartX,
543
+ gaugeStartY: gaugeStartY,
544
+ gaugeWidth: gaugeWidth,
545
+ gaugeHeight: gaugeHeight,
546
+ gaugeBarLength: gaugeBarLength,
547
+ orientation: orientation
548
+ }),
549
+ markerBarX = _ref16.gaugeBarX,
550
+ markerBarY = _ref16.gaugeBarY;
551
+
503
552
  var markerBarWidth = (0, exports.getGaugeBarWidth)({
504
553
  gaugeBarLength: gaugeBarLength,
505
554
  orientation: orientation
@@ -516,6 +565,7 @@ var getMarkerBarDimensions = function getMarkerBarDimensions(_ref15) {
516
565
  markerBarHeight: markerBarHeight
517
566
  };
518
567
  };
568
+
519
569
  exports.getMarkerBarDimensions = getMarkerBarDimensions;
520
570
  /**
521
571
  * get position x and y for value marker in marker gauge
@@ -533,17 +583,19 @@ exports.getMarkerBarDimensions = getMarkerBarDimensions;
533
583
  * @return {Number} position.valueMarkerX
534
584
  * @return {Number} position.valueMarkerY
535
585
  */
586
+
536
587
  var getMarkerGaugeValueMarkerPositions = function getMarkerGaugeValueMarkerPositions(_ref17) {
537
588
  var markerBarX = _ref17.markerBarX,
538
- markerBarY = _ref17.markerBarY,
539
- markerBarHeight = _ref17.markerBarHeight,
540
- gaugeLength = _ref17.markerBarLength,
541
- orientation = _ref17.orientation,
542
- value = _ref17.value,
543
- min = _ref17.min,
544
- max = _ref17.max;
589
+ markerBarY = _ref17.markerBarY,
590
+ markerBarHeight = _ref17.markerBarHeight,
591
+ gaugeLength = _ref17.markerBarLength,
592
+ orientation = _ref17.orientation,
593
+ value = _ref17.value,
594
+ min = _ref17.min,
595
+ max = _ref17.max;
545
596
  var valueMarkerX = markerBarX;
546
597
  var valueMarkerY = markerBarY;
598
+
547
599
  if (orientation === 'vertical') {
548
600
  valueMarkerY += markerBarHeight - (0, exports.getGaugeBarLength)({
549
601
  gaugeLength: gaugeLength,
@@ -561,11 +613,13 @@ var getMarkerGaugeValueMarkerPositions = function getMarkerGaugeValueMarkerPosit
561
613
  });
562
614
  valueMarkerY -= (exports.GAUGE_THICKNESS - exports.FILL_THICKNESS) / 4;
563
615
  }
616
+
564
617
  return {
565
618
  valueMarkerX: valueMarkerX,
566
619
  valueMarkerY: valueMarkerY
567
620
  };
568
621
  };
622
+
569
623
  exports.getMarkerGaugeValueMarkerPositions = getMarkerGaugeValueMarkerPositions;
570
624
  /**
571
625
  * sort the ranges in ascending order
@@ -573,11 +627,13 @@ exports.getMarkerGaugeValueMarkerPositions = getMarkerGaugeValueMarkerPositions;
573
627
  * @param {Array} ranges
574
628
  * @return {Array} sortedRanges
575
629
  */
630
+
576
631
  var getSortedRanges = function getSortedRanges(ranges) {
577
632
  return ranges.sort(function (a, b) {
578
633
  return a.from - b.from;
579
634
  });
580
635
  };
636
+
581
637
  exports.getSortedRanges = getSortedRanges;
582
638
  /**
583
639
  * validate whether ranges prop is valid - continuous ranges, range.to < range.from, range.from != range.to
@@ -585,29 +641,35 @@ exports.getSortedRanges = getSortedRanges;
585
641
  * @param {Array} ranges
586
642
  * @return {String} error
587
643
  */
644
+
588
645
  var validateRanges = function validateRanges(ranges) {
589
646
  if (!ranges.length) {
590
647
  return (0, i18n_1._)('Prop "ranges" is missing entries');
591
- }
592
- // check whether a range has "from" >= "to" eg: 10 - 10, 100 - 10, -20 - -10 are invalid
648
+ } // check whether a range has "from" >= "to" eg: 10 - 10, 100 - 10, -20 - -10 are invalid
649
+
650
+
593
651
  if (ranges.some(function (range) {
594
652
  return range.from >= range.to;
595
653
  })) {
596
654
  return (0, i18n_1._)('Prop "ranges" has invalid entries: invalid range');
597
- }
598
- // check whether ranges have duplicate "from/to" eg: 0 - 50, 25 - 50
655
+ } // check whether ranges have duplicate "from/to" eg: 0 - 50, 25 - 50
656
+
657
+
599
658
  if (ranges.length !== (0, lodash_1.uniqBy)(ranges, 'to').length || ranges.length !== (0, lodash_1.uniqBy)(ranges, 'from').length) {
600
659
  return (0, i18n_1._)('Prop "ranges" has invalid entries: duplicate values');
601
660
  }
602
- var sortedRanges = (0, exports.getSortedRanges)(ranges);
603
- // check whether ranges are continuous eg: 0 - 10, 10 - 20, 20 - 30
661
+
662
+ var sortedRanges = (0, exports.getSortedRanges)(ranges); // check whether ranges are continuous eg: 0 - 10, 10 - 20, 20 - 30
663
+
604
664
  for (var i = 1; i < sortedRanges.length; i += 1) {
605
665
  if (sortedRanges[i].from !== sortedRanges[i - 1].to) {
606
666
  return (0, i18n_1._)('Prop "ranges" has invalid entries: discontinuous ranges');
607
667
  }
608
668
  }
669
+
609
670
  return null;
610
671
  };
672
+
611
673
  exports.validateRanges = validateRanges;
612
674
  /**
613
675
  * calculate min and max value of gauge
@@ -617,6 +679,7 @@ exports.validateRanges = validateRanges;
617
679
  * @return {Number} gaugeRange.min
618
680
  * @return {Number} gaugeRange.max
619
681
  */
682
+
620
683
  var getGaugeRange = function getGaugeRange(ranges) {
621
684
  var min = Math.min.apply(Math, _toConsumableArray(ranges.map(function (range) {
622
685
  return range.from;
@@ -629,6 +692,7 @@ var getGaugeRange = function getGaugeRange(ranges) {
629
692
  max: max
630
693
  };
631
694
  };
695
+
632
696
  exports.getGaugeRange = getGaugeRange;
633
697
  /**
634
698
  * calculate stop offsets for linear gradient
@@ -637,17 +701,20 @@ exports.getGaugeRange = getGaugeRange;
637
701
  * @param {String} orientation
638
702
  * @return {Array} cumulativeOffsets
639
703
  */
704
+
640
705
  var getGradientStopOffsets = function getGradientStopOffsets(_ref18) {
641
706
  var ranges = _ref18.ranges,
642
- orientation = _ref18.orientation;
707
+ orientation = _ref18.orientation;
708
+
643
709
  var _ref19 = (0, exports.getGaugeRange)(ranges),
644
- min = _ref19.min,
645
- max = _ref19.max;
710
+ min = _ref19.min,
711
+ max = _ref19.max;
712
+
646
713
  var offsetScale = (GRADIENT_STOP_OFFSET_MAX - GRADIENT_STOP_OFFSET_MIN) / (max - min);
647
714
  var offsets = ranges.map(function (range) {
648
715
  return Math.abs(range.from - range.to) * offsetScale;
649
- });
650
- // When orientation is vertical, since the gauge starts from bottom to top, linear gradient should be reversed
716
+ }); // When orientation is vertical, since the gauge starts from bottom to top, linear gradient should be reversed
717
+
651
718
  offsets = orientation === 'vertical' ? offsets.reverse() : offsets;
652
719
  var cumulativeOffsets = [];
653
720
  offsets.reduce(function (accumulator, currentValue, idx) {
@@ -656,6 +723,7 @@ var getGradientStopOffsets = function getGradientStopOffsets(_ref18) {
656
723
  }, 0);
657
724
  return cumulativeOffsets;
658
725
  };
726
+
659
727
  exports.getGradientStopOffsets = getGradientStopOffsets;
660
728
  /**
661
729
  * calculate stop colors for linear gradient
@@ -664,15 +732,17 @@ exports.getGradientStopOffsets = getGradientStopOffsets;
664
732
  * @param {String} orientation
665
733
  * @return {Array} stopColors
666
734
  */
735
+
667
736
  var getGradientStopColors = function getGradientStopColors(_ref20) {
668
737
  var ranges = _ref20.ranges,
669
- orientation = _ref20.orientation;
738
+ orientation = _ref20.orientation;
670
739
  var stopColors = ranges.map(function (range) {
671
740
  return range.value;
672
- });
673
- // When orientation is vertical, since the gauge starts from bottom to top, linear gradient should be reversed
741
+ }); // When orientation is vertical, since the gauge starts from bottom to top, linear gradient should be reversed
742
+
674
743
  return orientation === 'vertical' ? stopColors.reverse() : stopColors;
675
744
  };
745
+
676
746
  exports.getGradientStopColors = getGradientStopColors;
677
747
  /**
678
748
  * calculate linear gradient stops from ranges
@@ -682,9 +752,10 @@ exports.getGradientStopColors = getGradientStopColors;
682
752
  * @param {String} orientation
683
753
  * @return {Array} stops
684
754
  */
755
+
685
756
  var getGradientStops = function getGradientStops(_ref21) {
686
757
  var ranges = _ref21.ranges,
687
- orientation = _ref21.orientation;
758
+ orientation = _ref21.orientation;
688
759
  var stops = [];
689
760
  var offsets = (0, exports.getGradientStopOffsets)({
690
761
  ranges: ranges,
@@ -693,13 +764,13 @@ var getGradientStops = function getGradientStops(_ref21) {
693
764
  var stopColors = (0, exports.getGradientStopColors)({
694
765
  ranges: ranges,
695
766
  orientation: orientation
696
- });
697
- // Initialize stops with the first color stop
767
+ }); // Initialize stops with the first color stop
768
+
698
769
  stops.push({
699
770
  offset: "".concat(offsets[0], "%"),
700
771
  stopColor: stopColors[0]
701
- });
702
- // Add the remaining color stops with gradient change at each stop
772
+ }); // Add the remaining color stops with gradient change at each stop
773
+
703
774
  for (var i = 1; i < ranges.length; i += 1) {
704
775
  stops.push({
705
776
  offset: "".concat(offsets[i - 1], "%"),
@@ -710,8 +781,10 @@ var getGradientStops = function getGradientStops(_ref21) {
710
781
  stopColor: stopColors[i]
711
782
  });
712
783
  }
784
+
713
785
  return stops;
714
786
  };
787
+
715
788
  exports.getGradientStops = getGradientStops;
716
789
  /**
717
790
  * calculate linear gradient dimensions
@@ -723,6 +796,7 @@ exports.getGradientStops = getGradientStops;
723
796
  * @return {String} dimensions.x2
724
797
  * @return {String} dimensions.y2
725
798
  */
799
+
726
800
  var getGradientDimensions = function getGradientDimensions(orientation) {
727
801
  var x1 = '0%';
728
802
  var y1 = '0%';
@@ -735,8 +809,9 @@ var getGradientDimensions = function getGradientDimensions(orientation) {
735
809
  y2: y2
736
810
  };
737
811
  };
738
- exports.getGradientDimensions = getGradientDimensions;
739
- // map for new options names to old option names
812
+
813
+ exports.getGradientDimensions = getGradientDimensions; // map for new options names to old option names
814
+
740
815
  var gaugeOptionsMapping = {
741
816
  majorTickInterval: 'majorUnit',
742
817
  gaugeRanges: 'ranges'
@@ -747,11 +822,13 @@ var gaugeOptionsMapping = {
747
822
  * @param {Object} options
748
823
  * @returns {Object}
749
824
  */
825
+
750
826
  var mapToOldKey = function mapToOldKey(options) {
751
827
  return (0, lodash_1.mapKeys)(options, function (val, key) {
752
828
  return gaugeOptionsMapping[key] ? gaugeOptionsMapping[key] : key;
753
829
  });
754
830
  };
831
+
755
832
  exports.mapToOldKey = mapToOldKey;
756
833
  /**
757
834
  * Helper method to map labelDisplay and valueDisplay options to pure component option names
@@ -760,12 +837,14 @@ exports.mapToOldKey = mapToOldKey;
760
837
  * @param {Object} options
761
838
  * @returns {Object}
762
839
  */
840
+
763
841
  var mapValueLabelDisplay = function mapValueLabelDisplay(labelOrValue, options) {
764
842
  var rangeOrValue = labelOrValue === 'value' ? 'Value' : 'Range';
765
843
  var showKey = labelOrValue === 'value' ? 'showValue' : 'showLabels';
766
844
  var percentKey = "usePercentage".concat(rangeOrValue);
767
845
  var optionString = "".concat(labelOrValue, "Display");
768
846
  var newOptions = Object.assign({}, options);
847
+
769
848
  if (newOptions[optionString]) {
770
849
  if (newOptions[optionString] === 'number') {
771
850
  newOptions[showKey] = true;
@@ -778,8 +857,10 @@ var mapValueLabelDisplay = function mapValueLabelDisplay(labelOrValue, options)
778
857
  newOptions[percentKey] = false;
779
858
  }
780
859
  }
860
+
781
861
  return (0, lodash_1.omit)(newOptions, [optionString]);
782
862
  };
863
+
783
864
  exports.mapValueLabelDisplay = mapValueLabelDisplay;
784
865
  /**
785
866
  * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that pure component accepts
@@ -788,6 +869,7 @@ exports.mapValueLabelDisplay = mapValueLabelDisplay;
788
869
  * @param {Object} originalOptions
789
870
  * @returns {Object}
790
871
  */
872
+
791
873
  var convertToGaugeProperties = function convertToGaugeProperties(originalOptions) {
792
874
  return (0, lodash_1.chain)((0, exports.mapToOldKey)(originalOptions)).thru(function (options) {
793
875
  return (0, exports.mapValueLabelDisplay)('label', options);
@@ -795,11 +877,12 @@ var convertToGaugeProperties = function convertToGaugeProperties(originalOptions
795
877
  return (0, exports.mapValueLabelDisplay)('value', options);
796
878
  }).value();
797
879
  };
880
+
798
881
  exports.convertToGaugeProperties = convertToGaugeProperties;
799
882
 
800
883
  /***/ }),
801
884
 
802
- /***/ 71:
885
+ /***/ 79:
803
886
  /***/ (function(module, exports) {
804
887
 
805
888
  module.exports = require("@splunk/visualizations-shared/colorConstants");