@splunk/visualizations 26.3.0 → 26.4.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 (104) hide show
  1. package/Area.config.js +1 -1
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +288 -288
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +1 -1
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +291 -291
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +1 -1
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +280 -280
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +1 -1
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +262 -260
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +1 -1
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +291 -291
  20. package/Column.js.map +1 -1
  21. package/Ellipse.js +220 -218
  22. package/Ellipse.js.map +1 -1
  23. package/Events.config.js +1 -1
  24. package/Events.config.js.map +1 -1
  25. package/Events.js +285 -283
  26. package/Events.js.map +1 -1
  27. package/FillerGauge.config.js +1 -1
  28. package/FillerGauge.config.js.map +1 -1
  29. package/FillerGauge.js +250 -248
  30. package/FillerGauge.js.map +1 -1
  31. package/Image.js +212 -210
  32. package/Image.js.map +1 -1
  33. package/Line.config.js +1 -1
  34. package/Line.config.js.map +1 -1
  35. package/Line.js +289 -289
  36. package/Line.js.map +1 -1
  37. package/LinkGraph.config.js +1 -1
  38. package/LinkGraph.config.js.map +1 -1
  39. package/LinkGraph.js +1725 -17201
  40. package/LinkGraph.js.map +1 -1
  41. package/MIGRATION.md +6 -0
  42. package/Map.config.js +1 -1
  43. package/Map.config.js.map +1 -1
  44. package/Map.js +465 -406
  45. package/Map.js.map +1 -1
  46. package/Markdown.config.js +1 -1
  47. package/Markdown.config.js.map +1 -1
  48. package/Markdown.js +281 -277
  49. package/Markdown.js.map +1 -1
  50. package/MarkerGauge.config.js +1 -1
  51. package/MarkerGauge.config.js.map +1 -1
  52. package/MarkerGauge.js +926 -922
  53. package/MarkerGauge.js.map +1 -1
  54. package/ParallelCoordinates.config.js +1 -1
  55. package/ParallelCoordinates.config.js.map +1 -1
  56. package/ParallelCoordinates.js +336 -320
  57. package/ParallelCoordinates.js.map +1 -1
  58. package/Pie.config.js +5 -1
  59. package/Pie.config.js.map +1 -1
  60. package/Pie.js +362 -330
  61. package/Pie.js.map +1 -1
  62. package/Punchcard.config.js +1 -1
  63. package/Punchcard.config.js.map +1 -1
  64. package/Punchcard.js +342 -338
  65. package/Punchcard.js.map +1 -1
  66. package/Rectangle.js +260 -256
  67. package/Rectangle.js.map +1 -1
  68. package/Sankey.config.js +1 -1
  69. package/Sankey.config.js.map +1 -1
  70. package/Sankey.js +339 -335
  71. package/Sankey.js.map +1 -1
  72. package/Scatter.config.js +1 -1
  73. package/Scatter.config.js.map +1 -1
  74. package/Scatter.js +339 -337
  75. package/Scatter.js.map +1 -1
  76. package/SingleValue.config.js +10 -2
  77. package/SingleValue.config.js.map +1 -1
  78. package/SingleValue.js +455 -427
  79. package/SingleValue.js.map +1 -1
  80. package/SingleValueBasic.js +65 -53
  81. package/SingleValueBasic.js.map +1 -1
  82. package/SingleValueIcon.config.js +10 -2
  83. package/SingleValueIcon.config.js.map +1 -1
  84. package/SingleValueIcon.js +449 -421
  85. package/SingleValueIcon.js.map +1 -1
  86. package/SingleValueRadial.config.js +11 -3
  87. package/SingleValueRadial.config.js.map +1 -1
  88. package/SingleValueRadial.js +1580 -1552
  89. package/SingleValueRadial.js.map +1 -1
  90. package/SparkLine.js +33 -33
  91. package/SparkLine.js.map +1 -1
  92. package/Table.config.js +8 -0
  93. package/Table.config.js.map +1 -1
  94. package/Table.js +366 -357
  95. package/Table.js.map +1 -1
  96. package/common/Charting.js +15 -23
  97. package/common/Charting.js.map +1 -1
  98. package/common/utils/dataUtils.js +12 -18
  99. package/common/utils/dataUtils.js.map +1 -1
  100. package/common/utils/singleValueUtils.js +23 -11
  101. package/common/utils/singleValueUtils.js.map +1 -1
  102. package/common/withDashboardViz.js +31 -27
  103. package/common/withDashboardViz.js.map +1 -1
  104. package/package.json +17 -16
@@ -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 = 493);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 485);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -95,70 +95,25 @@ module.exports =
95
95
  /***/ 0:
96
96
  /***/ (function(module, exports) {
97
97
 
98
- module.exports = require("react");
98
+ module.exports = require("prop-types");
99
99
 
100
100
  /***/ }),
101
101
 
102
102
  /***/ 1:
103
103
  /***/ (function(module, exports) {
104
104
 
105
- module.exports = require("prop-types");
105
+ module.exports = require("react");
106
106
 
107
107
  /***/ }),
108
108
 
109
109
  /***/ 10:
110
110
  /***/ (function(module, exports) {
111
111
 
112
- module.exports = require("@splunk/visualization-schemas");
112
+ module.exports = require("@splunk/visualizations-shared/numberUtils");
113
113
 
114
114
  /***/ }),
115
115
 
116
116
  /***/ 100:
117
- /***/ (function(module, exports, __webpack_require__) {
118
-
119
- "use strict";
120
-
121
-
122
- Object.defineProperty(exports, "__esModule", {
123
- value: true
124
- });
125
- exports.TrellisTitle = exports.TRELLIS_TITLE_HEIGHT = void 0;
126
-
127
- var React = __webpack_require__(0);
128
-
129
- var styled_components_1 = __webpack_require__(4);
130
-
131
- exports.TRELLIS_TITLE_HEIGHT = 28;
132
- var TrellisTitleText = styled_components_1.default.div.withConfig({
133
- displayName: "TrellisTitle__TrellisTitleText",
134
- componentId: "sc-2cu404-0"
135
- })(["margin-left:10px;margin-right:10px;padding-top:8px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;"]);
136
- var TrellisTitleDiv = styled_components_1.default.div.withConfig({
137
- displayName: "TrellisTitle__TrellisTitleDiv",
138
- componentId: "sc-2cu404-1"
139
- })(["height:", "px;font-size:14px;font-weight:700;color:", ";background-color:", ";box-shadow:0 1px ", ";"], exports.TRELLIS_TITLE_HEIGHT, function (props) {
140
- return props.fontColor;
141
- }, function (props) {
142
- return props.backgroundColor;
143
- }, function (props) {
144
- return props.backgroundColor;
145
- });
146
-
147
- var TrellisTitle = function TrellisTitle(props) {
148
- var titleText = String(props.trellisKey).toString();
149
- return React.createElement(TrellisTitleDiv, {
150
- fontColor: props.fontColor,
151
- backgroundColor: props.backgroundColor,
152
- "data-test": "trellis-title",
153
- title: titleText
154
- }, React.createElement(TrellisTitleText, null, titleText));
155
- };
156
-
157
- exports.TrellisTitle = TrellisTitle;
158
-
159
- /***/ }),
160
-
161
- /***/ 101:
162
117
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
163
118
 
164
119
  "use strict";
@@ -178,9 +133,9 @@ __webpack_require__.r(__webpack_exports__);
178
133
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showTrendPositionBelow", function() { return showTrendPositionBelow; });
179
134
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showTrendPositionOutside", function() { return showTrendPositionOutside; });
180
135
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRadialProgress", function() { return getRadialProgress; });
181
- /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70);
136
+ /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69);
182
137
  /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_0__);
183
- /* harmony import */ var _common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20);
138
+ /* harmony import */ var _common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(19);
184
139
 
185
140
 
186
141
  var VALID_TREND_POSITIONS = ['standard', 'below', 'outside'];
@@ -346,7 +301,7 @@ var getRadialProgress = function getRadialProgress(progressValue, minValue, maxV
346
301
 
347
302
  /***/ }),
348
303
 
349
- /***/ 102:
304
+ /***/ 101:
350
305
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
351
306
 
352
307
  "use strict";
@@ -357,15 +312,15 @@ __webpack_require__.r(__webpack_exports__);
357
312
  __webpack_require__.d(__webpack_exports__, "SingleValueTrendValue", function() { return /* binding */ SingleValueTrendValue; });
358
313
 
359
314
  // EXTERNAL MODULE: external "@babel/runtime/helpers/extends"
360
- var extends_ = __webpack_require__(69);
315
+ var extends_ = __webpack_require__(68);
361
316
  var extends_default = /*#__PURE__*/__webpack_require__.n(extends_);
362
317
 
363
318
  // EXTERNAL MODULE: external "react"
364
- var external_react_ = __webpack_require__(0);
319
+ var external_react_ = __webpack_require__(1);
365
320
  var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
366
321
 
367
322
  // EXTERNAL MODULE: external "prop-types"
368
- var external_prop_types_ = __webpack_require__(1);
323
+ var external_prop_types_ = __webpack_require__(0);
369
324
  var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
370
325
 
371
326
  // EXTERNAL MODULE: external "styled-components"
@@ -373,18 +328,18 @@ var external_styled_components_ = __webpack_require__(4);
373
328
  var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
374
329
 
375
330
  // EXTERNAL MODULE: ./src/common/utils/singleValueUtils.js
376
- var singleValueUtils = __webpack_require__(20);
331
+ var singleValueUtils = __webpack_require__(19);
377
332
 
378
333
  // EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowUp"
379
- var ArrowUp_ = __webpack_require__(106);
334
+ var ArrowUp_ = __webpack_require__(105);
380
335
  var ArrowUp_default = /*#__PURE__*/__webpack_require__.n(ArrowUp_);
381
336
 
382
337
  // EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowDown"
383
- var ArrowDown_ = __webpack_require__(107);
338
+ var ArrowDown_ = __webpack_require__(106);
384
339
  var ArrowDown_default = /*#__PURE__*/__webpack_require__.n(ArrowDown_);
385
340
 
386
341
  // EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
387
- var i18n_ = __webpack_require__(2);
342
+ var i18n_ = __webpack_require__(3);
388
343
 
389
344
  // CONCATENATED MODULE: ./src/SingleValueBasic/TrendValue.jsx
390
345
 
@@ -459,7 +414,7 @@ TrendValue_SingleValueContent.propTypes = {
459
414
  };
460
415
  /* harmony default export */ var TrendValue = (TrendValue_SingleValueContent);
461
416
  // EXTERNAL MODULE: external "cssesc"
462
- var external_cssesc_ = __webpack_require__(108);
417
+ var external_cssesc_ = __webpack_require__(107);
463
418
  var external_cssesc_default = /*#__PURE__*/__webpack_require__.n(external_cssesc_);
464
419
 
465
420
  // CONCATENATED MODULE: ./src/SingleValueBasic/MajorValue.jsx
@@ -665,35 +620,35 @@ var SingleValueTrendValue = TrendValue;
665
620
 
666
621
  /***/ }),
667
622
 
668
- /***/ 103:
623
+ /***/ 102:
669
624
  /***/ (function(module, exports) {
670
625
 
671
626
  module.exports = require("@babel/runtime/helpers/typeof");
672
627
 
673
628
  /***/ }),
674
629
 
675
- /***/ 105:
630
+ /***/ 104:
676
631
  /***/ (function(module, exports) {
677
632
 
678
633
  module.exports = require("@splunk/visualizations-shared/trellisUtils");
679
634
 
680
635
  /***/ }),
681
636
 
682
- /***/ 106:
637
+ /***/ 105:
683
638
  /***/ (function(module, exports) {
684
639
 
685
640
  module.exports = require("@splunk/react-icons/enterprise/ArrowUp");
686
641
 
687
642
  /***/ }),
688
643
 
689
- /***/ 107:
644
+ /***/ 106:
690
645
  /***/ (function(module, exports) {
691
646
 
692
647
  module.exports = require("@splunk/react-icons/enterprise/ArrowDown");
693
648
 
694
649
  /***/ }),
695
650
 
696
- /***/ 108:
651
+ /***/ 107:
697
652
  /***/ (function(module, exports) {
698
653
 
699
654
  module.exports = require("cssesc");
@@ -703,23 +658,23 @@ module.exports = require("cssesc");
703
658
  /***/ 11:
704
659
  /***/ (function(module, exports) {
705
660
 
706
- module.exports = require("@splunk/visualizations-shared/numberUtils");
661
+ module.exports = require("@splunk/visualizations-shared/Message");
707
662
 
708
663
  /***/ }),
709
664
 
710
- /***/ 112:
665
+ /***/ 111:
711
666
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
712
667
 
713
668
  "use strict";
714
669
  __webpack_require__.r(__webpack_exports__);
715
- /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
670
+ /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
716
671
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__);
717
- /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29);
672
+ /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28);
718
673
  /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__);
719
674
 
720
675
 
721
676
  var StaticBackgroundColorEditor = {
722
- label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Background'),
677
+ label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Background color'),
723
678
  option: 'backgroundColor',
724
679
  editor: 'editor.color',
725
680
  showEditor: function showEditor(_ref) {
@@ -731,27 +686,27 @@ var StaticBackgroundColorEditor = {
731
686
 
732
687
  /***/ }),
733
688
 
734
- /***/ 114:
689
+ /***/ 113:
735
690
  /***/ (function(module, exports) {
736
691
 
737
692
  module.exports = require("@splunk/react-ui/Paginator");
738
693
 
739
694
  /***/ }),
740
695
 
741
- /***/ 116:
696
+ /***/ 115:
742
697
  /***/ (function(module, exports, __webpack_require__) {
743
698
 
744
699
  "use strict";
745
700
 
746
701
 
747
- var _typeof = __webpack_require__(103);
702
+ var _typeof = __webpack_require__(102);
748
703
 
749
704
  Object.defineProperty(exports, "__esModule", {
750
705
  value: true
751
706
  });
752
707
  exports.getFormattedGaugeRanges = exports.getSortedGaugeRanges = exports.getGaugeStrokeWidth = exports.getLabelFontSize = exports.getVerticalLabelOffset = exports.computeTextWidth = exports.getProgressWidth = exports.validateGaugeRanges = exports.getGaugeRange = void 0;
753
708
 
754
- var displayUtils_1 = __webpack_require__(101);
709
+ var displayUtils_1 = __webpack_require__(100);
755
710
  /**
756
711
  * Figure out what range the major value lies in
757
712
  * @method getGaugeRange
@@ -987,7 +942,7 @@ exports.getFormattedGaugeRanges = getFormattedGaugeRanges;
987
942
  /***/ 12:
988
943
  /***/ (function(module, exports) {
989
944
 
990
- module.exports = require("@splunk/visualizations-shared/Message");
945
+ module.exports = require("@babel/runtime/helpers/defineProperty");
991
946
 
992
947
  /***/ }),
993
948
 
@@ -997,9 +952,9 @@ module.exports = require("@splunk/visualizations-shared/Message");
997
952
  "use strict";
998
953
  __webpack_require__.r(__webpack_exports__);
999
954
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDynamicTrendColorEditor", function() { return getDynamicTrendColorEditor; });
1000
- /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
955
+ /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
1001
956
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__);
1002
- /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29);
957
+ /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28);
1003
958
  /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__);
1004
959
 
1005
960
 
@@ -1042,9 +997,9 @@ var getDynamicTrendColorEditor = function getDynamicTrendColorEditor(_ref) {
1042
997
  "use strict";
1043
998
  __webpack_require__.r(__webpack_exports__);
1044
999
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDynamicBackgroundColorEditor", function() { return getDynamicBackgroundColorEditor; });
1045
- /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
1000
+ /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
1046
1001
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__);
1047
- /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29);
1002
+ /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28);
1048
1003
  /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__);
1049
1004
 
1050
1005
 
@@ -1052,7 +1007,7 @@ var getDynamicBackgroundColorEditor = function getDynamicBackgroundColorEditor(_
1052
1007
  var defaultContext = _ref.defaultContext,
1053
1008
  defaultPalettesConfig = _ref.defaultPalettesConfig;
1054
1009
  return {
1055
- label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Background'),
1010
+ label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Background color'),
1056
1011
  option: 'backgroundColor',
1057
1012
  context: 'backgroundColorEditorConfig',
1058
1013
  editor: 'editor.dynamicColor',
@@ -1096,7 +1051,7 @@ var getDynamicBackgroundColorEditor = function getDynamicBackgroundColorEditor(_
1096
1051
 
1097
1052
  "use strict";
1098
1053
  __webpack_require__.r(__webpack_exports__);
1099
- /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
1054
+ /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
1100
1055
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__);
1101
1056
 
1102
1057
  var StaticMajorAndTrendLayout = [[{
@@ -1147,9 +1102,9 @@ var StaticMajorAndTrendLayout = [[{
1147
1102
 
1148
1103
  "use strict";
1149
1104
  __webpack_require__.r(__webpack_exports__);
1150
- /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
1105
+ /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
1151
1106
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__);
1152
- /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29);
1107
+ /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28);
1153
1108
  /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__);
1154
1109
 
1155
1110
 
@@ -1171,9 +1126,9 @@ var StaticMajorColorEditor = {
1171
1126
 
1172
1127
  "use strict";
1173
1128
  __webpack_require__.r(__webpack_exports__);
1174
- /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
1129
+ /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
1175
1130
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__);
1176
- /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29);
1131
+ /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28);
1177
1132
  /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__);
1178
1133
 
1179
1134
 
@@ -1205,13 +1160,13 @@ Object.defineProperty(exports, "__esModule", {
1205
1160
  });
1206
1161
  exports.TrellisBackgroundColorEditor = exports.TrellisEditorConfig = void 0;
1207
1162
 
1208
- var React = __webpack_require__(0);
1163
+ var React = __webpack_require__(1);
1209
1164
 
1210
- var i18n_1 = __webpack_require__(2);
1165
+ var i18n_1 = __webpack_require__(3);
1211
1166
 
1212
- var FeatureFlagContext_1 = __webpack_require__(28);
1167
+ var FeatureFlagContext_1 = __webpack_require__(27);
1213
1168
 
1214
- var visualization_schemas_1 = __webpack_require__(10);
1169
+ var visualization_schemas_1 = __webpack_require__(9);
1215
1170
  /* eslint-disable react-hooks/rules-of-hooks */
1216
1171
 
1217
1172
 
@@ -1311,7 +1266,7 @@ exports.TrellisBackgroundColorEditor = {
1311
1266
  "use strict";
1312
1267
 
1313
1268
 
1314
- var _slicedToArray = __webpack_require__(6);
1269
+ var _slicedToArray = __webpack_require__(5);
1315
1270
 
1316
1271
  var __rest = this && this.__rest || function (s, e) {
1317
1272
  var t = {};
@@ -1330,39 +1285,39 @@ Object.defineProperty(exports, "__esModule", {
1330
1285
  value: true
1331
1286
  });
1332
1287
 
1333
- var React = __webpack_require__(0);
1288
+ var React = __webpack_require__(1);
1334
1289
 
1335
- var react_1 = __webpack_require__(0);
1290
+ var react_1 = __webpack_require__(1);
1336
1291
 
1337
- var lodash_1 = __webpack_require__(3);
1292
+ var lodash_1 = __webpack_require__(2);
1338
1293
 
1339
1294
  var styled_components_1 = __webpack_require__(4);
1340
1295
 
1341
- var Paginator_1 = __webpack_require__(114);
1296
+ var Paginator_1 = __webpack_require__(113);
1342
1297
 
1343
- var i18n_1 = __webpack_require__(2);
1298
+ var i18n_1 = __webpack_require__(3);
1344
1299
 
1345
- var themes_1 = __webpack_require__(80);
1300
+ var themes_1 = __webpack_require__(79);
1346
1301
 
1347
- var useSplunkTheme_1 = __webpack_require__(77);
1302
+ var useSplunkTheme_1 = __webpack_require__(76);
1348
1303
 
1349
- var FeatureFlagContext_1 = __webpack_require__(28);
1304
+ var FeatureFlagContext_1 = __webpack_require__(27);
1350
1305
 
1351
- var SizeAwareWrapper_1 = __webpack_require__(26);
1306
+ var SizeAwareWrapper_1 = __webpack_require__(25);
1352
1307
 
1353
- var style_1 = __webpack_require__(19);
1308
+ var style_1 = __webpack_require__(18);
1354
1309
 
1355
- var Message_1 = __webpack_require__(12);
1310
+ var Message_1 = __webpack_require__(11);
1356
1311
 
1357
- var trellisUtils_1 = __webpack_require__(105);
1312
+ var trellisUtils_1 = __webpack_require__(104);
1358
1313
 
1359
- var hocUtils_1 = __webpack_require__(34);
1314
+ var hocUtils_1 = __webpack_require__(33);
1360
1315
 
1361
- var JSONSchemaUtils_1 = __webpack_require__(35);
1316
+ var JSONSchemaUtils_1 = __webpack_require__(34);
1362
1317
 
1363
- var visualization_schemas_1 = __webpack_require__(10);
1318
+ var visualization_schemas_1 = __webpack_require__(9);
1364
1319
 
1365
- var Options_1 = __webpack_require__(17);
1320
+ var Options_1 = __webpack_require__(16);
1366
1321
 
1367
1322
  var trellisUtils_2 = __webpack_require__(128);
1368
1323
 
@@ -1618,16 +1573,16 @@ exports.default = withTrellis;
1618
1573
  "use strict";
1619
1574
 
1620
1575
 
1621
- var _toConsumableArray = __webpack_require__(7);
1576
+ var _toConsumableArray = __webpack_require__(6);
1622
1577
 
1623
1578
  Object.defineProperty(exports, "__esModule", {
1624
1579
  value: true
1625
1580
  });
1626
1581
  exports.getTrellisDataSourcesBySplitMode = exports.dataSourcesSplitByModeStatsorUnknown = exports.dataSourcesSplitByModeChart = exports.dataSourcesSplitByModeTimechart = exports.dataSourcesSplitByAggregationsStats = exports.dataSourcesSplitByAggregationsTimechartAndChart = exports.dataSourcesSplitByAggregationsUnknown = exports.AGGREGATIONS = void 0;
1627
1582
 
1628
- var lodash_1 = __webpack_require__(3);
1583
+ var lodash_1 = __webpack_require__(2);
1629
1584
 
1630
- var trellisUtils_1 = __webpack_require__(105);
1585
+ var trellisUtils_1 = __webpack_require__(104);
1631
1586
 
1632
1587
  exports.AGGREGATIONS = 'aggregations';
1633
1588
  /**
@@ -2111,18 +2066,11 @@ exports.getTrellisDataSourcesBySplitMode = getTrellisDataSourcesBySplitMode;
2111
2066
  /***/ 13:
2112
2067
  /***/ (function(module, exports) {
2113
2068
 
2114
- module.exports = require("@babel/runtime/helpers/defineProperty");
2115
-
2116
- /***/ }),
2117
-
2118
- /***/ 14:
2119
- /***/ (function(module, exports) {
2120
-
2121
2069
  module.exports = require("@splunk/themes/variables");
2122
2070
 
2123
2071
  /***/ }),
2124
2072
 
2125
- /***/ 15:
2073
+ /***/ 14:
2126
2074
  /***/ (function(module, exports, __webpack_require__) {
2127
2075
 
2128
2076
  "use strict";
@@ -2133,9 +2081,9 @@ Object.defineProperty(exports, "__esModule", {
2133
2081
  });
2134
2082
  exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
2135
2083
 
2136
- var numberUtils_1 = __webpack_require__(11);
2084
+ var numberUtils_1 = __webpack_require__(10);
2137
2085
 
2138
- var interfaces_1 = __webpack_require__(40); // TODO: utilize this fn in ParallelCoordinates
2086
+ var interfaces_1 = __webpack_require__(39); // TODO: utilize this fn in ParallelCoordinates
2139
2087
 
2140
2088
 
2141
2089
  var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
@@ -2270,19 +2218,21 @@ var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, thr
2270
2218
  */
2271
2219
 
2272
2220
 
2273
- var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
2274
- // Splunk charting allows for numbers in formats such as negative hex that
2221
+ var strictlyCoerceYColumn = function strictlyCoerceYColumn(column, options) {
2222
+ var isNullCoercionEnabled = options.nullValueDisplay === 'zero'; // Splunk charting allows for numbers in formats such as negative hex that
2275
2223
  // Number() does not support and also allows loose coercion of hex numbers (but not other formats)
2276
2224
  // We want to identify columns which contain at least one value that can be loosely coerced
2225
+
2277
2226
  var canLooselyCoerceSomeValues = column.findIndex(function (value) {
2278
- return (0, numberUtils_1.startsWithNumber)("".concat(value));
2227
+ return (0, numberUtils_1.startsWithNumber)("".concat(value)) || isNullCoercionEnabled && value === null;
2279
2228
  }) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
2280
2229
 
2281
2230
  var coercedColumn = [];
2282
2231
  var canDownsampleColumn = !column.some(function (value) {
2283
- var coercedValue = Number(value); // if it can't be parsed or isn't safe, fail
2232
+ var coercedValue = Number(value);
2233
+ var coerceValueToZero = isNullCoercionEnabled && value === null; // if it can't be parsed or isn't safe, fail
2284
2234
 
2285
- if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
2235
+ if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number' && !coerceValueToZero) {
2286
2236
  return true;
2287
2237
  } // save value and continue to next
2288
2238
 
@@ -2363,8 +2313,7 @@ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_re
2363
2313
  dataSources = _ref3.dataSources,
2364
2314
  selectChartEvent = _ref3.selectChartEvent,
2365
2315
  width = _ref3.width,
2366
- xField = _ref3.xField,
2367
- y2Fields = _ref3.y2Fields;
2316
+ xField = _ref3.xField;
2368
2317
 
2369
2318
  var _a, _b, _c;
2370
2319
 
@@ -2401,14 +2350,7 @@ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_re
2401
2350
  });
2402
2351
  var lastIndex = fullSeries.findIndex(function (x) {
2403
2352
  return downsampledSeries[endXIndex] === x;
2404
- }); // For charts with categorical x-axis (charts with an xField that isn't _time), do not support
2405
- // re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
2406
- // Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
2407
- // until SPL-259611 is fixed
2408
-
2409
- if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
2410
- return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
2411
- }
2353
+ });
2412
2354
 
2413
2355
  if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
2414
2356
  return (0, exports.calculateThresholdOnRangeSelect)({
@@ -2458,7 +2400,7 @@ var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fie
2458
2400
  */
2459
2401
 
2460
2402
 
2461
- var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
2403
+ var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes, options) {
2462
2404
  var xColumn = [];
2463
2405
  var yColumns = [];
2464
2406
  var canDownsample = !ds.data.fields.some(function (field, index) {
@@ -2472,7 +2414,7 @@ var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, x
2472
2414
  if (fieldName === xField) {
2473
2415
  xColumn = strictlyCoerceXColumn(column, fieldType);
2474
2416
  } else if (yFields.has(fieldName)) {
2475
- var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
2417
+ var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index], options),
2476
2418
  coercedColumn = _strictlyCoerceYColum.coercedColumn,
2477
2419
  canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
2478
2420
  canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
@@ -2562,7 +2504,7 @@ var downsampleDataSources = function downsampleDataSources(_ref4) {
2562
2504
  return dataSources;
2563
2505
  }
2564
2506
 
2565
- var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
2507
+ var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes, options),
2566
2508
  xColumn = _tryToCoerceAllDispla.xColumn,
2567
2509
  yColumns = _tryToCoerceAllDispla.yColumns;
2568
2510
 
@@ -2599,41 +2541,41 @@ exports.downsampleDataSources = downsampleDataSources;
2599
2541
 
2600
2542
  /***/ }),
2601
2543
 
2602
- /***/ 16:
2544
+ /***/ 15:
2603
2545
  /***/ (function(module, exports) {
2604
2546
 
2605
2547
  module.exports = require("@splunk/visualizations-shared/colorUtils");
2606
2548
 
2607
2549
  /***/ }),
2608
2550
 
2609
- /***/ 17:
2551
+ /***/ 16:
2610
2552
  /***/ (function(module, exports) {
2611
2553
 
2612
2554
  module.exports = require("@splunk/visualization-encoding/Options");
2613
2555
 
2614
2556
  /***/ }),
2615
2557
 
2616
- /***/ 18:
2558
+ /***/ 17:
2617
2559
  /***/ (function(module, exports, __webpack_require__) {
2618
2560
 
2619
2561
  "use strict";
2620
2562
 
2621
2563
 
2622
- var _slicedToArray = __webpack_require__(6);
2564
+ var _slicedToArray = __webpack_require__(5);
2623
2565
 
2624
2566
  Object.defineProperty(exports, "__esModule", {
2625
2567
  value: true
2626
2568
  });
2627
2569
 
2628
- var React = __webpack_require__(0);
2570
+ var React = __webpack_require__(1);
2629
2571
 
2630
2572
  var styled_components_1 = __webpack_require__(4);
2631
2573
 
2632
- var style_1 = __webpack_require__(19);
2574
+ var style_1 = __webpack_require__(18);
2633
2575
 
2634
- var colorUtils_1 = __webpack_require__(16);
2576
+ var colorUtils_1 = __webpack_require__(15);
2635
2577
 
2636
- var SizeAwareWrapper_1 = __webpack_require__(26);
2578
+ var SizeAwareWrapper_1 = __webpack_require__(25);
2637
2579
 
2638
2580
  var Item = styled_components_1.default.div.attrs(function (_ref) {
2639
2581
  var width = _ref.width;
@@ -2704,7 +2646,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
2704
2646
 
2705
2647
  return React.createElement(FixSizeItem, {
2706
2648
  "data-test": "fix-size-item",
2707
- "data-splunk-visualization-version": "26.3.0 - a1ef240a6",
2649
+ "data-splunk-visualization-version": "26.4.0 - 04078274d",
2708
2650
  width: width,
2709
2651
  height: height,
2710
2652
  backgroundColor: backgroundColor
@@ -2726,1344 +2668,1356 @@ exports.default = withFixedSizeContainer;
2726
2668
 
2727
2669
  /***/ }),
2728
2670
 
2729
- /***/ 19:
2671
+ /***/ 18:
2730
2672
  /***/ (function(module, exports) {
2731
2673
 
2732
2674
  module.exports = require("@splunk/visualizations-shared/style");
2733
2675
 
2734
2676
  /***/ }),
2735
2677
 
2736
- /***/ 195:
2737
- /***/ (function(module, exports, __webpack_require__) {
2678
+ /***/ 19:
2679
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2738
2680
 
2739
2681
  "use strict";
2682
+ __webpack_require__.r(__webpack_exports__);
2683
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_FONT", function() { return DEFAULT_FONT; });
2684
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_FONT_FAMILY", function() { return DEFAULT_FONT_FAMILY; });
2685
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SVR_PADDING", function() { return SVR_PADDING; });
2686
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAligment", function() { return getAligment; });
2687
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shouldShowTrend", function() { return shouldShowTrend; });
2688
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isLoadingOrNoColumns", function() { return isLoadingOrNoColumns; });
2689
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFormattedColor", function() { return getFormattedColor; });
2690
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasBackground", function() { return hasBackground; });
2691
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIdenticalColor", function() { return isIdenticalColor; });
2692
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultColorWithBg", function() { return getDefaultColorWithBg; });
2693
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorColor", function() { return getMajorColor; });
2694
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrendColor", function() { return getTrendColor; });
2695
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeColors", function() { return computeColors; });
2696
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeText", function() { return computeText; });
2697
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorText", function() { return getMajorText; });
2698
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrendText", function() { return getTrendText; });
2699
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeFontSize", function() { return computeFontSize; });
2700
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorFontSize", function() { return getMajorFontSize; });
2701
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrendFontSize", function() { return getTrendFontSize; });
2702
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUnderLabelHeight", function() { return getUnderLabelHeight; });
2703
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUnderLabel", function() { return getUnderLabel; });
2704
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorAndTrend", function() { return getMajorAndTrend; });
2705
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateVizInSmallSpace", function() { return updateVizInSmallSpace; });
2706
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeSingleValueContent", function() { return computeSingleValueContent; });
2707
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "minimallyTruncateStringToWidth", function() { return minimallyTruncateStringToWidth; });
2708
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeSingleValueRadialContent", function() { return computeSingleValueRadialContent; });
2709
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getGraphColors", function() { return getGraphColors; });
2710
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjustRGB", function() { return adjustRGB; });
2711
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lighten", function() { return lighten; });
2712
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "darken", function() { return darken; });
2713
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "handleValueClickCallback", function() { return handleValueClickCallback; });
2714
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
2715
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
2716
+ /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
2717
+ /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);
2718
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(10);
2719
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__);
2720
+ /* harmony import */ var _splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(73);
2721
+ /* harmony import */ var _splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__);
2722
+ /* harmony import */ var _splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(35);
2723
+ /* harmony import */ var _splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__);
2724
+ /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(69);
2725
+ /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__);
2740
2726
 
2741
2727
 
2742
- Object.defineProperty(exports, "__esModule", {
2743
- value: true
2744
- });
2745
-
2746
- var React = __webpack_require__(0);
2747
-
2748
- var T = __webpack_require__(1);
2749
-
2750
- var colorConstants_1 = __webpack_require__(70);
2751
-
2752
- var gaugeUtils_1 = __webpack_require__(116);
2728
+ function ownKeys(object, enumerableOnly) {
2729
+ var keys = Object.keys(object);
2753
2730
 
2754
- var displayUtils_1 = __webpack_require__(101);
2731
+ if (Object.getOwnPropertySymbols) {
2732
+ var symbols = Object.getOwnPropertySymbols(object);
2733
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
2734
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2735
+ });
2736
+ keys.push.apply(keys, symbols);
2737
+ }
2755
2738
 
2756
- var GaugeGraph = function GaugeGraph(_ref) {
2757
- var _ref$width = _ref.width,
2758
- width = _ref$width === void 0 ? 200 : _ref$width,
2759
- _ref$height = _ref.height,
2760
- height = _ref$height === void 0 ? 200 : _ref$height,
2761
- _ref$strokeWidth = _ref.strokeWidth,
2762
- strokeWidth = _ref$strokeWidth === void 0 ? (0, gaugeUtils_1.getGaugeStrokeWidth)(height) : _ref$strokeWidth,
2763
- _ref$radialBackground = _ref.radialBackgroundColor,
2764
- radialBackgroundColor = _ref$radialBackground === void 0 ? colorConstants_1.RADIAL_BACKGROUND_COLOR : _ref$radialBackground,
2765
- fontColor = _ref.fontColor,
2766
- formattedGaugeRanges = _ref.formattedGaugeRanges,
2767
- propMajorValue = _ref.majorValue,
2768
- maxValue = _ref.maxValue,
2769
- minValue = _ref.minValue,
2770
- showRadialGraph = _ref.showRadialGraph;
2739
+ return keys;
2740
+ }
2771
2741
 
2772
- function toRadians(degrees) {
2773
- return degrees * Math.PI / 180;
2774
- }
2742
+ function _objectSpread(target) {
2743
+ for (var i = 1; i < arguments.length; i++) {
2744
+ var source = arguments[i] != null ? arguments[i] : {};
2775
2745
 
2776
- function toDegrees(radians) {
2777
- return radians * 180 / Math.PI;
2746
+ if (i % 2) {
2747
+ ownKeys(Object(source), true).forEach(function (key) {
2748
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
2749
+ });
2750
+ } else if (Object.getOwnPropertyDescriptors) {
2751
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2752
+ } else {
2753
+ ownKeys(Object(source)).forEach(function (key) {
2754
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2755
+ });
2756
+ }
2778
2757
  }
2779
2758
 
2780
- var labelFontSize = (0, gaugeUtils_1.getLabelFontSize)(height, showRadialGraph);
2781
- var labelFontSizeString = "".concat(String(labelFontSize), "px Splunk Platform Sans");
2782
- var maxOffset = 0.35; // space between the label and the radial
2759
+ return target;
2760
+ }
2783
2761
 
2784
- var labelSpace = labelFontSize / 2; // length of the base of triangle marker
2785
2762
 
2786
- var triangleBase = height >= 113 ? 8 : 4; // amount of padding around semi-circle
2787
2763
 
2788
- var padding = labelFontSize > 0 ? labelSpace * 2 + labelFontSize * 2 : triangleBase;
2789
- var semicircleRadius = height - strokeWidth / 2 - padding;
2790
- var circumference = semicircleRadius * 2 * Math.PI;
2791
- var bgCircleOffset = circumference * 0.5; // half a circle
2792
2764
 
2793
- var strokeDashoffset = circumference * 0.5; // half a circle
2794
2765
 
2795
- var semicircleEdgeRadius = semicircleRadius + strokeWidth / 2; // For inner radial
2796
2766
 
2797
- var innerStrokeWidth = strokeWidth / 4;
2798
- var innerSemicircleRadius = height - strokeWidth - padding - innerStrokeWidth / 2 - 1; // subtract 1 to make the 1px space between outer and inner arc
2767
+ var DEFAULT_FONT = 12;
2768
+ var DEFAULT_FONT_FAMILY = '"Splunk Platform Sans", "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif';
2769
+ var SVR_PADDING = {
2770
+ top: 12,
2771
+ bottom: 12,
2772
+ left: 16,
2773
+ right: 16
2774
+ };
2775
+ var getAligment = function getAligment(align) {
2776
+ var alignMap = {
2777
+ left: 'start',
2778
+ center: 'center',
2779
+ right: 'end'
2780
+ };
2781
+ return alignMap[align] || 'center';
2782
+ };
2783
+ /**
2784
+ * @method shouldShowTrend
2785
+ * @param {String} trendDisplay
2786
+ * @returns {Bool}
2787
+ */
2799
2788
 
2800
- var innerCircumference = innerSemicircleRadius * 2 * Math.PI; // Center of radials
2789
+ var shouldShowTrend = function shouldShowTrend(trendDisplay) {
2790
+ return trendDisplay === 'absolute' || trendDisplay === 'percent';
2791
+ };
2792
+ /**
2793
+ * @method isLoadingOrNoColumns
2794
+ * @param {Object} dataSources
2795
+ * @param {Boolean} loading
2796
+ * @returns {Boolean} return true if loading or without columns in dataSources
2797
+ */
2801
2798
 
2802
- var cx = width / 2;
2803
- var cyOffset = labelFontSize > 0 ? labelSpace * 2 + labelFontSize : triangleBase / 2;
2804
- var cy = semicircleRadius + strokeWidth / 2 + cyOffset;
2805
- var majorValue;
2799
+ var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
2800
+ var data = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["get"])(dataSources, 'primary.data.columns[0]', undefined);
2801
+ var noColumns = data === undefined;
2802
+ return loading || noColumns;
2803
+ };
2804
+ /**
2805
+ * Retrieve the valid formatted color
2806
+ * @method getFormattedColor
2807
+ * @param {String} color
2808
+ * @param {String} defaultColor
2809
+ * @returns {String} the formatted color
2810
+ */
2806
2811
 
2807
- if (typeof propMajorValue === 'string') {
2808
- majorValue = parseInt(propMajorValue, 10);
2809
- } else {
2810
- majorValue = propMajorValue;
2811
- }
2812
+ var getFormattedColor = function getFormattedColor(color, defaultColor) {
2813
+ return Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(color) || Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(defaultColor);
2814
+ };
2815
+ /**
2816
+ * Determines if there is a background color
2817
+ * @method hasBackground
2818
+ * @param {String} backgroundColor
2819
+ * @returns true for non-transparent background color
2820
+ */
2812
2821
 
2813
- var range = (0, gaugeUtils_1.getGaugeRange)(formattedGaugeRanges, majorValue);
2814
- var circles = [];
2815
- var labels = [];
2816
- var showMarker = false; // Calculate Marker Values
2822
+ var hasBackground = function hasBackground(backgroundColor) {
2823
+ return !!backgroundColor && backgroundColor !== 'transparent';
2824
+ };
2825
+ /**
2826
+ * @method isIdenticalColor
2827
+ * @param {String} colorA
2828
+ * @param {String} colorB
2829
+ * @returns {Boolean}
2830
+ */
2817
2831
 
2818
- var radius = semicircleRadius;
2819
- var x = strokeWidth / 2 + innerStrokeWidth + 2; // distance of tip of marker from center of outer semicircle stroke
2832
+ var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
2833
+ return !!colorA && !!colorB && Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(colorA.toLowerCase()) === Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(colorB.toLowerCase());
2834
+ };
2835
+ /*
2836
+ * @method getDefaultColorWithBg
2837
+ * @param {Object} props
2838
+ * @param {String} props.backgroundColor
2839
+ * @param {String} props.defaultFontColor
2840
+ * @param {String} props.defaultBlockFontColor
2841
+ * @returns {String} defaultColor
2842
+ */
2820
2843
 
2821
- var markerVal = Math.max(Math.min(maxValue, majorValue), minValue);
2822
- var theta = toRadians(180 - (0, displayUtils_1.getRadialProgress)(markerVal - minValue, minValue, maxValue) / 100 * 180); // degree of progress
2844
+ var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
2845
+ var backgroundColor = _ref.backgroundColor,
2846
+ defaultFontColor = _ref.defaultFontColor,
2847
+ defaultBlockFontColor = _ref.defaultBlockFontColor;
2848
+ return isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;
2849
+ };
2850
+ /*
2851
+ * @method getMajorColor
2852
+ * return formatted majorColor.
2853
+ * @param {Object} props
2854
+ * @param {String} props.majorColor
2855
+ * @param {String} props.backgroundColor
2856
+ * @param {String} props.defaultFontColor
2857
+ * @param {String} props.defaultBlockFontColor
2858
+ * @returns {String} majorColor
2859
+ */
2823
2860
 
2824
- var p1x = cx + (radius - x) * Math.cos(theta);
2825
- var p1y = cy - (radius - x) * Math.sin(theta);
2826
- var centerX = (radius - x - triangleBase / Math.sqrt(3)) * Math.cos(theta);
2827
- var centerY = (radius - x - triangleBase / Math.sqrt(3)) * Math.sin(theta);
2828
- var rotation1 = 2 * Math.PI / 3; // degrees of rotation around center for 2nd point
2861
+ var getMajorColor = function getMajorColor(_ref2) {
2862
+ var majorColor = _ref2.majorColor,
2863
+ backgroundColor = _ref2.backgroundColor,
2864
+ defaultFontColor = _ref2.defaultFontColor,
2865
+ defaultBlockFontColor = _ref2.defaultBlockFontColor; // If backgroundColor is set, but no majorColor,
2866
+ // the default majorColor will turn to be defaultBlockFontColor.
2867
+ // eg: major color will turn to be white in enterprise mode.
2868
+ // however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.
2829
2869
 
2830
- var rotation2 = -2 * Math.PI / 3; // degrees of rotation around center for 3rd point
2870
+ if (hasBackground(backgroundColor) && !majorColor) {
2871
+ return getDefaultColorWithBg({
2872
+ backgroundColor: backgroundColor,
2873
+ defaultFontColor: defaultFontColor,
2874
+ defaultBlockFontColor: defaultBlockFontColor
2875
+ });
2876
+ }
2831
2877
 
2832
- var xVal = (radius - x) * Math.cos(theta); // x-axis offset of center
2878
+ return getFormattedColor(majorColor, defaultFontColor);
2879
+ };
2880
+ /**
2881
+ * Get the color for the trend components
2882
+ * @method getTrendColor
2883
+ * @param {Object} props
2884
+ * @param {String} props.trendColor The trendColor value determined from encoding
2885
+ * @param {Number} props.trendValue
2886
+ * @param {Number} props.majorValue
2887
+ * @param {String} props.customizedBgColor
2888
+ * @param {String} props.trendDisplay absolute || percent || off
2889
+ * @param {Object} defaultColors
2890
+ * @returns {String} trendColor
2891
+ */
2833
2892
 
2834
- var yVal = (radius - x) * Math.sin(theta); // y-axis offset of center
2893
+ var getTrendColor = function getTrendColor(_ref3) {
2894
+ var trendColor = _ref3.trendColor,
2895
+ trendValue = _ref3.trendValue,
2896
+ majorValue = _ref3.majorValue,
2897
+ customizedBgColor = _ref3.customizedBgColor,
2898
+ trendDisplay = _ref3.trendDisplay,
2899
+ defaultColors = _ref3.defaultColors;
2835
2900
 
2836
- var p2x = centerX + (xVal - centerX) * Math.cos(rotation1) - (yVal - centerY) * Math.sin(rotation1); // x-axis of 2nd point
2901
+ if (trendColor) {
2902
+ return trendColor;
2903
+ }
2837
2904
 
2838
- var p2y = centerY + (xVal - centerX) * Math.sin(rotation1) + (yVal - centerY) * Math.cos(rotation1); // y-axis of 2nd point
2905
+ if (Number.isNaN(Number(trendValue))) {
2906
+ return undefined;
2907
+ }
2839
2908
 
2840
- var p3x = centerX + (xVal - centerX) * Math.cos(rotation2) - (yVal - centerY) * Math.sin(rotation2); // x-axis of 3rd point
2909
+ var defaultFontColor = defaultColors.defaultFontColor,
2910
+ defaultBlockFontColor = defaultColors.defaultBlockFontColor,
2911
+ defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
2841
2912
 
2842
- var p3y = centerY + (xVal - centerX) * Math.sin(rotation2) + (yVal - centerY) * Math.cos(rotation2); // y-axis of 3rd point
2913
+ if (hasBackground(customizedBgColor) && !isIdenticalColor(customizedBgColor, defaultBackgroundColor) && !isIdenticalColor(customizedBgColor, defaultBlockFontColor)) {
2914
+ return defaultBlockFontColor;
2915
+ } // if trendDisplay is percent, and trendValue === value
2916
+ // the trend percent = trendValue / (value - trendValue) will return Infinity
2843
2917
 
2844
- var d = "M ".concat(p1x, " ").concat(p1y, " L ").concat(cx + p2x, " ").concat(cy - p2y, " L ").concat(cx + p3x, " ").concat(cy - p3y, " Z"); // d-value for marker path in SVG
2845
2918
 
2846
- formattedGaugeRanges.forEach(function (r, i) {
2847
- if (range >= i && typeof majorValue === 'number') {
2848
- var startVal = Math.min(r.from, majorValue);
2849
- var endVal = Math.min(r.to, majorValue); // width of stroke for each gauge range
2919
+ var isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);
2850
2920
 
2851
- var _progressWidth = (0, gaugeUtils_1.getProgressWidth)(endVal - startVal, minValue, maxValue, circumference); // distance of stroke from right edge of circle
2921
+ if (trendValue === 0 || isInvalidTrend) {
2922
+ return defaultFontColor;
2923
+ }
2852
2924
 
2925
+ return trendValue > 0 ? _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_GREEN"] : _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_RED"];
2926
+ };
2927
+ /**
2928
+ * Computes visualization properties for display component
2929
+ * @method computeColors
2930
+ * @param {Object} props all viz props
2931
+ * @param {Object} defaultColors defaultColors from theme
2932
+ * @returns {Object} result
2933
+ * @returns {Boolean} backgroundEnabled
2934
+ * @returns {String} backgroundColor
2935
+ * @returns {String} majorColor
2936
+ * @returns {String} trendColor
2937
+ * @returns {String} underLabelColor
2938
+ */
2853
2939
 
2854
- var _offsetDistance = (0, gaugeUtils_1.getProgressWidth)(maxValue - startVal, minValue, maxValue, circumference); // main gauge progress radial
2940
+ var computeColors = function computeColors(props, defaultColors) {
2941
+ var backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);
2942
+ var backgroundEnabled = hasBackground(backgroundColor);
2943
+ var majorColor = getMajorColor({
2944
+ majorColor: props.majorColor,
2945
+ backgroundColor: backgroundColor,
2946
+ defaultFontColor: defaultColors.defaultFontColor,
2947
+ defaultBlockFontColor: defaultColors.defaultBlockFontColor
2948
+ });
2949
+ var trendColor = getTrendColor({
2950
+ trendColor: props.trendColor,
2951
+ trendValue: props.trendValue,
2952
+ majorValue: props.majorValue,
2953
+ customizedBgColor: props.backgroundColor,
2954
+ trendDisplay: props.trendDisplay,
2955
+ defaultColors: defaultColors
2956
+ }); // todo: need change it to not depend on majorColor
2855
2957
 
2958
+ var underLabelColor = majorColor;
2959
+ return {
2960
+ backgroundColor: backgroundColor,
2961
+ backgroundEnabled: backgroundEnabled,
2962
+ majorColor: majorColor,
2963
+ trendColor: trendColor,
2964
+ underLabelColor: underLabelColor
2965
+ };
2966
+ };
2967
+ /**
2968
+ * Format and return the value (major/trend)
2969
+ * @method computeText
2970
+ * @param {Object} props
2971
+ * @param {Number} props.value // The major/trend value
2972
+ * @param {Number} props.numberPrecision
2973
+ * @param {Bool} props.shouldUseThousandSeparators
2974
+ * @param {Bool} props.shouldAbbreviateValue
2975
+ * @returns {Number} major or trend text
2976
+ */
2856
2977
 
2857
- circles.push(React.createElement("circle", {
2858
- "data-test": "progress-radial",
2859
- stroke: r.value,
2860
- fill: "transparent",
2861
- strokeWidth: strokeWidth,
2862
- strokeDasharray: "".concat(_progressWidth, " ").concat(circumference - _progressWidth),
2863
- style: {
2864
- strokeDashoffset: _offsetDistance
2865
- },
2866
- r: semicircleRadius,
2867
- cx: cx,
2868
- cy: cy,
2869
- key: "progress".concat(r.from)
2870
- }));
2871
- }
2978
+ var computeText = function computeText(_ref4) {
2979
+ var value = _ref4.value,
2980
+ numberPrecision = _ref4.numberPrecision,
2981
+ shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
2982
+ shouldAbbreviateValue = _ref4.shouldAbbreviateValue;
2983
+ var text = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(value) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["formatNumber"])(value, numberPrecision, {
2984
+ useThousandSeparators: shouldUseThousandSeparators,
2985
+ // todo: need update formatNumber
2986
+ useTrendUnits: shouldAbbreviateValue
2987
+ }) : value; // When text is undefined, return empty string
2872
2988
 
2873
- if (range <= i && (typeof majorValue !== 'number' || majorValue < r.to) && i < formattedGaugeRanges.length - 1) {
2874
- // width of stroke for each breakpoint dash
2875
- var breakpointWidth = 1; // opacity of the dash (15%)
2989
+ text = text || '';
2990
+ return text;
2991
+ };
2992
+ /*
2993
+ * @method getMajorText
2994
+ * @param {Object} props
2995
+ * @param {Number} props.majorValue
2996
+ * @param {Number} props.numberPrecision
2997
+ * @param {Bool} props.shouldUseThousandSeparators
2998
+ * @param {Bool} props.shouldAbbreviateMajorValue
2999
+ * @returns {String} majorText
3000
+ */
2876
3001
 
2877
- var breakpointOpacity = 0.15; // distance of stroke from right edge of circle
3002
+ var getMajorText = function getMajorText(_ref5) {
3003
+ var majorValue = _ref5.majorValue,
3004
+ numberPrecision = _ref5.numberPrecision,
3005
+ shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators,
3006
+ shouldAbbreviateMajorValue = _ref5.shouldAbbreviateMajorValue;
3007
+ return computeText({
3008
+ value: majorValue === null ? 'N/A' : majorValue,
3009
+ // if majorValue is null, use `N/A`.
3010
+ numberPrecision: numberPrecision,
3011
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
3012
+ shouldAbbreviateValue: shouldAbbreviateMajorValue
3013
+ });
3014
+ };
3015
+ /*
3016
+ * @method getTrendText
3017
+ * @param {Object} props
3018
+ * @param {Number} props.majorValue
3019
+ * @param {Number} props.trendValue
3020
+ * @param {String} props.trendDisplay
3021
+ * @param {Number} props.numberPrecision
3022
+ * @param {Bool} props.shouldUseThousandSeparators
3023
+ * @param {Bool} props.shouldAbbreviateTrendValue
3024
+ * @returns {String} trendText
3025
+ */
2878
3026
 
2879
- var _offsetDistance2 = (0, gaugeUtils_1.getProgressWidth)(maxValue - r.to, minValue, maxValue, circumference); // dashes at each gauge breakpoint after the major value
3027
+ var getTrendText = function getTrendText(_ref6) {
3028
+ var majorValue = _ref6.majorValue,
3029
+ trendValue = _ref6.trendValue,
3030
+ trendDisplay = _ref6.trendDisplay,
3031
+ numberPrecision = _ref6.numberPrecision,
3032
+ shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
3033
+ shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
2880
3034
 
3035
+ var compute = function compute(value) {
3036
+ return computeText({
3037
+ value: value,
3038
+ numberPrecision: numberPrecision,
3039
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
3040
+ shouldAbbreviateValue: shouldAbbreviateTrendValue
3041
+ });
3042
+ };
2881
3043
 
2882
- circles.push(React.createElement("circle", {
2883
- "data-test": "breakpoint-radial",
2884
- stroke: fontColor,
2885
- opacity: breakpointOpacity,
2886
- fill: "transparent",
2887
- strokeWidth: strokeWidth,
2888
- strokeDasharray: "".concat(breakpointWidth, " ").concat(circumference - breakpointWidth),
2889
- style: {
2890
- strokeDashoffset: _offsetDistance2
2891
- },
2892
- r: semicircleRadius,
2893
- cx: cx,
2894
- cy: cy,
2895
- key: "breakpoint".concat(r.from)
2896
- }));
2897
- }
3044
+ if (trendValue === '' || !Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue)) {
3045
+ return '';
3046
+ }
2898
3047
 
2899
- if (i < formattedGaugeRanges.length - 1) {
2900
- var toTheta = toRadians(180 - (0, displayUtils_1.getRadialProgress)(r.to - minValue, minValue, maxValue) / 100 * 180);
2901
- var labelX = cx + (semicircleEdgeRadius + labelSpace) * Math.cos(toTheta);
2902
- var labelY = cy - (semicircleEdgeRadius + labelSpace) * Math.sin(toTheta);
2903
- var labelWidth = (0, gaugeUtils_1.computeTextWidth)(String(r.to), labelFontSizeString);
2904
- var vertOffset = (0, gaugeUtils_1.getVerticalLabelOffset)(toDegrees(toTheta), labelFontSize, maxOffset);
2905
- labelY += vertOffset;
2906
-
2907
- if (r.to < (maxValue + minValue) / 2) {
2908
- labelX -= labelWidth + vertOffset / 3;
2909
- } else if (r.to === (maxValue + minValue) / 2) {
2910
- labelX -= labelWidth / 2;
2911
- } // labels of each gauge range, excluding min and max
2912
-
2913
-
2914
- labels.push(React.createElement("text", {
2915
- "data-test": "label",
2916
- fill: fontColor,
2917
- x: labelX,
2918
- y: labelY,
2919
- fontSize: labelFontSize,
2920
- key: "label".concat(r.from)
2921
- }, r.to));
2922
- } // width of stroke for each inner radial gauge range
2923
-
2924
-
2925
- var progressWidth = (0, gaugeUtils_1.getProgressWidth)(r.to - r.from, minValue, maxValue, innerCircumference); // distance of stroke from right edge of circle
2926
-
2927
- var offsetDistance = (0, gaugeUtils_1.getProgressWidth)(maxValue - r.from, minValue, maxValue, innerCircumference); // inner radial for all gauge ranges
2928
-
2929
- circles.push(React.createElement("circle", {
2930
- "data-test": "inner-radial",
2931
- stroke: r.value,
2932
- fill: "transparent",
2933
- strokeWidth: innerStrokeWidth,
2934
- strokeDasharray: "".concat(progressWidth, " ").concat(innerCircumference - progressWidth),
2935
- style: {
2936
- strokeDashoffset: offsetDistance
2937
- },
2938
- r: innerSemicircleRadius,
2939
- cx: cx,
2940
- cy: cy,
2941
- key: "inner".concat(r.from)
2942
- }));
2943
- }); // min label
3048
+ var showPercent = trendDisplay === 'percent';
2944
3049
 
2945
- labels.push(React.createElement("text", {
2946
- "data-test": "min-label",
2947
- fill: fontColor,
2948
- x: cx - semicircleEdgeRadius,
2949
- y: cy + labelFontSize,
2950
- fontSize: labelFontSize,
2951
- key: "min-label"
2952
- }, minValue)); // max label
3050
+ if (!showPercent) {
3051
+ return compute(trendValue);
3052
+ }
2953
3053
 
2954
- var maxLabelWidth = (0, gaugeUtils_1.computeTextWidth)(String(maxValue), labelFontSizeString);
2955
- labels.push(React.createElement("text", {
2956
- "data-test": "max-label",
2957
- fill: fontColor,
2958
- x: cx + semicircleEdgeRadius - maxLabelWidth,
2959
- y: cy + labelFontSize,
2960
- fontSize: labelFontSize,
2961
- key: "max-label"
2962
- }, maxValue)); // dash to indicate majorValue
3054
+ var diff = Math.abs(trendValue - majorValue);
3055
+ var val = Math.round(trendValue / diff * 100);
2963
3056
 
2964
- showMarker = typeof majorValue === 'number' && formattedGaugeRanges.length >= 1;
3057
+ if (trendValue === 0 && diff === 0) {
3058
+ val = 0;
3059
+ }
2965
3060
 
2966
- if (showMarker && majorValue > formattedGaugeRanges[0].from && majorValue <= formattedGaugeRanges[formattedGaugeRanges.length - 1].to) {
2967
- var progressWidth = (0, gaugeUtils_1.getProgressWidth)(maxValue - majorValue, minValue, maxValue, circumference);
2968
- var indicatorWidth = 1;
2969
- circles.push(React.createElement("circle", {
2970
- "data-test": "indicator-radial",
2971
- stroke: fontColor || '#FFFFFF',
2972
- fill: "transparent",
2973
- strokeWidth: strokeWidth,
2974
- strokeDasharray: "".concat(indicatorWidth, " ").concat(circumference - indicatorWidth),
2975
- style: {
2976
- strokeDashoffset: progressWidth
2977
- },
2978
- r: semicircleRadius,
2979
- cx: cx,
2980
- cy: cy,
2981
- key: "indicator"
2982
- }));
3061
+ if (!Number.isFinite(val)) {
3062
+ return 'N/A';
2983
3063
  }
2984
3064
 
2985
- return React.createElement("svg", {
2986
- height: height,
2987
- width: width,
2988
- "data-test": "radial-gauge-visualization"
2989
- }, React.createElement("g", null, React.createElement("circle", {
2990
- "data-test": "background-radial",
2991
- stroke: radialBackgroundColor,
2992
- fill: "transparent",
2993
- strokeWidth: strokeWidth,
2994
- strokeDasharray: "".concat(bgCircleOffset, " ").concat(circumference - bgCircleOffset),
2995
- style: {
2996
- strokeDashoffset: strokeDashoffset
2997
- },
2998
- r: semicircleRadius,
2999
- cx: cx,
3000
- cy: cy
3001
- }), circles, labels, showMarker && React.createElement("path", {
3002
- fill: fontColor,
3003
- d: d,
3004
- opacity: "100",
3005
- "data-z-index": "4",
3006
- "data-test": "marker"
3007
- })));
3065
+ var text = compute(val);
3066
+ return "".concat(text, "%");
3008
3067
  };
3068
+ /**
3069
+ * Helper to determine the font size for an element
3070
+ * @method computeFontSize
3071
+ * @param {String} text The string to find a size for
3072
+ * @param {Object} dimensions
3073
+ * @param {Number} dimensions.width The width of the container
3074
+ * @param {Number} dimensions.height The height of the container
3075
+ * @param {String} [fontFamily='"Splunk Platform Sans" ...'] The font being used
3076
+ * @param {String} [fontWeight='normal'] Boldness of font
3077
+ * @returns {Number} The size to use for fontSize styles
3078
+ */
3009
3079
 
3010
- GaugeGraph.propTypes = {
3011
- width: T.number,
3012
- height: T.number,
3013
- strokeWidth: T.number,
3014
- radialBackgroundColor: T.string,
3015
- formattedGaugeRanges: T.array,
3016
- majorValue: T.oneOfType([T.string, T.number]),
3017
- maxValue: T.number,
3018
- minValue: T.number,
3019
- showRadialGraph: T.bool
3080
+ var computeFontSize = function computeFontSize(text, _ref7) {
3081
+ var width = _ref7.width,
3082
+ height = _ref7.height;
3083
+ var fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FONT_FAMILY;
3084
+ var fontWeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'normal';
3085
+ var widthInDefaultFont = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(DEFAULT_FONT, "px ").concat(fontFamily));
3086
+ var fontSize = Math.min(width / widthInDefaultFont * DEFAULT_FONT, height / DEFAULT_FONT * DEFAULT_FONT);
3087
+ return parseInt(fontSize, 10);
3020
3088
  };
3021
- GaugeGraph.defaultProps = {
3022
- strokeWidth: 12,
3023
- formattedGaugeRanges: [],
3024
- majorValue: 'N/A'
3089
+ /*
3090
+ * @method getMajorFontSize
3091
+ * @param {Object} props
3092
+ * @param {Number} props.width
3093
+ * @param {Number} props.height
3094
+ * @param {String} props.unit
3095
+ * @param {String} props.majorText
3096
+ * @param {Number} props.spaceRatio
3097
+ * @returns {Number} majorFontSize
3098
+ */
3099
+
3100
+ var getMajorFontSize = function getMajorFontSize(_ref8) {
3101
+ var width = _ref8.width,
3102
+ height = _ref8.height,
3103
+ unit = _ref8.unit,
3104
+ majorText = _ref8.majorText,
3105
+ _ref8$spaceRatio = _ref8.spaceRatio,
3106
+ spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
3107
+ var majorTextCalc = unit ? "".concat(unit).concat(majorText) : majorText;
3108
+ return computeFontSize(majorTextCalc, {
3109
+ width: width * spaceRatio,
3110
+ height: height
3111
+ });
3025
3112
  };
3026
- exports.default = GaugeGraph;
3113
+ /*
3114
+ * @method getTrendFontSize
3115
+ * @param {Object} props
3116
+ * @param {Number} props.width
3117
+ * @param {Number} props.height
3118
+ * @param {String} props.trendText
3119
+ * @param {Number} props.spaceRatio
3120
+ * @returns {Number} trendFontSize
3121
+ */
3027
3122
 
3028
- /***/ }),
3123
+ var getTrendFontSize = function getTrendFontSize(_ref9) {
3124
+ var width = _ref9.width,
3125
+ height = _ref9.height,
3126
+ trendText = _ref9.trendText,
3127
+ _ref9$spaceRatio = _ref9.spaceRatio,
3128
+ spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
3129
+ var trendFontSize = 12;
3029
3130
 
3030
- /***/ 2:
3031
- /***/ (function(module, exports) {
3131
+ if (spaceRatio > 0) {
3132
+ trendFontSize = computeFontSize(trendText, {
3133
+ width: width * spaceRatio,
3134
+ height: height
3135
+ });
3136
+ trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;
3137
+ }
3032
3138
 
3033
- module.exports = require("@splunk/ui-utils/i18n");
3139
+ return trendFontSize;
3140
+ };
3141
+ /*
3142
+ * The height of underLabel should no more than 12px
3143
+ * @param {Number} height
3144
+ * @return {Number} height || DEFAULT_FONT
3145
+ */
3034
3146
 
3035
- /***/ }),
3147
+ var getUnderLabelHeight = function getUnderLabelHeight(height) {
3148
+ return height > DEFAULT_FONT ? DEFAULT_FONT : height;
3149
+ };
3150
+ /*
3151
+ * @param {Object} config
3152
+ * @param {String} underLabel
3153
+ * @param {Number} width width of underLabel
3154
+ * @param {Number} height height of underLabel
3155
+ * @param {Number} fond size of underLabel
3156
+ */
3036
3157
 
3037
- /***/ 20:
3038
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3158
+ var getUnderLabel = function getUnderLabel(_ref10) {
3159
+ var underLabel = _ref10.underLabel,
3160
+ width = _ref10.width,
3161
+ height = _ref10.height;
3162
+ return (// todo: may need truncate underLabel later
3163
+ computeFontSize(underLabel, {
3164
+ width: width,
3165
+ height: height
3166
+ })
3167
+ );
3168
+ };
3169
+ /**
3170
+ * Compute value and font size for major and trend
3171
+ * @method getMajorAndTrend
3172
+ * @param {Object} props
3173
+ * @param {Number} props.width // Width of the text container
3174
+ * @param {Number} props.height // Height of the text container
3175
+ * @param {Number} props.majorValue // Major value
3176
+ * @param {Number} props.trendValue // Trend value
3177
+ * @param {Number} props.majorFontSize
3178
+ * @param {Number} props.trendFontSize
3179
+ * @param {String} props.trendDisplay
3180
+ * @param {String} props.unit // Unit for the value
3181
+ * @param {Number} props.numberPrecision
3182
+ * @param {Bool} props.shouldUseThousandSeparators
3183
+ * @param {Bool} props.shouldAbbreviateTrendValue
3184
+ * @param {Bool} props.shouldAbbreviateMajorValue
3185
+ * @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size
3186
+ */
3039
3187
 
3040
- "use strict";
3041
- __webpack_require__.r(__webpack_exports__);
3042
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_FONT", function() { return DEFAULT_FONT; });
3043
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_FONT_FAMILY", function() { return DEFAULT_FONT_FAMILY; });
3044
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SVR_PADDING", function() { return SVR_PADDING; });
3045
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAligment", function() { return getAligment; });
3046
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shouldShowTrend", function() { return shouldShowTrend; });
3047
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isLoadingOrNoColumns", function() { return isLoadingOrNoColumns; });
3048
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFormattedColor", function() { return getFormattedColor; });
3049
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasBackground", function() { return hasBackground; });
3050
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIdenticalColor", function() { return isIdenticalColor; });
3051
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultColorWithBg", function() { return getDefaultColorWithBg; });
3052
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorColor", function() { return getMajorColor; });
3053
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrendColor", function() { return getTrendColor; });
3054
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeColors", function() { return computeColors; });
3055
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeText", function() { return computeText; });
3056
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorText", function() { return getMajorText; });
3057
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrendText", function() { return getTrendText; });
3058
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeFontSize", function() { return computeFontSize; });
3059
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorFontSize", function() { return getMajorFontSize; });
3060
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrendFontSize", function() { return getTrendFontSize; });
3061
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUnderLabelHeight", function() { return getUnderLabelHeight; });
3062
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUnderLabel", function() { return getUnderLabel; });
3063
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorAndTrend", function() { return getMajorAndTrend; });
3064
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateVizInSmallSpace", function() { return updateVizInSmallSpace; });
3065
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeSingleValueContent", function() { return computeSingleValueContent; });
3066
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "minimallyTruncateStringToWidth", function() { return minimallyTruncateStringToWidth; });
3067
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeSingleValueRadialContent", function() { return computeSingleValueRadialContent; });
3068
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getGraphColors", function() { return getGraphColors; });
3069
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjustRGB", function() { return adjustRGB; });
3070
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lighten", function() { return lighten; });
3071
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "darken", function() { return darken; });
3072
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "handleValueClickCallback", function() { return handleValueClickCallback; });
3073
- /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13);
3074
- /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
3075
- /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
3076
- /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);
3077
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11);
3078
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__);
3079
- /* harmony import */ var _splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74);
3080
- /* harmony import */ var _splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__);
3081
- /* harmony import */ var _splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(36);
3082
- /* harmony import */ var _splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__);
3083
- /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(70);
3084
- /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__);
3188
+ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
3189
+ var width = _ref11.width,
3190
+ height = _ref11.height,
3191
+ majorValue = _ref11.majorValue,
3192
+ trendValue = _ref11.trendValue,
3193
+ majorFontSize = _ref11.majorFontSize,
3194
+ trendFontSize = _ref11.trendFontSize,
3195
+ trendDisplay = _ref11.trendDisplay,
3196
+ unit = _ref11.unit,
3197
+ numberPrecision = _ref11.numberPrecision,
3198
+ shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
3199
+ shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue,
3200
+ shouldAbbreviateMajorValue = _ref11.shouldAbbreviateMajorValue;
3201
+ var majorTextSpaceRatio = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;
3202
+ var textContentWidth = width * 0.9;
3203
+ var textContentHeight = height * 0.9;
3204
+ var majorText = getMajorText({
3205
+ majorValue: majorValue,
3206
+ numberPrecision: numberPrecision,
3207
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
3208
+ shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
3209
+ });
3210
+ var majorTextFontSize = majorFontSize || getMajorFontSize({
3211
+ width: textContentWidth,
3212
+ height: textContentHeight,
3213
+ unit: unit,
3214
+ majorText: majorText,
3215
+ spaceRatio: majorTextSpaceRatio
3216
+ });
3217
+ var trendText = getTrendText({
3218
+ majorValue: majorValue,
3219
+ trendValue: trendValue,
3220
+ trendDisplay: trendDisplay,
3221
+ numberPrecision: numberPrecision,
3222
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
3223
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3224
+ });
3225
+ var trendTextFontSize = trendFontSize || getTrendFontSize({
3226
+ width: textContentWidth,
3227
+ height: textContentHeight,
3228
+ trendText: trendText,
3229
+ spaceRatio: 1 - majorTextSpaceRatio
3230
+ });
3231
+ return {
3232
+ majorText: majorText,
3233
+ majorTextFontSize: majorTextFontSize,
3234
+ trendText: trendText,
3235
+ trendTextFontSize: trendTextFontSize
3236
+ };
3237
+ };
3238
+ /*
3239
+ * @method updateVizInSmallSpace
3240
+ * @param {Object} props
3241
+ * @param {Number} props.width // Width of the text container
3242
+ * @param {Number} props.height // Height of the text container
3243
+ * @param {Object} props.toRemoveList
3244
+ * @param {Number} props.majorValue // Major value
3245
+ * @param {Number} props.trendValue // Trend value
3246
+ * @param {Number} props.majorFontSize
3247
+ * @param {Number} props.trendFontSize
3248
+ * @param {Number} props.majorTextFontSize
3249
+ * @param {String} props.unit // Unit for the value
3250
+ * @param {Number} props.numberPrecision
3251
+ * @param {Bool} props.shouldUseThousandSeparators
3252
+ * @param {Bool} props.shouldAbbreviateTrendValue
3253
+ * @returns {Object} results
3254
+ * @returns {Object} results.newMajorAndTrend
3255
+ * @returns {Object} results.updatedProps
3256
+ */
3257
+
3258
+ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
3259
+ var width = _ref12.width,
3260
+ height = _ref12.height,
3261
+ toRemoveList = _ref12.toRemoveList,
3262
+ majorValue = _ref12.majorValue,
3263
+ trendValue = _ref12.trendValue,
3264
+ majorFontSize = _ref12.majorFontSize,
3265
+ trendFontSize = _ref12.trendFontSize,
3266
+ majorTextFontSize = _ref12.majorTextFontSize,
3267
+ unit = _ref12.unit,
3268
+ numberPrecision = _ref12.numberPrecision,
3269
+ shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
3270
+ shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
3271
+ var removeIndex = 0;
3272
+ var newProps = {}; // options need to be updated
3273
+
3274
+ var newMajorAndTrend = {};
3275
+ var newTextSize = majorTextFontSize; // remove info on viz to make textFontSize >= 12px;
3276
+
3277
+ while (newTextSize < 12 && removeIndex < toRemoveList.length) {
3278
+ var toRemove = toRemoveList[removeIndex];
3279
+ newProps = _objectSpread(_objectSpread({}, newProps), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, toRemove.key, toRemove.value));
3280
+ newMajorAndTrend = getMajorAndTrend(_objectSpread({
3281
+ majorValue: majorValue,
3282
+ trendValue: trendValue,
3283
+ majorFontSize: majorFontSize,
3284
+ trendFontSize: trendFontSize,
3285
+ width: width,
3286
+ height: height,
3287
+ unit: unit,
3288
+ numberPrecision: numberPrecision,
3289
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
3290
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3291
+ }, newProps));
3292
+ newTextSize = newMajorAndTrend.majorTextFontSize;
3293
+ removeIndex += 1;
3294
+ } // truncate text if textFontSize is still less than 12
3295
+
3296
+
3297
+ if (newTextSize < 12) {
3298
+ var truncateValue = "".concat(majorValue.toString().slice(0, 3), "...");
3299
+ newMajorAndTrend = getMajorAndTrend(_objectSpread({
3300
+ majorValue: truncateValue,
3301
+ trendValue: trendValue,
3302
+ majorFontSize: majorFontSize,
3303
+ trendFontSize: trendFontSize,
3304
+ width: width,
3305
+ height: height,
3306
+ unit: unit,
3307
+ numberPrecision: numberPrecision,
3308
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
3309
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3310
+ }, newProps));
3311
+ }
3312
+
3313
+ return {
3314
+ newMajorAndTrend: newMajorAndTrend,
3315
+ updatedProps: newProps
3316
+ };
3317
+ };
3318
+ /*
3319
+ * @method computeSingleValueContent
3320
+ * @param {Object} props
3321
+ * @param {Number} props.contentWidth
3322
+ * @param {Number} props.contentHeight
3323
+ * @param {Number} props.containerWidth
3324
+ * @param {Number} props.containerHeight
3325
+ * @param {Number} props.majorValue // Major value
3326
+ * @param {Number} props.trendValue // Trend value
3327
+ * @param {Number} props.majorFontSize
3328
+ * @param {Number} props.trendFontSize
3329
+ * @param {String} props.trendDisplay
3330
+ * @param {String} props.unit // Unit for the value
3331
+ * @param {Number} props.numberPrecision
3332
+ * @param {Bool} props.shouldUseThousandSeparators
3333
+ * @param {Bool} props.shouldAbbreviateTrendValue
3334
+ * @param {Bool} props.shouldAbbreviateMajorValue
3335
+ * @param {Object} props.toRemoveList
3336
+ * @returns {Object} results
3337
+ * @returns {String} results.majorText
3338
+ * @returns {String} results.trendText
3339
+ * @returns {Number} results.majorTextFontSize
3340
+ * @returns {Number} results.trendTextFontSize
3341
+ * @returns {String} results.majorValueTitle
3342
+ * @returns {Object} results.smallVizProps
3343
+ */
3344
+
3345
+ var computeSingleValueContent = function computeSingleValueContent(_ref13) {
3346
+ var contentWidth = _ref13.contentWidth,
3347
+ contentHeight = _ref13.contentHeight,
3348
+ containerWidth = _ref13.containerWidth,
3349
+ containerHeight = _ref13.containerHeight,
3350
+ majorValue = _ref13.majorValue,
3351
+ trendValue = _ref13.trendValue,
3352
+ majorFontSize = _ref13.majorFontSize,
3353
+ trendFontSize = _ref13.trendFontSize,
3354
+ trendDisplay = _ref13.trendDisplay,
3355
+ unit = _ref13.unit,
3356
+ numberPrecision = _ref13.numberPrecision,
3357
+ shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
3358
+ shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
3359
+ shouldAbbreviateMajorValue = _ref13.shouldAbbreviateMajorValue,
3360
+ toRemoveList = _ref13.toRemoveList;
3361
+
3362
+ var _getMajorAndTrend = getMajorAndTrend({
3363
+ majorValue: majorValue,
3364
+ trendValue: trendValue,
3365
+ majorFontSize: majorFontSize,
3366
+ trendFontSize: trendFontSize,
3367
+ trendDisplay: trendDisplay,
3368
+ width: contentWidth,
3369
+ height: contentHeight,
3370
+ unit: unit,
3371
+ numberPrecision: numberPrecision,
3372
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
3373
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
3374
+ shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
3375
+ }),
3376
+ majorText = _getMajorAndTrend.majorText,
3377
+ trendText = _getMajorAndTrend.trendText,
3378
+ majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
3379
+ trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
3380
+
3381
+ var majorValueTitle = majorText;
3382
+ var smallVizProps = {}; // update viz in small space
3383
+ // if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
3384
+ // or truncate major value to make the major font size >= 12
3385
+
3386
+ if (majorTextFontSize < 12) {
3387
+ var _updateVizInSmallSpac = updateVizInSmallSpace({
3388
+ width: containerWidth,
3389
+ height: containerHeight,
3390
+ toRemoveList: toRemoveList,
3391
+ majorValue: majorValue,
3392
+ trendValue: trendValue,
3393
+ majorFontSize: majorFontSize,
3394
+ trendFontSize: trendFontSize,
3395
+ majorTextFontSize: majorTextFontSize,
3396
+ unit: unit,
3397
+ numberPrecision: numberPrecision,
3398
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
3399
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3400
+ }),
3401
+ newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
3402
+ updatedProps = _updateVizInSmallSpac.updatedProps;
3403
+
3404
+ majorText = newMajorAndTrend.majorText;
3405
+ trendText = newMajorAndTrend.trendText;
3406
+ majorTextFontSize = newMajorAndTrend.majorTextFontSize;
3407
+ trendTextFontSize = newMajorAndTrend.trendTextFontSize;
3408
+ smallVizProps = updatedProps;
3409
+ }
3410
+
3411
+ return {
3412
+ majorText: majorText,
3413
+ trendText: trendText,
3414
+ majorTextFontSize: majorTextFontSize,
3415
+ trendTextFontSize: trendTextFontSize,
3416
+ majorValueTitle: majorValueTitle,
3417
+ smallVizProps: smallVizProps
3418
+ };
3419
+ };
3420
+ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_ref14) {
3421
+ var text = _ref14.text,
3422
+ _ref14$fontSize = _ref14.fontSize,
3423
+ fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
3424
+ _ref14$fontFamily = _ref14.fontFamily,
3425
+ fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
3426
+ _ref14$fontWeight = _ref14.fontWeight,
3427
+ fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
3428
+ containerWidth = _ref14.containerWidth;
3429
+ var textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
3430
+ var modifiedText = text;
3431
+ var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily)); // `containerWidth - ellipsesLength > 0` condition ensures space even exists for text.
3085
3432
 
3433
+ if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {
3434
+ // Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.
3435
+ // `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.
3436
+ // `text.length > 1` condition included to keep at least the first number.
3437
+ while (textWidth + ellipsesLength > containerWidth && modifiedText.length > 1) {
3438
+ modifiedText = modifiedText.substring(0, modifiedText.length - 1);
3439
+ textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(modifiedText, "normal ".concat(fontSize, "px ").concat(fontFamily));
3440
+ }
3441
+
3442
+ modifiedText = "".concat(modifiedText, "...");
3443
+ }
3444
+
3445
+ return modifiedText;
3446
+ };
3447
+ /*
3448
+ * @method computeSingleValueRadialContent
3449
+ * @param {Object} props
3450
+ * @param {Number} props.contentWidth
3451
+ * @param {Number} props.contentHeight
3452
+ * @param {Number} props.containerWidth
3453
+ * @param {Number} props.containerHeight
3454
+ * @param {Number} props.majorValue // Major value
3455
+ * @param {Number} props.trendValue // Trend value
3456
+ * @param {Number} props.majorFontSize
3457
+ * @param {Number} props.trendFontSize
3458
+ * @param {String} props.trendDisplay
3459
+ * @param {String} props.unit // Unit for the value
3460
+ * @param {Number} props.numberPrecision
3461
+ * @param {Bool} props.shouldUseThousandSeparators
3462
+ * @param {Bool} props.shouldAbbreviateTrendValue
3463
+ * @param {Bool} props.shouldAbbreviateMajorValue,
3464
+ * @param {Object} props.toRemoveList
3465
+ * @param {Bool} props.smallViz
3466
+ * @returns {Object} results
3467
+ * @returns {String} results.majorText
3468
+ * @returns {String} results.trendText
3469
+ * @returns {Number} results.majorTextFontSize
3470
+ * @returns {Number} results.trendTextFontSize
3471
+ * @returns {String} results.majorValueTitle
3472
+ * @returns {Object} results.smallVizProps
3473
+ */
3474
+
3475
+ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_ref15) {
3476
+ var contentWidth = _ref15.contentWidth,
3477
+ contentHeight = _ref15.contentHeight,
3478
+ containerWidth = _ref15.containerWidth,
3479
+ containerHeight = _ref15.containerHeight,
3480
+ majorValue = _ref15.majorValue,
3481
+ trendValue = _ref15.trendValue,
3482
+ majorFontSize = _ref15.majorFontSize,
3483
+ trendFontSize = _ref15.trendFontSize,
3484
+ trendDisplay = _ref15.trendDisplay,
3485
+ unit = _ref15.unit,
3486
+ numberPrecision = _ref15.numberPrecision,
3487
+ shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
3488
+ shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
3489
+ shouldAbbreviateMajorValue = _ref15.shouldAbbreviateMajorValue,
3490
+ smallViz = _ref15.smallViz;
3491
+
3492
+ var _getMajorAndTrend2 = getMajorAndTrend({
3493
+ majorValue: majorValue,
3494
+ trendValue: trendValue,
3495
+ majorFontSize: majorFontSize,
3496
+ trendFontSize: trendFontSize,
3497
+ trendDisplay: trendDisplay,
3498
+ width: contentWidth,
3499
+ height: contentHeight,
3500
+ unit: unit,
3501
+ numberPrecision: numberPrecision,
3502
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
3503
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
3504
+ shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
3505
+ }),
3506
+ majorText = _getMajorAndTrend2.majorText,
3507
+ trendText = _getMajorAndTrend2.trendText,
3508
+ majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
3509
+ trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
3086
3510
 
3087
- function ownKeys(object, enumerableOnly) {
3088
- var keys = Object.keys(object);
3511
+ var majorValueTitle = majorText;
3512
+ var smallVizProps = {}; // custom logic for viz in small space
3513
+ // if not showing the radial graph (if `smallViz` is true), then compute truncated major value
3514
+ // and font sizes
3089
3515
 
3090
- if (Object.getOwnPropertySymbols) {
3091
- var symbols = Object.getOwnPropertySymbols(object);
3092
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
3093
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3516
+ if (smallViz) {
3517
+ var truncateValue = minimallyTruncateStringToWidth({
3518
+ text: majorValue,
3519
+ fontWeight: 'bold',
3520
+ fontSize: 12,
3521
+ containerWidth: containerWidth
3094
3522
  });
3095
- keys.push.apply(keys, symbols);
3096
- }
3097
-
3098
- return keys;
3099
- }
3100
3523
 
3101
- function _objectSpread(target) {
3102
- for (var i = 1; i < arguments.length; i++) {
3103
- var source = arguments[i] != null ? arguments[i] : {};
3524
+ var _getMajorAndTrend3 = getMajorAndTrend({
3525
+ majorValue: truncateValue,
3526
+ trendValue: trendValue,
3527
+ majorFontSize: majorFontSize,
3528
+ trendFontSize: trendFontSize,
3529
+ width: containerWidth,
3530
+ height: containerHeight,
3531
+ unit: unit,
3532
+ trendDisplay: trendDisplay,
3533
+ numberPrecision: numberPrecision,
3534
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
3535
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
3536
+ shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
3537
+ });
3104
3538
 
3105
- if (i % 2) {
3106
- ownKeys(Object(source), true).forEach(function (key) {
3107
- _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
3108
- });
3109
- } else if (Object.getOwnPropertyDescriptors) {
3110
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3111
- } else {
3112
- ownKeys(Object(source)).forEach(function (key) {
3113
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3114
- });
3115
- }
3539
+ majorText = _getMajorAndTrend3.majorText;
3540
+ trendText = _getMajorAndTrend3.trendText;
3541
+ majorTextFontSize = _getMajorAndTrend3.majorTextFontSize;
3542
+ trendTextFontSize = _getMajorAndTrend3.trendTextFontSize;
3543
+ smallVizProps = {
3544
+ trendDisplay: trendDisplay,
3545
+ unit: unit
3546
+ };
3116
3547
  }
3117
3548
 
3118
- return target;
3119
- }
3120
-
3121
-
3122
-
3123
-
3124
-
3125
-
3126
- var DEFAULT_FONT = 12;
3127
- var DEFAULT_FONT_FAMILY = '"Splunk Platform Sans", "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif';
3128
- var SVR_PADDING = {
3129
- top: 12,
3130
- bottom: 12,
3131
- left: 16,
3132
- right: 16
3133
- };
3134
- var getAligment = function getAligment(align) {
3135
- var alignMap = {
3136
- left: 'start',
3137
- center: 'center',
3138
- right: 'end'
3549
+ return {
3550
+ majorText: majorText,
3551
+ trendText: trendText,
3552
+ majorTextFontSize: majorTextFontSize,
3553
+ trendTextFontSize: trendTextFontSize,
3554
+ majorValueTitle: majorValueTitle,
3555
+ smallVizProps: smallVizProps
3139
3556
  };
3140
- return alignMap[align] || 'center';
3141
- };
3142
- /**
3143
- * @method shouldShowTrend
3144
- * @param {String} trendDisplay
3145
- * @returns {Bool}
3146
- */
3147
-
3148
- var shouldShowTrend = function shouldShowTrend(trendDisplay) {
3149
- return trendDisplay === 'absolute' || trendDisplay === 'percent';
3150
3557
  };
3151
3558
  /**
3152
- * @method isLoadingOrNoColumns
3153
- * @param {Object} dataSources
3154
- * @param {Boolean} loading
3155
- * @returns {Boolean} return true if loading or without columns in dataSources
3559
+ * Get the colors for a graph
3560
+ *
3561
+ * @method getGraphColors
3562
+ * @param {Object} options
3563
+ * @param {Bool} options.backgroundEnabled // Flag to turn on color mode
3564
+ * @param {String} options.backgroundColor // The current background color, overrides trend background color
3565
+ * @param {Object} options.defaultColors // Default colors by severity
3566
+ * @param {Function} options.customColorFormatter // must return { background, stroke } given a color
3567
+ * @returns {Object} { background, stroke } colors
3568
+ * @private
3156
3569
  */
3157
3570
 
3158
- var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
3159
- var data = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["get"])(dataSources, 'primary.data.columns[0]', undefined);
3160
- var noColumns = data === undefined;
3161
- return loading || noColumns;
3162
- };
3163
- /**
3164
- * Retrieve the valid formatted color
3165
- * @method getFormattedColor
3166
- * @param {String} color
3167
- * @param {String} defaultColor
3168
- * @returns {String} the formatted color
3169
- */
3571
+ var getGraphColors = function getGraphColors(_ref16) {
3572
+ var backgroundEnabled = _ref16.backgroundEnabled,
3573
+ backgroundColor = _ref16.backgroundColor,
3574
+ defaultColors = _ref16.defaultColors,
3575
+ customColorFormatter = _ref16.customColorFormatter; // Only do custom colors in block mode
3170
3576
 
3171
- var getFormattedColor = function getFormattedColor(color, defaultColor) {
3172
- return Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(color) || Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(defaultColor);
3173
- };
3174
- /**
3175
- * Determines if there is a background color
3176
- * @method hasBackground
3177
- * @param {String} backgroundColor
3178
- * @returns true for non-transparent background color
3179
- */
3577
+ if (backgroundEnabled) {
3578
+ // Check if the user defined colors to use
3579
+ if (backgroundColor && typeof customColorFormatter === 'function') {
3580
+ return customColorFormatter(backgroundColor);
3581
+ }
3582
+ }
3180
3583
 
3181
- var hasBackground = function hasBackground(backgroundColor) {
3182
- return !!backgroundColor && backgroundColor !== 'transparent';
3584
+ return defaultColors.none;
3183
3585
  };
3184
3586
  /**
3185
- * @method isIdenticalColor
3186
- * @param {String} colorA
3187
- * @param {String} colorB
3188
- * @returns {Boolean}
3189
- */
3190
-
3191
- var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
3192
- return !!colorA && !!colorB && Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(colorA.toLowerCase()) === Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(colorB.toLowerCase());
3193
- };
3194
- /*
3195
- * @method getDefaultColorWithBg
3196
- * @param {Object} props
3197
- * @param {String} props.backgroundColor
3198
- * @param {String} props.defaultFontColor
3199
- * @param {String} props.defaultBlockFontColor
3200
- * @returns {String} defaultColor
3201
- */
3202
-
3203
- var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
3204
- var backgroundColor = _ref.backgroundColor,
3205
- defaultFontColor = _ref.defaultFontColor,
3206
- defaultBlockFontColor = _ref.defaultBlockFontColor;
3207
- return isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;
3208
- };
3209
- /*
3210
- * @method getMajorColor
3211
- * return formatted majorColor.
3212
- * @param {Object} props
3213
- * @param {String} props.majorColor
3214
- * @param {String} props.backgroundColor
3215
- * @param {String} props.defaultFontColor
3216
- * @param {String} props.defaultBlockFontColor
3217
- * @returns {String} majorColor
3587
+ * Adjust rgb value if it equals to 0 or 255
3588
+ * @method adjustRGB
3589
+ * @param {Number} rgb [0 - 255]
3590
+ * @param {Number} delta
3591
+ * @returns {Number} adjusted rgb
3592
+ * @private
3218
3593
  */
3219
3594
 
3220
- var getMajorColor = function getMajorColor(_ref2) {
3221
- var majorColor = _ref2.majorColor,
3222
- backgroundColor = _ref2.backgroundColor,
3223
- defaultFontColor = _ref2.defaultFontColor,
3224
- defaultBlockFontColor = _ref2.defaultBlockFontColor; // If backgroundColor is set, but no majorColor,
3225
- // the default majorColor will turn to be defaultBlockFontColor.
3226
- // eg: major color will turn to be white in enterprise mode.
3227
- // however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.
3595
+ var adjustRGB = function adjustRGB(rgb, delta) {
3596
+ if (rgb === 255) {
3597
+ return rgb - delta;
3598
+ }
3228
3599
 
3229
- if (hasBackground(backgroundColor) && !majorColor) {
3230
- return getDefaultColorWithBg({
3231
- backgroundColor: backgroundColor,
3232
- defaultFontColor: defaultFontColor,
3233
- defaultBlockFontColor: defaultBlockFontColor
3234
- });
3600
+ if (rgb === 0) {
3601
+ return rgb + delta;
3235
3602
  }
3236
3603
 
3237
- return getFormattedColor(majorColor, defaultFontColor);
3604
+ return rgb;
3238
3605
  };
3239
3606
  /**
3240
- * Get the color for the trend components
3241
- * @method getTrendColor
3242
- * @param {Object} props
3243
- * @param {String} props.trendColor The trendColor value determined from encoding
3244
- * @param {Number} props.trendValue
3245
- * @param {Number} props.majorValue
3246
- * @param {String} props.customizedBgColor
3247
- * @param {String} props.trendDisplay absolute || percent || off
3248
- * @param {Object} defaultColors
3249
- * @returns {String} trendColor
3607
+ * Modifies colors by multiplying by a given ratio
3608
+ * @method changeColor
3609
+ * @param {String} color // Color to modify
3610
+ * @param {Number} ratio // Float to modify color
3611
+ * @returns {String} new color
3612
+ * @private
3250
3613
  */
3251
3614
 
3252
- var getTrendColor = function getTrendColor(_ref3) {
3253
- var trendColor = _ref3.trendColor,
3254
- trendValue = _ref3.trendValue,
3255
- majorValue = _ref3.majorValue,
3256
- customizedBgColor = _ref3.customizedBgColor,
3257
- trendDisplay = _ref3.trendDisplay,
3258
- defaultColors = _ref3.defaultColors;
3259
-
3260
- if (trendColor) {
3261
- return trendColor;
3262
- }
3263
-
3264
- if (Number.isNaN(Number(trendValue))) {
3265
- return undefined;
3266
- }
3267
-
3268
- var defaultFontColor = defaultColors.defaultFontColor,
3269
- defaultBlockFontColor = defaultColors.defaultBlockFontColor,
3270
- defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
3271
-
3272
- if (hasBackground(customizedBgColor) && !isIdenticalColor(customizedBgColor, defaultBackgroundColor) && !isIdenticalColor(customizedBgColor, defaultBlockFontColor)) {
3273
- return defaultBlockFontColor;
3274
- } // if trendDisplay is percent, and trendValue === value
3275
- // the trend percent = trendValue / (value - trendValue) will return Infinity
3276
-
3615
+ var changeColor = function changeColor(color, ratio) {
3616
+ var hex = color.replace(/(0x|#)/, '');
3617
+ var r = parseInt(hex.substr(0, 2), 16);
3618
+ var g = parseInt(hex.substr(2, 2), 16);
3619
+ var b = parseInt(hex.substr(4, 2), 16); // Multiply by given ratio, make sure is between 0 and 255;
3277
3620
 
3278
- var isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);
3621
+ var newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);
3622
+ var newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);
3623
+ var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0); // If the color is not changed
3624
+ // case 1: the color is (0, 0 0)
3625
+ // lighten color (80, 80, 80)
3626
+ // darken color (40, 40, 40)
3627
+ // case 2: the color is (255, 255, 255)
3628
+ // lighten color (235, 235, 235)
3629
+ // darken color (175, 175, 175)
3630
+ // case 3: the color is e.g. (0, 255, 0)
3631
+ // new color (20, 235, 20)
3279
3632
 
3280
- if (trendValue === 0 || isInvalidTrend) {
3281
- return defaultFontColor;
3633
+ if (newR === r && newG === g && newB === b) {
3634
+ if (newR === 0 && newG === 0 && newB === 0) {
3635
+ if (ratio > 1) {
3636
+ newR = adjustRGB(newR, 80);
3637
+ newG = adjustRGB(newG, 80);
3638
+ newB = adjustRGB(newB, 80);
3639
+ } else {
3640
+ newR = adjustRGB(newR, 40);
3641
+ newG = adjustRGB(newG, 40);
3642
+ newB = adjustRGB(newB, 40);
3643
+ }
3644
+ } else if (newR === 255 && newG === 255 && newB === 255) {
3645
+ if (ratio > 1) {
3646
+ newR = adjustRGB(newR, 20);
3647
+ newG = adjustRGB(newG, 20);
3648
+ newB = adjustRGB(newB, 20);
3649
+ } else {
3650
+ newR = adjustRGB(newR, 80);
3651
+ newG = adjustRGB(newG, 80);
3652
+ newB = adjustRGB(newB, 80);
3653
+ }
3654
+ } else {
3655
+ newR = adjustRGB(newR, 20);
3656
+ newG = adjustRGB(newG, 20);
3657
+ newB = adjustRGB(newB, 20);
3658
+ }
3282
3659
  }
3283
3660
 
3284
- return trendValue > 0 ? _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_GREEN"] : _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_RED"];
3661
+ return "#".concat(newR.toString(16).padStart(2, 0)) + "".concat(newG.toString(16).padStart(2, 0)) + "".concat(newB.toString(16).padStart(2, 0));
3285
3662
  };
3286
3663
  /**
3287
- * Computes visualization properties for display component
3288
- * @method computeColors
3289
- * @param {Object} props all viz props
3290
- * @param {Object} defaultColors defaultColors from theme
3291
- * @returns {Object} result
3292
- * @returns {Boolean} backgroundEnabled
3293
- * @returns {String} backgroundColor
3294
- * @returns {String} majorColor
3295
- * @returns {String} trendColor
3296
- * @returns {String} underLabelColor
3664
+ * Lighten a given color
3665
+ * @method lighten
3666
+ * @param {String} color
3667
+ * @returns {String}
3668
+ * @private
3297
3669
  */
3298
3670
 
3299
- var computeColors = function computeColors(props, defaultColors) {
3300
- var backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);
3301
- var backgroundEnabled = hasBackground(backgroundColor);
3302
- var majorColor = getMajorColor({
3303
- majorColor: props.majorColor,
3304
- backgroundColor: backgroundColor,
3305
- defaultFontColor: defaultColors.defaultFontColor,
3306
- defaultBlockFontColor: defaultColors.defaultBlockFontColor
3307
- });
3308
- var trendColor = getTrendColor({
3309
- trendColor: props.trendColor,
3310
- trendValue: props.trendValue,
3311
- majorValue: props.majorValue,
3312
- customizedBgColor: props.backgroundColor,
3313
- trendDisplay: props.trendDisplay,
3314
- defaultColors: defaultColors
3315
- }); // todo: need change it to not depend on majorColor
3316
3671
 
3317
- var underLabelColor = majorColor;
3318
- return {
3319
- backgroundColor: backgroundColor,
3320
- backgroundEnabled: backgroundEnabled,
3321
- majorColor: majorColor,
3322
- trendColor: trendColor,
3323
- underLabelColor: underLabelColor
3324
- };
3672
+ var lighten = function lighten(color) {
3673
+ return changeColor(color, 1.3);
3325
3674
  };
3326
3675
  /**
3327
- * Format and return the value (major/trend)
3328
- * @method computeText
3329
- * @param {Object} props
3330
- * @param {Number} props.value // The major/trend value
3331
- * @param {Number} props.numberPrecision
3332
- * @param {Bool} props.shouldUseThousandSeparators
3333
- * @param {Bool} props.shouldAbbreviateTrendValue
3334
- * @returns {Number} major or trend text
3676
+ * Darkens a given color
3677
+ * @method darken
3678
+ * @param {String} color
3679
+ * @returns {String}
3680
+ * @private
3335
3681
  */
3336
3682
 
3337
- var computeText = function computeText(_ref4) {
3338
- var value = _ref4.value,
3339
- numberPrecision = _ref4.numberPrecision,
3340
- shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
3341
- shouldAbbreviateTrendValue = _ref4.shouldAbbreviateTrendValue;
3342
- var text = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(value) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["formatNumber"])(value, numberPrecision, {
3343
- useThousandSeparators: shouldUseThousandSeparators,
3344
- // todo: need update formatNumber
3345
- useTrendUnits: shouldAbbreviateTrendValue
3346
- }) : value; // When text is undefined, return empty string
3347
-
3348
- text = text || '';
3349
- return text;
3683
+ var darken = function darken(color) {
3684
+ return changeColor(color, 0.5);
3350
3685
  };
3351
- /*
3352
- * @method getMajorText
3353
- * @param {Object} props
3354
- * @param {Number} props.majorValue
3355
- * @param {Number} props.numberPrecision
3356
- * @param {Bool} props.shouldUseThousandSeparators
3357
- * @returns {String} majorText
3686
+ /** consistent token structure: handle callback to add value and name in event payload
3687
+ * @method handleValueClickCallback
3688
+ * @param {Object} ev
3689
+ * @param {String | Number} majorValue
3690
+ * @param {String} majorValueField
3691
+ * @param {Number} trendValue
3692
+ * @param {Function} onValueClick
3358
3693
  */
3359
3694
 
3360
- var getMajorText = function getMajorText(_ref5) {
3361
- var majorValue = _ref5.majorValue,
3362
- numberPrecision = _ref5.numberPrecision,
3363
- shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators;
3364
- return computeText({
3365
- value: majorValue === null ? 'N/A' : majorValue,
3366
- // if majorValue is null, use `N/A`.
3367
- numberPrecision: numberPrecision,
3368
- shouldUseThousandSeparators: shouldUseThousandSeparators,
3369
- shouldAbbreviateTrendValue: false
3370
- });
3695
+ var handleValueClickCallback = function handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick) {
3696
+ var trellisEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
3697
+ var trellisSplityBy = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
3698
+ var trellisKey = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : '';
3699
+ var payload = {
3700
+ trendValue: trendValue,
3701
+ value: majorValue,
3702
+ name: majorValueField
3703
+ };
3704
+
3705
+ if (trellisEnabled) {
3706
+ payload = _objectSpread(_objectSpread({}, payload), {}, {
3707
+ 'trellis.name': trellisSplityBy,
3708
+ 'trellis.value': trellisKey
3709
+ });
3710
+ }
3711
+
3712
+ return onValueClick(_objectSpread(_objectSpread({}, ev), {}, {
3713
+ payload: payload
3714
+ }));
3371
3715
  };
3372
- /*
3373
- * @method getTrendText
3374
- * @param {Object} props
3375
- * @param {Number} props.majorValue
3376
- * @param {Number} props.trendValue
3377
- * @param {String} props.trendDisplay
3378
- * @param {Number} props.numberPrecision
3379
- * @param {Bool} props.shouldUseThousandSeparators
3380
- * @param {Bool} props.shouldAbbreviateTrendValue
3381
- * @returns {String} trendText
3382
- */
3383
3716
 
3384
- var getTrendText = function getTrendText(_ref6) {
3385
- var majorValue = _ref6.majorValue,
3386
- trendValue = _ref6.trendValue,
3387
- trendDisplay = _ref6.trendDisplay,
3388
- numberPrecision = _ref6.numberPrecision,
3389
- shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
3390
- shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
3717
+ /***/ }),
3391
3718
 
3392
- var compute = function compute(value) {
3393
- return computeText({
3394
- value: value,
3395
- numberPrecision: numberPrecision,
3396
- shouldUseThousandSeparators: shouldUseThousandSeparators,
3397
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3398
- });
3399
- };
3719
+ /***/ 193:
3720
+ /***/ (function(module, exports, __webpack_require__) {
3400
3721
 
3401
- if (trendValue === '' || !Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue)) {
3402
- return '';
3403
- }
3722
+ "use strict";
3404
3723
 
3405
- var showPercent = trendDisplay === 'percent';
3406
3724
 
3407
- if (!showPercent) {
3408
- return compute(trendValue);
3409
- }
3725
+ Object.defineProperty(exports, "__esModule", {
3726
+ value: true
3727
+ });
3410
3728
 
3411
- var diff = Math.abs(trendValue - majorValue);
3412
- var val = Math.round(trendValue / diff * 100);
3729
+ var React = __webpack_require__(1);
3413
3730
 
3414
- if (trendValue === 0 && diff === 0) {
3415
- val = 0;
3416
- }
3731
+ var T = __webpack_require__(0);
3417
3732
 
3418
- if (!Number.isFinite(val)) {
3419
- return 'N/A';
3420
- }
3733
+ var colorConstants_1 = __webpack_require__(69);
3421
3734
 
3422
- var text = compute(val);
3423
- return "".concat(text, "%");
3424
- };
3425
- /**
3426
- * Helper to determine the font size for an element
3427
- * @method computeFontSize
3428
- * @param {String} text The string to find a size for
3429
- * @param {Object} dimensions
3430
- * @param {Number} dimensions.width The width of the container
3431
- * @param {Number} dimensions.height The height of the container
3432
- * @param {String} [fontFamily='"Splunk Platform Sans" ...'] The font being used
3433
- * @param {String} [fontWeight='normal'] Boldness of font
3434
- * @returns {Number} The size to use for fontSize styles
3435
- */
3735
+ var gaugeUtils_1 = __webpack_require__(115);
3436
3736
 
3437
- var computeFontSize = function computeFontSize(text, _ref7) {
3438
- var width = _ref7.width,
3439
- height = _ref7.height;
3440
- var fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FONT_FAMILY;
3441
- var fontWeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'normal';
3442
- var widthInDefaultFont = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(DEFAULT_FONT, "px ").concat(fontFamily));
3443
- var fontSize = Math.min(width / widthInDefaultFont * DEFAULT_FONT, height / DEFAULT_FONT * DEFAULT_FONT);
3444
- return parseInt(fontSize, 10);
3445
- };
3446
- /*
3447
- * @method getMajorFontSize
3448
- * @param {Object} props
3449
- * @param {Number} props.width
3450
- * @param {Number} props.height
3451
- * @param {String} props.unit
3452
- * @param {String} props.majorText
3453
- * @param {Number} props.spaceRatio
3454
- * @returns {Number} majorFontSize
3455
- */
3737
+ var displayUtils_1 = __webpack_require__(100);
3456
3738
 
3457
- var getMajorFontSize = function getMajorFontSize(_ref8) {
3458
- var width = _ref8.width,
3459
- height = _ref8.height,
3460
- unit = _ref8.unit,
3461
- majorText = _ref8.majorText,
3462
- _ref8$spaceRatio = _ref8.spaceRatio,
3463
- spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
3464
- var majorTextCalc = unit ? "".concat(unit).concat(majorText) : majorText;
3465
- return computeFontSize(majorTextCalc, {
3466
- width: width * spaceRatio,
3467
- height: height
3468
- });
3469
- };
3470
- /*
3471
- * @method getTrendFontSize
3472
- * @param {Object} props
3473
- * @param {Number} props.width
3474
- * @param {Number} props.height
3475
- * @param {String} props.trendText
3476
- * @param {Number} props.spaceRatio
3477
- * @returns {Number} trendFontSize
3478
- */
3739
+ var GaugeGraph = function GaugeGraph(_ref) {
3740
+ var _ref$width = _ref.width,
3741
+ width = _ref$width === void 0 ? 200 : _ref$width,
3742
+ _ref$height = _ref.height,
3743
+ height = _ref$height === void 0 ? 200 : _ref$height,
3744
+ _ref$strokeWidth = _ref.strokeWidth,
3745
+ strokeWidth = _ref$strokeWidth === void 0 ? (0, gaugeUtils_1.getGaugeStrokeWidth)(height) : _ref$strokeWidth,
3746
+ _ref$radialBackground = _ref.radialBackgroundColor,
3747
+ radialBackgroundColor = _ref$radialBackground === void 0 ? colorConstants_1.RADIAL_BACKGROUND_COLOR : _ref$radialBackground,
3748
+ fontColor = _ref.fontColor,
3749
+ formattedGaugeRanges = _ref.formattedGaugeRanges,
3750
+ propMajorValue = _ref.majorValue,
3751
+ maxValue = _ref.maxValue,
3752
+ minValue = _ref.minValue,
3753
+ showRadialGraph = _ref.showRadialGraph;
3479
3754
 
3480
- var getTrendFontSize = function getTrendFontSize(_ref9) {
3481
- var width = _ref9.width,
3482
- height = _ref9.height,
3483
- trendText = _ref9.trendText,
3484
- _ref9$spaceRatio = _ref9.spaceRatio,
3485
- spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
3486
- var trendFontSize = 12;
3755
+ function toRadians(degrees) {
3756
+ return degrees * Math.PI / 180;
3757
+ }
3487
3758
 
3488
- if (spaceRatio > 0) {
3489
- trendFontSize = computeFontSize(trendText, {
3490
- width: width * spaceRatio,
3491
- height: height
3492
- });
3493
- trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;
3759
+ function toDegrees(radians) {
3760
+ return radians * 180 / Math.PI;
3494
3761
  }
3495
3762
 
3496
- return trendFontSize;
3497
- };
3498
- /*
3499
- * The height of underLabel should no more than 12px
3500
- * @param {Number} height
3501
- * @return {Number} height || DEFAULT_FONT
3502
- */
3763
+ var labelFontSize = (0, gaugeUtils_1.getLabelFontSize)(height, showRadialGraph);
3764
+ var labelFontSizeString = "".concat(String(labelFontSize), "px Splunk Platform Sans");
3765
+ var maxOffset = 0.35; // space between the label and the radial
3503
3766
 
3504
- var getUnderLabelHeight = function getUnderLabelHeight(height) {
3505
- return height > DEFAULT_FONT ? DEFAULT_FONT : height;
3506
- };
3507
- /*
3508
- * @param {Object} config
3509
- * @param {String} underLabel
3510
- * @param {Number} width width of underLabel
3511
- * @param {Number} height height of underLabel
3512
- * @param {Number} fond size of underLabel
3513
- */
3767
+ var labelSpace = labelFontSize / 2; // length of the base of triangle marker
3514
3768
 
3515
- var getUnderLabel = function getUnderLabel(_ref10) {
3516
- var underLabel = _ref10.underLabel,
3517
- width = _ref10.width,
3518
- height = _ref10.height;
3519
- return (// todo: may need truncate underLabel later
3520
- computeFontSize(underLabel, {
3521
- width: width,
3522
- height: height
3523
- })
3524
- );
3525
- };
3526
- /**
3527
- * Compute value and font size for major and trend
3528
- * @method getMajorAndTrend
3529
- * @param {Object} props
3530
- * @param {Number} props.width // Width of the text container
3531
- * @param {Number} props.height // Height of the text container
3532
- * @param {Number} props.majorValue // Major value
3533
- * @param {Number} props.trendValue // Trend value
3534
- * @param {Number} props.majorFontSize
3535
- * @param {Number} props.trendFontSize
3536
- * @param {String} props.trendDisplay
3537
- * @param {String} props.unit // Unit for the value
3538
- * @param {Number} props.numberPrecision
3539
- * @param {Bool} props.shouldUseThousandSeparators
3540
- * @param {Bool} props.shouldAbbreviateTrendValue
3541
- * @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size
3542
- */
3769
+ var triangleBase = height >= 113 ? 8 : 4; // amount of padding around semi-circle
3543
3770
 
3544
- var getMajorAndTrend = function getMajorAndTrend(_ref11) {
3545
- var width = _ref11.width,
3546
- height = _ref11.height,
3547
- majorValue = _ref11.majorValue,
3548
- trendValue = _ref11.trendValue,
3549
- majorFontSize = _ref11.majorFontSize,
3550
- trendFontSize = _ref11.trendFontSize,
3551
- trendDisplay = _ref11.trendDisplay,
3552
- unit = _ref11.unit,
3553
- numberPrecision = _ref11.numberPrecision,
3554
- shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
3555
- shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue;
3556
- var majorTextSpaceRatio = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;
3557
- var textContentWidth = width * 0.9;
3558
- var textContentHeight = height * 0.9;
3559
- var majorText = getMajorText({
3560
- majorValue: majorValue,
3561
- numberPrecision: numberPrecision,
3562
- shouldUseThousandSeparators: shouldUseThousandSeparators
3563
- });
3564
- var majorTextFontSize = majorFontSize || getMajorFontSize({
3565
- width: textContentWidth,
3566
- height: textContentHeight,
3567
- unit: unit,
3568
- majorText: majorText,
3569
- spaceRatio: majorTextSpaceRatio
3570
- });
3571
- var trendText = getTrendText({
3572
- majorValue: majorValue,
3573
- trendValue: trendValue,
3574
- trendDisplay: trendDisplay,
3575
- numberPrecision: numberPrecision,
3576
- shouldUseThousandSeparators: shouldUseThousandSeparators,
3577
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3578
- });
3579
- var trendTextFontSize = trendFontSize || getTrendFontSize({
3580
- width: textContentWidth,
3581
- height: textContentHeight,
3582
- trendText: trendText,
3583
- spaceRatio: 1 - majorTextSpaceRatio
3584
- });
3585
- return {
3586
- majorText: majorText,
3587
- majorTextFontSize: majorTextFontSize,
3588
- trendText: trendText,
3589
- trendTextFontSize: trendTextFontSize
3590
- };
3591
- };
3592
- /*
3593
- * @method updateVizInSmallSpace
3594
- * @param {Object} props
3595
- * @param {Number} props.width // Width of the text container
3596
- * @param {Number} props.height // Height of the text container
3597
- * @param {Object} props.toRemoveList
3598
- * @param {Number} props.majorValue // Major value
3599
- * @param {Number} props.trendValue // Trend value
3600
- * @param {Number} props.majorFontSize
3601
- * @param {Number} props.trendFontSize
3602
- * @param {Number} props.majorTextFontSize
3603
- * @param {String} props.unit // Unit for the value
3604
- * @param {Number} props.numberPrecision
3605
- * @param {Bool} props.shouldUseThousandSeparators
3606
- * @param {Bool} props.shouldAbbreviateTrendValue
3607
- * @returns {Object} results
3608
- * @returns {Object} results.newMajorAndTrend
3609
- * @returns {Object} results.updatedProps
3610
- */
3771
+ var padding = labelFontSize > 0 ? labelSpace * 2 + labelFontSize * 2 : triangleBase;
3772
+ var semicircleRadius = height - strokeWidth / 2 - padding;
3773
+ var circumference = semicircleRadius * 2 * Math.PI;
3774
+ var bgCircleOffset = circumference * 0.5; // half a circle
3611
3775
 
3612
- var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
3613
- var width = _ref12.width,
3614
- height = _ref12.height,
3615
- toRemoveList = _ref12.toRemoveList,
3616
- majorValue = _ref12.majorValue,
3617
- trendValue = _ref12.trendValue,
3618
- majorFontSize = _ref12.majorFontSize,
3619
- trendFontSize = _ref12.trendFontSize,
3620
- majorTextFontSize = _ref12.majorTextFontSize,
3621
- unit = _ref12.unit,
3622
- numberPrecision = _ref12.numberPrecision,
3623
- shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
3624
- shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
3625
- var removeIndex = 0;
3626
- var newProps = {}; // options need to be updated
3776
+ var strokeDashoffset = circumference * 0.5; // half a circle
3627
3777
 
3628
- var newMajorAndTrend = {};
3629
- var newTextSize = majorTextFontSize; // remove info on viz to make textFontSize >= 12px;
3778
+ var semicircleEdgeRadius = semicircleRadius + strokeWidth / 2; // For inner radial
3630
3779
 
3631
- while (newTextSize < 12 && removeIndex < toRemoveList.length) {
3632
- var toRemove = toRemoveList[removeIndex];
3633
- newProps = _objectSpread(_objectSpread({}, newProps), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, toRemove.key, toRemove.value));
3634
- newMajorAndTrend = getMajorAndTrend(_objectSpread({
3635
- majorValue: majorValue,
3636
- trendValue: trendValue,
3637
- majorFontSize: majorFontSize,
3638
- trendFontSize: trendFontSize,
3639
- width: width,
3640
- height: height,
3641
- unit: unit,
3642
- numberPrecision: numberPrecision,
3643
- shouldUseThousandSeparators: shouldUseThousandSeparators,
3644
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3645
- }, newProps));
3646
- newTextSize = newMajorAndTrend.majorTextFontSize;
3647
- removeIndex += 1;
3648
- } // truncate text if textFontSize is still less than 12
3780
+ var innerStrokeWidth = strokeWidth / 4;
3781
+ var innerSemicircleRadius = height - strokeWidth - padding - innerStrokeWidth / 2 - 1; // subtract 1 to make the 1px space between outer and inner arc
3649
3782
 
3783
+ var innerCircumference = innerSemicircleRadius * 2 * Math.PI; // Center of radials
3650
3784
 
3651
- if (newTextSize < 12) {
3652
- var truncateValue = "".concat(majorValue.toString().slice(0, 3), "...");
3653
- newMajorAndTrend = getMajorAndTrend(_objectSpread({
3654
- majorValue: truncateValue,
3655
- trendValue: trendValue,
3656
- majorFontSize: majorFontSize,
3657
- trendFontSize: trendFontSize,
3658
- width: width,
3659
- height: height,
3660
- unit: unit,
3661
- numberPrecision: numberPrecision,
3662
- shouldUseThousandSeparators: shouldUseThousandSeparators,
3663
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3664
- }, newProps));
3785
+ var cx = width / 2;
3786
+ var cyOffset = labelFontSize > 0 ? labelSpace * 2 + labelFontSize : triangleBase / 2;
3787
+ var cy = semicircleRadius + strokeWidth / 2 + cyOffset;
3788
+ var majorValue;
3789
+
3790
+ if (typeof propMajorValue === 'string') {
3791
+ majorValue = parseInt(propMajorValue, 10);
3792
+ } else {
3793
+ majorValue = propMajorValue;
3665
3794
  }
3666
3795
 
3667
- return {
3668
- newMajorAndTrend: newMajorAndTrend,
3669
- updatedProps: newProps
3670
- };
3671
- };
3672
- /*
3673
- * @method computeSingleValueContent
3674
- * @param {Object} props
3675
- * @param {Number} props.contentWidth
3676
- * @param {Number} props.contentHeight
3677
- * @param {Number} props.containerWidth
3678
- * @param {Number} props.containerHeight
3679
- * @param {Number} props.majorValue // Major value
3680
- * @param {Number} props.trendValue // Trend value
3681
- * @param {Number} props.majorFontSize
3682
- * @param {Number} props.trendFontSize
3683
- * @param {String} props.trendDisplay
3684
- * @param {String} props.unit // Unit for the value
3685
- * @param {Number} props.numberPrecision
3686
- * @param {Bool} props.shouldUseThousandSeparators
3687
- * @param {Bool} props.shouldAbbreviateTrendValue
3688
- * @param {Object} props.toRemoveList
3689
- * @returns {Object} results
3690
- * @returns {String} results.majorText
3691
- * @returns {String} results.trendText
3692
- * @returns {Number} results.majorTextFontSize
3693
- * @returns {Number} results.trendTextFontSize
3694
- * @returns {String} results.majorValueTitle
3695
- * @returns {Object} results.smallVizProps
3696
- */
3796
+ var range = (0, gaugeUtils_1.getGaugeRange)(formattedGaugeRanges, majorValue);
3797
+ var circles = [];
3798
+ var labels = [];
3799
+ var showMarker = false; // Calculate Marker Values
3800
+
3801
+ var radius = semicircleRadius;
3802
+ var x = strokeWidth / 2 + innerStrokeWidth + 2; // distance of tip of marker from center of outer semicircle stroke
3803
+
3804
+ var markerVal = Math.max(Math.min(maxValue, majorValue), minValue);
3805
+ var theta = toRadians(180 - (0, displayUtils_1.getRadialProgress)(markerVal - minValue, minValue, maxValue) / 100 * 180); // degree of progress
3806
+
3807
+ var p1x = cx + (radius - x) * Math.cos(theta);
3808
+ var p1y = cy - (radius - x) * Math.sin(theta);
3809
+ var centerX = (radius - x - triangleBase / Math.sqrt(3)) * Math.cos(theta);
3810
+ var centerY = (radius - x - triangleBase / Math.sqrt(3)) * Math.sin(theta);
3811
+ var rotation1 = 2 * Math.PI / 3; // degrees of rotation around center for 2nd point
3812
+
3813
+ var rotation2 = -2 * Math.PI / 3; // degrees of rotation around center for 3rd point
3697
3814
 
3698
- var computeSingleValueContent = function computeSingleValueContent(_ref13) {
3699
- var contentWidth = _ref13.contentWidth,
3700
- contentHeight = _ref13.contentHeight,
3701
- containerWidth = _ref13.containerWidth,
3702
- containerHeight = _ref13.containerHeight,
3703
- majorValue = _ref13.majorValue,
3704
- trendValue = _ref13.trendValue,
3705
- majorFontSize = _ref13.majorFontSize,
3706
- trendFontSize = _ref13.trendFontSize,
3707
- trendDisplay = _ref13.trendDisplay,
3708
- unit = _ref13.unit,
3709
- numberPrecision = _ref13.numberPrecision,
3710
- shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
3711
- shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
3712
- toRemoveList = _ref13.toRemoveList;
3815
+ var xVal = (radius - x) * Math.cos(theta); // x-axis offset of center
3713
3816
 
3714
- var _getMajorAndTrend = getMajorAndTrend({
3715
- majorValue: majorValue,
3716
- trendValue: trendValue,
3717
- majorFontSize: majorFontSize,
3718
- trendFontSize: trendFontSize,
3719
- trendDisplay: trendDisplay,
3720
- width: contentWidth,
3721
- height: contentHeight,
3722
- unit: unit,
3723
- numberPrecision: numberPrecision,
3724
- shouldUseThousandSeparators: shouldUseThousandSeparators,
3725
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3726
- }),
3727
- majorText = _getMajorAndTrend.majorText,
3728
- trendText = _getMajorAndTrend.trendText,
3729
- majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
3730
- trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
3817
+ var yVal = (radius - x) * Math.sin(theta); // y-axis offset of center
3731
3818
 
3732
- var majorValueTitle = majorText;
3733
- var smallVizProps = {}; // update viz in small space
3734
- // if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
3735
- // or truncate major value to make the major font size >= 12
3819
+ var p2x = centerX + (xVal - centerX) * Math.cos(rotation1) - (yVal - centerY) * Math.sin(rotation1); // x-axis of 2nd point
3736
3820
 
3737
- if (majorTextFontSize < 12) {
3738
- var _updateVizInSmallSpac = updateVizInSmallSpace({
3739
- width: containerWidth,
3740
- height: containerHeight,
3741
- toRemoveList: toRemoveList,
3742
- majorValue: majorValue,
3743
- trendValue: trendValue,
3744
- majorFontSize: majorFontSize,
3745
- trendFontSize: trendFontSize,
3746
- majorTextFontSize: majorTextFontSize,
3747
- unit: unit,
3748
- numberPrecision: numberPrecision,
3749
- shouldUseThousandSeparators: shouldUseThousandSeparators,
3750
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3751
- }),
3752
- newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
3753
- updatedProps = _updateVizInSmallSpac.updatedProps;
3821
+ var p2y = centerY + (xVal - centerX) * Math.sin(rotation1) + (yVal - centerY) * Math.cos(rotation1); // y-axis of 2nd point
3754
3822
 
3755
- majorText = newMajorAndTrend.majorText;
3756
- trendText = newMajorAndTrend.trendText;
3757
- majorTextFontSize = newMajorAndTrend.majorTextFontSize;
3758
- trendTextFontSize = newMajorAndTrend.trendTextFontSize;
3759
- smallVizProps = updatedProps;
3760
- }
3823
+ var p3x = centerX + (xVal - centerX) * Math.cos(rotation2) - (yVal - centerY) * Math.sin(rotation2); // x-axis of 3rd point
3761
3824
 
3762
- return {
3763
- majorText: majorText,
3764
- trendText: trendText,
3765
- majorTextFontSize: majorTextFontSize,
3766
- trendTextFontSize: trendTextFontSize,
3767
- majorValueTitle: majorValueTitle,
3768
- smallVizProps: smallVizProps
3769
- };
3770
- };
3771
- var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_ref14) {
3772
- var text = _ref14.text,
3773
- _ref14$fontSize = _ref14.fontSize,
3774
- fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
3775
- _ref14$fontFamily = _ref14.fontFamily,
3776
- fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
3777
- _ref14$fontWeight = _ref14.fontWeight,
3778
- fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
3779
- containerWidth = _ref14.containerWidth;
3780
- var textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
3781
- var modifiedText = text;
3782
- var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily)); // `containerWidth - ellipsesLength > 0` condition ensures space even exists for text.
3825
+ var p3y = centerY + (xVal - centerX) * Math.sin(rotation2) + (yVal - centerY) * Math.cos(rotation2); // y-axis of 3rd point
3783
3826
 
3784
- if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {
3785
- // Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.
3786
- // `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.
3787
- // `text.length > 1` condition included to keep at least the first number.
3788
- while (textWidth + ellipsesLength > containerWidth && modifiedText.length > 1) {
3789
- modifiedText = modifiedText.substring(0, modifiedText.length - 1);
3790
- textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(modifiedText, "normal ".concat(fontSize, "px ").concat(fontFamily));
3791
- }
3827
+ var d = "M ".concat(p1x, " ").concat(p1y, " L ").concat(cx + p2x, " ").concat(cy - p2y, " L ").concat(cx + p3x, " ").concat(cy - p3y, " Z"); // d-value for marker path in SVG
3792
3828
 
3793
- modifiedText = "".concat(modifiedText, "...");
3794
- }
3829
+ formattedGaugeRanges.forEach(function (r, i) {
3830
+ if (range >= i && typeof majorValue === 'number') {
3831
+ var startVal = Math.min(r.from, majorValue);
3832
+ var endVal = Math.min(r.to, majorValue); // width of stroke for each gauge range
3795
3833
 
3796
- return modifiedText;
3797
- };
3798
- /*
3799
- * @method computeSingleValueRadialContent
3800
- * @param {Object} props
3801
- * @param {Number} props.contentWidth
3802
- * @param {Number} props.contentHeight
3803
- * @param {Number} props.containerWidth
3804
- * @param {Number} props.containerHeight
3805
- * @param {Number} props.majorValue // Major value
3806
- * @param {Number} props.trendValue // Trend value
3807
- * @param {Number} props.majorFontSize
3808
- * @param {Number} props.trendFontSize
3809
- * @param {String} props.trendDisplay
3810
- * @param {String} props.unit // Unit for the value
3811
- * @param {Number} props.numberPrecision
3812
- * @param {Bool} props.shouldUseThousandSeparators
3813
- * @param {Bool} props.shouldAbbreviateTrendValue
3814
- * @param {Object} props.toRemoveList
3815
- * @param {Bool} props.smallViz
3816
- * @returns {Object} results
3817
- * @returns {String} results.majorText
3818
- * @returns {String} results.trendText
3819
- * @returns {Number} results.majorTextFontSize
3820
- * @returns {Number} results.trendTextFontSize
3821
- * @returns {String} results.majorValueTitle
3822
- * @returns {Object} results.smallVizProps
3823
- */
3834
+ var _progressWidth = (0, gaugeUtils_1.getProgressWidth)(endVal - startVal, minValue, maxValue, circumference); // distance of stroke from right edge of circle
3824
3835
 
3825
- var computeSingleValueRadialContent = function computeSingleValueRadialContent(_ref15) {
3826
- var contentWidth = _ref15.contentWidth,
3827
- contentHeight = _ref15.contentHeight,
3828
- containerWidth = _ref15.containerWidth,
3829
- containerHeight = _ref15.containerHeight,
3830
- majorValue = _ref15.majorValue,
3831
- trendValue = _ref15.trendValue,
3832
- majorFontSize = _ref15.majorFontSize,
3833
- trendFontSize = _ref15.trendFontSize,
3834
- trendDisplay = _ref15.trendDisplay,
3835
- unit = _ref15.unit,
3836
- numberPrecision = _ref15.numberPrecision,
3837
- shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
3838
- shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
3839
- smallViz = _ref15.smallViz;
3840
3836
 
3841
- var _getMajorAndTrend2 = getMajorAndTrend({
3842
- majorValue: majorValue,
3843
- trendValue: trendValue,
3844
- majorFontSize: majorFontSize,
3845
- trendFontSize: trendFontSize,
3846
- trendDisplay: trendDisplay,
3847
- width: contentWidth,
3848
- height: contentHeight,
3849
- unit: unit,
3850
- numberPrecision: numberPrecision,
3851
- shouldUseThousandSeparators: shouldUseThousandSeparators,
3852
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3853
- }),
3854
- majorText = _getMajorAndTrend2.majorText,
3855
- trendText = _getMajorAndTrend2.trendText,
3856
- majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
3857
- trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
3837
+ var _offsetDistance = (0, gaugeUtils_1.getProgressWidth)(maxValue - startVal, minValue, maxValue, circumference); // main gauge progress radial
3858
3838
 
3859
- var majorValueTitle = majorText;
3860
- var smallVizProps = {}; // custom logic for viz in small space
3861
- // if not showing the radial graph (if `smallViz` is true), then compute truncated major value
3862
- // and font sizes
3863
3839
 
3864
- if (smallViz) {
3865
- var truncateValue = minimallyTruncateStringToWidth({
3866
- text: majorValue,
3867
- fontWeight: 'bold',
3868
- fontSize: 12,
3869
- containerWidth: containerWidth
3870
- });
3840
+ circles.push(React.createElement("circle", {
3841
+ "data-test": "progress-radial",
3842
+ stroke: r.value,
3843
+ fill: "transparent",
3844
+ strokeWidth: strokeWidth,
3845
+ strokeDasharray: "".concat(_progressWidth, " ").concat(circumference - _progressWidth),
3846
+ style: {
3847
+ strokeDashoffset: _offsetDistance
3848
+ },
3849
+ r: semicircleRadius,
3850
+ cx: cx,
3851
+ cy: cy,
3852
+ key: "progress".concat(r.from)
3853
+ }));
3854
+ }
3871
3855
 
3872
- var _getMajorAndTrend3 = getMajorAndTrend({
3873
- majorValue: truncateValue,
3874
- trendValue: trendValue,
3875
- majorFontSize: majorFontSize,
3876
- trendFontSize: trendFontSize,
3877
- width: containerWidth,
3878
- height: containerHeight,
3879
- unit: unit,
3880
- trendDisplay: trendDisplay,
3881
- numberPrecision: numberPrecision,
3882
- shouldUseThousandSeparators: shouldUseThousandSeparators,
3883
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
3884
- });
3856
+ if (range <= i && (typeof majorValue !== 'number' || majorValue < r.to) && i < formattedGaugeRanges.length - 1) {
3857
+ // width of stroke for each breakpoint dash
3858
+ var breakpointWidth = 1; // opacity of the dash (15%)
3885
3859
 
3886
- majorText = _getMajorAndTrend3.majorText;
3887
- trendText = _getMajorAndTrend3.trendText;
3888
- majorTextFontSize = _getMajorAndTrend3.majorTextFontSize;
3889
- trendTextFontSize = _getMajorAndTrend3.trendTextFontSize;
3890
- smallVizProps = {
3891
- trendDisplay: trendDisplay,
3892
- unit: unit
3893
- };
3894
- }
3860
+ var breakpointOpacity = 0.15; // distance of stroke from right edge of circle
3895
3861
 
3896
- return {
3897
- majorText: majorText,
3898
- trendText: trendText,
3899
- majorTextFontSize: majorTextFontSize,
3900
- trendTextFontSize: trendTextFontSize,
3901
- majorValueTitle: majorValueTitle,
3902
- smallVizProps: smallVizProps
3903
- };
3904
- };
3905
- /**
3906
- * Get the colors for a graph
3907
- *
3908
- * @method getGraphColors
3909
- * @param {Object} options
3910
- * @param {Bool} options.backgroundEnabled // Flag to turn on color mode
3911
- * @param {String} options.backgroundColor // The current background color, overrides trend background color
3912
- * @param {Object} options.defaultColors // Default colors by severity
3913
- * @param {Function} options.customColorFormatter // must return { background, stroke } given a color
3914
- * @returns {Object} { background, stroke } colors
3915
- * @private
3916
- */
3862
+ var _offsetDistance2 = (0, gaugeUtils_1.getProgressWidth)(maxValue - r.to, minValue, maxValue, circumference); // dashes at each gauge breakpoint after the major value
3863
+
3864
+
3865
+ circles.push(React.createElement("circle", {
3866
+ "data-test": "breakpoint-radial",
3867
+ stroke: fontColor,
3868
+ opacity: breakpointOpacity,
3869
+ fill: "transparent",
3870
+ strokeWidth: strokeWidth,
3871
+ strokeDasharray: "".concat(breakpointWidth, " ").concat(circumference - breakpointWidth),
3872
+ style: {
3873
+ strokeDashoffset: _offsetDistance2
3874
+ },
3875
+ r: semicircleRadius,
3876
+ cx: cx,
3877
+ cy: cy,
3878
+ key: "breakpoint".concat(r.from)
3879
+ }));
3880
+ }
3881
+
3882
+ if (i < formattedGaugeRanges.length - 1) {
3883
+ var toTheta = toRadians(180 - (0, displayUtils_1.getRadialProgress)(r.to - minValue, minValue, maxValue) / 100 * 180);
3884
+ var labelX = cx + (semicircleEdgeRadius + labelSpace) * Math.cos(toTheta);
3885
+ var labelY = cy - (semicircleEdgeRadius + labelSpace) * Math.sin(toTheta);
3886
+ var labelWidth = (0, gaugeUtils_1.computeTextWidth)(String(r.to), labelFontSizeString);
3887
+ var vertOffset = (0, gaugeUtils_1.getVerticalLabelOffset)(toDegrees(toTheta), labelFontSize, maxOffset);
3888
+ labelY += vertOffset;
3917
3889
 
3918
- var getGraphColors = function getGraphColors(_ref16) {
3919
- var backgroundEnabled = _ref16.backgroundEnabled,
3920
- backgroundColor = _ref16.backgroundColor,
3921
- defaultColors = _ref16.defaultColors,
3922
- customColorFormatter = _ref16.customColorFormatter; // Only do custom colors in block mode
3890
+ if (r.to < (maxValue + minValue) / 2) {
3891
+ labelX -= labelWidth + vertOffset / 3;
3892
+ } else if (r.to === (maxValue + minValue) / 2) {
3893
+ labelX -= labelWidth / 2;
3894
+ } // labels of each gauge range, excluding min and max
3923
3895
 
3924
- if (backgroundEnabled) {
3925
- // Check if the user defined colors to use
3926
- if (backgroundColor && typeof customColorFormatter === 'function') {
3927
- return customColorFormatter(backgroundColor);
3928
- }
3929
- }
3930
3896
 
3931
- return defaultColors.none;
3932
- };
3933
- /**
3934
- * Adjust rgb value if it equals to 0 or 255
3935
- * @method adjustRGB
3936
- * @param {Number} rgb [0 - 255]
3937
- * @param {Number} delta
3938
- * @returns {Number} adjusted rgb
3939
- * @private
3940
- */
3897
+ labels.push(React.createElement("text", {
3898
+ "data-test": "label",
3899
+ fill: fontColor,
3900
+ x: labelX,
3901
+ y: labelY,
3902
+ fontSize: labelFontSize,
3903
+ key: "label".concat(r.from)
3904
+ }, r.to));
3905
+ } // width of stroke for each inner radial gauge range
3941
3906
 
3942
- var adjustRGB = function adjustRGB(rgb, delta) {
3943
- if (rgb === 255) {
3944
- return rgb - delta;
3945
- }
3946
3907
 
3947
- if (rgb === 0) {
3948
- return rgb + delta;
3949
- }
3908
+ var progressWidth = (0, gaugeUtils_1.getProgressWidth)(r.to - r.from, minValue, maxValue, innerCircumference); // distance of stroke from right edge of circle
3950
3909
 
3951
- return rgb;
3952
- };
3953
- /**
3954
- * Modifies colors by multiplying by a given ratio
3955
- * @method changeColor
3956
- * @param {String} color // Color to modify
3957
- * @param {Number} ratio // Float to modify color
3958
- * @returns {String} new color
3959
- * @private
3960
- */
3910
+ var offsetDistance = (0, gaugeUtils_1.getProgressWidth)(maxValue - r.from, minValue, maxValue, innerCircumference); // inner radial for all gauge ranges
3961
3911
 
3962
- var changeColor = function changeColor(color, ratio) {
3963
- var hex = color.replace(/(0x|#)/, '');
3964
- var r = parseInt(hex.substr(0, 2), 16);
3965
- var g = parseInt(hex.substr(2, 2), 16);
3966
- var b = parseInt(hex.substr(4, 2), 16); // Multiply by given ratio, make sure is between 0 and 255;
3912
+ circles.push(React.createElement("circle", {
3913
+ "data-test": "inner-radial",
3914
+ stroke: r.value,
3915
+ fill: "transparent",
3916
+ strokeWidth: innerStrokeWidth,
3917
+ strokeDasharray: "".concat(progressWidth, " ").concat(innerCircumference - progressWidth),
3918
+ style: {
3919
+ strokeDashoffset: offsetDistance
3920
+ },
3921
+ r: innerSemicircleRadius,
3922
+ cx: cx,
3923
+ cy: cy,
3924
+ key: "inner".concat(r.from)
3925
+ }));
3926
+ }); // min label
3967
3927
 
3968
- var newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);
3969
- var newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);
3970
- var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0); // If the color is not changed
3971
- // case 1: the color is (0, 0 0)
3972
- // lighten color (80, 80, 80)
3973
- // darken color (40, 40, 40)
3974
- // case 2: the color is (255, 255, 255)
3975
- // lighten color (235, 235, 235)
3976
- // darken color (175, 175, 175)
3977
- // case 3: the color is e.g. (0, 255, 0)
3978
- // new color (20, 235, 20)
3928
+ labels.push(React.createElement("text", {
3929
+ "data-test": "min-label",
3930
+ fill: fontColor,
3931
+ x: cx - semicircleEdgeRadius,
3932
+ y: cy + labelFontSize,
3933
+ fontSize: labelFontSize,
3934
+ key: "min-label"
3935
+ }, minValue)); // max label
3979
3936
 
3980
- if (newR === r && newG === g && newB === b) {
3981
- if (newR === 0 && newG === 0 && newB === 0) {
3982
- if (ratio > 1) {
3983
- newR = adjustRGB(newR, 80);
3984
- newG = adjustRGB(newG, 80);
3985
- newB = adjustRGB(newB, 80);
3986
- } else {
3987
- newR = adjustRGB(newR, 40);
3988
- newG = adjustRGB(newG, 40);
3989
- newB = adjustRGB(newB, 40);
3990
- }
3991
- } else if (newR === 255 && newG === 255 && newB === 255) {
3992
- if (ratio > 1) {
3993
- newR = adjustRGB(newR, 20);
3994
- newG = adjustRGB(newG, 20);
3995
- newB = adjustRGB(newB, 20);
3996
- } else {
3997
- newR = adjustRGB(newR, 80);
3998
- newG = adjustRGB(newG, 80);
3999
- newB = adjustRGB(newB, 80);
4000
- }
4001
- } else {
4002
- newR = adjustRGB(newR, 20);
4003
- newG = adjustRGB(newG, 20);
4004
- newB = adjustRGB(newB, 20);
4005
- }
4006
- }
3937
+ var maxLabelWidth = (0, gaugeUtils_1.computeTextWidth)(String(maxValue), labelFontSizeString);
3938
+ labels.push(React.createElement("text", {
3939
+ "data-test": "max-label",
3940
+ fill: fontColor,
3941
+ x: cx + semicircleEdgeRadius - maxLabelWidth,
3942
+ y: cy + labelFontSize,
3943
+ fontSize: labelFontSize,
3944
+ key: "max-label"
3945
+ }, maxValue)); // dash to indicate majorValue
4007
3946
 
4008
- return "#".concat(newR.toString(16).padStart(2, 0)) + "".concat(newG.toString(16).padStart(2, 0)) + "".concat(newB.toString(16).padStart(2, 0));
4009
- };
4010
- /**
4011
- * Lighten a given color
4012
- * @method lighten
4013
- * @param {String} color
4014
- * @returns {String}
4015
- * @private
4016
- */
3947
+ showMarker = typeof majorValue === 'number' && formattedGaugeRanges.length >= 1;
4017
3948
 
3949
+ if (showMarker && majorValue > formattedGaugeRanges[0].from && majorValue <= formattedGaugeRanges[formattedGaugeRanges.length - 1].to) {
3950
+ var progressWidth = (0, gaugeUtils_1.getProgressWidth)(maxValue - majorValue, minValue, maxValue, circumference);
3951
+ var indicatorWidth = 1;
3952
+ circles.push(React.createElement("circle", {
3953
+ "data-test": "indicator-radial",
3954
+ stroke: fontColor || '#FFFFFF',
3955
+ fill: "transparent",
3956
+ strokeWidth: strokeWidth,
3957
+ strokeDasharray: "".concat(indicatorWidth, " ").concat(circumference - indicatorWidth),
3958
+ style: {
3959
+ strokeDashoffset: progressWidth
3960
+ },
3961
+ r: semicircleRadius,
3962
+ cx: cx,
3963
+ cy: cy,
3964
+ key: "indicator"
3965
+ }));
3966
+ }
4018
3967
 
4019
- var lighten = function lighten(color) {
4020
- return changeColor(color, 1.3);
3968
+ return React.createElement("svg", {
3969
+ height: height,
3970
+ width: width,
3971
+ "data-test": "radial-gauge-visualization"
3972
+ }, React.createElement("g", null, React.createElement("circle", {
3973
+ "data-test": "background-radial",
3974
+ stroke: radialBackgroundColor,
3975
+ fill: "transparent",
3976
+ strokeWidth: strokeWidth,
3977
+ strokeDasharray: "".concat(bgCircleOffset, " ").concat(circumference - bgCircleOffset),
3978
+ style: {
3979
+ strokeDashoffset: strokeDashoffset
3980
+ },
3981
+ r: semicircleRadius,
3982
+ cx: cx,
3983
+ cy: cy
3984
+ }), circles, labels, showMarker && React.createElement("path", {
3985
+ fill: fontColor,
3986
+ d: d,
3987
+ opacity: "100",
3988
+ "data-z-index": "4",
3989
+ "data-test": "marker"
3990
+ })));
4021
3991
  };
4022
- /**
4023
- * Darkens a given color
4024
- * @method darken
4025
- * @param {String} color
4026
- * @returns {String}
4027
- * @private
4028
- */
4029
3992
 
4030
- var darken = function darken(color) {
4031
- return changeColor(color, 0.5);
3993
+ GaugeGraph.propTypes = {
3994
+ width: T.number,
3995
+ height: T.number,
3996
+ strokeWidth: T.number,
3997
+ radialBackgroundColor: T.string,
3998
+ formattedGaugeRanges: T.array,
3999
+ majorValue: T.oneOfType([T.string, T.number]),
4000
+ maxValue: T.number,
4001
+ minValue: T.number,
4002
+ showRadialGraph: T.bool
4032
4003
  };
4033
- /** consistent token structure: handle callback to add value and name in event payload
4034
- * @method handleValueClickCallback
4035
- * @param {Object} ev
4036
- * @param {String | Number} majorValue
4037
- * @param {String} majorValueField
4038
- * @param {Number} trendValue
4039
- * @param {Function} onValueClick
4040
- */
4004
+ GaugeGraph.defaultProps = {
4005
+ strokeWidth: 12,
4006
+ formattedGaugeRanges: [],
4007
+ majorValue: 'N/A'
4008
+ };
4009
+ exports.default = GaugeGraph;
4041
4010
 
4042
- var handleValueClickCallback = function handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick) {
4043
- var trellisEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
4044
- var trellisSplityBy = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
4045
- var trellisKey = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : '';
4046
- var payload = {
4047
- trendValue: trendValue,
4048
- value: majorValue,
4049
- name: majorValueField
4050
- };
4011
+ /***/ }),
4051
4012
 
4052
- if (trellisEnabled) {
4053
- payload = _objectSpread(_objectSpread({}, payload), {}, {
4054
- 'trellis.name': trellisSplityBy,
4055
- 'trellis.value': trellisKey
4056
- });
4057
- }
4013
+ /***/ 2:
4014
+ /***/ (function(module, exports) {
4058
4015
 
4059
- return onValueClick(_objectSpread(_objectSpread({}, ev), {}, {
4060
- payload: payload
4061
- }));
4062
- };
4016
+ module.exports = require("lodash");
4063
4017
 
4064
4018
  /***/ }),
4065
4019
 
4066
- /***/ 21:
4020
+ /***/ 20:
4067
4021
  /***/ (function(module, exports, __webpack_require__) {
4068
4022
 
4069
4023
  "use strict";
@@ -4078,15 +4032,15 @@ exports.validOutputModes = ['json_cols', 'json'];
4078
4032
 
4079
4033
  /***/ }),
4080
4034
 
4081
- /***/ 22:
4035
+ /***/ 21:
4082
4036
  /***/ (function(module, exports, __webpack_require__) {
4083
4037
 
4084
4038
  "use strict";
4085
4039
 
4086
4040
 
4087
- var _classCallCheck = __webpack_require__(9);
4041
+ var _classCallCheck = __webpack_require__(8);
4088
4042
 
4089
- var _createClass = __webpack_require__(25);
4043
+ var _createClass = __webpack_require__(24);
4090
4044
 
4091
4045
  Object.defineProperty(exports, "__esModule", {
4092
4046
  value: true
@@ -4116,7 +4070,7 @@ exports.DefaultVizActionHandler = DefaultVizActionHandler;
4116
4070
 
4117
4071
  /***/ }),
4118
4072
 
4119
- /***/ 23:
4073
+ /***/ 22:
4120
4074
  /***/ (function(module, exports, __webpack_require__) {
4121
4075
 
4122
4076
  "use strict";
@@ -4145,7 +4099,7 @@ var VizCategory;
4145
4099
 
4146
4100
  /***/ }),
4147
4101
 
4148
- /***/ 24:
4102
+ /***/ 23:
4149
4103
  /***/ (function(module, exports, __webpack_require__) {
4150
4104
 
4151
4105
  "use strict";
@@ -4178,37 +4132,37 @@ exports.extendStaticWrapperProps = extendStaticWrapperProps;
4178
4132
 
4179
4133
  /***/ }),
4180
4134
 
4181
- /***/ 25:
4135
+ /***/ 24:
4182
4136
  /***/ (function(module, exports) {
4183
4137
 
4184
4138
  module.exports = require("@babel/runtime/helpers/createClass");
4185
4139
 
4186
4140
  /***/ }),
4187
4141
 
4188
- /***/ 26:
4142
+ /***/ 25:
4189
4143
  /***/ (function(module, exports) {
4190
4144
 
4191
4145
  module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
4192
4146
 
4193
4147
  /***/ }),
4194
4148
 
4195
- /***/ 27:
4149
+ /***/ 26:
4196
4150
  /***/ (function(module, exports, __webpack_require__) {
4197
4151
 
4198
4152
  "use strict";
4199
4153
 
4200
4154
 
4201
- var _toConsumableArray = __webpack_require__(7);
4155
+ var _toConsumableArray = __webpack_require__(6);
4202
4156
 
4203
4157
  Object.defineProperty(exports, "__esModule", {
4204
4158
  value: true
4205
4159
  });
4206
4160
  exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceConfig = exports.enhanceOptionsSchemaWithDynamicOptions = void 0;
4207
4161
 
4208
- var lodash_1 = __webpack_require__(3); // included for backwards compatibility
4162
+ var lodash_1 = __webpack_require__(2); // included for backwards compatibility
4209
4163
 
4210
4164
 
4211
- var visualization_schemas_1 = __webpack_require__(10);
4165
+ var visualization_schemas_1 = __webpack_require__(9);
4212
4166
 
4213
4167
  Object.defineProperty(exports, "enhanceOptionsSchemaWithDynamicOptions", {
4214
4168
  enumerable: true,
@@ -4349,49 +4303,49 @@ exports.insertLayout = insertLayout;
4349
4303
 
4350
4304
  /***/ }),
4351
4305
 
4352
- /***/ 28:
4306
+ /***/ 27:
4353
4307
  /***/ (function(module, exports) {
4354
4308
 
4355
4309
  module.exports = require("@splunk/visualization-context/FeatureFlagContext");
4356
4310
 
4357
4311
  /***/ }),
4358
4312
 
4359
- /***/ 29:
4313
+ /***/ 28:
4360
4314
  /***/ (function(module, exports) {
4361
4315
 
4362
4316
  module.exports = require("@splunk/visualizations-shared/configUtils");
4363
4317
 
4364
4318
  /***/ }),
4365
4319
 
4366
- /***/ 3:
4320
+ /***/ 29:
4367
4321
  /***/ (function(module, exports) {
4368
4322
 
4369
- module.exports = require("lodash");
4323
+ module.exports = require("@splunk/themes/pick");
4370
4324
 
4371
4325
  /***/ }),
4372
4326
 
4373
- /***/ 30:
4327
+ /***/ 3:
4374
4328
  /***/ (function(module, exports) {
4375
4329
 
4376
- module.exports = require("@splunk/themes/pick");
4330
+ module.exports = require("@splunk/ui-utils/i18n");
4377
4331
 
4378
4332
  /***/ }),
4379
4333
 
4380
- /***/ 31:
4334
+ /***/ 30:
4381
4335
  /***/ (function(module, exports) {
4382
4336
 
4383
4337
  module.exports = require("@splunk/ui-utils/id");
4384
4338
 
4385
4339
  /***/ }),
4386
4340
 
4387
- /***/ 32:
4341
+ /***/ 31:
4388
4342
  /***/ (function(module, exports) {
4389
4343
 
4390
4344
  module.exports = require("@splunk/visualization-context/TimezoneContext");
4391
4345
 
4392
4346
  /***/ }),
4393
4347
 
4394
- /***/ 33:
4348
+ /***/ 32:
4395
4349
  /***/ (function(module, exports, __webpack_require__) {
4396
4350
 
4397
4351
  "use strict";
@@ -4401,7 +4355,7 @@ Object.defineProperty(exports, "__esModule", {
4401
4355
  value: true
4402
4356
  });
4403
4357
 
4404
- var react_1 = __webpack_require__(0);
4358
+ var react_1 = __webpack_require__(1);
4405
4359
 
4406
4360
  function usePrevious(value) {
4407
4361
  var ref = (0, react_1.useRef)();
@@ -4415,28 +4369,28 @@ exports.default = usePrevious;
4415
4369
 
4416
4370
  /***/ }),
4417
4371
 
4418
- /***/ 34:
4372
+ /***/ 33:
4419
4373
  /***/ (function(module, exports) {
4420
4374
 
4421
4375
  module.exports = require("@splunk/visualizations-shared/hocUtils");
4422
4376
 
4423
4377
  /***/ }),
4424
4378
 
4425
- /***/ 35:
4379
+ /***/ 34:
4426
4380
  /***/ (function(module, exports) {
4427
4381
 
4428
4382
  module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
4429
4383
 
4430
4384
  /***/ }),
4431
4385
 
4432
- /***/ 36:
4386
+ /***/ 35:
4433
4387
  /***/ (function(module, exports) {
4434
4388
 
4435
4389
  module.exports = require("@splunk/visualizations-shared/propUtils");
4436
4390
 
4437
4391
  /***/ }),
4438
4392
 
4439
- /***/ 37:
4393
+ /***/ 36:
4440
4394
  /***/ (function(module, exports, __webpack_require__) {
4441
4395
 
4442
4396
  "use strict";
@@ -4447,17 +4401,17 @@ Object.defineProperty(exports, "__esModule", {
4447
4401
  });
4448
4402
  exports.shouldShowIconPlaceholder = void 0;
4449
4403
 
4450
- var React = __webpack_require__(0);
4404
+ var React = __webpack_require__(1);
4451
4405
 
4452
- var T = __webpack_require__(1);
4406
+ var T = __webpack_require__(0);
4453
4407
 
4454
- var lodash_1 = __webpack_require__(3);
4408
+ var lodash_1 = __webpack_require__(2);
4455
4409
 
4456
- var i18n_1 = __webpack_require__(2);
4410
+ var i18n_1 = __webpack_require__(3);
4457
4411
 
4458
- var Message_1 = __webpack_require__(12);
4412
+ var Message_1 = __webpack_require__(11);
4459
4413
 
4460
- var FixedSizeContainer_1 = __webpack_require__(18);
4414
+ var FixedSizeContainer_1 = __webpack_require__(17);
4461
4415
  /**
4462
4416
  * @method shouldShowIconPlaceholder
4463
4417
  * @param {object} dataSources
@@ -4529,24 +4483,24 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
4529
4483
 
4530
4484
  /***/ }),
4531
4485
 
4532
- /***/ 38:
4486
+ /***/ 37:
4533
4487
  /***/ (function(module, exports, __webpack_require__) {
4534
4488
 
4535
4489
  "use strict";
4536
4490
 
4537
4491
 
4538
- var _defineProperty = __webpack_require__(13);
4492
+ var _defineProperty = __webpack_require__(12);
4539
4493
 
4540
4494
  Object.defineProperty(exports, "__esModule", {
4541
4495
  value: true
4542
4496
  });
4543
4497
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
4544
4498
 
4545
- var T = __webpack_require__(1);
4499
+ var T = __webpack_require__(0);
4546
4500
 
4547
- var lodash_1 = __webpack_require__(3);
4501
+ var lodash_1 = __webpack_require__(2);
4548
4502
 
4549
- var DataSource_1 = __webpack_require__(21);
4503
+ var DataSource_1 = __webpack_require__(20);
4550
4504
 
4551
4505
  exports.SortParamsPropTypes = T.shape({
4552
4506
  currentSortKey: T.string,
@@ -4600,7 +4554,7 @@ exports.getSortingParams = getSortingParams;
4600
4554
 
4601
4555
  /***/ }),
4602
4556
 
4603
- /***/ 39:
4557
+ /***/ 38:
4604
4558
  /***/ (function(module, exports, __webpack_require__) {
4605
4559
 
4606
4560
  "use strict";
@@ -4611,9 +4565,9 @@ Object.defineProperty(exports, "__esModule", {
4611
4565
  });
4612
4566
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
4613
4567
 
4614
- var T = __webpack_require__(1);
4568
+ var T = __webpack_require__(0);
4615
4569
 
4616
- var lodash_1 = __webpack_require__(3);
4570
+ var lodash_1 = __webpack_require__(2);
4617
4571
 
4618
4572
  exports.PaginatorParamsPropTypes = T.shape({
4619
4573
  isPaging: T.bool,
@@ -4665,14 +4619,7 @@ exports.getPaginationParams = getPaginationParams;
4665
4619
 
4666
4620
  /***/ }),
4667
4621
 
4668
- /***/ 4:
4669
- /***/ (function(module, exports) {
4670
-
4671
- module.exports = require("styled-components");
4672
-
4673
- /***/ }),
4674
-
4675
- /***/ 40:
4622
+ /***/ 39:
4676
4623
  /***/ (function(module, exports, __webpack_require__) {
4677
4624
 
4678
4625
  "use strict";
@@ -4707,11 +4654,13 @@ Object.defineProperty(exports, "__esModule", {
4707
4654
  value: true
4708
4655
  });
4709
4656
 
4657
+ __exportStar(__webpack_require__(40), exports);
4658
+
4710
4659
  __exportStar(__webpack_require__(41), exports);
4711
4660
 
4712
- __exportStar(__webpack_require__(42), exports);
4661
+ __exportStar(__webpack_require__(20), exports);
4713
4662
 
4714
- __exportStar(__webpack_require__(21), exports);
4663
+ __exportStar(__webpack_require__(42), exports);
4715
4664
 
4716
4665
  __exportStar(__webpack_require__(43), exports);
4717
4666
 
@@ -4723,13 +4672,13 @@ __exportStar(__webpack_require__(46), exports);
4723
4672
 
4724
4673
  __exportStar(__webpack_require__(47), exports);
4725
4674
 
4726
- __exportStar(__webpack_require__(48), exports);
4675
+ __exportStar(__webpack_require__(21), exports);
4727
4676
 
4728
- __exportStar(__webpack_require__(22), exports);
4677
+ __exportStar(__webpack_require__(7), exports);
4729
4678
 
4730
- __exportStar(__webpack_require__(8), exports);
4679
+ __exportStar(__webpack_require__(22), exports);
4731
4680
 
4732
- __exportStar(__webpack_require__(23), exports);
4681
+ __exportStar(__webpack_require__(48), exports);
4733
4682
 
4734
4683
  __exportStar(__webpack_require__(49), exports);
4735
4684
 
@@ -4741,11 +4690,16 @@ __exportStar(__webpack_require__(52), exports);
4741
4690
 
4742
4691
  __exportStar(__webpack_require__(53), exports);
4743
4692
 
4744
- __exportStar(__webpack_require__(54), exports);
4693
+ /***/ }),
4694
+
4695
+ /***/ 4:
4696
+ /***/ (function(module, exports) {
4697
+
4698
+ module.exports = require("styled-components");
4745
4699
 
4746
4700
  /***/ }),
4747
4701
 
4748
- /***/ 41:
4702
+ /***/ 40:
4749
4703
  /***/ (function(module, exports, __webpack_require__) {
4750
4704
 
4751
4705
  "use strict";
@@ -4757,7 +4711,7 @@ Object.defineProperty(exports, "__esModule", {
4757
4711
 
4758
4712
  /***/ }),
4759
4713
 
4760
- /***/ 42:
4714
+ /***/ 41:
4761
4715
  /***/ (function(module, exports, __webpack_require__) {
4762
4716
 
4763
4717
  "use strict";
@@ -4772,7 +4726,7 @@ Object.defineProperty(exports, "__esModule", {
4772
4726
 
4773
4727
  /***/ }),
4774
4728
 
4775
- /***/ 43:
4729
+ /***/ 42:
4776
4730
  /***/ (function(module, exports, __webpack_require__) {
4777
4731
 
4778
4732
  "use strict";
@@ -4784,7 +4738,7 @@ Object.defineProperty(exports, "__esModule", {
4784
4738
 
4785
4739
  /***/ }),
4786
4740
 
4787
- /***/ 44:
4741
+ /***/ 43:
4788
4742
  /***/ (function(module, exports, __webpack_require__) {
4789
4743
 
4790
4744
  "use strict";
@@ -4796,7 +4750,7 @@ Object.defineProperty(exports, "__esModule", {
4796
4750
 
4797
4751
  /***/ }),
4798
4752
 
4799
- /***/ 45:
4753
+ /***/ 44:
4800
4754
  /***/ (function(module, exports, __webpack_require__) {
4801
4755
 
4802
4756
  "use strict";
@@ -4808,7 +4762,7 @@ Object.defineProperty(exports, "__esModule", {
4808
4762
 
4809
4763
  /***/ }),
4810
4764
 
4811
- /***/ 46:
4765
+ /***/ 45:
4812
4766
  /***/ (function(module, exports, __webpack_require__) {
4813
4767
 
4814
4768
  "use strict";
@@ -4820,7 +4774,7 @@ Object.defineProperty(exports, "__esModule", {
4820
4774
 
4821
4775
  /***/ }),
4822
4776
 
4823
- /***/ 47:
4777
+ /***/ 46:
4824
4778
  /***/ (function(module, exports, __webpack_require__) {
4825
4779
 
4826
4780
  "use strict";
@@ -4832,7 +4786,7 @@ Object.defineProperty(exports, "__esModule", {
4832
4786
 
4833
4787
  /***/ }),
4834
4788
 
4835
- /***/ 48:
4789
+ /***/ 47:
4836
4790
  /***/ (function(module, exports, __webpack_require__) {
4837
4791
 
4838
4792
  "use strict";
@@ -4844,7 +4798,7 @@ Object.defineProperty(exports, "__esModule", {
4844
4798
 
4845
4799
  /***/ }),
4846
4800
 
4847
- /***/ 49:
4801
+ /***/ 48:
4848
4802
  /***/ (function(module, exports, __webpack_require__) {
4849
4803
 
4850
4804
  "use strict";
@@ -4856,7 +4810,7 @@ Object.defineProperty(exports, "__esModule", {
4856
4810
 
4857
4811
  /***/ }),
4858
4812
 
4859
- /***/ 493:
4813
+ /***/ 485:
4860
4814
  /***/ (function(module, exports, __webpack_require__) {
4861
4815
 
4862
4816
  "use strict";
@@ -4880,11 +4834,11 @@ Object.defineProperty(exports, "__esModule", {
4880
4834
  });
4881
4835
  exports.themes = exports.computeVizProps = exports.PureSingleValueRadialThemes = exports.PureSingleValueRadial = exports.config = void 0;
4882
4836
 
4883
- var SingleValueRadial_1 = __webpack_require__(512);
4837
+ var SingleValueRadial_1 = __webpack_require__(504);
4884
4838
 
4885
- var withDashboardViz_1 = __webpack_require__(55);
4839
+ var withDashboardViz_1 = __webpack_require__(54);
4886
4840
 
4887
- var config_1 = __webpack_require__(494);
4841
+ var config_1 = __webpack_require__(486);
4888
4842
 
4889
4843
  var withTrellis_1 = __webpack_require__(127);
4890
4844
 
@@ -4913,43 +4867,43 @@ exports.default = viz;
4913
4867
 
4914
4868
  /***/ }),
4915
4869
 
4916
- /***/ 494:
4870
+ /***/ 486:
4917
4871
  /***/ (function(module, exports, __webpack_require__) {
4918
4872
 
4919
4873
  "use strict";
4920
4874
 
4921
4875
 
4922
- var _toConsumableArray = __webpack_require__(7);
4876
+ var _toConsumableArray = __webpack_require__(6);
4923
4877
 
4924
4878
  Object.defineProperty(exports, "__esModule", {
4925
4879
  value: true
4926
4880
  });
4927
4881
 
4928
- var i18n_1 = __webpack_require__(2);
4882
+ var i18n_1 = __webpack_require__(3);
4929
4883
 
4930
- var visualization_schemas_1 = __webpack_require__(10);
4884
+ var visualization_schemas_1 = __webpack_require__(9);
4931
4885
 
4932
- var pick_1 = __webpack_require__(30);
4886
+ var pick_1 = __webpack_require__(29);
4933
4887
 
4934
- var variables_1 = __webpack_require__(14);
4888
+ var variables_1 = __webpack_require__(13);
4935
4889
 
4936
- var PresetPalettes_1 = __webpack_require__(81);
4890
+ var PresetPalettes_1 = __webpack_require__(80);
4937
4891
 
4938
- var visualization_icons_1 = __webpack_require__(72);
4892
+ var visualization_icons_1 = __webpack_require__(71);
4939
4893
 
4940
- var placeholders_1 = __webpack_require__(71);
4894
+ var placeholders_1 = __webpack_require__(70);
4941
4895
 
4942
- var configUtils_1 = __webpack_require__(29);
4896
+ var configUtils_1 = __webpack_require__(28);
4943
4897
 
4944
4898
  var StaticMajorAndTrendLayout_1 = __webpack_require__(123);
4945
4899
 
4946
- var VizBehavior_1 = __webpack_require__(8);
4900
+ var VizBehavior_1 = __webpack_require__(7);
4947
4901
 
4948
- var configUtils_2 = __webpack_require__(27);
4902
+ var configUtils_2 = __webpack_require__(26);
4949
4903
 
4950
- var VizCategory_1 = __webpack_require__(23);
4904
+ var VizCategory_1 = __webpack_require__(22);
4951
4905
 
4952
- var DynamicMajorColorAndGaugeEditor_1 = __webpack_require__(495);
4906
+ var DynamicMajorColorAndGaugeEditor_1 = __webpack_require__(487);
4953
4907
 
4954
4908
  var DynamicTrendColorEditor_1 = __webpack_require__(121);
4955
4909
 
@@ -4959,9 +4913,9 @@ var StaticMajorColorEditor_1 = __webpack_require__(124);
4959
4913
 
4960
4914
  var StaticTrendColorEditor_1 = __webpack_require__(125);
4961
4915
 
4962
- var StaticBackgroundColorEditor_1 = __webpack_require__(112);
4916
+ var StaticBackgroundColorEditor_1 = __webpack_require__(111);
4963
4917
 
4964
- var RadialBackgroundColor_1 = __webpack_require__(496);
4918
+ var RadialBackgroundColor_1 = __webpack_require__(488);
4965
4919
 
4966
4920
  var TrellisEditors_1 = __webpack_require__(126);
4967
4921
 
@@ -5193,7 +5147,15 @@ var editorConfig = [{
5193
5147
  })], [(0, DynamicTrendColorEditor_1.getDynamicTrendColorEditor)({
5194
5148
  defaultContext: defaultContext,
5195
5149
  defaultPalettesConfig: PresetPalettes_1.defaultPalettesConfig
5196
- })], (0, RadialBackgroundColor_1.default)({
5150
+ })], [{
5151
+ label: (0, i18n_1._)('Major value abbreviation'),
5152
+ option: 'shouldAbbreviateMajorValue',
5153
+ editor: 'editor.checkbox'
5154
+ }], [{
5155
+ label: (0, i18n_1._)('Trend value abbreviation'),
5156
+ option: 'shouldAbbreviateTrendValue',
5157
+ editor: 'editor.checkbox'
5158
+ }], (0, RadialBackgroundColor_1.default)({
5197
5159
  themes: themes
5198
5160
  }), [Object.assign(Object.assign({}, StaticBackgroundColorEditor_1.default), {
5199
5161
  editorProps: {
@@ -5255,15 +5217,15 @@ exports.default = (0, configUtils_2.enhanceConfig)(config);
5255
5217
 
5256
5218
  /***/ }),
5257
5219
 
5258
- /***/ 495:
5220
+ /***/ 487:
5259
5221
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5260
5222
 
5261
5223
  "use strict";
5262
5224
  __webpack_require__.r(__webpack_exports__);
5263
5225
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDynamicMajorColorAndGaugeEditor", function() { return getDynamicMajorColorAndGaugeEditor; });
5264
- /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
5226
+ /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
5265
5227
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__);
5266
- /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29);
5228
+ /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28);
5267
5229
  /* harmony import */ var _splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_configUtils__WEBPACK_IMPORTED_MODULE_1__);
5268
5230
 
5269
5231
 
@@ -5300,7 +5262,7 @@ var getDynamicMajorColorAndGaugeEditor = function getDynamicMajorColorAndGaugeEd
5300
5262
 
5301
5263
  /***/ }),
5302
5264
 
5303
- /***/ 496:
5265
+ /***/ 488:
5304
5266
  /***/ (function(module, exports, __webpack_require__) {
5305
5267
 
5306
5268
  "use strict";
@@ -5310,7 +5272,7 @@ Object.defineProperty(exports, "__esModule", {
5310
5272
  value: true
5311
5273
  });
5312
5274
 
5313
- var i18n_1 = __webpack_require__(2);
5275
+ var i18n_1 = __webpack_require__(3);
5314
5276
 
5315
5277
  var radialBackground = function radialBackground(_ref) {
5316
5278
  var label = _ref.label,
@@ -5331,7 +5293,7 @@ exports.default = radialBackground;
5331
5293
 
5332
5294
  /***/ }),
5333
5295
 
5334
- /***/ 50:
5296
+ /***/ 49:
5335
5297
  /***/ (function(module, exports, __webpack_require__) {
5336
5298
 
5337
5299
  "use strict";
@@ -5343,7 +5305,14 @@ Object.defineProperty(exports, "__esModule", {
5343
5305
 
5344
5306
  /***/ }),
5345
5307
 
5346
- /***/ 51:
5308
+ /***/ 5:
5309
+ /***/ (function(module, exports) {
5310
+
5311
+ module.exports = require("@babel/runtime/helpers/slicedToArray");
5312
+
5313
+ /***/ }),
5314
+
5315
+ /***/ 50:
5347
5316
  /***/ (function(module, exports, __webpack_require__) {
5348
5317
 
5349
5318
  "use strict";
@@ -5355,7 +5324,7 @@ Object.defineProperty(exports, "__esModule", {
5355
5324
 
5356
5325
  /***/ }),
5357
5326
 
5358
- /***/ 512:
5327
+ /***/ 504:
5359
5328
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5360
5329
 
5361
5330
  "use strict";
@@ -5363,27 +5332,27 @@ Object.defineProperty(exports, "__esModule", {
5363
5332
  __webpack_require__.r(__webpack_exports__);
5364
5333
 
5365
5334
  // EXTERNAL MODULE: external "@babel/runtime/helpers/slicedToArray"
5366
- var slicedToArray_ = __webpack_require__(6);
5335
+ var slicedToArray_ = __webpack_require__(5);
5367
5336
  var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray_);
5368
5337
 
5369
5338
  // EXTERNAL MODULE: external "@babel/runtime/helpers/extends"
5370
- var extends_ = __webpack_require__(69);
5339
+ var extends_ = __webpack_require__(68);
5371
5340
  var extends_default = /*#__PURE__*/__webpack_require__.n(extends_);
5372
5341
 
5373
5342
  // EXTERNAL MODULE: external "react"
5374
- var external_react_ = __webpack_require__(0);
5343
+ var external_react_ = __webpack_require__(1);
5375
5344
  var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
5376
5345
 
5377
5346
  // EXTERNAL MODULE: external "prop-types"
5378
- var external_prop_types_ = __webpack_require__(1);
5347
+ var external_prop_types_ = __webpack_require__(0);
5379
5348
  var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
5380
5349
 
5381
5350
  // EXTERNAL MODULE: external "@splunk/themes/pick"
5382
- var pick_ = __webpack_require__(30);
5351
+ var pick_ = __webpack_require__(29);
5383
5352
  var pick_default = /*#__PURE__*/__webpack_require__.n(pick_);
5384
5353
 
5385
5354
  // EXTERNAL MODULE: external "@splunk/themes/variables"
5386
- var variables_ = __webpack_require__(14);
5355
+ var variables_ = __webpack_require__(13);
5387
5356
  var variables_default = /*#__PURE__*/__webpack_require__.n(variables_);
5388
5357
 
5389
5358
  // EXTERNAL MODULE: external "styled-components"
@@ -5391,37 +5360,37 @@ var external_styled_components_ = __webpack_require__(4);
5391
5360
  var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
5392
5361
 
5393
5362
  // EXTERNAL MODULE: external "lodash"
5394
- var external_lodash_ = __webpack_require__(3);
5363
+ var external_lodash_ = __webpack_require__(2);
5395
5364
 
5396
5365
  // EXTERNAL MODULE: external "@splunk/visualization-context/FeatureFlagContext"
5397
- var FeatureFlagContext_ = __webpack_require__(28);
5366
+ var FeatureFlagContext_ = __webpack_require__(27);
5398
5367
  var FeatureFlagContext_default = /*#__PURE__*/__webpack_require__.n(FeatureFlagContext_);
5399
5368
 
5400
5369
  // EXTERNAL MODULE: external "@splunk/visualizations-shared/style"
5401
- var style_ = __webpack_require__(19);
5370
+ var style_ = __webpack_require__(18);
5402
5371
 
5403
5372
  // EXTERNAL MODULE: external "@splunk/visualizations-shared/SizeAwareWrapper"
5404
- var SizeAwareWrapper_ = __webpack_require__(26);
5373
+ var SizeAwareWrapper_ = __webpack_require__(25);
5405
5374
  var SizeAwareWrapper_default = /*#__PURE__*/__webpack_require__.n(SizeAwareWrapper_);
5406
5375
 
5407
5376
  // EXTERNAL MODULE: external "@splunk/visualization-schemas"
5408
- var visualization_schemas_ = __webpack_require__(10);
5377
+ var visualization_schemas_ = __webpack_require__(9);
5409
5378
 
5410
5379
  // EXTERNAL MODULE: ./src/common/components/VizStyleWrapper.jsx
5411
- var VizStyleWrapper = __webpack_require__(94);
5380
+ var VizStyleWrapper = __webpack_require__(93);
5412
5381
 
5413
5382
  // EXTERNAL MODULE: ./src/common/components/TrellisTitle.tsx
5414
- var TrellisTitle = __webpack_require__(100);
5383
+ var TrellisTitle = __webpack_require__(99);
5415
5384
 
5416
5385
  // EXTERNAL MODULE: external "@babel/runtime/helpers/defineProperty"
5417
- var defineProperty_ = __webpack_require__(13);
5386
+ var defineProperty_ = __webpack_require__(12);
5418
5387
  var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
5419
5388
 
5420
5389
  // EXTERNAL MODULE: ./src/SingleValueBasic/SingleValueBasic.jsx + 2 modules
5421
- var SingleValueBasic = __webpack_require__(102);
5390
+ var SingleValueBasic = __webpack_require__(101);
5422
5391
 
5423
5392
  // EXTERNAL MODULE: external "@splunk/visualizations-shared/colorConstants"
5424
- var colorConstants_ = __webpack_require__(70);
5393
+ var colorConstants_ = __webpack_require__(69);
5425
5394
 
5426
5395
  // CONCATENATED MODULE: ./src/SingleValueRadial/PureSingleValueRadial/RadialGraph.jsx
5427
5396
 
@@ -5491,10 +5460,10 @@ RadialGraph_RadialGraph.defaultProps = {
5491
5460
  };
5492
5461
  /* harmony default export */ var PureSingleValueRadial_RadialGraph = (RadialGraph_RadialGraph);
5493
5462
  // EXTERNAL MODULE: ./src/SingleValueRadial/PureSingleValueRadial/utils/displayUtils.js
5494
- var displayUtils = __webpack_require__(101);
5463
+ var displayUtils = __webpack_require__(100);
5495
5464
 
5496
5465
  // EXTERNAL MODULE: ./src/SingleValueRadial/PureSingleValueRadial/GaugeGraph.tsx
5497
- var GaugeGraph = __webpack_require__(195);
5466
+ var GaugeGraph = __webpack_require__(193);
5498
5467
  var GaugeGraph_default = /*#__PURE__*/__webpack_require__.n(GaugeGraph);
5499
5468
 
5500
5469
  // CONCATENATED MODULE: ./src/SingleValueRadial/PureSingleValueRadial/RadialLayout.jsx
@@ -5714,10 +5683,10 @@ RadialLayout_RadialContent.propTypes = _objectSpread(_objectSpread({}, SingleVal
5714
5683
  });
5715
5684
  /* harmony default export */ var RadialLayout = (RadialLayout_RadialContent);
5716
5685
  // EXTERNAL MODULE: ./src/common/utils/singleValueUtils.js
5717
- var singleValueUtils = __webpack_require__(20);
5686
+ var singleValueUtils = __webpack_require__(19);
5718
5687
 
5719
5688
  // EXTERNAL MODULE: ./src/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.ts
5720
- var gaugeUtils = __webpack_require__(116);
5689
+ var gaugeUtils = __webpack_require__(115);
5721
5690
 
5722
5691
  // CONCATENATED MODULE: ./src/SingleValueRadial/PureSingleValueRadial/SingleValueRadial.jsx
5723
5692
 
@@ -5766,6 +5735,7 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
5766
5735
  numberPrecision = props.numberPrecision,
5767
5736
  shouldUseThousandSeparators = props.shouldUseThousandSeparators,
5768
5737
  shouldAbbreviateTrendValue = props.shouldAbbreviateTrendValue,
5738
+ shouldAbbreviateMajorValue = props.shouldAbbreviateMajorValue,
5769
5739
  onValueClick = props.onValueClick,
5770
5740
  splitByLayout = props.splitByLayout,
5771
5741
  _props$trellisKey = props.trellisKey,
@@ -5879,6 +5849,7 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
5879
5849
  numberPrecision: numberPrecision,
5880
5850
  shouldUseThousandSeparators: shouldUseThousandSeparators,
5881
5851
  shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
5852
+ shouldAbbreviateMajorValue: shouldAbbreviateMajorValue,
5882
5853
  smallViz: !showRadialGraph
5883
5854
  }),
5884
5855
  majorText = _computeSingleValueRa.majorText,
@@ -5971,6 +5942,7 @@ SingleValueRadial_SingleValueRadial.propTypes = {
5971
5942
  trendDisplay: external_prop_types_["string"],
5972
5943
  trendIndicatorPosition: external_prop_types_["oneOf"](['standard', 'below', 'outside']),
5973
5944
  shouldAbbreviateTrendValue: external_prop_types_["bool"],
5945
+ shouldAbbreviateMajorValue: external_prop_types_["bool"],
5974
5946
  backgroundColor: external_prop_types_["string"],
5975
5947
  unit: external_prop_types_["string"],
5976
5948
  unitPosition: external_prop_types_["string"],
@@ -5997,6 +5969,7 @@ SingleValueRadial_SingleValueRadial.defaultProps = {
5997
5969
  trendDisplay: 'absolute',
5998
5970
  trendIndicatorPosition: 'standard',
5999
5971
  shouldAbbreviateTrendValue: false,
5972
+ shouldAbbreviateMajorValue: false,
6000
5973
  unitPosition: 'after',
6001
5974
  numberPrecision: 0,
6002
5975
  shouldUseThousandSeparators: true,
@@ -6008,7 +5981,7 @@ SingleValueRadial_SingleValueRadial.defaultProps = {
6008
5981
 
6009
5982
  /***/ }),
6010
5983
 
6011
- /***/ 52:
5984
+ /***/ 51:
6012
5985
  /***/ (function(module, exports, __webpack_require__) {
6013
5986
 
6014
5987
  "use strict";
@@ -6020,7 +5993,7 @@ Object.defineProperty(exports, "__esModule", {
6020
5993
 
6021
5994
  /***/ }),
6022
5995
 
6023
- /***/ 53:
5996
+ /***/ 52:
6024
5997
  /***/ (function(module, exports, __webpack_require__) {
6025
5998
 
6026
5999
  "use strict";
@@ -6032,7 +6005,7 @@ Object.defineProperty(exports, "__esModule", {
6032
6005
 
6033
6006
  /***/ }),
6034
6007
 
6035
- /***/ 54:
6008
+ /***/ 53:
6036
6009
  /***/ (function(module, exports, __webpack_require__) {
6037
6010
 
6038
6011
  "use strict";
@@ -6044,65 +6017,65 @@ Object.defineProperty(exports, "__esModule", {
6044
6017
 
6045
6018
  /***/ }),
6046
6019
 
6047
- /***/ 55:
6020
+ /***/ 54:
6048
6021
  /***/ (function(module, exports, __webpack_require__) {
6049
6022
 
6050
6023
  "use strict";
6051
6024
 
6052
6025
 
6053
- var _slicedToArray = __webpack_require__(6);
6026
+ var _slicedToArray = __webpack_require__(5);
6054
6027
 
6055
6028
  Object.defineProperty(exports, "__esModule", {
6056
6029
  value: true
6057
6030
  });
6058
6031
 
6059
- var React = __webpack_require__(0);
6032
+ var React = __webpack_require__(1);
6060
6033
 
6061
- var lodash_1 = __webpack_require__(3);
6034
+ var lodash_1 = __webpack_require__(2);
6062
6035
 
6063
- var getSettingsFromThemedProps_1 = __webpack_require__(56);
6036
+ var getSettingsFromThemedProps_1 = __webpack_require__(55);
6064
6037
 
6065
- var Options_1 = __webpack_require__(17);
6038
+ var Options_1 = __webpack_require__(16);
6066
6039
 
6067
- var SanitizeProps_1 = __webpack_require__(57);
6040
+ var SanitizeProps_1 = __webpack_require__(56);
6068
6041
 
6069
- var TimezoneContext_1 = __webpack_require__(32);
6042
+ var TimezoneContext_1 = __webpack_require__(31);
6070
6043
 
6071
- var moment_1 = __webpack_require__(58);
6044
+ var moment_1 = __webpack_require__(57);
6072
6045
 
6073
- var FeatureFlagContext_1 = __webpack_require__(28);
6046
+ var FeatureFlagContext_1 = __webpack_require__(27);
6074
6047
 
6075
6048
  var styled_components_1 = __webpack_require__(4);
6076
6049
 
6077
- var hocUtils_1 = __webpack_require__(34);
6050
+ var hocUtils_1 = __webpack_require__(33);
6078
6051
 
6079
- var JSONSchemaUtils_1 = __webpack_require__(35);
6052
+ var JSONSchemaUtils_1 = __webpack_require__(34);
6080
6053
 
6081
- var async_dynamic_options_evaluator_1 = __webpack_require__(59);
6054
+ var async_dynamic_options_evaluator_1 = __webpack_require__(58);
6082
6055
 
6083
- var id_1 = __webpack_require__(31);
6056
+ var id_1 = __webpack_require__(30);
6084
6057
 
6085
- var SplunkVisualization_1 = __webpack_require__(60);
6058
+ var SplunkVisualization_1 = __webpack_require__(59);
6086
6059
 
6087
- var VizBehavior_1 = __webpack_require__(8);
6060
+ var VizBehavior_1 = __webpack_require__(7);
6088
6061
 
6089
- var getSorting_1 = __webpack_require__(38);
6062
+ var getSorting_1 = __webpack_require__(37);
6090
6063
 
6091
- var getPagination_1 = __webpack_require__(39);
6064
+ var getPagination_1 = __webpack_require__(38);
6092
6065
 
6093
- var useDeepMemo_1 = __webpack_require__(61);
6066
+ var useDeepMemo_1 = __webpack_require__(60);
6094
6067
 
6095
- var MissingPropsMessage_1 = __webpack_require__(62);
6068
+ var MissingPropsMessage_1 = __webpack_require__(61);
6096
6069
 
6097
- var withEditModeCover_1 = __webpack_require__(63);
6070
+ var withEditModeCover_1 = __webpack_require__(62);
6098
6071
 
6099
- var withPlaceholder_1 = __webpack_require__(64);
6072
+ var withPlaceholder_1 = __webpack_require__(63);
6100
6073
 
6101
- var useDownsampleDataSources_1 = __webpack_require__(65);
6074
+ var useDownsampleDataSources_1 = __webpack_require__(64);
6102
6075
 
6103
- var dataUtils_1 = __webpack_require__(15);
6076
+ var dataUtils_1 = __webpack_require__(14);
6104
6077
 
6105
- var featureFlagUtils_1 = __webpack_require__(67);
6078
+ var featureFlagUtils_1 = __webpack_require__(66);
6106
6079
  /**
6107
6080
  * hoc that wraps a pure react visualization in a Dashboard visualization
6108
6081
  * @param {DashboardVizOpts} opts
@@ -6435,48 +6408,41 @@ exports.default = withDashboardViz;
6435
6408
 
6436
6409
  /***/ }),
6437
6410
 
6438
- /***/ 56:
6411
+ /***/ 55:
6439
6412
  /***/ (function(module, exports) {
6440
6413
 
6441
6414
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
6442
6415
 
6443
6416
  /***/ }),
6444
6417
 
6445
- /***/ 57:
6418
+ /***/ 56:
6446
6419
  /***/ (function(module, exports) {
6447
6420
 
6448
6421
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
6449
6422
 
6450
6423
  /***/ }),
6451
6424
 
6452
- /***/ 58:
6425
+ /***/ 57:
6453
6426
  /***/ (function(module, exports) {
6454
6427
 
6455
6428
  module.exports = require("@splunk/moment");
6456
6429
 
6457
6430
  /***/ }),
6458
6431
 
6459
- /***/ 59:
6432
+ /***/ 58:
6460
6433
  /***/ (function(module, exports) {
6461
6434
 
6462
6435
  module.exports = require("@splunk/async-dynamic-options-evaluator");
6463
6436
 
6464
6437
  /***/ }),
6465
6438
 
6466
- /***/ 6:
6467
- /***/ (function(module, exports) {
6468
-
6469
- module.exports = require("@babel/runtime/helpers/slicedToArray");
6470
-
6471
- /***/ }),
6472
-
6473
- /***/ 60:
6439
+ /***/ 59:
6474
6440
  /***/ (function(module, exports, __webpack_require__) {
6475
6441
 
6476
6442
  "use strict";
6477
6443
 
6478
6444
 
6479
- var _classCallCheck = __webpack_require__(9);
6445
+ var _classCallCheck = __webpack_require__(8);
6480
6446
 
6481
6447
  Object.defineProperty(exports, "__esModule", {
6482
6448
  value: true
@@ -6484,11 +6450,11 @@ Object.defineProperty(exports, "__esModule", {
6484
6450
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
6485
6451
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
6486
6452
 
6487
- var T = __webpack_require__(1);
6453
+ var T = __webpack_require__(0);
6488
6454
 
6489
- var lodash_1 = __webpack_require__(3);
6455
+ var lodash_1 = __webpack_require__(2);
6490
6456
 
6491
- var VizActionHandler_1 = __webpack_require__(22); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
6457
+ var VizActionHandler_1 = __webpack_require__(21); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
6492
6458
 
6493
6459
 
6494
6460
  exports.INITIAL_WIDTH = 250;
@@ -6622,7 +6588,14 @@ exports.default = SplunkVisualization;
6622
6588
 
6623
6589
  /***/ }),
6624
6590
 
6625
- /***/ 61:
6591
+ /***/ 6:
6592
+ /***/ (function(module, exports) {
6593
+
6594
+ module.exports = require("@babel/runtime/helpers/toConsumableArray");
6595
+
6596
+ /***/ }),
6597
+
6598
+ /***/ 60:
6626
6599
  /***/ (function(module, exports, __webpack_require__) {
6627
6600
 
6628
6601
  "use strict";
@@ -6633,9 +6606,9 @@ Object.defineProperty(exports, "__esModule", {
6633
6606
  });
6634
6607
  exports.useDeepMemo = void 0;
6635
6608
 
6636
- var react_1 = __webpack_require__(0);
6609
+ var react_1 = __webpack_require__(1);
6637
6610
 
6638
- var lodash_1 = __webpack_require__(3);
6611
+ var lodash_1 = __webpack_require__(2);
6639
6612
  /**
6640
6613
  * This hook evaluates and stores the result of a passed function and only
6641
6614
  * re-evaluates the function when passed dependencies change.
@@ -6668,7 +6641,7 @@ exports.useDeepMemo = useDeepMemo;
6668
6641
 
6669
6642
  /***/ }),
6670
6643
 
6671
- /***/ 62:
6644
+ /***/ 61:
6672
6645
  /***/ (function(module, exports, __webpack_require__) {
6673
6646
 
6674
6647
  "use strict";
@@ -6679,15 +6652,15 @@ Object.defineProperty(exports, "__esModule", {
6679
6652
  });
6680
6653
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
6681
6654
 
6682
- var React = __webpack_require__(0);
6655
+ var React = __webpack_require__(1);
6683
6656
 
6684
- var T = __webpack_require__(1);
6657
+ var T = __webpack_require__(0);
6685
6658
 
6686
- var i18n_1 = __webpack_require__(2);
6659
+ var i18n_1 = __webpack_require__(3);
6687
6660
 
6688
- var Message_1 = __webpack_require__(12);
6661
+ var Message_1 = __webpack_require__(11);
6689
6662
 
6690
- var FixedSizeContainer_1 = __webpack_require__(18);
6663
+ var FixedSizeContainer_1 = __webpack_require__(17);
6691
6664
  /**
6692
6665
  * @method isMissing
6693
6666
  * @param {any} v
@@ -6749,7 +6722,7 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
6749
6722
 
6750
6723
  /***/ }),
6751
6724
 
6752
- /***/ 63:
6725
+ /***/ 62:
6753
6726
  /***/ (function(module, exports, __webpack_require__) {
6754
6727
 
6755
6728
  "use strict";
@@ -6759,18 +6732,18 @@ Object.defineProperty(exports, "__esModule", {
6759
6732
  value: true
6760
6733
  });
6761
6734
 
6762
- var React = __webpack_require__(0);
6735
+ var React = __webpack_require__(1);
6763
6736
 
6764
6737
  var styled_components_1 = __webpack_require__(4);
6765
6738
 
6766
- var hocUtils_1 = __webpack_require__(24);
6739
+ var hocUtils_1 = __webpack_require__(23);
6767
6740
 
6768
6741
  var Cover = styled_components_1.default.div.withConfig({
6769
6742
  displayName: "withEditModeCover__Cover",
6770
6743
  componentId: "sc-1gsbnxb-0"
6771
6744
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
6772
6745
  var Blocker = styled_components_1.default.div.attrs({
6773
- 'data-splunk-visualization-version': "26.3.0 - a1ef240a6"
6746
+ 'data-splunk-visualization-version': "26.4.0 - 04078274d"
6774
6747
  }).withConfig({
6775
6748
  displayName: "withEditModeCover__Blocker",
6776
6749
  componentId: "sc-1gsbnxb-1"
@@ -6802,7 +6775,7 @@ exports.default = withEditModeCover;
6802
6775
 
6803
6776
  /***/ }),
6804
6777
 
6805
- /***/ 64:
6778
+ /***/ 63:
6806
6779
  /***/ (function(module, exports, __webpack_require__) {
6807
6780
 
6808
6781
  "use strict";
@@ -6812,17 +6785,17 @@ Object.defineProperty(exports, "__esModule", {
6812
6785
  value: true
6813
6786
  });
6814
6787
 
6815
- var React = __webpack_require__(0);
6788
+ var React = __webpack_require__(1);
6816
6789
 
6817
- var colorUtils_1 = __webpack_require__(16);
6790
+ var colorUtils_1 = __webpack_require__(15);
6818
6791
 
6819
- var variables_1 = __webpack_require__(14);
6792
+ var variables_1 = __webpack_require__(13);
6820
6793
 
6821
- var IconPlaceholder_1 = __webpack_require__(37);
6794
+ var IconPlaceholder_1 = __webpack_require__(36);
6822
6795
 
6823
- var VizBehavior_1 = __webpack_require__(8);
6796
+ var VizBehavior_1 = __webpack_require__(7);
6824
6797
 
6825
- var hocUtils_1 = __webpack_require__(24);
6798
+ var hocUtils_1 = __webpack_require__(23);
6826
6799
 
6827
6800
  var withPlaceholder = function withPlaceholder(Visualization) {
6828
6801
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
@@ -6867,27 +6840,30 @@ exports.default = withPlaceholder;
6867
6840
 
6868
6841
  /***/ }),
6869
6842
 
6870
- /***/ 65:
6843
+ /***/ 64:
6871
6844
  /***/ (function(module, exports, __webpack_require__) {
6872
6845
 
6873
6846
  "use strict";
6874
6847
 
6875
6848
 
6876
- var _slicedToArray = __webpack_require__(6);
6849
+ var _slicedToArray = __webpack_require__(5);
6877
6850
 
6878
6851
  Object.defineProperty(exports, "__esModule", {
6879
6852
  value: true
6880
6853
  });
6881
6854
 
6882
- var react_1 = __webpack_require__(0);
6855
+ var react_1 = __webpack_require__(1);
6856
+
6857
+ var lodash_1 = __webpack_require__(2);
6883
6858
 
6884
- var lodash_1 = __webpack_require__(3);
6859
+ var dataUtils_1 = __webpack_require__(14);
6885
6860
 
6886
- var dataUtils_1 = __webpack_require__(15);
6861
+ var usePrevious_1 = __webpack_require__(32);
6887
6862
 
6888
- var usePrevious_1 = __webpack_require__(33);
6863
+ var useGetXAndYFields_1 = __webpack_require__(65); // Options properties which impact/require re-downsample on change.
6889
6864
 
6890
- var useGetXAndYFields_1 = __webpack_require__(66);
6865
+
6866
+ var downsampleVizOptionProperties = ['nullValueDisplay'];
6891
6867
 
6892
6868
  var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
6893
6869
  var dataSources = _ref.dataSources,
@@ -6901,8 +6877,15 @@ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
6901
6877
  options: options,
6902
6878
  context: context,
6903
6879
  dataSources: dataSources
6904
- });
6905
- var previousXAndYFieldsWithTypes = (0, usePrevious_1.default)(xAndYFieldsWithTypes);
6880
+ }); // Extract viz options that impact downsampling.
6881
+
6882
+ var downsampleVizOptions = (0, react_1.useMemo)(function () {
6883
+ return (0, lodash_1.pick)(options, downsampleVizOptionProperties);
6884
+ }, [options]);
6885
+ var downsampleDSOptions = (0, react_1.useMemo)(function () {
6886
+ return Object.assign(Object.assign({}, downsampleVizOptions), xAndYFieldsWithTypes);
6887
+ }, [xAndYFieldsWithTypes, downsampleVizOptions]);
6888
+ var previousDownsampleDSOptions = (0, usePrevious_1.default)(downsampleDSOptions);
6906
6889
  var previousDataSources = (0, usePrevious_1.default)(dataSources);
6907
6890
  var previousThreshold = (0, usePrevious_1.default)(threshold);
6908
6891
 
@@ -6910,7 +6893,7 @@ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
6910
6893
  return isDownsamplingEnabled ? (0, dataUtils_1.downsampleDataSources)({
6911
6894
  dataSources: dataSources,
6912
6895
  threshold: threshold,
6913
- options: xAndYFieldsWithTypes
6896
+ options: downsampleDSOptions
6914
6897
  }) : dataSources;
6915
6898
  }),
6916
6899
  _ref3 = _slicedToArray(_ref2, 2),
@@ -6938,7 +6921,7 @@ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
6938
6921
  return;
6939
6922
  }
6940
6923
 
6941
- if ((0, lodash_1.isEqual)(previousXAndYFieldsWithTypes, xAndYFieldsWithTypes) && previousDataSources === dataSources && previousThreshold === threshold) {
6924
+ if ((0, lodash_1.isEqual)(previousDownsampleDSOptions, downsampleDSOptions) && previousDataSources === dataSources && previousThreshold === threshold) {
6942
6925
  return;
6943
6926
  } // Debounce the downsampling so we don't have to downsample and execute DSL multiple times
6944
6927
  // while the viz is being resized
@@ -6946,10 +6929,10 @@ var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
6946
6929
 
6947
6930
  debouncedDownsampleDataSources({
6948
6931
  dataSources: dataSources,
6949
- options: xAndYFieldsWithTypes,
6932
+ options: downsampleDSOptions,
6950
6933
  threshold: threshold
6951
6934
  }); // need to detect if this runs as part of the initial render
6952
- }, [dataSources, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousXAndYFieldsWithTypes, previousDataSources, previousThreshold]);
6935
+ }, [dataSources, downsampleDSOptions, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousDataSources, previousThreshold, previousDownsampleDSOptions]);
6953
6936
  return downsampledDataSources;
6954
6937
  };
6955
6938
 
@@ -6957,21 +6940,21 @@ exports.default = useDownsampleDataSources;
6957
6940
 
6958
6941
  /***/ }),
6959
6942
 
6960
- /***/ 66:
6943
+ /***/ 65:
6961
6944
  /***/ (function(module, exports, __webpack_require__) {
6962
6945
 
6963
6946
  "use strict";
6964
6947
 
6965
6948
 
6966
- var _toConsumableArray = __webpack_require__(7);
6949
+ var _toConsumableArray = __webpack_require__(6);
6967
6950
 
6968
6951
  Object.defineProperty(exports, "__esModule", {
6969
6952
  value: true
6970
6953
  });
6971
6954
 
6972
- var react_1 = __webpack_require__(0);
6955
+ var react_1 = __webpack_require__(1);
6973
6956
 
6974
- var Options_1 = __webpack_require__(17);
6957
+ var Options_1 = __webpack_require__(16);
6975
6958
  /**
6976
6959
  * Hook that evaluates the DSL for subset of a viz's options needed to determine
6977
6960
  * its x and y fields as well as the types of all its fields.
@@ -7072,7 +7055,7 @@ exports.default = useGetXAndYFields;
7072
7055
 
7073
7056
  /***/ }),
7074
7057
 
7075
- /***/ 67:
7058
+ /***/ 66:
7076
7059
  /***/ (function(module, exports, __webpack_require__) {
7077
7060
 
7078
7061
  "use strict";
@@ -7083,7 +7066,7 @@ Object.defineProperty(exports, "__esModule", {
7083
7066
  });
7084
7067
  exports.getFeatureFlag = void 0;
7085
7068
 
7086
- var FeatureFlags_1 = __webpack_require__(68);
7069
+ var FeatureFlags_1 = __webpack_require__(67);
7087
7070
 
7088
7071
  var getFeatureFlag = function getFeatureFlag(context, flagName) {
7089
7072
  // look for feature flag in context first
@@ -7108,63 +7091,28 @@ exports.getFeatureFlag = getFeatureFlag;
7108
7091
 
7109
7092
  /***/ }),
7110
7093
 
7111
- /***/ 68:
7094
+ /***/ 67:
7112
7095
  /***/ (function(module, exports) {
7113
7096
 
7114
7097
  module.exports = require("@splunk/visualization-context/FeatureFlags");
7115
7098
 
7116
7099
  /***/ }),
7117
7100
 
7118
- /***/ 69:
7101
+ /***/ 68:
7119
7102
  /***/ (function(module, exports) {
7120
7103
 
7121
7104
  module.exports = require("@babel/runtime/helpers/extends");
7122
7105
 
7123
7106
  /***/ }),
7124
7107
 
7125
- /***/ 7:
7126
- /***/ (function(module, exports) {
7127
-
7128
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
7129
-
7130
- /***/ }),
7131
-
7132
- /***/ 70:
7108
+ /***/ 69:
7133
7109
  /***/ (function(module, exports) {
7134
7110
 
7135
7111
  module.exports = require("@splunk/visualizations-shared/colorConstants");
7136
7112
 
7137
7113
  /***/ }),
7138
7114
 
7139
- /***/ 71:
7140
- /***/ (function(module, exports) {
7141
-
7142
- module.exports = require("@splunk/visualization-icons/placeholders");
7143
-
7144
- /***/ }),
7145
-
7146
- /***/ 72:
7147
- /***/ (function(module, exports) {
7148
-
7149
- module.exports = require("@splunk/visualization-icons");
7150
-
7151
- /***/ }),
7152
-
7153
- /***/ 74:
7154
- /***/ (function(module, exports) {
7155
-
7156
- module.exports = require("@splunk/visualizations-shared/domUtils");
7157
-
7158
- /***/ }),
7159
-
7160
- /***/ 77:
7161
- /***/ (function(module, exports) {
7162
-
7163
- module.exports = require("@splunk/themes/useSplunkTheme");
7164
-
7165
- /***/ }),
7166
-
7167
- /***/ 8:
7115
+ /***/ 7:
7168
7116
  /***/ (function(module, exports, __webpack_require__) {
7169
7117
 
7170
7118
  "use strict";
@@ -7204,14 +7152,49 @@ var VizBehavior;
7204
7152
 
7205
7153
  /***/ }),
7206
7154
 
7207
- /***/ 80:
7155
+ /***/ 70:
7156
+ /***/ (function(module, exports) {
7157
+
7158
+ module.exports = require("@splunk/visualization-icons/placeholders");
7159
+
7160
+ /***/ }),
7161
+
7162
+ /***/ 71:
7163
+ /***/ (function(module, exports) {
7164
+
7165
+ module.exports = require("@splunk/visualization-icons");
7166
+
7167
+ /***/ }),
7168
+
7169
+ /***/ 73:
7170
+ /***/ (function(module, exports) {
7171
+
7172
+ module.exports = require("@splunk/visualizations-shared/domUtils");
7173
+
7174
+ /***/ }),
7175
+
7176
+ /***/ 76:
7177
+ /***/ (function(module, exports) {
7178
+
7179
+ module.exports = require("@splunk/themes/useSplunkTheme");
7180
+
7181
+ /***/ }),
7182
+
7183
+ /***/ 79:
7208
7184
  /***/ (function(module, exports) {
7209
7185
 
7210
7186
  module.exports = require("@splunk/themes");
7211
7187
 
7212
7188
  /***/ }),
7213
7189
 
7214
- /***/ 81:
7190
+ /***/ 8:
7191
+ /***/ (function(module, exports) {
7192
+
7193
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
7194
+
7195
+ /***/ }),
7196
+
7197
+ /***/ 80:
7215
7198
  /***/ (function(module, exports) {
7216
7199
 
7217
7200
  module.exports = require("@splunk/visualization-color-palettes/editors/PresetPalettes");
@@ -7221,11 +7204,11 @@ module.exports = require("@splunk/visualization-color-palettes/editors/PresetPal
7221
7204
  /***/ 9:
7222
7205
  /***/ (function(module, exports) {
7223
7206
 
7224
- module.exports = require("@babel/runtime/helpers/classCallCheck");
7207
+ module.exports = require("@splunk/visualization-schemas");
7225
7208
 
7226
7209
  /***/ }),
7227
7210
 
7228
- /***/ 94:
7211
+ /***/ 93:
7229
7212
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
7230
7213
 
7231
7214
  "use strict";
@@ -7248,6 +7231,51 @@ var VizStyleWrapper = styled_components__WEBPACK_IMPORTED_MODULE_0___default.a.d
7248
7231
  VizStyleWrapper.displayName = 'VizStyleWrapper';
7249
7232
  /* harmony default export */ __webpack_exports__["default"] = (VizStyleWrapper);
7250
7233
 
7234
+ /***/ }),
7235
+
7236
+ /***/ 99:
7237
+ /***/ (function(module, exports, __webpack_require__) {
7238
+
7239
+ "use strict";
7240
+
7241
+
7242
+ Object.defineProperty(exports, "__esModule", {
7243
+ value: true
7244
+ });
7245
+ exports.TrellisTitle = exports.TRELLIS_TITLE_HEIGHT = void 0;
7246
+
7247
+ var React = __webpack_require__(1);
7248
+
7249
+ var styled_components_1 = __webpack_require__(4);
7250
+
7251
+ exports.TRELLIS_TITLE_HEIGHT = 28;
7252
+ var TrellisTitleText = styled_components_1.default.div.withConfig({
7253
+ displayName: "TrellisTitle__TrellisTitleText",
7254
+ componentId: "sc-2cu404-0"
7255
+ })(["margin-left:10px;margin-right:10px;padding-top:8px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;"]);
7256
+ var TrellisTitleDiv = styled_components_1.default.div.withConfig({
7257
+ displayName: "TrellisTitle__TrellisTitleDiv",
7258
+ componentId: "sc-2cu404-1"
7259
+ })(["height:", "px;font-size:14px;font-weight:700;color:", ";background-color:", ";box-shadow:0 1px ", ";"], exports.TRELLIS_TITLE_HEIGHT, function (props) {
7260
+ return props.fontColor;
7261
+ }, function (props) {
7262
+ return props.backgroundColor;
7263
+ }, function (props) {
7264
+ return props.backgroundColor;
7265
+ });
7266
+
7267
+ var TrellisTitle = function TrellisTitle(props) {
7268
+ var titleText = String(props.trellisKey).toString();
7269
+ return React.createElement(TrellisTitleDiv, {
7270
+ fontColor: props.fontColor,
7271
+ backgroundColor: props.backgroundColor,
7272
+ "data-test": "trellis-title",
7273
+ title: titleText
7274
+ }, React.createElement(TrellisTitleText, null, titleText));
7275
+ };
7276
+
7277
+ exports.TrellisTitle = TrellisTitle;
7278
+
7251
7279
  /***/ })
7252
7280
 
7253
7281
  /******/ });