@splunk/visualizations 26.2.0 → 26.3.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 (149) hide show
  1. package/Area.config.js +91 -594
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +184 -689
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +92 -561
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +184 -655
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +83 -482
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +177 -578
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +76 -201
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +173 -301
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +92 -599
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +184 -693
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +82 -200
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +137 -262
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +61 -282
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +222 -428
  28. package/Events.js.map +1 -1
  29. package/FillerGauge.config.js +90 -219
  30. package/FillerGauge.config.js.map +1 -1
  31. package/FillerGauge.js +163 -299
  32. package/FillerGauge.js.map +1 -1
  33. package/Image.config.js +61 -157
  34. package/Image.config.js.map +1 -1
  35. package/Image.js +130 -242
  36. package/Image.js.map +1 -1
  37. package/Line.config.js +91 -606
  38. package/Line.config.js.map +1 -1
  39. package/Line.js +184 -701
  40. package/Line.js.map +1 -1
  41. package/LinkGraph.config.js +74 -256
  42. package/LinkGraph.config.js.map +1 -1
  43. package/LinkGraph.js +17198 -24224
  44. package/LinkGraph.js.map +1 -1
  45. package/Map.config.js +128 -1123
  46. package/Map.config.js.map +1 -1
  47. package/Map.js +309 -680
  48. package/Map.js.map +1 -1
  49. package/Markdown.config.js +61 -188
  50. package/Markdown.config.js.map +1 -1
  51. package/Markdown.js +190 -323
  52. package/Markdown.js.map +1 -1
  53. package/MarkerGauge.config.js +137 -297
  54. package/MarkerGauge.config.js.map +1 -1
  55. package/MarkerGauge.js +1038 -1203
  56. package/MarkerGauge.js.map +1 -1
  57. package/ParallelCoordinates.config.js +71 -191
  58. package/ParallelCoordinates.config.js.map +1 -1
  59. package/ParallelCoordinates.js +218 -343
  60. package/ParallelCoordinates.js.map +1 -1
  61. package/Pie.config.js +72 -240
  62. package/Pie.config.js.map +1 -1
  63. package/Pie.js +214 -381
  64. package/Pie.js.map +1 -1
  65. package/Punchcard.config.js +71 -305
  66. package/Punchcard.config.js.map +1 -1
  67. package/Punchcard.js +246 -477
  68. package/Punchcard.js.map +1 -1
  69. package/Rectangle.config.js +211 -347
  70. package/Rectangle.config.js.map +1 -1
  71. package/Rectangle.js +274 -416
  72. package/Rectangle.js.map +1 -1
  73. package/Sankey.config.js +71 -213
  74. package/Sankey.config.js.map +1 -1
  75. package/Sankey.js +246 -382
  76. package/Sankey.js.map +1 -1
  77. package/Scatter.config.js +85 -463
  78. package/Scatter.config.js.map +1 -1
  79. package/Scatter.js +825 -1202
  80. package/Scatter.js.map +1 -1
  81. package/SingleValue.config.js +114 -409
  82. package/SingleValue.config.js.map +1 -1
  83. package/SingleValue.js +287 -582
  84. package/SingleValue.js.map +1 -1
  85. package/SingleValueBasic.js +30 -30
  86. package/SingleValueBasic.js.map +1 -1
  87. package/SingleValueIcon.config.js +113 -378
  88. package/SingleValueIcon.config.js.map +1 -1
  89. package/SingleValueIcon.js +268 -533
  90. package/SingleValueIcon.js.map +1 -1
  91. package/SingleValueRadial.config.js +110 -382
  92. package/SingleValueRadial.config.js.map +1 -1
  93. package/SingleValueRadial.js +272 -543
  94. package/SingleValueRadial.js.map +1 -1
  95. package/SparkLine.js +24 -24
  96. package/SparkLine.js.map +1 -1
  97. package/Table.config.js +74 -496
  98. package/Table.config.js.map +1 -1
  99. package/Table.js +302 -720
  100. package/Table.js.map +1 -1
  101. package/common/Charting.js +22 -34
  102. package/common/Charting.js.map +1 -1
  103. package/common/DocExampleWithVizSandbox.js +21 -21
  104. package/common/DocExampleWithVizSandbox.js.map +1 -1
  105. package/common/EventsDoc.js +18 -18
  106. package/common/EventsDoc.js.map +1 -1
  107. package/common/GaugeMajorTicks.js +4 -4
  108. package/common/GaugeMajorTicks.js.map +1 -1
  109. package/common/GaugeValueMarker.js +2 -2
  110. package/common/GaugeValueMarker.js.map +1 -1
  111. package/common/OptionsDoc.js +4 -4
  112. package/common/OptionsDoc.js.map +1 -1
  113. package/common/OverviewDoc.js +39 -40
  114. package/common/OverviewDoc.js.map +1 -1
  115. package/common/SplunkVisualization.js +2 -2
  116. package/common/SplunkVisualization.js.map +1 -1
  117. package/common/SplunkVisualizationApi.js +2 -2
  118. package/common/SplunkVisualizationApi.js.map +1 -1
  119. package/common/ThemesDoc.js +19 -19
  120. package/common/ThemesDoc.js.map +1 -1
  121. package/common/chartingUtils.js +2 -2
  122. package/common/chartingUtils.js.map +1 -1
  123. package/common/gaugeUtils.js +10 -10
  124. package/common/gaugeUtils.js.map +1 -1
  125. package/common/shapeUtils.js +10 -10
  126. package/common/shapeUtils.js.map +1 -1
  127. package/common/utils/configUtils.js +25 -155
  128. package/common/utils/configUtils.js.map +1 -1
  129. package/common/utils/dataUtils.js +75 -87
  130. package/common/utils/dataUtils.js.map +1 -1
  131. package/common/utils/featureFlagUtils.js +4 -4
  132. package/common/utils/featureFlagUtils.js.map +1 -1
  133. package/common/utils/hocUtils.js +2 -2
  134. package/common/utils/hocUtils.js.map +1 -1
  135. package/common/utils/mapUtils.js +51 -54
  136. package/common/utils/mapUtils.js.map +1 -1
  137. package/common/utils/singleValueUtils.js +7 -7
  138. package/common/utils/singleValueUtils.js.map +1 -1
  139. package/common/utils/testHelper.js +7 -36
  140. package/common/utils/testHelper.js.map +1 -1
  141. package/common/utils/trellisUtils.js +7 -6
  142. package/common/utils/trellisUtils.js.map +1 -1
  143. package/common/utils/urlUtils.js +2 -2
  144. package/common/utils/urlUtils.js.map +1 -1
  145. package/common/withDashboardViz.js +65 -77
  146. package/common/withDashboardViz.js.map +1 -1
  147. package/package.json +46 -49
  148. package/common/utils/layoutUtils.js +0 -115
  149. package/common/utils/layoutUtils.js.map +0 -1
package/MarkerGauge.js CHANGED
@@ -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 = 449);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 445);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -109,7 +109,7 @@ module.exports = require("prop-types");
109
109
  /***/ 10:
110
110
  /***/ (function(module, exports) {
111
111
 
112
- module.exports = require("@babel/runtime/helpers/classCallCheck");
112
+ module.exports = require("@splunk/visualization-schemas");
113
113
 
114
114
  /***/ }),
115
115
 
@@ -120,20 +120,13 @@ module.exports = require("@splunk/visualizations-shared/numberUtils");
120
120
 
121
121
  /***/ }),
122
122
 
123
- /***/ 12:
124
- /***/ (function(module, exports) {
125
-
126
- module.exports = require("@splunk/visualizations-shared/Message");
127
-
128
- /***/ }),
129
-
130
- /***/ 121:
123
+ /***/ 118:
131
124
  /***/ (function(module, exports, __webpack_require__) {
132
125
 
133
126
  "use strict";
134
127
 
135
128
 
136
- var _toConsumableArray = __webpack_require__(8);
129
+ var _toConsumableArray = __webpack_require__(7);
137
130
 
138
131
  Object.defineProperty(exports, "__esModule", {
139
132
  value: true
@@ -142,7 +135,7 @@ exports.convertToGaugeProperties = exports.mapValueLabelDisplay = exports.mapToO
142
135
 
143
136
  var lodash_1 = __webpack_require__(3);
144
137
 
145
- var colorConstants_1 = __webpack_require__(71);
138
+ var colorConstants_1 = __webpack_require__(70);
146
139
 
147
140
  var i18n_1 = __webpack_require__(2);
148
141
 
@@ -896,14 +889,28 @@ exports.convertToGaugeProperties = convertToGaugeProperties;
896
889
 
897
890
  /***/ }),
898
891
 
892
+ /***/ 12:
893
+ /***/ (function(module, exports) {
894
+
895
+ module.exports = require("@splunk/visualizations-shared/Message");
896
+
897
+ /***/ }),
898
+
899
899
  /***/ 13:
900
900
  /***/ (function(module, exports) {
901
901
 
902
- module.exports = require("@splunk/themes/variables");
902
+ module.exports = require("@babel/runtime/helpers/defineProperty");
903
903
 
904
904
  /***/ }),
905
905
 
906
906
  /***/ 14:
907
+ /***/ (function(module, exports) {
908
+
909
+ module.exports = require("@splunk/themes/variables");
910
+
911
+ /***/ }),
912
+
913
+ /***/ 146:
907
914
  /***/ (function(module, exports, __webpack_require__) {
908
915
 
909
916
  "use strict";
@@ -912,1027 +919,1029 @@ module.exports = require("@splunk/themes/variables");
912
919
  Object.defineProperty(exports, "__esModule", {
913
920
  value: true
914
921
  });
915
- exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
916
922
 
917
- var numberUtils_1 = __webpack_require__(11);
923
+ var i18n_1 = __webpack_require__(2);
918
924
 
919
- var interfaces_1 = __webpack_require__(40); // TODO: utilize this fn in ParallelCoordinates
925
+ var gauge = {
926
+ label: (0, i18n_1._)('Data display'),
927
+ layout: [[{
928
+ label: (0, i18n_1._)('Value display'),
929
+ option: 'valueDisplay',
930
+ editor: 'editor.radioBar',
931
+ editorProps: {
932
+ values: [{
933
+ label: (0, i18n_1._)('Number'),
934
+ value: 'number'
935
+ }, {
936
+ label: (0, i18n_1._)('Percentage'),
937
+ value: 'percentage'
938
+ }, {
939
+ label: (0, i18n_1._)('Off'),
940
+ value: 'off'
941
+ }]
942
+ }
943
+ }], [{
944
+ label: (0, i18n_1._)('Label display'),
945
+ option: 'labelDisplay',
946
+ editor: 'editor.radioBar',
947
+ editorProps: {
948
+ values: [{
949
+ label: (0, i18n_1._)('Numbers'),
950
+ value: 'number'
951
+ }, {
952
+ label: (0, i18n_1._)('Percentages'),
953
+ value: 'percentage'
954
+ }, {
955
+ label: (0, i18n_1._)('Off'),
956
+ value: 'off'
957
+ }]
958
+ }
959
+ }], [{
960
+ label: (0, i18n_1._)('Orientation'),
961
+ option: 'orientation',
962
+ editor: 'editor.radioBar',
963
+ editorProps: {
964
+ values: [{
965
+ label: (0, i18n_1._)('Vertical'),
966
+ value: 'vertical'
967
+ }, {
968
+ label: (0, i18n_1._)('Horizontal'),
969
+ value: 'horizontal'
970
+ }]
971
+ }
972
+ }]]
973
+ };
974
+ exports.default = gauge;
920
975
 
976
+ /***/ }),
921
977
 
922
- var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
923
- if (!columns || !columns[0] || !columns[0].length) return [];
924
- var data = [];
978
+ /***/ 147:
979
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
925
980
 
926
- var _loop = function _loop(i) {
927
- var newObj = {};
928
- fields.forEach(function (field, index) {
929
- var fieldName = typeof field === 'string' ? field : field.name;
981
+ "use strict";
982
+ __webpack_require__.r(__webpack_exports__);
983
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MajorTick", function() { return MajorTick; });
984
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionMajorTick", function() { return positionMajorTick; });
985
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69);
986
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
987
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
988
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
989
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
990
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
991
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
992
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
993
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11);
994
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
930
995
 
931
- if (columns[index][i] === '') {
932
- newObj[fieldName] = null;
933
- } else {
934
- newObj[fieldName] = columns[index][i];
935
- }
936
- });
937
- data.push(newObj);
938
- };
939
996
 
940
- for (var i = 0; i < columns[0].length; i += 1) {
941
- _loop(i);
942
- }
943
997
 
944
- return data;
945
- };
946
998
 
947
- exports.convertToArrOfObjects = convertToArrOfObjects; // LTTB algorithm which can be used to downsample time series data while striving to maintain
948
- // the spikes and overall shape of the chart
949
- // Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js
950
- // Modifications include:
951
- // 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)
952
- // 2) Convert to camel case
953
- // 3) Convert to TS and also return the indices of the points that are in the downsampled result.
954
- // 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points
955
- // that should be used in case of a tie of the max area in a bucket
956
999
 
957
- var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, threshold, preferredDownsampleIndices) {
958
- var dataLength = data.length;
959
- var downsampledIndices = [];
1000
+ var DEFAULT_NUM_OF_TICKS = 5;
1001
+ var TICK_LENGTH_DELTA = 5;
1002
+ var TICK_LABEL_PADDING_FACTOR = 3.2;
1003
+ var MajorTickLine = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.line.withConfig({
1004
+ displayName: "GaugeMajorTicks__MajorTickLine",
1005
+ componentId: "sc-mchiad-0"
1006
+ })(["stroke:", ";stroke-width:2px;stroke-dasharray:", ";"], function (props) {
1007
+ return props.majorTickStrokeColor;
1008
+ }, function (props) {
1009
+ return props.index === 0 ? 0 : 3;
1010
+ });
1011
+ var MajorTickLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.text.withConfig({
1012
+ displayName: "GaugeMajorTicks__MajorTickLabel",
1013
+ componentId: "sc-mchiad-1"
1014
+ })(["font-size:12px;font-family:Splunk Platform Sans,sans-serif;line-height:19px;fill:", ";text-anchor:middle;text-align:center;"], function (props) {
1015
+ return props.majorTickFillColor;
1016
+ });
1017
+ var MajorTick = function MajorTick(_ref) {
1018
+ var index = _ref.index,
1019
+ x1 = _ref.x1,
1020
+ y1 = _ref.y1,
1021
+ x2 = _ref.x2,
1022
+ y2 = _ref.y2,
1023
+ showLabels = _ref.showLabels,
1024
+ label = _ref.label,
1025
+ labelX = _ref.labelX,
1026
+ labelY = _ref.labelY,
1027
+ majorTickStrokeColor = _ref.majorTickStrokeColor,
1028
+ majorTickFillColor = _ref.majorTickFillColor;
1029
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLine, {
1030
+ "data-test": "major-tick-line",
1031
+ index: index,
1032
+ x1: x1,
1033
+ y1: y1,
1034
+ x2: x2,
1035
+ y2: y2,
1036
+ majorTickStrokeColor: majorTickStrokeColor
1037
+ }), showLabels && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLabel, {
1038
+ x: labelX,
1039
+ y: labelY,
1040
+ majorTickFillColor: majorTickFillColor,
1041
+ "data-test": "major-tick-label"
1042
+ }, Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["isNumerial"])(label) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["formatNumber"])(label, 0, {
1043
+ useThousandSeparators: true,
1044
+ useTrendUnits: true
1045
+ }) : label));
1046
+ };
1047
+ MajorTick.propTypes = {
1048
+ index: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1049
+ x1: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1050
+ y1: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1051
+ x2: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1052
+ y2: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1053
+ showLabels: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
1054
+ label: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number]),
1055
+ labelX: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1056
+ labelY: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1057
+ majorTickStrokeColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1058
+ majorTickFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
1059
+ };
1060
+ /**
1061
+ * calculate position for each major tick
1062
+ * @method positionMajorTick
1063
+ * @param {Object} input
1064
+ * @param {Number} input.width
1065
+ * @param {Number} input.height
1066
+ * @param {Number} input.startX start x for rendering the first major tick
1067
+ * @param {Number} input.startY start y for rendering the first major tick
1068
+ * @param {String} input.orientation
1069
+ * @param {Number} input.numOfTicks how many ticks need to render
1070
+ * @param {Number} input.i index of major tick
1071
+ * @return {Object} MajorTick positions
1072
+ */
960
1073
 
961
- if (threshold >= dataLength || threshold === 0) {
962
- var allIndices = data.map(function (values, index) {
963
- return index;
964
- });
965
- return {
966
- downsampledData: data,
967
- downsampledIndices: allIndices
968
- }; // Nothing to do
969
- }
1074
+ var positionMajorTick = function positionMajorTick(_ref2) {
1075
+ var width = _ref2.width,
1076
+ height = _ref2.height,
1077
+ startX = _ref2.startX,
1078
+ startY = _ref2.startY,
1079
+ orientation = _ref2.orientation,
1080
+ numOfTicks = _ref2.numOfTicks,
1081
+ i = _ref2.i;
1082
+ var x1 = startX;
1083
+ var y1 = startY;
1084
+ var x2 = startX;
1085
+ var y2 = startY;
1086
+ var labelX = startX;
1087
+ var labelY;
970
1088
 
971
- var sampled = [];
972
- var sampledIndex = 0; // Bucket size. Leave room for start and end data points
1089
+ if (orientation === 'vertical') {
1090
+ var y = height / numOfTicks * (numOfTicks - i) + startY;
1091
+ x1 -= TICK_LENGTH_DELTA;
1092
+ y1 = y;
1093
+ x2 += width + TICK_LENGTH_DELTA;
1094
+ y2 = y;
1095
+ labelX += width + TICK_LENGTH_DELTA * TICK_LABEL_PADDING_FACTOR;
1096
+ labelY = y;
1097
+ } else {
1098
+ var x = width / numOfTicks * i + startX;
1099
+ x1 = x;
1100
+ y1 -= TICK_LENGTH_DELTA;
1101
+ x2 = x;
1102
+ y2 += height + TICK_LENGTH_DELTA;
1103
+ labelX = x;
1104
+ labelY = y2 + 16;
1105
+ }
973
1106
 
974
- var every = (dataLength - 2) / (threshold - 2);
975
- var a = 0; // Initially a is the first point in the triangle
1107
+ return {
1108
+ x1: x1,
1109
+ y1: y1,
1110
+ x2: x2,
1111
+ y2: y2,
1112
+ labelX: labelX,
1113
+ labelY: labelY
1114
+ };
1115
+ };
976
1116
 
977
- var maxAreaPoint;
978
- var maxArea;
979
- var area;
980
- var nextA;
981
- sampled.push(data[a]); // Always add the first point
1117
+ var MajorTicks = function MajorTicks(_ref3) {
1118
+ var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
982
1119
 
983
- downsampledIndices.push(0); // eslint-disable-next-line no-plusplus
984
-
985
- for (var i = 0; i < threshold - 2; i++) {
986
- // Calculate point average for next bucket (containing c)
987
- var avgX = 0;
988
- var avgY = 0;
989
- var avgRangeStart = Math.floor((i + 1) * every) + 1;
990
- var avgRangeEnd = Math.floor((i + 2) * every) + 1;
991
- avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
992
- var avgRangeLength = avgRangeEnd - avgRangeStart; // eslint-disable-next-line no-plusplus
1120
+ var width = props.width,
1121
+ height = props.height,
1122
+ startX = props.startX,
1123
+ startY = props.startY,
1124
+ min = props.min,
1125
+ max = props.max,
1126
+ majorUnit = props.majorUnit,
1127
+ orientation = props.orientation,
1128
+ showLabels = props.showLabels,
1129
+ usePercentageRange = props.usePercentageRange,
1130
+ majorTickFillColor = props.majorTickFillColor,
1131
+ majorTickStrokeColor = props.majorTickStrokeColor;
1132
+ var range = max - min;
1133
+ var numOfTicks = majorUnit === 'auto' || Number.isNaN(Number(majorUnit)) || majorUnit <= 0 ? DEFAULT_NUM_OF_TICKS : range / majorUnit;
1134
+ var majorTicks = [];
993
1135
 
994
- for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
995
- avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)
1136
+ for (var i = 0; i <= numOfTicks; i += 1) {
1137
+ var _positionMajorTick = positionMajorTick({
1138
+ width: width,
1139
+ height: height,
1140
+ startX: startX,
1141
+ startY: startY,
1142
+ orientation: orientation,
1143
+ numOfTicks: numOfTicks,
1144
+ i: i
1145
+ }),
1146
+ x1 = _positionMajorTick.x1,
1147
+ y1 = _positionMajorTick.y1,
1148
+ x2 = _positionMajorTick.x2,
1149
+ y2 = _positionMajorTick.y2,
1150
+ labelX = _positionMajorTick.labelX,
1151
+ labelY = _positionMajorTick.labelY;
996
1152
 
997
- avgY += data[avgRangeStart][1] * 1;
998
- }
1153
+ var label = usePercentageRange ? "".concat(parseInt((i / numOfTicks - min / range) * 100, 10), "%") : parseInt(min + range / numOfTicks * i, 10);
1154
+ majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
1155
+ key: i,
1156
+ index: i,
1157
+ x1: x1,
1158
+ y1: y1,
1159
+ x2: x2,
1160
+ y2: y2,
1161
+ showLabels: showLabels,
1162
+ label: label,
1163
+ labelX: labelX,
1164
+ labelY: labelY,
1165
+ majorTickFillColor: majorTickFillColor,
1166
+ majorTickStrokeColor: majorTickStrokeColor
1167
+ }));
1168
+ } // if the gauge is not divided evenly, put the last tick at the end of the gauge
999
1169
 
1000
- avgX /= avgRangeLength;
1001
- avgY /= avgRangeLength; // Get the range for this bucket
1002
1170
 
1003
- var rangeOffs = Math.floor((i + 0) * every) + 1;
1004
- var rangeTo = Math.floor((i + 1) * every) + 1; // Point a
1171
+ if (!Number.isInteger(numOfTicks)) {
1172
+ var extraNumOfTicks = Math.ceil(numOfTicks);
1005
1173
 
1006
- var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
1174
+ var _positionMajorTick2 = positionMajorTick({
1175
+ width: width,
1176
+ height: height,
1177
+ startX: startX,
1178
+ startY: startY,
1179
+ orientation: orientation,
1180
+ numOfTicks: extraNumOfTicks,
1181
+ i: extraNumOfTicks
1182
+ }),
1183
+ _x = _positionMajorTick2.x1,
1184
+ _y = _positionMajorTick2.y1,
1185
+ _x2 = _positionMajorTick2.x2,
1186
+ _y2 = _positionMajorTick2.y2,
1187
+ _labelX = _positionMajorTick2.labelX,
1188
+ _labelY = _positionMajorTick2.labelY;
1007
1189
 
1008
- var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
1190
+ majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
1191
+ key: extraNumOfTicks,
1192
+ id: extraNumOfTicks,
1193
+ x1: _x,
1194
+ y1: _y,
1195
+ x2: _x2,
1196
+ y2: _y2,
1197
+ showLabels: showLabels,
1198
+ label: usePercentageRange ? '100%' : max,
1199
+ labelX: _labelX,
1200
+ labelY: _labelY,
1201
+ majorTickFillColor: majorTickFillColor,
1202
+ majorTickStrokeColor: majorTickStrokeColor
1203
+ }));
1204
+ }
1009
1205
 
1010
- maxArea = area = -1;
1011
- var maxAreaIndex = rangeOffs; // eslint-disable-next-line no-plusplus
1206
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, majorTicks);
1207
+ };
1012
1208
 
1013
- for (; rangeOffs < rangeTo; rangeOffs++) {
1014
- // Calculate triangle area over three buckets
1015
- area = Math.abs((pointAX - avgX) * (data[rangeOffs][1] - pointAY) - (pointAX - Number(data[rangeOffs][0])) * (avgY - pointAY)) * 0.5; // Modification: try to downsample the least amount of points possible when there are multiple series
1016
- // If all points in a bucket have the same area, prioritize the one with an x index
1017
- // that also existed from another series so we don't add another point unnecessarily.
1018
- // By default LTTB picks the leftmost point in the bucket
1209
+ MajorTicks.propTypes = {
1210
+ width: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1211
+ height: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1212
+ startX: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1213
+ startY: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1214
+ min: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1215
+ max: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1216
+ majorUnit: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number]),
1217
+ orientation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1218
+ showLabels: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
1219
+ usePercentageRange: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
1220
+ majorTickFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1221
+ majorTickStrokeColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
1222
+ };
1223
+ MajorTicks.defaultProps = {
1224
+ min: 0,
1225
+ max: 100,
1226
+ majorUnit: 'auto',
1227
+ orientation: 'horizontal',
1228
+ showLabels: true,
1229
+ usePercentageRange: false
1230
+ };
1231
+ /* harmony default export */ __webpack_exports__["default"] = (MajorTicks);
1019
1232
 
1020
- if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
1021
- maxArea = area;
1022
- maxAreaPoint = data[rangeOffs];
1023
- nextA = rangeOffs; // Next a is this b
1024
- // Modification: save the index of the point with the most area
1233
+ /***/ }),
1025
1234
 
1026
- maxAreaIndex = rangeOffs;
1027
- }
1028
- } // eslint-disable-next-line no-plusplus
1235
+ /***/ 148:
1236
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
1029
1237
 
1238
+ "use strict";
1239
+ __webpack_require__.r(__webpack_exports__);
1240
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionValueMarkerRect", function() { return positionValueMarkerRect; });
1241
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionLabel", function() { return positionLabel; });
1242
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69);
1243
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
1244
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
1245
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
1246
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
1247
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
1248
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
1249
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
1250
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11);
1251
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
1030
1252
 
1031
- sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
1032
1253
 
1033
- downsampledIndices.push(maxAreaIndex);
1034
- a = nextA; // This a is the next a (chosen b)
1035
- } // eslint-disable-next-line no-plusplus
1036
1254
 
1037
1255
 
1038
- sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
1039
1256
 
1040
- downsampledIndices.push(dataLength - 1);
1041
- return {
1042
- downsampledData: sampled,
1043
- downsampledIndices: downsampledIndices
1044
- };
1045
- };
1257
+ var MARKER_THICKNESS = 15;
1258
+ var MARKER_INNER_LENGTH = 30;
1259
+ var MARKER_LABEL_WIDTH = 60;
1260
+ var MARKER_LABEL_HEIGHT = 25;
1261
+ var RADIUS = 2;
1262
+ var DELTA_LENGTH = 12;
1263
+ var ValueMarkerRect = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.path.withConfig({
1264
+ displayName: "GaugeValueMarker__ValueMarkerRect",
1265
+ componentId: "sc-1bxkeao-0"
1266
+ })(["stroke-width:2px;fill:", ";"], function (props) {
1267
+ return props.valueMarkerFillColor;
1268
+ });
1269
+ var ValueMarkerLabelRect = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.rect.withConfig({
1270
+ displayName: "GaugeValueMarker__ValueMarkerLabelRect",
1271
+ componentId: "sc-1bxkeao-1"
1272
+ })(["fill:", ";"], function (props) {
1273
+ return props.valueMarkerFillColor;
1274
+ });
1275
+ var ValueMarkerLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.text.withConfig({
1276
+ displayName: "GaugeValueMarker__ValueMarkerLabel",
1277
+ componentId: "sc-1bxkeao-2"
1278
+ })(["fill:", ";font-size:14px;font-family:Splunk Platform Sans,sans-serif;line-height:16px;text-anchor:middle;text-align:center;dominant-baseline:middle;"], function (props) {
1279
+ return props.valueMarkerLabelFillColor;
1280
+ });
1046
1281
  /**
1047
- * Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines
1048
- * if at least one of the values in the column can be loosely coerced to a number.
1049
- * If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and
1050
- * returns that it cannot downsample the column.
1282
+ * calculate the path of Value Marker shape
1283
+ * @method positionValueMarkerRect
1284
+ * @param {Object} input
1285
+ * @param {Number} input.x
1286
+ * @param {Number} input.y
1287
+ * @param {String} input.orientation
1288
+ * @param {Number} input.valueMarkerRectLength
1289
+ * @return {String} d containing a series of path commands that define the path to be
1051
1290
  */
1052
1291
 
1292
+ var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
1293
+ var x = _ref.x,
1294
+ y = _ref.y,
1295
+ orientation = _ref.orientation,
1296
+ valueMarkerRectLength = _ref.valueMarkerRectLength,
1297
+ _ref$alignCenter = _ref.alignCenter,
1298
+ alignCenter = _ref$alignCenter === void 0 ? false : _ref$alignCenter;
1299
+ var hLength = MARKER_THICKNESS;
1300
+ var vLength = valueMarkerRectLength;
1301
+ var markerStartX = alignCenter ? x - MARKER_THICKNESS / 2 : x - MARKER_THICKNESS;
1302
+ var markerStartY = y;
1303
+ var innerHLength = hLength / 3;
1304
+ var innerVLength = MARKER_INNER_LENGTH;
1305
+ var innerStartX = markerStartX + innerHLength;
1306
+ var innerStartY = markerStartY + 7;
1053
1307
 
1054
- var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
1055
- // Splunk charting allows for numbers in formats such as negative hex that
1056
- // Number() does not support and also allows loose coercion of hex numbers (but not other formats)
1057
- // We want to identify columns which contain at least one value that can be loosely coerced
1058
- var canLooselyCoerceSomeValues = column.findIndex(function (value) {
1059
- return (0, numberUtils_1.startsWithNumber)("".concat(value));
1060
- }) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
1061
-
1062
- var coercedColumn = [];
1063
- var canDownsampleColumn = !column.some(function (value) {
1064
- var coercedValue = Number(value); // if it can't be parsed or isn't safe, fail
1065
-
1066
- if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
1067
- return true;
1068
- } // save value and continue to next
1069
-
1308
+ if (orientation === 'vertical') {
1309
+ hLength = valueMarkerRectLength;
1310
+ vLength = MARKER_THICKNESS;
1311
+ markerStartX = x;
1312
+ markerStartY = alignCenter ? y - MARKER_THICKNESS / 2 : y;
1313
+ innerHLength = MARKER_INNER_LENGTH;
1314
+ innerVLength = vLength / 3;
1315
+ innerStartX = markerStartX + 7;
1316
+ innerStartY = markerStartY + innerVLength;
1317
+ }
1070
1318
 
1071
- coercedColumn.push(coercedValue);
1072
- return false;
1073
- });
1074
- return {
1075
- canDownsampleColumn: canDownsampleColumn,
1076
- canLooselyCoerceSomeValues: canLooselyCoerceSomeValues,
1077
- coercedColumn: canDownsampleColumn ? coercedColumn : []
1078
- };
1319
+ return "M".concat(markerStartX, ",").concat(markerStartY, "h").concat(hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(RADIUS, "v").concat(vLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(RADIUS, "h").concat(-hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(-RADIUS, "v").concat(2 * RADIUS - vLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(-RADIUS, "z") + "M".concat(innerStartX, ",").concat(innerStartY, "v").concat(innerVLength - RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(RADIUS, "h").concat(innerHLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(-RADIUS, "v").concat(RADIUS - innerVLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(-RADIUS, "h").concat(2 * RADIUS - innerHLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(RADIUS, "z");
1079
1320
  };
1080
1321
  /**
1081
- * Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.
1082
- * Only strictly increasing x-columns are eligible for downsampling.
1083
- * If the column is not eligible for downsampling, returns an empty array.
1084
- */
1085
-
1322
+ * calculate the position of value marker label
1323
+ * @method positionLabel
1324
+ * @param {Object} input
1325
+ * @param {Number} input.x
1326
+ * @param {Number} input.y
1327
+ * @param {Number} input.length gauge thickness
1328
+ * @param {String} input.orientation
1329
+ * @return {Object} positions
1330
+ * @return {Number} positions.labelRectX x of value marker label rect
1331
+ * @return {Number} positions.labelRectY y of value marker label rect
1332
+ * @return {Number} positions.labelX x of value marker label text
1333
+ * @return {Number} positions.labelY y of value marker label text
1334
+ */
1086
1335
 
1087
- var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
1088
- if (fieldType === 'number') {
1089
- var coercedXColumn = column.map(function (xValue) {
1090
- return Number(xValue);
1091
- });
1336
+ var positionLabel = function positionLabel(_ref2) {
1337
+ var x = _ref2.x,
1338
+ y = _ref2.y,
1339
+ length = _ref2.length,
1340
+ orientation = _ref2.orientation,
1341
+ _ref2$alignCenter = _ref2.alignCenter,
1342
+ alignCenter = _ref2$alignCenter === void 0 ? false : _ref2$alignCenter; // for horizontal view
1092
1343
 
1093
- if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
1094
- return coercedXColumn;
1095
- }
1096
- } else if (fieldType === 'time') {
1097
- var _coercedXColumn = column.map(function (xValue) {
1098
- return new Date(xValue);
1099
- });
1344
+ var labelRectX = alignCenter ? x - MARKER_LABEL_WIDTH / 2 : x - MARKER_THICKNESS / 2 - MARKER_LABEL_WIDTH / 2;
1345
+ var labelRectY = y + length;
1100
1346
 
1101
- if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
1102
- return _coercedXColumn;
1103
- }
1347
+ if (orientation === 'vertical') {
1348
+ labelRectX = x + length;
1349
+ labelRectY = alignCenter ? y - MARKER_LABEL_HEIGHT / 2 : y - (MARKER_LABEL_HEIGHT - MARKER_THICKNESS) / 2;
1104
1350
  }
1105
1351
 
1106
- return [];
1352
+ var labelX = labelRectX + MARKER_LABEL_WIDTH / 2;
1353
+ var labelY = labelRectY + MARKER_LABEL_HEIGHT / 2;
1354
+ return {
1355
+ labelRectX: labelRectX,
1356
+ labelRectY: labelRectY,
1357
+ labelX: labelX,
1358
+ labelY: labelY
1359
+ };
1107
1360
  };
1108
1361
 
1109
- var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
1110
- var vizConfig = _ref.vizConfig;
1111
-
1112
- var _a;
1113
-
1114
- return (_a = vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(interfaces_1.VizBehavior.DOWNSAMPLING);
1115
- };
1362
+ var ValueMarker = function ValueMarker(_ref3) {
1363
+ var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
1116
1364
 
1117
- exports.isDownsamplingEnabledForViz = isDownsamplingEnabledForViz;
1365
+ var x = props.x,
1366
+ y = props.y,
1367
+ length = props.length,
1368
+ min = props.min,
1369
+ max = props.max,
1370
+ value = props.value,
1371
+ orientation = props.orientation,
1372
+ showValue = props.showValue,
1373
+ usePercentageValue = props.usePercentageValue,
1374
+ valueMarkerFillColor = props.valueMarkerFillColor,
1375
+ valueMarkerLabelFillColor = props.valueMarkerLabelFillColor,
1376
+ alignCenter = props.alignCenter;
1377
+ var valueMarkerRectLength = length + DELTA_LENGTH;
1118
1378
 
1119
- var calculateThresholdOnRangeSelect = function calculateThresholdOnRangeSelect(_ref2) {
1120
- var firstIndex = _ref2.firstIndex,
1121
- lastIndex = _ref2.lastIndex,
1122
- dataSources = _ref2.dataSources,
1123
- width = _ref2.width;
1379
+ var _positionLabel = positionLabel({
1380
+ x: x,
1381
+ y: y,
1382
+ length: length,
1383
+ orientation: orientation,
1384
+ alignCenter: alignCenter
1385
+ }),
1386
+ labelRectX = _positionLabel.labelRectX,
1387
+ labelRectY = _positionLabel.labelRectY,
1388
+ labelX = _positionLabel.labelX,
1389
+ labelY = _positionLabel.labelY;
1124
1390
 
1125
- var _a, _b, _c;
1391
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerRect, {
1392
+ "data-test": "value-marker-rect",
1393
+ d: positionValueMarkerRect({
1394
+ x: x,
1395
+ y: y,
1396
+ orientation: orientation,
1397
+ valueMarkerRectLength: valueMarkerRectLength,
1398
+ alignCenter: alignCenter
1399
+ }),
1400
+ valueMarkerFillColor: valueMarkerFillColor
1401
+ }), showValue && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerLabelRect, {
1402
+ "data-test": "value-marker-label-rect",
1403
+ x: labelRectX,
1404
+ y: labelRectY,
1405
+ width: MARKER_LABEL_WIDTH,
1406
+ height: MARKER_LABEL_HEIGHT,
1407
+ rx: RADIUS,
1408
+ ry: RADIUS,
1409
+ valueMarkerFillColor: valueMarkerFillColor
1410
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerLabel, {
1411
+ "data-test": "value-marker-label",
1412
+ x: labelX,
1413
+ y: labelY,
1414
+ valueMarkerLabelFillColor: valueMarkerLabelFillColor
1415
+ }, usePercentageValue ? "".concat((value / (max - min) * 100).toFixed(2), "%") : Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["formatNumber"])(value, 0, {
1416
+ useThousandSeparators: true,
1417
+ useTrendUnits: true
1418
+ }))));
1419
+ };
1126
1420
 
1127
- var window = lastIndex - firstIndex + 1;
1128
- var ratio = Math.round(Number(((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns[0]) === null || _c === void 0 ? void 0 : _c.length) / window) * 10) / 10;
1129
- return Math.round(ratio * Number(width));
1421
+ ValueMarker.propTypes = {
1422
+ x: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1423
+ y: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1424
+ length: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1425
+ min: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1426
+ max: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1427
+ value: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1428
+ orientation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1429
+ showValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
1430
+ usePercentageValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
1431
+ valueMarkerFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1432
+ valueMarkerLabelFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1433
+ alignCenter: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool
1434
+ };
1435
+ ValueMarker.defaultProps = {
1436
+ min: 0,
1437
+ max: 100,
1438
+ orientation: 'horizontal',
1439
+ showValue: true,
1440
+ usePercentageValue: false,
1441
+ alignCenter: false
1130
1442
  };
1443
+ /* harmony default export */ __webpack_exports__["default"] = (ValueMarker);
1131
1444
 
1132
- exports.calculateThresholdOnRangeSelect = calculateThresholdOnRangeSelect;
1133
- /**
1134
- * Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,
1135
- * then returns the width of the visualization.
1136
- *
1137
- * Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled
1138
- * data sources. Returns null if the chart event's dataset does not match the passed in primary data source or if the chart is zoomed
1139
- * in for a categorical chart.
1140
- */
1445
+ /***/ }),
1141
1446
 
1142
- var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
1143
- var enableSearchZoom = _ref3.enableSearchZoom,
1144
- dataSources = _ref3.dataSources,
1145
- selectChartEvent = _ref3.selectChartEvent,
1146
- width = _ref3.width,
1147
- xField = _ref3.xField,
1148
- y2Fields = _ref3.y2Fields;
1447
+ /***/ 15:
1448
+ /***/ (function(module, exports, __webpack_require__) {
1149
1449
 
1150
- var _a, _b, _c;
1450
+ "use strict";
1151
1451
 
1152
- if (enableSearchZoom || !selectChartEvent) {
1153
- return Number(width);
1154
- }
1155
1452
 
1156
- var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
1453
+ Object.defineProperty(exports, "__esModule", {
1454
+ value: true
1455
+ });
1456
+ exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
1157
1457
 
1158
- if (!primaryDataSource) {
1159
- return null;
1160
- }
1458
+ var numberUtils_1 = __webpack_require__(11);
1161
1459
 
1162
- var startXIndex = selectChartEvent.startXIndex,
1163
- endXIndex = selectChartEvent.endXIndex,
1164
- currentTarget = selectChartEvent.currentTarget;
1460
+ var interfaces_1 = __webpack_require__(40); // TODO: utilize this fn in ParallelCoordinates
1165
1461
 
1166
- try {
1167
- var xFieldIndex = (_a = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _a === void 0 ? void 0 : _a.fields.findIndex(function (field) {
1168
- return field.name === xField;
1169
- });
1170
- var downsampledXFieldIndex = (_b = currentTarget.dataSet) === null || _b === void 0 ? void 0 : _b.fields.findIndex(function (field) {
1171
- return field === xField;
1172
- });
1173
1462
 
1174
- if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
1175
- return null;
1176
- }
1463
+ var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
1464
+ if (!columns || !columns[0] || !columns[0].length) return [];
1465
+ var data = [];
1177
1466
 
1178
- var fullSeries = (_c = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _c === void 0 ? void 0 : _c.columns[xFieldIndex];
1179
- var downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
1180
- var firstIndex = fullSeries.findIndex(function (x) {
1181
- return downsampledSeries[startXIndex] === x;
1182
- });
1183
- var lastIndex = fullSeries.findIndex(function (x) {
1184
- return downsampledSeries[endXIndex] === x;
1185
- }); // For charts with categorical x-axis (charts with an xField that isn't _time), do not support
1186
- // re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
1187
- // Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
1188
- // until SPL-259611 is fixed
1467
+ var _loop = function _loop(i) {
1468
+ var newObj = {};
1469
+ fields.forEach(function (field, index) {
1470
+ var fieldName = typeof field === 'string' ? field : field.name;
1189
1471
 
1190
- if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
1191
- return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
1192
- }
1472
+ if (columns[index][i] === '') {
1473
+ newObj[fieldName] = null;
1474
+ } else {
1475
+ newObj[fieldName] = columns[index][i];
1476
+ }
1477
+ });
1478
+ data.push(newObj);
1479
+ };
1193
1480
 
1194
- if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
1195
- return (0, exports.calculateThresholdOnRangeSelect)({
1196
- firstIndex: firstIndex,
1197
- lastIndex: lastIndex,
1198
- dataSources: dataSources,
1199
- width: width
1200
- });
1201
- }
1202
- } catch (e) {
1203
- console.error('Error occurred while setting downsample threshold on range select event', e);
1481
+ for (var i = 0; i < columns[0].length; i += 1) {
1482
+ _loop(i);
1204
1483
  }
1205
1484
 
1206
- return null;
1485
+ return data;
1207
1486
  };
1208
1487
 
1209
- exports.calculateDownsamplingThreshold = calculateDownsamplingThreshold;
1488
+ exports.convertToArrOfObjects = convertToArrOfObjects; // LTTB algorithm which can be used to downsample time series data while striving to maintain
1489
+ // the spikes and overall shape of the chart
1490
+ // Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js
1491
+ // Modifications include:
1492
+ // 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)
1493
+ // 2) Convert to camel case
1494
+ // 3) Convert to TS and also return the indices of the points that are in the downsampled result.
1495
+ // 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points
1496
+ // that should be used in case of a tie of the max area in a bucket
1210
1497
 
1211
- var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fieldType) {
1212
- return column.every(function (value, index) {
1213
- if (fieldType === 'number') {
1214
- if (Number.isNaN(value)) {
1215
- return false;
1216
- }
1217
- }
1498
+ var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, threshold, preferredDownsampleIndices) {
1499
+ var dataLength = data.length;
1500
+ var downsampledIndices = [];
1218
1501
 
1219
- if (fieldType === 'time') {
1220
- if (Number.isNaN(value.getTime())) {
1221
- return false;
1222
- }
1223
- }
1502
+ if (threshold >= dataLength || threshold === 0) {
1503
+ var allIndices = data.map(function (values, index) {
1504
+ return index;
1505
+ });
1506
+ return {
1507
+ downsampledData: data,
1508
+ downsampledIndices: allIndices
1509
+ }; // Nothing to do
1510
+ }
1224
1511
 
1225
- if (index === 0) {
1226
- return true;
1227
- }
1512
+ var sampled = [];
1513
+ var sampledIndex = 0; // Bucket size. Leave room for start and end data points
1228
1514
 
1229
- return value > column[index - 1];
1230
- });
1231
- };
1232
- /**
1233
- * Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be
1234
- * displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.
1235
- *
1236
- * If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
1237
- * If not all columns can be downsampled, then returns empty arrays for both x and y
1238
- */
1515
+ var every = (dataLength - 2) / (threshold - 2);
1516
+ var a = 0; // Initially a is the first point in the triangle
1239
1517
 
1518
+ var maxAreaPoint;
1519
+ var maxArea;
1520
+ var area;
1521
+ var nextA;
1522
+ sampled.push(data[a]); // Always add the first point
1240
1523
 
1241
- var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
1242
- var xColumn = [];
1243
- var yColumns = [];
1244
- var canDownsample = !ds.data.fields.some(function (field, index) {
1245
- var _a, _b;
1524
+ downsampledIndices.push(0); // eslint-disable-next-line no-plusplus
1246
1525
 
1247
- var fieldName = (_a = field.name) !== null && _a !== void 0 ? _a : field;
1248
- var fieldType = (_b = fieldTypes[index]) !== null && _b !== void 0 ? _b : 'unknown';
1249
- var column = ds.data.columns[index];
1250
- var hasDisplayedColumnThatCantBeDownsampled = false;
1526
+ for (var i = 0; i < threshold - 2; i++) {
1527
+ // Calculate point average for next bucket (containing c)
1528
+ var avgX = 0;
1529
+ var avgY = 0;
1530
+ var avgRangeStart = Math.floor((i + 1) * every) + 1;
1531
+ var avgRangeEnd = Math.floor((i + 2) * every) + 1;
1532
+ avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
1533
+ var avgRangeLength = avgRangeEnd - avgRangeStart; // eslint-disable-next-line no-plusplus
1251
1534
 
1252
- if (fieldName === xField) {
1253
- xColumn = strictlyCoerceXColumn(column, fieldType);
1254
- } else if (yFields.has(fieldName)) {
1255
- var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
1256
- coercedColumn = _strictlyCoerceYColum.coercedColumn,
1257
- canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
1258
- canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
1259
- // be downsampled using LTTB
1535
+ for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
1536
+ avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)
1260
1537
 
1538
+ avgY += data[avgRangeStart][1] * 1;
1539
+ }
1261
1540
 
1262
- hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
1541
+ avgX /= avgRangeLength;
1542
+ avgY /= avgRangeLength; // Get the range for this bucket
1263
1543
 
1264
- if (hasDisplayedColumnThatCantBeDownsampled) {
1265
- return true;
1266
- }
1544
+ var rangeOffs = Math.floor((i + 0) * every) + 1;
1545
+ var rangeTo = Math.floor((i + 1) * every) + 1; // Point a
1267
1546
 
1268
- if (canDownsampleColumn) {
1269
- yColumns.push(coercedColumn);
1270
- }
1271
- }
1547
+ var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
1272
1548
 
1273
- return false;
1274
- });
1549
+ var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
1275
1550
 
1276
- if (canDownsample) {
1277
- return {
1278
- xColumn: xColumn,
1279
- yColumns: yColumns
1280
- };
1281
- }
1551
+ maxArea = area = -1;
1552
+ var maxAreaIndex = rangeOffs; // eslint-disable-next-line no-plusplus
1282
1553
 
1283
- return {
1284
- xColumn: [],
1285
- yColumns: []
1286
- };
1287
- };
1554
+ for (; rangeOffs < rangeTo; rangeOffs++) {
1555
+ // Calculate triangle area over three buckets
1556
+ area = Math.abs((pointAX - avgX) * (data[rangeOffs][1] - pointAY) - (pointAX - Number(data[rangeOffs][0])) * (avgY - pointAY)) * 0.5; // Modification: try to downsample the least amount of points possible when there are multiple series
1557
+ // If all points in a bucket have the same area, prioritize the one with an x index
1558
+ // that also existed from another series so we don't add another point unnecessarily.
1559
+ // By default LTTB picks the leftmost point in the bucket
1288
1560
 
1289
- var pickIndicesFromDataSource = function pickIndicesFromDataSource(ds, indices) {
1290
- var sortedIndices = Array.from(indices).sort(function (a, b) {
1291
- return a - b;
1292
- });
1293
- var slicedColumns = [];
1294
- ds.data.columns.forEach(function (column) {
1295
- var slicedColumn = [];
1296
- sortedIndices.forEach(function (index) {
1297
- slicedColumn.push(column[index]);
1298
- });
1299
- slicedColumns.push(slicedColumn);
1300
- }); // update data columns with downsampled columns
1561
+ if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
1562
+ maxArea = area;
1563
+ maxAreaPoint = data[rangeOffs];
1564
+ nextA = rangeOffs; // Next a is this b
1565
+ // Modification: save the index of the point with the most area
1301
1566
 
1302
- return Object.assign(Object.assign({}, ds), {
1303
- data: Object.assign(Object.assign({}, ds.data), {
1304
- columns: slicedColumns
1305
- })
1306
- });
1307
- };
1567
+ maxAreaIndex = rangeOffs;
1568
+ }
1569
+ } // eslint-disable-next-line no-plusplus
1308
1570
 
1309
- var downsampleDataSources = function downsampleDataSources(_ref4) {
1310
- var dataSources = _ref4.dataSources,
1311
- threshold = _ref4.threshold,
1312
- options = _ref4.options;
1313
1571
 
1314
- var _a, _b, _c;
1572
+ sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
1315
1573
 
1316
- var primaryDS = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary; // only downsample time series when number of data points are over threshold
1574
+ downsampledIndices.push(maxAreaIndex);
1575
+ a = nextA; // This a is the next a (chosen b)
1576
+ } // eslint-disable-next-line no-plusplus
1317
1577
 
1318
- var numPoints = (_c = (_b = (_a = primaryDS === null || primaryDS === void 0 ? void 0 : primaryDS.data) === null || _a === void 0 ? void 0 : _a.columns[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
1319
1578
 
1320
- if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
1321
- return dataSources;
1322
- }
1579
+ sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
1323
1580
 
1324
- var xField = options.xField,
1325
- yFields = options.yFields,
1326
- fieldTypes = options.fieldTypes;
1581
+ downsampledIndices.push(dataLength - 1);
1582
+ return {
1583
+ downsampledData: sampled,
1584
+ downsampledIndices: downsampledIndices
1585
+ };
1586
+ };
1587
+ /**
1588
+ * Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines
1589
+ * if at least one of the values in the column can be loosely coerced to a number.
1590
+ * If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and
1591
+ * returns that it cannot downsample the column.
1592
+ */
1327
1593
 
1328
- if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
1329
- return dataSources;
1330
- }
1331
1594
 
1332
- var nonInternalYFields = new Set(yFields.filter(function (yField) {
1333
- return !yField.startsWith('_');
1334
- }));
1335
- var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
1336
- // At the worst case, each series has non-overlapping downsampled pts
1337
- // which will mean that all points will be included in the downsampled result
1338
- // This will just lead to additional overhead due to coercing each
1339
- // x and y field to number
1595
+ var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
1596
+ // Splunk charting allows for numbers in formats such as negative hex that
1597
+ // Number() does not support and also allows loose coercion of hex numbers (but not other formats)
1598
+ // We want to identify columns which contain at least one value that can be loosely coerced
1599
+ var canLooselyCoerceSomeValues = column.findIndex(function (value) {
1600
+ return (0, numberUtils_1.startsWithNumber)("".concat(value));
1601
+ }) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
1340
1602
 
1341
- if (maxPointsInDownsample >= numPoints) {
1342
- return dataSources;
1343
- }
1603
+ var coercedColumn = [];
1604
+ var canDownsampleColumn = !column.some(function (value) {
1605
+ var coercedValue = Number(value); // if it can't be parsed or isn't safe, fail
1344
1606
 
1345
- var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
1346
- xColumn = _tryToCoerceAllDispla.xColumn,
1347
- yColumns = _tryToCoerceAllDispla.yColumns;
1607
+ if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
1608
+ return true;
1609
+ } // save value and continue to next
1348
1610
 
1349
- if (!yColumns.length || !xColumn.length) {
1350
- return dataSources;
1351
- }
1352
1611
 
1353
- var downsampledDataSources = Object.assign({}, dataSources);
1354
- var downsampledIndices = new Set();
1355
- yColumns.forEach(function (yColumn, columnIndex) {
1356
- // perform LTTB downsampling for current series, LTTB takes an [x, y] pair
1357
- var xyPair = yColumn.map(function (yValue, index) {
1358
- return [xColumn[index], yValue];
1612
+ coercedColumn.push(coercedValue);
1613
+ return false;
1614
+ });
1615
+ return {
1616
+ canDownsampleColumn: canDownsampleColumn,
1617
+ canLooselyCoerceSomeValues: canLooselyCoerceSomeValues,
1618
+ coercedColumn: canDownsampleColumn ? coercedColumn : []
1619
+ };
1620
+ };
1621
+ /**
1622
+ * Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.
1623
+ * Only strictly increasing x-columns are eligible for downsampling.
1624
+ * If the column is not eligible for downsampling, returns an empty array.
1625
+ */
1626
+
1627
+
1628
+ var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
1629
+ if (fieldType === 'number') {
1630
+ var coercedXColumn = column.map(function (xValue) {
1631
+ return Number(xValue);
1359
1632
  });
1360
1633
 
1361
- try {
1362
- var _largestTriangleThree = largestTriangleThreeBuckets(xyPair, threshold, downsampledIndices),
1363
- downsampledIndicesForSeries = _largestTriangleThree.downsampledIndices;
1634
+ if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
1635
+ return coercedXColumn;
1636
+ }
1637
+ } else if (fieldType === 'time') {
1638
+ var _coercedXColumn = column.map(function (xValue) {
1639
+ return new Date(xValue);
1640
+ });
1364
1641
 
1365
- downsampledIndicesForSeries.forEach(function (downsampleIndex) {
1366
- return downsampledIndices.add(downsampleIndex);
1367
- });
1368
- } catch (e) {
1369
- console.error("Error occurred while downsampling column ".concat(columnIndex), e);
1642
+ if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
1643
+ return _coercedXColumn;
1370
1644
  }
1371
- }); // update data columns with downsampled columns
1645
+ }
1372
1646
 
1373
- downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
1374
- return downsampledDataSources;
1647
+ return [];
1375
1648
  };
1376
1649
 
1377
- exports.downsampleDataSources = downsampleDataSources;
1650
+ var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
1651
+ var vizConfig = _ref.vizConfig;
1378
1652
 
1379
- /***/ }),
1653
+ var _a;
1380
1654
 
1381
- /***/ 148:
1382
- /***/ (function(module, exports, __webpack_require__) {
1655
+ return (_a = vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(interfaces_1.VizBehavior.DOWNSAMPLING);
1656
+ };
1383
1657
 
1384
- "use strict";
1658
+ exports.isDownsamplingEnabledForViz = isDownsamplingEnabledForViz;
1385
1659
 
1660
+ var calculateThresholdOnRangeSelect = function calculateThresholdOnRangeSelect(_ref2) {
1661
+ var firstIndex = _ref2.firstIndex,
1662
+ lastIndex = _ref2.lastIndex,
1663
+ dataSources = _ref2.dataSources,
1664
+ width = _ref2.width;
1386
1665
 
1387
- Object.defineProperty(exports, "__esModule", {
1388
- value: true
1389
- });
1666
+ var _a, _b, _c;
1390
1667
 
1391
- var i18n_1 = __webpack_require__(2);
1392
-
1393
- var gauge = {
1394
- label: (0, i18n_1._)('Data display'),
1395
- layout: [[{
1396
- label: (0, i18n_1._)('Value display'),
1397
- option: 'valueDisplay',
1398
- editor: 'editor.radioBar',
1399
- editorProps: {
1400
- values: [{
1401
- label: (0, i18n_1._)('Number'),
1402
- value: 'number'
1403
- }, {
1404
- label: (0, i18n_1._)('Percentage'),
1405
- value: 'percentage'
1406
- }, {
1407
- label: (0, i18n_1._)('Off'),
1408
- value: 'off'
1409
- }]
1410
- }
1411
- }], [{
1412
- label: (0, i18n_1._)('Label display'),
1413
- option: 'labelDisplay',
1414
- editor: 'editor.radioBar',
1415
- editorProps: {
1416
- values: [{
1417
- label: (0, i18n_1._)('Numbers'),
1418
- value: 'number'
1419
- }, {
1420
- label: (0, i18n_1._)('Percentages'),
1421
- value: 'percentage'
1422
- }, {
1423
- label: (0, i18n_1._)('Off'),
1424
- value: 'off'
1425
- }]
1426
- }
1427
- }], [{
1428
- label: (0, i18n_1._)('Orientation'),
1429
- option: 'orientation',
1430
- editor: 'editor.radioBar',
1431
- editorProps: {
1432
- values: [{
1433
- label: (0, i18n_1._)('Vertical'),
1434
- value: 'vertical'
1435
- }, {
1436
- label: (0, i18n_1._)('Horizontal'),
1437
- value: 'horizontal'
1438
- }]
1439
- }
1440
- }]]
1668
+ var window = lastIndex - firstIndex + 1;
1669
+ var ratio = Math.round(Number(((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns[0]) === null || _c === void 0 ? void 0 : _c.length) / window) * 10) / 10;
1670
+ return Math.round(ratio * Number(width));
1441
1671
  };
1442
- exports.default = gauge;
1443
1672
 
1444
- /***/ }),
1673
+ exports.calculateThresholdOnRangeSelect = calculateThresholdOnRangeSelect;
1674
+ /**
1675
+ * Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,
1676
+ * then returns the width of the visualization.
1677
+ *
1678
+ * Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled
1679
+ * data sources. Returns null if the chart event's dataset does not match the passed in primary data source or if the chart is zoomed
1680
+ * in for a categorical chart.
1681
+ */
1445
1682
 
1446
- /***/ 149:
1447
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1683
+ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
1684
+ var enableSearchZoom = _ref3.enableSearchZoom,
1685
+ dataSources = _ref3.dataSources,
1686
+ selectChartEvent = _ref3.selectChartEvent,
1687
+ width = _ref3.width,
1688
+ xField = _ref3.xField,
1689
+ y2Fields = _ref3.y2Fields;
1448
1690
 
1449
- "use strict";
1450
- __webpack_require__.r(__webpack_exports__);
1451
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MajorTick", function() { return MajorTick; });
1452
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionMajorTick", function() { return positionMajorTick; });
1453
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70);
1454
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
1455
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
1456
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
1457
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
1458
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
1459
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
1460
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
1461
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11);
1462
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
1691
+ var _a, _b, _c;
1463
1692
 
1693
+ if (enableSearchZoom || !selectChartEvent) {
1694
+ return Number(width);
1695
+ }
1464
1696
 
1697
+ var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
1465
1698
 
1699
+ if (!primaryDataSource) {
1700
+ return null;
1701
+ }
1466
1702
 
1703
+ var startXIndex = selectChartEvent.startXIndex,
1704
+ endXIndex = selectChartEvent.endXIndex,
1705
+ currentTarget = selectChartEvent.currentTarget;
1467
1706
 
1468
- var DEFAULT_NUM_OF_TICKS = 5;
1469
- var TICK_LENGTH_DELTA = 5;
1470
- var TICK_LABEL_PADDING_FACTOR = 3.2;
1471
- var MajorTickLine = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.line.withConfig({
1472
- displayName: "GaugeMajorTicks__MajorTickLine",
1473
- componentId: "mchiad-0"
1474
- })(["stroke:", ";stroke-width:2px;stroke-dasharray:", ";"], function (props) {
1475
- return props.majorTickStrokeColor;
1476
- }, function (props) {
1477
- return props.index === 0 ? 0 : 3;
1478
- });
1479
- var MajorTickLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.text.withConfig({
1480
- displayName: "GaugeMajorTicks__MajorTickLabel",
1481
- componentId: "mchiad-1"
1482
- })(["font-size:12px;font-family:Splunk Platform Sans,sans-serif;line-height:19px;fill:", ";text-anchor:middle;text-align:center;"], function (props) {
1483
- return props.majorTickFillColor;
1484
- });
1485
- var MajorTick = function MajorTick(_ref) {
1486
- var index = _ref.index,
1487
- x1 = _ref.x1,
1488
- y1 = _ref.y1,
1489
- x2 = _ref.x2,
1490
- y2 = _ref.y2,
1491
- showLabels = _ref.showLabels,
1492
- label = _ref.label,
1493
- labelX = _ref.labelX,
1494
- labelY = _ref.labelY,
1495
- majorTickStrokeColor = _ref.majorTickStrokeColor,
1496
- majorTickFillColor = _ref.majorTickFillColor;
1497
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLine, {
1498
- "data-test": "major-tick-line",
1499
- index: index,
1500
- x1: x1,
1501
- y1: y1,
1502
- x2: x2,
1503
- y2: y2,
1504
- majorTickStrokeColor: majorTickStrokeColor
1505
- }), showLabels && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLabel, {
1506
- x: labelX,
1507
- y: labelY,
1508
- majorTickFillColor: majorTickFillColor,
1509
- "data-test": "major-tick-label"
1510
- }, Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["isNumerial"])(label) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["formatNumber"])(label, 0, {
1511
- useThousandSeparators: true,
1512
- useTrendUnits: true
1513
- }) : label));
1514
- };
1515
- MajorTick.propTypes = {
1516
- index: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1517
- x1: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1518
- y1: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1519
- x2: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1520
- y2: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1521
- showLabels: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
1522
- label: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number]),
1523
- labelX: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1524
- labelY: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1525
- majorTickStrokeColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1526
- majorTickFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
1527
- };
1528
- /**
1529
- * calculate position for each major tick
1530
- * @method positionMajorTick
1531
- * @param {Object} input
1532
- * @param {Number} input.width
1533
- * @param {Number} input.height
1534
- * @param {Number} input.startX start x for rendering the first major tick
1535
- * @param {Number} input.startY start y for rendering the first major tick
1536
- * @param {String} input.orientation
1537
- * @param {Number} input.numOfTicks how many ticks need to render
1538
- * @param {Number} input.i index of major tick
1539
- * @return {Object} MajorTick positions
1540
- */
1707
+ try {
1708
+ var xFieldIndex = (_a = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _a === void 0 ? void 0 : _a.fields.findIndex(function (field) {
1709
+ return field.name === xField;
1710
+ });
1711
+ var downsampledXFieldIndex = (_b = currentTarget.dataSet) === null || _b === void 0 ? void 0 : _b.fields.findIndex(function (field) {
1712
+ return field === xField;
1713
+ });
1541
1714
 
1542
- var positionMajorTick = function positionMajorTick(_ref2) {
1543
- var width = _ref2.width,
1544
- height = _ref2.height,
1545
- startX = _ref2.startX,
1546
- startY = _ref2.startY,
1547
- orientation = _ref2.orientation,
1548
- numOfTicks = _ref2.numOfTicks,
1549
- i = _ref2.i;
1550
- var x1 = startX;
1551
- var y1 = startY;
1552
- var x2 = startX;
1553
- var y2 = startY;
1554
- var labelX = startX;
1555
- var labelY;
1715
+ if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
1716
+ return null;
1717
+ }
1556
1718
 
1557
- if (orientation === 'vertical') {
1558
- var y = height / numOfTicks * (numOfTicks - i) + startY;
1559
- x1 -= TICK_LENGTH_DELTA;
1560
- y1 = y;
1561
- x2 += width + TICK_LENGTH_DELTA;
1562
- y2 = y;
1563
- labelX += width + TICK_LENGTH_DELTA * TICK_LABEL_PADDING_FACTOR;
1564
- labelY = y;
1565
- } else {
1566
- var x = width / numOfTicks * i + startX;
1567
- x1 = x;
1568
- y1 -= TICK_LENGTH_DELTA;
1569
- x2 = x;
1570
- y2 += height + TICK_LENGTH_DELTA;
1571
- labelX = x;
1572
- labelY = y2 + 16;
1719
+ var fullSeries = (_c = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _c === void 0 ? void 0 : _c.columns[xFieldIndex];
1720
+ var downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
1721
+ var firstIndex = fullSeries.findIndex(function (x) {
1722
+ return downsampledSeries[startXIndex] === x;
1723
+ });
1724
+ var lastIndex = fullSeries.findIndex(function (x) {
1725
+ return downsampledSeries[endXIndex] === x;
1726
+ }); // For charts with categorical x-axis (charts with an xField that isn't _time), do not support
1727
+ // re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
1728
+ // Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
1729
+ // until SPL-259611 is fixed
1730
+
1731
+ if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
1732
+ return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
1733
+ }
1734
+
1735
+ if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
1736
+ return (0, exports.calculateThresholdOnRangeSelect)({
1737
+ firstIndex: firstIndex,
1738
+ lastIndex: lastIndex,
1739
+ dataSources: dataSources,
1740
+ width: width
1741
+ });
1742
+ }
1743
+ } catch (e) {
1744
+ // eslint-disable-next-line no-console
1745
+ console.error('Error occurred while setting downsample threshold on range select event', e);
1573
1746
  }
1574
1747
 
1575
- return {
1576
- x1: x1,
1577
- y1: y1,
1578
- x2: x2,
1579
- y2: y2,
1580
- labelX: labelX,
1581
- labelY: labelY
1582
- };
1748
+ return null;
1583
1749
  };
1584
1750
 
1585
- var MajorTicks = function MajorTicks(_ref3) {
1586
- var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
1751
+ exports.calculateDownsamplingThreshold = calculateDownsamplingThreshold;
1587
1752
 
1588
- var width = props.width,
1589
- height = props.height,
1590
- startX = props.startX,
1591
- startY = props.startY,
1592
- min = props.min,
1593
- max = props.max,
1594
- majorUnit = props.majorUnit,
1595
- orientation = props.orientation,
1596
- showLabels = props.showLabels,
1597
- usePercentageRange = props.usePercentageRange,
1598
- majorTickFillColor = props.majorTickFillColor,
1599
- majorTickStrokeColor = props.majorTickStrokeColor;
1600
- var range = max - min;
1601
- var numOfTicks = majorUnit === 'auto' || Number.isNaN(Number(majorUnit)) || majorUnit <= 0 ? DEFAULT_NUM_OF_TICKS : range / majorUnit;
1602
- var majorTicks = [];
1753
+ var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fieldType) {
1754
+ return column.every(function (value, index) {
1755
+ if (fieldType === 'number') {
1756
+ if (Number.isNaN(value)) {
1757
+ return false;
1758
+ }
1759
+ }
1603
1760
 
1604
- for (var i = 0; i <= numOfTicks; i += 1) {
1605
- var _positionMajorTick = positionMajorTick({
1606
- width: width,
1607
- height: height,
1608
- startX: startX,
1609
- startY: startY,
1610
- orientation: orientation,
1611
- numOfTicks: numOfTicks,
1612
- i: i
1613
- }),
1614
- x1 = _positionMajorTick.x1,
1615
- y1 = _positionMajorTick.y1,
1616
- x2 = _positionMajorTick.x2,
1617
- y2 = _positionMajorTick.y2,
1618
- labelX = _positionMajorTick.labelX,
1619
- labelY = _positionMajorTick.labelY;
1761
+ if (fieldType === 'time') {
1762
+ if (Number.isNaN(value.getTime())) {
1763
+ return false;
1764
+ }
1765
+ }
1620
1766
 
1621
- var label = usePercentageRange ? "".concat(parseInt((i / numOfTicks - min / range) * 100, 10), "%") : parseInt(min + range / numOfTicks * i, 10);
1622
- majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
1623
- key: i,
1624
- index: i,
1625
- x1: x1,
1626
- y1: y1,
1627
- x2: x2,
1628
- y2: y2,
1629
- showLabels: showLabels,
1630
- label: label,
1631
- labelX: labelX,
1632
- labelY: labelY,
1633
- majorTickFillColor: majorTickFillColor,
1634
- majorTickStrokeColor: majorTickStrokeColor
1635
- }));
1636
- } // if the gauge is not divided evenly, put the last tick at the end of the gauge
1767
+ if (index === 0) {
1768
+ return true;
1769
+ }
1637
1770
 
1771
+ return value > column[index - 1];
1772
+ });
1773
+ };
1774
+ /**
1775
+ * Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be
1776
+ * displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.
1777
+ *
1778
+ * If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
1779
+ * If not all columns can be downsampled, then returns empty arrays for both x and y
1780
+ */
1638
1781
 
1639
- if (!Number.isInteger(numOfTicks)) {
1640
- var extraNumOfTicks = Math.ceil(numOfTicks);
1641
1782
 
1642
- var _positionMajorTick2 = positionMajorTick({
1643
- width: width,
1644
- height: height,
1645
- startX: startX,
1646
- startY: startY,
1647
- orientation: orientation,
1648
- numOfTicks: extraNumOfTicks,
1649
- i: extraNumOfTicks
1650
- }),
1651
- _x = _positionMajorTick2.x1,
1652
- _y = _positionMajorTick2.y1,
1653
- _x2 = _positionMajorTick2.x2,
1654
- _y2 = _positionMajorTick2.y2,
1655
- _labelX = _positionMajorTick2.labelX,
1656
- _labelY = _positionMajorTick2.labelY;
1783
+ var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
1784
+ var xColumn = [];
1785
+ var yColumns = [];
1786
+ var canDownsample = !ds.data.fields.some(function (field, index) {
1787
+ var _a, _b;
1657
1788
 
1658
- majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
1659
- key: extraNumOfTicks,
1660
- id: extraNumOfTicks,
1661
- x1: _x,
1662
- y1: _y,
1663
- x2: _x2,
1664
- y2: _y2,
1665
- showLabels: showLabels,
1666
- label: usePercentageRange ? '100%' : max,
1667
- labelX: _labelX,
1668
- labelY: _labelY,
1669
- majorTickFillColor: majorTickFillColor,
1670
- majorTickStrokeColor: majorTickStrokeColor
1671
- }));
1672
- }
1789
+ var fieldName = (_a = field.name) !== null && _a !== void 0 ? _a : field;
1790
+ var fieldType = (_b = fieldTypes[index]) !== null && _b !== void 0 ? _b : 'unknown';
1791
+ var column = ds.data.columns[index];
1792
+ var hasDisplayedColumnThatCantBeDownsampled = false;
1673
1793
 
1674
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, majorTicks);
1675
- };
1794
+ if (fieldName === xField) {
1795
+ xColumn = strictlyCoerceXColumn(column, fieldType);
1796
+ } else if (yFields.has(fieldName)) {
1797
+ var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
1798
+ coercedColumn = _strictlyCoerceYColum.coercedColumn,
1799
+ canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
1800
+ canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
1801
+ // be downsampled using LTTB
1676
1802
 
1677
- MajorTicks.propTypes = {
1678
- width: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1679
- height: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1680
- startX: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1681
- startY: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1682
- min: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1683
- max: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1684
- majorUnit: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number]),
1685
- orientation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1686
- showLabels: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
1687
- usePercentageRange: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
1688
- majorTickFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1689
- majorTickStrokeColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
1690
- };
1691
- MajorTicks.defaultProps = {
1692
- min: 0,
1693
- max: 100,
1694
- majorUnit: 'auto',
1695
- orientation: 'horizontal',
1696
- showLabels: true,
1697
- usePercentageRange: false
1698
- };
1699
- /* harmony default export */ __webpack_exports__["default"] = (MajorTicks);
1700
1803
 
1701
- /***/ }),
1804
+ hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
1702
1805
 
1703
- /***/ 15:
1704
- /***/ (function(module, exports) {
1806
+ if (hasDisplayedColumnThatCantBeDownsampled) {
1807
+ return true;
1808
+ }
1705
1809
 
1706
- module.exports = require("@splunk/visualizations-shared/colorUtils");
1810
+ if (canDownsampleColumn) {
1811
+ yColumns.push(coercedColumn);
1812
+ }
1813
+ }
1707
1814
 
1708
- /***/ }),
1815
+ return false;
1816
+ });
1817
+
1818
+ if (canDownsample) {
1819
+ return {
1820
+ xColumn: xColumn,
1821
+ yColumns: yColumns
1822
+ };
1823
+ }
1824
+
1825
+ return {
1826
+ xColumn: [],
1827
+ yColumns: []
1828
+ };
1829
+ };
1709
1830
 
1710
- /***/ 150:
1711
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1831
+ var pickIndicesFromDataSource = function pickIndicesFromDataSource(ds, indices) {
1832
+ var sortedIndices = Array.from(indices).sort(function (a, b) {
1833
+ return a - b;
1834
+ });
1835
+ var slicedColumns = [];
1836
+ ds.data.columns.forEach(function (column) {
1837
+ var slicedColumn = [];
1838
+ sortedIndices.forEach(function (index) {
1839
+ slicedColumn.push(column[index]);
1840
+ });
1841
+ slicedColumns.push(slicedColumn);
1842
+ }); // update data columns with downsampled columns
1712
1843
 
1713
- "use strict";
1714
- __webpack_require__.r(__webpack_exports__);
1715
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionValueMarkerRect", function() { return positionValueMarkerRect; });
1716
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionLabel", function() { return positionLabel; });
1717
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70);
1718
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
1719
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
1720
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
1721
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
1722
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
1723
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
1724
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
1725
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11);
1726
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
1844
+ return Object.assign(Object.assign({}, ds), {
1845
+ data: Object.assign(Object.assign({}, ds.data), {
1846
+ columns: slicedColumns
1847
+ })
1848
+ });
1849
+ };
1727
1850
 
1851
+ var downsampleDataSources = function downsampleDataSources(_ref4) {
1852
+ var dataSources = _ref4.dataSources,
1853
+ threshold = _ref4.threshold,
1854
+ options = _ref4.options;
1728
1855
 
1856
+ var _a, _b, _c;
1729
1857
 
1858
+ var primaryDS = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary; // only downsample time series when number of data points are over threshold
1730
1859
 
1860
+ var numPoints = (_c = (_b = (_a = primaryDS === null || primaryDS === void 0 ? void 0 : primaryDS.data) === null || _a === void 0 ? void 0 : _a.columns[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
1731
1861
 
1732
- var MARKER_THICKNESS = 15;
1733
- var MARKER_INNER_LENGTH = 30;
1734
- var MARKER_LABEL_WIDTH = 60;
1735
- var MARKER_LABEL_HEIGHT = 25;
1736
- var RADIUS = 2;
1737
- var DELTA_LENGTH = 12;
1738
- var ValueMarkerRect = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.path.withConfig({
1739
- displayName: "GaugeValueMarker__ValueMarkerRect",
1740
- componentId: "sc-1bxkeao-0"
1741
- })(["stroke-width:2px;fill:", ";"], function (props) {
1742
- return props.valueMarkerFillColor;
1743
- });
1744
- var ValueMarkerLabelRect = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.rect.withConfig({
1745
- displayName: "GaugeValueMarker__ValueMarkerLabelRect",
1746
- componentId: "sc-1bxkeao-1"
1747
- })(["fill:", ";"], function (props) {
1748
- return props.valueMarkerFillColor;
1749
- });
1750
- var ValueMarkerLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.text.withConfig({
1751
- displayName: "GaugeValueMarker__ValueMarkerLabel",
1752
- componentId: "sc-1bxkeao-2"
1753
- })(["fill:", ";font-size:14px;font-family:Splunk Platform Sans,sans-serif;line-height:16px;text-anchor:middle;text-align:center;dominant-baseline:middle;"], function (props) {
1754
- return props.valueMarkerLabelFillColor;
1755
- });
1756
- /**
1757
- * calculate the path of Value Marker shape
1758
- * @method positionValueMarkerRect
1759
- * @param {Object} input
1760
- * @param {Number} input.x
1761
- * @param {Number} input.y
1762
- * @param {String} input.orientation
1763
- * @param {Number} input.valueMarkerRectLength
1764
- * @return {String} d containing a series of path commands that define the path to be
1765
- */
1862
+ if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
1863
+ return dataSources;
1864
+ }
1766
1865
 
1767
- var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
1768
- var x = _ref.x,
1769
- y = _ref.y,
1770
- orientation = _ref.orientation,
1771
- valueMarkerRectLength = _ref.valueMarkerRectLength,
1772
- _ref$alignCenter = _ref.alignCenter,
1773
- alignCenter = _ref$alignCenter === void 0 ? false : _ref$alignCenter;
1774
- var hLength = MARKER_THICKNESS;
1775
- var vLength = valueMarkerRectLength;
1776
- var markerStartX = alignCenter ? x - MARKER_THICKNESS / 2 : x - MARKER_THICKNESS;
1777
- var markerStartY = y;
1778
- var innerHLength = hLength / 3;
1779
- var innerVLength = MARKER_INNER_LENGTH;
1780
- var innerStartX = markerStartX + innerHLength;
1781
- var innerStartY = markerStartY + 7;
1866
+ var xField = options.xField,
1867
+ yFields = options.yFields,
1868
+ fieldTypes = options.fieldTypes;
1782
1869
 
1783
- if (orientation === 'vertical') {
1784
- hLength = valueMarkerRectLength;
1785
- vLength = MARKER_THICKNESS;
1786
- markerStartX = x;
1787
- markerStartY = alignCenter ? y - MARKER_THICKNESS / 2 : y;
1788
- innerHLength = MARKER_INNER_LENGTH;
1789
- innerVLength = vLength / 3;
1790
- innerStartX = markerStartX + 7;
1791
- innerStartY = markerStartY + innerVLength;
1870
+ if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
1871
+ return dataSources;
1792
1872
  }
1793
1873
 
1794
- return "M".concat(markerStartX, ",").concat(markerStartY, "h").concat(hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(RADIUS, "v").concat(vLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(RADIUS, "h").concat(-hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(-RADIUS, "v").concat(2 * RADIUS - vLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(-RADIUS, "z") + "M".concat(innerStartX, ",").concat(innerStartY, "v").concat(innerVLength - RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(RADIUS, "h").concat(innerHLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(-RADIUS, "v").concat(RADIUS - innerVLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(-RADIUS, "h").concat(2 * RADIUS - innerHLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(RADIUS, "z");
1795
- };
1796
- /**
1797
- * calculate the position of value marker label
1798
- * @method positionLabel
1799
- * @param {Object} input
1800
- * @param {Number} input.x
1801
- * @param {Number} input.y
1802
- * @param {Number} input.length gauge thickness
1803
- * @param {String} input.orientation
1804
- * @return {Object} positions
1805
- * @return {Number} positions.labelRectX x of value marker label rect
1806
- * @return {Number} positions.labelRectY y of value marker label rect
1807
- * @return {Number} positions.labelX x of value marker label text
1808
- * @return {Number} positions.labelY y of value marker label text
1809
- */
1874
+ var nonInternalYFields = new Set(yFields.filter(function (yField) {
1875
+ return !yField.startsWith('_');
1876
+ }));
1877
+ var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
1878
+ // At the worst case, each series has non-overlapping downsampled pts
1879
+ // which will mean that all points will be included in the downsampled result
1880
+ // This will just lead to additional overhead due to coercing each
1881
+ // x and y field to number
1810
1882
 
1811
- var positionLabel = function positionLabel(_ref2) {
1812
- var x = _ref2.x,
1813
- y = _ref2.y,
1814
- length = _ref2.length,
1815
- orientation = _ref2.orientation,
1816
- _ref2$alignCenter = _ref2.alignCenter,
1817
- alignCenter = _ref2$alignCenter === void 0 ? false : _ref2$alignCenter; // for horizontal view
1883
+ if (maxPointsInDownsample >= numPoints) {
1884
+ return dataSources;
1885
+ }
1818
1886
 
1819
- var labelRectX = alignCenter ? x - MARKER_LABEL_WIDTH / 2 : x - MARKER_THICKNESS / 2 - MARKER_LABEL_WIDTH / 2;
1820
- var labelRectY = y + length;
1887
+ var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
1888
+ xColumn = _tryToCoerceAllDispla.xColumn,
1889
+ yColumns = _tryToCoerceAllDispla.yColumns;
1821
1890
 
1822
- if (orientation === 'vertical') {
1823
- labelRectX = x + length;
1824
- labelRectY = alignCenter ? y - MARKER_LABEL_HEIGHT / 2 : y - (MARKER_LABEL_HEIGHT - MARKER_THICKNESS) / 2;
1891
+ if (!yColumns.length || !xColumn.length) {
1892
+ return dataSources;
1825
1893
  }
1826
1894
 
1827
- var labelX = labelRectX + MARKER_LABEL_WIDTH / 2;
1828
- var labelY = labelRectY + MARKER_LABEL_HEIGHT / 2;
1829
- return {
1830
- labelRectX: labelRectX,
1831
- labelRectY: labelRectY,
1832
- labelX: labelX,
1833
- labelY: labelY
1834
- };
1835
- };
1836
-
1837
- var ValueMarker = function ValueMarker(_ref3) {
1838
- var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
1895
+ var downsampledDataSources = Object.assign({}, dataSources);
1896
+ var downsampledIndices = new Set();
1897
+ yColumns.forEach(function (yColumn, columnIndex) {
1898
+ // perform LTTB downsampling for current series, LTTB takes an [x, y] pair
1899
+ var xyPair = yColumn.map(function (yValue, index) {
1900
+ return [xColumn[index], yValue];
1901
+ });
1839
1902
 
1840
- var x = props.x,
1841
- y = props.y,
1842
- length = props.length,
1843
- min = props.min,
1844
- max = props.max,
1845
- value = props.value,
1846
- orientation = props.orientation,
1847
- showValue = props.showValue,
1848
- usePercentageValue = props.usePercentageValue,
1849
- valueMarkerFillColor = props.valueMarkerFillColor,
1850
- valueMarkerLabelFillColor = props.valueMarkerLabelFillColor,
1851
- alignCenter = props.alignCenter;
1852
- var valueMarkerRectLength = length + DELTA_LENGTH;
1903
+ try {
1904
+ var _largestTriangleThree = largestTriangleThreeBuckets(xyPair, threshold, downsampledIndices),
1905
+ downsampledIndicesForSeries = _largestTriangleThree.downsampledIndices;
1853
1906
 
1854
- var _positionLabel = positionLabel({
1855
- x: x,
1856
- y: y,
1857
- length: length,
1858
- orientation: orientation,
1859
- alignCenter: alignCenter
1860
- }),
1861
- labelRectX = _positionLabel.labelRectX,
1862
- labelRectY = _positionLabel.labelRectY,
1863
- labelX = _positionLabel.labelX,
1864
- labelY = _positionLabel.labelY;
1907
+ downsampledIndicesForSeries.forEach(function (downsampleIndex) {
1908
+ return downsampledIndices.add(downsampleIndex);
1909
+ });
1910
+ } catch (e) {
1911
+ // eslint-disable-next-line no-console
1912
+ console.error("Error occurred while downsampling column ".concat(columnIndex), e);
1913
+ }
1914
+ }); // update data columns with downsampled columns
1865
1915
 
1866
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerRect, {
1867
- "data-test": "value-marker-rect",
1868
- d: positionValueMarkerRect({
1869
- x: x,
1870
- y: y,
1871
- orientation: orientation,
1872
- valueMarkerRectLength: valueMarkerRectLength,
1873
- alignCenter: alignCenter
1874
- }),
1875
- valueMarkerFillColor: valueMarkerFillColor
1876
- }), showValue && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerLabelRect, {
1877
- "data-test": "value-marker-label-rect",
1878
- x: labelRectX,
1879
- y: labelRectY,
1880
- width: MARKER_LABEL_WIDTH,
1881
- height: MARKER_LABEL_HEIGHT,
1882
- rx: RADIUS,
1883
- ry: RADIUS,
1884
- valueMarkerFillColor: valueMarkerFillColor
1885
- }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerLabel, {
1886
- "data-test": "value-marker-label",
1887
- x: labelX,
1888
- y: labelY,
1889
- valueMarkerLabelFillColor: valueMarkerLabelFillColor
1890
- }, usePercentageValue ? "".concat((value / (max - min) * 100).toFixed(2), "%") : Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["formatNumber"])(value, 0, {
1891
- useThousandSeparators: true,
1892
- useTrendUnits: true
1893
- }))));
1916
+ downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
1917
+ return downsampledDataSources;
1894
1918
  };
1895
1919
 
1896
- ValueMarker.propTypes = {
1897
- x: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1898
- y: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1899
- length: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1900
- min: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1901
- max: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1902
- value: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
1903
- orientation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1904
- showValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
1905
- usePercentageValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
1906
- valueMarkerFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1907
- valueMarkerLabelFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
1908
- alignCenter: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool
1909
- };
1910
- ValueMarker.defaultProps = {
1911
- min: 0,
1912
- max: 100,
1913
- orientation: 'horizontal',
1914
- showValue: true,
1915
- usePercentageValue: false,
1916
- alignCenter: false
1917
- };
1918
- /* harmony default export */ __webpack_exports__["default"] = (ValueMarker);
1920
+ exports.downsampleDataSources = downsampleDataSources;
1919
1921
 
1920
1922
  /***/ }),
1921
1923
 
1922
1924
  /***/ 16:
1923
1925
  /***/ (function(module, exports) {
1924
1926
 
1925
- module.exports = require("@splunk/visualization-encoding/Options");
1927
+ module.exports = require("@splunk/visualizations-shared/colorUtils");
1926
1928
 
1927
1929
  /***/ }),
1928
1930
 
1929
1931
  /***/ 17:
1932
+ /***/ (function(module, exports) {
1933
+
1934
+ module.exports = require("@splunk/visualization-encoding/Options");
1935
+
1936
+ /***/ }),
1937
+
1938
+ /***/ 18:
1930
1939
  /***/ (function(module, exports, __webpack_require__) {
1931
1940
 
1932
1941
  "use strict";
1933
1942
 
1934
1943
 
1935
- var _slicedToArray = __webpack_require__(7);
1944
+ var _slicedToArray = __webpack_require__(6);
1936
1945
 
1937
1946
  Object.defineProperty(exports, "__esModule", {
1938
1947
  value: true
@@ -1942,9 +1951,9 @@ var React = __webpack_require__(0);
1942
1951
 
1943
1952
  var styled_components_1 = __webpack_require__(4);
1944
1953
 
1945
- var style_1 = __webpack_require__(18);
1954
+ var style_1 = __webpack_require__(19);
1946
1955
 
1947
- var colorUtils_1 = __webpack_require__(15);
1956
+ var colorUtils_1 = __webpack_require__(16);
1948
1957
 
1949
1958
  var SizeAwareWrapper_1 = __webpack_require__(26);
1950
1959
 
@@ -2017,7 +2026,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
2017
2026
 
2018
2027
  return React.createElement(FixSizeItem, {
2019
2028
  "data-test": "fix-size-item",
2020
- "data-splunk-visualization-version": "26.2.0 - 49b909915",
2029
+ "data-splunk-visualization-version": "26.3.0 - a1ef240a6",
2021
2030
  width: width,
2022
2031
  height: height,
2023
2032
  backgroundColor: backgroundColor
@@ -2039,14 +2048,7 @@ exports.default = withFixedSizeContainer;
2039
2048
 
2040
2049
  /***/ }),
2041
2050
 
2042
- /***/ 18:
2043
- /***/ (function(module, exports) {
2044
-
2045
- module.exports = require("@splunk/visualizations-shared/style");
2046
-
2047
- /***/ }),
2048
-
2049
- /***/ 185:
2051
+ /***/ 182:
2050
2052
  /***/ (function(module, exports, __webpack_require__) {
2051
2053
 
2052
2054
  "use strict";
@@ -2072,15 +2074,15 @@ exports.config = exports.computeVizProps = exports.PureMarkerGauge = void 0;
2072
2074
 
2073
2075
  var lodash_1 = __webpack_require__(3);
2074
2076
 
2075
- var MarkerGauge_1 = __webpack_require__(450);
2077
+ var MarkerGauge_1 = __webpack_require__(446);
2076
2078
 
2077
- var config_1 = __webpack_require__(451);
2079
+ var config_1 = __webpack_require__(447);
2078
2080
 
2079
2081
  exports.config = config_1.default;
2080
2082
 
2081
- var withDashboardViz_1 = __webpack_require__(56);
2083
+ var withDashboardViz_1 = __webpack_require__(55);
2082
2084
 
2083
- var gaugeUtils_1 = __webpack_require__(121);
2085
+ var gaugeUtils_1 = __webpack_require__(118);
2084
2086
 
2085
2087
  exports.PureMarkerGauge = MarkerGauge_1.default;
2086
2088
  var validOptions = Object.keys(config_1.default.optionsSchema);
@@ -2110,6 +2112,20 @@ exports.default = viz;
2110
2112
  /***/ }),
2111
2113
 
2112
2114
  /***/ 19:
2115
+ /***/ (function(module, exports) {
2116
+
2117
+ module.exports = require("@splunk/visualizations-shared/style");
2118
+
2119
+ /***/ }),
2120
+
2121
+ /***/ 2:
2122
+ /***/ (function(module, exports) {
2123
+
2124
+ module.exports = require("@splunk/ui-utils/i18n");
2125
+
2126
+ /***/ }),
2127
+
2128
+ /***/ 21:
2113
2129
  /***/ (function(module, exports, __webpack_require__) {
2114
2130
 
2115
2131
  "use strict";
@@ -2118,27 +2134,19 @@ exports.default = viz;
2118
2134
  Object.defineProperty(exports, "__esModule", {
2119
2135
  value: true
2120
2136
  });
2121
- exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
2137
+ exports.validOutputModes = exports.validSortDirs = void 0;
2122
2138
  exports.validSortDirs = ['asc', 'desc', 'none'];
2123
- exports.validSegmentationModes = ['none', 'inner'];
2124
2139
  exports.validOutputModes = ['json_cols', 'json'];
2125
2140
 
2126
2141
  /***/ }),
2127
2142
 
2128
- /***/ 2:
2129
- /***/ (function(module, exports) {
2130
-
2131
- module.exports = require("@splunk/ui-utils/i18n");
2132
-
2133
- /***/ }),
2134
-
2135
- /***/ 21:
2143
+ /***/ 22:
2136
2144
  /***/ (function(module, exports, __webpack_require__) {
2137
2145
 
2138
2146
  "use strict";
2139
2147
 
2140
2148
 
2141
- var _classCallCheck = __webpack_require__(10);
2149
+ var _classCallCheck = __webpack_require__(9);
2142
2150
 
2143
2151
  var _createClass = __webpack_require__(25);
2144
2152
 
@@ -2170,7 +2178,7 @@ exports.DefaultVizActionHandler = DefaultVizActionHandler;
2170
2178
 
2171
2179
  /***/ }),
2172
2180
 
2173
- /***/ 22:
2181
+ /***/ 23:
2174
2182
  /***/ (function(module, exports, __webpack_require__) {
2175
2183
 
2176
2184
  "use strict";
@@ -2199,7 +2207,7 @@ var VizCategory;
2199
2207
 
2200
2208
  /***/ }),
2201
2209
 
2202
- /***/ 23:
2210
+ /***/ 24:
2203
2211
  /***/ (function(module, exports, __webpack_require__) {
2204
2212
 
2205
2213
  "use strict";
@@ -2232,13 +2240,6 @@ exports.extendStaticWrapperProps = extendStaticWrapperProps;
2232
2240
 
2233
2241
  /***/ }),
2234
2242
 
2235
- /***/ 24:
2236
- /***/ (function(module, exports) {
2237
-
2238
- module.exports = require("@splunk/visualizations-shared/schemaUtils");
2239
-
2240
- /***/ }),
2241
-
2242
2243
  /***/ 25:
2243
2244
  /***/ (function(module, exports) {
2244
2245
 
@@ -2259,99 +2260,24 @@ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
2259
2260
  "use strict";
2260
2261
 
2261
2262
 
2262
- var _toConsumableArray = __webpack_require__(8);
2263
-
2264
- var _defineProperty = __webpack_require__(9);
2265
-
2266
- var __rest = this && this.__rest || function (s, e) {
2267
- var t = {};
2268
-
2269
- for (var p in s) {
2270
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2271
- }
2272
-
2273
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2274
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2275
- }
2276
- return t;
2277
- };
2263
+ var _toConsumableArray = __webpack_require__(7);
2278
2264
 
2279
2265
  Object.defineProperty(exports, "__esModule", {
2280
2266
  value: true
2281
2267
  });
2282
- exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
2283
-
2284
- var lodash_1 = __webpack_require__(3);
2285
-
2286
- var schemaUtils_1 = __webpack_require__(24);
2287
-
2288
- var VizBehavior_1 = __webpack_require__(6);
2289
-
2290
- var dynamicOptionsDSLType = {
2291
- type: 'string',
2292
- pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
2293
- };
2294
- /**
2295
- * Helper function to extend an options schema with dynamic options DSL
2296
- * @param optionsSchema a visualization's options schema
2297
- * @returns an updated options schema that additionally allows strings starting with > for each option
2298
- */
2268
+ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceConfig = exports.enhanceOptionsSchemaWithDynamicOptions = void 0;
2299
2269
 
2300
- function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
2301
- var enhancedOptionsSchema = {};
2302
- Object.keys(optionsSchema).forEach(function (key) {
2303
- var _a = optionsSchema[key],
2304
- title = _a.title,
2305
- description = _a.description,
2306
- readOnly = _a.readOnly,
2307
- writeOnly = _a.writeOnly,
2308
- examples = _a.examples,
2309
- defaultValue = _a.default,
2310
- type = _a.type,
2311
- properties = _a.properties,
2312
- patternProperties = _a.patternProperties,
2313
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
2314
-
2315
- var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
2316
- title: title
2317
- }), description !== undefined && {
2318
- description: description
2319
- }), readOnly !== undefined && {
2320
- readOnly: readOnly
2321
- }), writeOnly !== undefined && {
2322
- writeOnly: writeOnly
2323
- }), examples !== undefined && {
2324
- examples: examples
2325
- }), defaultValue !== undefined && {
2326
- default: defaultValue
2327
- });
2270
+ var lodash_1 = __webpack_require__(3); // included for backwards compatibility
2328
2271
 
2329
- if (type === 'object') {
2330
- enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
2331
- type: type
2332
- }), properties && {
2333
- properties: enhanceOptionsSchemaWithDynamicOptions(properties)
2334
- });
2335
2272
 
2336
- if (patternProperties) {
2337
- var enhancedPatternProperties = {};
2338
- Object.keys(patternProperties).forEach(function (opt) {
2339
- enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
2340
- });
2341
- enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
2342
- }
2343
- } else {
2344
- enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
2345
- anyOf: [Object.assign(Object.assign({}, type !== undefined && {
2346
- type: type
2347
- }), remainingSchemaEntry), dynamicOptionsDSLType]
2348
- });
2349
- }
2350
- });
2351
- return enhancedOptionsSchema;
2352
- }
2273
+ var visualization_schemas_1 = __webpack_require__(10);
2353
2274
 
2354
- exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
2275
+ Object.defineProperty(exports, "enhanceOptionsSchemaWithDynamicOptions", {
2276
+ enumerable: true,
2277
+ get: function get() {
2278
+ return visualization_schemas_1.enhanceOptionsSchemaWithDynamicOptions;
2279
+ }
2280
+ });
2355
2281
  /**
2356
2282
  * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
2357
2283
  * this function also collapse all editor panels
@@ -2362,11 +2288,6 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
2362
2288
 
2363
2289
  function enhanceConfig(vizConfig) {
2364
2290
  var enhancedConfig = Object.assign({}, vizConfig);
2365
-
2366
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
2367
- enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
2368
- }
2369
-
2370
2291
  enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
2371
2292
  return Object.assign(Object.assign({}, config), {
2372
2293
  open: config.open || false
@@ -2584,7 +2505,7 @@ var i18n_1 = __webpack_require__(2);
2584
2505
 
2585
2506
  var Message_1 = __webpack_require__(12);
2586
2507
 
2587
- var FixedSizeContainer_1 = __webpack_require__(17);
2508
+ var FixedSizeContainer_1 = __webpack_require__(18);
2588
2509
  /**
2589
2510
  * @method shouldShowIconPlaceholder
2590
2511
  * @param {object} dataSources
@@ -2662,7 +2583,7 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
2662
2583
  "use strict";
2663
2584
 
2664
2585
 
2665
- var _defineProperty = __webpack_require__(9);
2586
+ var _defineProperty = __webpack_require__(13);
2666
2587
 
2667
2588
  Object.defineProperty(exports, "__esModule", {
2668
2589
  value: true
@@ -2673,7 +2594,7 @@ var T = __webpack_require__(1);
2673
2594
 
2674
2595
  var lodash_1 = __webpack_require__(3);
2675
2596
 
2676
- var DataSource_1 = __webpack_require__(19);
2597
+ var DataSource_1 = __webpack_require__(21);
2677
2598
 
2678
2599
  exports.SortParamsPropTypes = T.shape({
2679
2600
  currentSortKey: T.string,
@@ -2838,7 +2759,7 @@ __exportStar(__webpack_require__(41), exports);
2838
2759
 
2839
2760
  __exportStar(__webpack_require__(42), exports);
2840
2761
 
2841
- __exportStar(__webpack_require__(19), exports);
2762
+ __exportStar(__webpack_require__(21), exports);
2842
2763
 
2843
2764
  __exportStar(__webpack_require__(43), exports);
2844
2765
 
@@ -2852,13 +2773,13 @@ __exportStar(__webpack_require__(47), exports);
2852
2773
 
2853
2774
  __exportStar(__webpack_require__(48), exports);
2854
2775
 
2855
- __exportStar(__webpack_require__(49), exports);
2776
+ __exportStar(__webpack_require__(22), exports);
2856
2777
 
2857
- __exportStar(__webpack_require__(21), exports);
2778
+ __exportStar(__webpack_require__(8), exports);
2858
2779
 
2859
- __exportStar(__webpack_require__(6), exports);
2780
+ __exportStar(__webpack_require__(23), exports);
2860
2781
 
2861
- __exportStar(__webpack_require__(22), exports);
2782
+ __exportStar(__webpack_require__(49), exports);
2862
2783
 
2863
2784
  __exportStar(__webpack_require__(50), exports);
2864
2785
 
@@ -2870,8 +2791,6 @@ __exportStar(__webpack_require__(53), exports);
2870
2791
 
2871
2792
  __exportStar(__webpack_require__(54), exports);
2872
2793
 
2873
- __exportStar(__webpack_require__(55), exports);
2874
-
2875
2794
  /***/ }),
2876
2795
 
2877
2796
  /***/ 41:
@@ -2925,7 +2844,7 @@ Object.defineProperty(exports, "__esModule", {
2925
2844
 
2926
2845
  /***/ }),
2927
2846
 
2928
- /***/ 449:
2847
+ /***/ 445:
2929
2848
  /***/ (function(module, exports, __webpack_require__) {
2930
2849
 
2931
2850
  "use strict";
@@ -2961,9 +2880,9 @@ Object.defineProperty(exports, "__esModule", {
2961
2880
  });
2962
2881
  exports.default = void 0;
2963
2882
 
2964
- __exportStar(__webpack_require__(185), exports);
2883
+ __exportStar(__webpack_require__(182), exports);
2965
2884
 
2966
- var MarkerGauge_1 = __webpack_require__(185);
2885
+ var MarkerGauge_1 = __webpack_require__(182);
2967
2886
 
2968
2887
  Object.defineProperty(exports, "default", {
2969
2888
  enumerable: true,
@@ -2974,25 +2893,13 @@ Object.defineProperty(exports, "default", {
2974
2893
 
2975
2894
  /***/ }),
2976
2895
 
2977
- /***/ 45:
2978
- /***/ (function(module, exports, __webpack_require__) {
2979
-
2980
- "use strict";
2981
-
2982
-
2983
- Object.defineProperty(exports, "__esModule", {
2984
- value: true
2985
- });
2986
-
2987
- /***/ }),
2988
-
2989
- /***/ 450:
2896
+ /***/ 446:
2990
2897
  /***/ (function(module, exports, __webpack_require__) {
2991
2898
 
2992
2899
  "use strict";
2993
2900
 
2994
2901
 
2995
- var _slicedToArray = __webpack_require__(7);
2902
+ var _slicedToArray = __webpack_require__(6);
2996
2903
 
2997
2904
  var __rest = this && this.__rest || function (s, e) {
2998
2905
  var t = {};
@@ -3023,7 +2930,7 @@ var lodash_1 = __webpack_require__(3);
3023
2930
 
3024
2931
  var i18n_1 = __webpack_require__(2);
3025
2932
 
3026
- var style_1 = __webpack_require__(18);
2933
+ var style_1 = __webpack_require__(19);
3027
2934
 
3028
2935
  var SizeAwareWrapper_1 = __webpack_require__(26);
3029
2936
 
@@ -3031,11 +2938,11 @@ var Message_1 = __webpack_require__(12);
3031
2938
 
3032
2939
  var id_1 = __webpack_require__(31);
3033
2940
 
3034
- var gaugeUtils_1 = __webpack_require__(121);
2941
+ var gaugeUtils_1 = __webpack_require__(118);
3035
2942
 
3036
- var GaugeMajorTicks_1 = __webpack_require__(149);
2943
+ var GaugeMajorTicks_1 = __webpack_require__(147);
3037
2944
 
3038
- var GaugeValueMarker_1 = __webpack_require__(150);
2945
+ var GaugeValueMarker_1 = __webpack_require__(148);
3039
2946
 
3040
2947
  var MAX_VERTICAL_CONTAINER_WIDTH = 200;
3041
2948
  var MIN_VERTICAL_CONTAINER_HEIGHT = 200;
@@ -3311,6 +3218,7 @@ var MarkerGauge = function MarkerGauge(_a) {
3311
3218
  }))));
3312
3219
  }, [orientation, error, calculateMarkerGaugeDimensions, backgroundColor, linearGradient, fillColor, min, max, majorUnit, showLabels, usePercentageRange, majorTickFillColor, majorTickStrokeColor, linearGradientId, value, showValue, usePercentageValue, valueMarkerFillColor, valueMarkerLabelFillColor, errorMessage, errorId]);
3313
3220
  return React.createElement(Container, {
3221
+ "data-test": "marker-gauge-container",
3314
3222
  width: width,
3315
3223
  height: height,
3316
3224
  backgroundColor: backgroundColor
@@ -3378,7 +3286,7 @@ exports.default = MarkerGauge;
3378
3286
 
3379
3287
  /***/ }),
3380
3288
 
3381
- /***/ 451:
3289
+ /***/ 447:
3382
3290
  /***/ (function(module, exports, __webpack_require__) {
3383
3291
 
3384
3292
  "use strict";
@@ -3390,25 +3298,25 @@ Object.defineProperty(exports, "__esModule", {
3390
3298
 
3391
3299
  var i18n_1 = __webpack_require__(2);
3392
3300
 
3393
- var GaugeMarker_1 = __webpack_require__(452);
3301
+ var GaugeMarker_1 = __webpack_require__(448);
3394
3302
 
3395
- var placeholders_1 = __webpack_require__(72);
3303
+ var placeholders_1 = __webpack_require__(71);
3396
3304
 
3397
- var schemaUtils_1 = __webpack_require__(24);
3305
+ var visualization_schemas_1 = __webpack_require__(10);
3398
3306
 
3399
- var variables_1 = __webpack_require__(13);
3307
+ var variables_1 = __webpack_require__(14);
3400
3308
 
3401
3309
  var pick_1 = __webpack_require__(30);
3402
3310
 
3403
- var Gauge_1 = __webpack_require__(148);
3311
+ var Gauge_1 = __webpack_require__(146);
3404
3312
 
3405
- var VizBehavior_1 = __webpack_require__(6);
3313
+ var VizBehavior_1 = __webpack_require__(8);
3406
3314
 
3407
- var VizCategory_1 = __webpack_require__(22);
3315
+ var VizCategory_1 = __webpack_require__(23);
3408
3316
 
3409
3317
  var configUtils_1 = __webpack_require__(27);
3410
3318
 
3411
- var BackgroundColor_1 = __webpack_require__(75);
3319
+ var BackgroundColor_1 = __webpack_require__(73);
3412
3320
 
3413
3321
  var dataContract = {
3414
3322
  requiredDataSources: [{
@@ -3428,79 +3336,6 @@ var size = {
3428
3336
  initialHeight: 300
3429
3337
  };
3430
3338
  var defaultContext = {};
3431
- var optionsSchema = {
3432
- backgroundColor: {
3433
- description: 'Specify the color used for the background. The default for enterprise light is "#ffffff". The default for enterprise dark is "#000000". The default for prisma dark is "#0b0c0e".',
3434
- type: 'string',
3435
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
3436
- default: '> themes.defaultBackgroundColor'
3437
- },
3438
- gaugeRanges: {
3439
- description: 'Specify the overall range of the gauge as a series of continuous, color-coded subranges. For example, [{"from": 0, "to": 20, "value": "#4BEBA8"}, {"from": 20, "to": 50, "value": "#F4DF7A"}].',
3440
- default: [{
3441
- from: 0,
3442
- to: 50,
3443
- value: '#118832'
3444
- }, {
3445
- from: 50,
3446
- to: 90,
3447
- value: '#CBA700'
3448
- }, {
3449
- from: 90,
3450
- to: 100,
3451
- value: '#D41F1F'
3452
- }],
3453
- type: 'array',
3454
- items: {
3455
- type: 'object',
3456
- properties: {
3457
- from: {
3458
- type: 'number',
3459
- description: 'Starting value for range.'
3460
- },
3461
- to: {
3462
- type: 'number',
3463
- description: 'Ending value for range.'
3464
- },
3465
- value: {
3466
- description: 'Color for sub range.',
3467
- type: 'string',
3468
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
3469
- }
3470
- },
3471
- required: ['from', 'to', 'value'],
3472
- additionalProperties: false
3473
- }
3474
- },
3475
- labelDisplay: {
3476
- description: 'Specify whether to display the labels as numbers, percentages, or off. The label center aligns to the value.',
3477
- default: 'number',
3478
- type: 'string',
3479
- pattern: (0, schemaUtils_1.getPattern)(['number', 'percentage', 'off'])
3480
- },
3481
- majorTickInterval: {
3482
- description: 'Specify, in pixels, the spacing between major tick marks.',
3483
- default: 'auto',
3484
- type: ['string', 'number']
3485
- },
3486
- orientation: {
3487
- description: 'Specify the axis orientation of the gauge.',
3488
- default: 'vertical',
3489
- type: 'string',
3490
- pattern: (0, schemaUtils_1.getPattern)(['horizontal', 'vertical'])
3491
- },
3492
- value: {
3493
- description: 'Specify the dataSource applied to the value of the marker gauge.',
3494
- type: 'string',
3495
- default: '> primary | seriesByType("number") | lastPoint()'
3496
- },
3497
- valueDisplay: {
3498
- description: 'Specify whether to display the value as a number, percentage, or off.',
3499
- default: 'number',
3500
- type: 'string',
3501
- pattern: (0, schemaUtils_1.getPattern)(['number', 'percentage', 'off'])
3502
- }
3503
- };
3504
3339
  var themes = {
3505
3340
  defaultFillColor: function defaultFillColor(props) {
3506
3341
  return (0, pick_1.default)({
@@ -3620,7 +3455,7 @@ var config = {
3620
3455
  dataContract: dataContract,
3621
3456
  size: size,
3622
3457
  defaultContext: defaultContext,
3623
- optionsSchema: optionsSchema,
3458
+ optionsSchema: visualization_schemas_1.markerGaugeOptionsSchema,
3624
3459
  editorConfig: editorConfig,
3625
3460
  supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER],
3626
3461
  themes: themes
@@ -3629,14 +3464,14 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
3629
3464
 
3630
3465
  /***/ }),
3631
3466
 
3632
- /***/ 452:
3467
+ /***/ 448:
3633
3468
  /***/ (function(module, exports) {
3634
3469
 
3635
3470
  module.exports = require("@splunk/react-icons/enterprise/GaugeMarker");
3636
3471
 
3637
3472
  /***/ }),
3638
3473
 
3639
- /***/ 46:
3474
+ /***/ 45:
3640
3475
  /***/ (function(module, exports, __webpack_require__) {
3641
3476
 
3642
3477
  "use strict";
@@ -3648,7 +3483,7 @@ Object.defineProperty(exports, "__esModule", {
3648
3483
 
3649
3484
  /***/ }),
3650
3485
 
3651
- /***/ 47:
3486
+ /***/ 46:
3652
3487
  /***/ (function(module, exports, __webpack_require__) {
3653
3488
 
3654
3489
  "use strict";
@@ -3660,7 +3495,7 @@ Object.defineProperty(exports, "__esModule", {
3660
3495
 
3661
3496
  /***/ }),
3662
3497
 
3663
- /***/ 48:
3498
+ /***/ 47:
3664
3499
  /***/ (function(module, exports, __webpack_require__) {
3665
3500
 
3666
3501
  "use strict";
@@ -3672,7 +3507,7 @@ Object.defineProperty(exports, "__esModule", {
3672
3507
 
3673
3508
  /***/ }),
3674
3509
 
3675
- /***/ 49:
3510
+ /***/ 48:
3676
3511
  /***/ (function(module, exports, __webpack_require__) {
3677
3512
 
3678
3513
  "use strict";
@@ -3684,7 +3519,7 @@ Object.defineProperty(exports, "__esModule", {
3684
3519
 
3685
3520
  /***/ }),
3686
3521
 
3687
- /***/ 50:
3522
+ /***/ 49:
3688
3523
  /***/ (function(module, exports, __webpack_require__) {
3689
3524
 
3690
3525
  "use strict";
@@ -3696,7 +3531,7 @@ Object.defineProperty(exports, "__esModule", {
3696
3531
 
3697
3532
  /***/ }),
3698
3533
 
3699
- /***/ 51:
3534
+ /***/ 50:
3700
3535
  /***/ (function(module, exports, __webpack_require__) {
3701
3536
 
3702
3537
  "use strict";
@@ -3708,7 +3543,7 @@ Object.defineProperty(exports, "__esModule", {
3708
3543
 
3709
3544
  /***/ }),
3710
3545
 
3711
- /***/ 52:
3546
+ /***/ 51:
3712
3547
  /***/ (function(module, exports, __webpack_require__) {
3713
3548
 
3714
3549
  "use strict";
@@ -3720,7 +3555,7 @@ Object.defineProperty(exports, "__esModule", {
3720
3555
 
3721
3556
  /***/ }),
3722
3557
 
3723
- /***/ 53:
3558
+ /***/ 52:
3724
3559
  /***/ (function(module, exports, __webpack_require__) {
3725
3560
 
3726
3561
  "use strict";
@@ -3732,7 +3567,7 @@ Object.defineProperty(exports, "__esModule", {
3732
3567
 
3733
3568
  /***/ }),
3734
3569
 
3735
- /***/ 54:
3570
+ /***/ 53:
3736
3571
  /***/ (function(module, exports, __webpack_require__) {
3737
3572
 
3738
3573
  "use strict";
@@ -3744,7 +3579,7 @@ Object.defineProperty(exports, "__esModule", {
3744
3579
 
3745
3580
  /***/ }),
3746
3581
 
3747
- /***/ 55:
3582
+ /***/ 54:
3748
3583
  /***/ (function(module, exports, __webpack_require__) {
3749
3584
 
3750
3585
  "use strict";
@@ -3756,13 +3591,13 @@ Object.defineProperty(exports, "__esModule", {
3756
3591
 
3757
3592
  /***/ }),
3758
3593
 
3759
- /***/ 56:
3594
+ /***/ 55:
3760
3595
  /***/ (function(module, exports, __webpack_require__) {
3761
3596
 
3762
3597
  "use strict";
3763
3598
 
3764
3599
 
3765
- var _slicedToArray = __webpack_require__(7);
3600
+ var _slicedToArray = __webpack_require__(6);
3766
3601
 
3767
3602
  Object.defineProperty(exports, "__esModule", {
3768
3603
  value: true
@@ -3772,15 +3607,15 @@ var React = __webpack_require__(0);
3772
3607
 
3773
3608
  var lodash_1 = __webpack_require__(3);
3774
3609
 
3775
- var getSettingsFromThemedProps_1 = __webpack_require__(57);
3610
+ var getSettingsFromThemedProps_1 = __webpack_require__(56);
3776
3611
 
3777
- var Options_1 = __webpack_require__(16);
3612
+ var Options_1 = __webpack_require__(17);
3778
3613
 
3779
- var SanitizeProps_1 = __webpack_require__(58);
3614
+ var SanitizeProps_1 = __webpack_require__(57);
3780
3615
 
3781
3616
  var TimezoneContext_1 = __webpack_require__(32);
3782
3617
 
3783
- var moment_1 = __webpack_require__(59);
3618
+ var moment_1 = __webpack_require__(58);
3784
3619
 
3785
3620
  var FeatureFlagContext_1 = __webpack_require__(28);
3786
3621
 
@@ -3790,31 +3625,31 @@ var hocUtils_1 = __webpack_require__(34);
3790
3625
 
3791
3626
  var JSONSchemaUtils_1 = __webpack_require__(35);
3792
3627
 
3793
- var async_dynamic_options_evaluator_1 = __webpack_require__(60);
3628
+ var async_dynamic_options_evaluator_1 = __webpack_require__(59);
3794
3629
 
3795
3630
  var id_1 = __webpack_require__(31);
3796
3631
 
3797
- var SplunkVisualization_1 = __webpack_require__(61);
3632
+ var SplunkVisualization_1 = __webpack_require__(60);
3798
3633
 
3799
- var VizBehavior_1 = __webpack_require__(6);
3634
+ var VizBehavior_1 = __webpack_require__(8);
3800
3635
 
3801
3636
  var getSorting_1 = __webpack_require__(38);
3802
3637
 
3803
3638
  var getPagination_1 = __webpack_require__(39);
3804
3639
 
3805
- var useDeepMemo_1 = __webpack_require__(62);
3640
+ var useDeepMemo_1 = __webpack_require__(61);
3806
3641
 
3807
- var MissingPropsMessage_1 = __webpack_require__(63);
3642
+ var MissingPropsMessage_1 = __webpack_require__(62);
3808
3643
 
3809
- var withEditModeCover_1 = __webpack_require__(64);
3644
+ var withEditModeCover_1 = __webpack_require__(63);
3810
3645
 
3811
- var withPlaceholder_1 = __webpack_require__(65);
3646
+ var withPlaceholder_1 = __webpack_require__(64);
3812
3647
 
3813
- var useDownsampleDataSources_1 = __webpack_require__(66);
3648
+ var useDownsampleDataSources_1 = __webpack_require__(65);
3814
3649
 
3815
- var dataUtils_1 = __webpack_require__(14);
3650
+ var dataUtils_1 = __webpack_require__(15);
3816
3651
 
3817
- var featureFlagUtils_1 = __webpack_require__(68);
3652
+ var featureFlagUtils_1 = __webpack_require__(67);
3818
3653
  /**
3819
3654
  * hoc that wraps a pure react visualization in a Dashboard visualization
3820
3655
  * @param {DashboardVizOpts} opts
@@ -4147,81 +3982,48 @@ exports.default = withDashboardViz;
4147
3982
 
4148
3983
  /***/ }),
4149
3984
 
4150
- /***/ 57:
3985
+ /***/ 56:
4151
3986
  /***/ (function(module, exports) {
4152
3987
 
4153
3988
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
4154
3989
 
4155
3990
  /***/ }),
4156
3991
 
4157
- /***/ 58:
3992
+ /***/ 57:
4158
3993
  /***/ (function(module, exports) {
4159
3994
 
4160
3995
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
4161
3996
 
4162
3997
  /***/ }),
4163
3998
 
4164
- /***/ 59:
3999
+ /***/ 58:
4165
4000
  /***/ (function(module, exports) {
4166
4001
 
4167
4002
  module.exports = require("@splunk/moment");
4168
4003
 
4169
4004
  /***/ }),
4170
4005
 
4171
- /***/ 6:
4172
- /***/ (function(module, exports, __webpack_require__) {
4173
-
4174
- "use strict";
4175
-
4176
-
4177
- Object.defineProperty(exports, "__esModule", {
4178
- value: true
4179
- });
4180
- exports.VizBehavior = void 0;
4181
- var VizBehavior;
4182
-
4183
- (function (VizBehavior) {
4184
- /**
4185
- * Dynamic Options Behavior.
4186
- * This allows visualization options to be powered by data
4187
- *
4188
- * **Example**
4189
- *
4190
- * sparklineValues: ">primary|seriesByIndex(0)"
4191
- * would configure sparklineValues with an array of data points
4192
- * coming from the first series in the primary datasource
4193
- *
4194
- */
4195
- VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
4196
- VizBehavior["EVENTS"] = "events";
4197
- VizBehavior["DOWNSAMPLING"] = "downsampling";
4198
- /**
4199
- * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
4200
- * missing.
4201
- * @type {string}
4202
- */
4006
+ /***/ 59:
4007
+ /***/ (function(module, exports) {
4203
4008
 
4204
- VizBehavior["PLACEHOLDER"] = "placeholder";
4205
- VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
4206
- VizBehavior["TRELLIS"] = "trellis";
4207
- })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
4009
+ module.exports = require("@splunk/async-dynamic-options-evaluator");
4208
4010
 
4209
4011
  /***/ }),
4210
4012
 
4211
- /***/ 60:
4013
+ /***/ 6:
4212
4014
  /***/ (function(module, exports) {
4213
4015
 
4214
- module.exports = require("@splunk/async-dynamic-options-evaluator");
4016
+ module.exports = require("@babel/runtime/helpers/slicedToArray");
4215
4017
 
4216
4018
  /***/ }),
4217
4019
 
4218
- /***/ 61:
4020
+ /***/ 60:
4219
4021
  /***/ (function(module, exports, __webpack_require__) {
4220
4022
 
4221
4023
  "use strict";
4222
4024
 
4223
4025
 
4224
- var _classCallCheck = __webpack_require__(10);
4026
+ var _classCallCheck = __webpack_require__(9);
4225
4027
 
4226
4028
  Object.defineProperty(exports, "__esModule", {
4227
4029
  value: true
@@ -4233,7 +4035,7 @@ var T = __webpack_require__(1);
4233
4035
 
4234
4036
  var lodash_1 = __webpack_require__(3);
4235
4037
 
4236
- var VizActionHandler_1 = __webpack_require__(21); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
4038
+ var VizActionHandler_1 = __webpack_require__(22); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
4237
4039
 
4238
4040
 
4239
4041
  exports.INITIAL_WIDTH = 250;
@@ -4367,7 +4169,7 @@ exports.default = SplunkVisualization;
4367
4169
 
4368
4170
  /***/ }),
4369
4171
 
4370
- /***/ 62:
4172
+ /***/ 61:
4371
4173
  /***/ (function(module, exports, __webpack_require__) {
4372
4174
 
4373
4175
  "use strict";
@@ -4413,7 +4215,7 @@ exports.useDeepMemo = useDeepMemo;
4413
4215
 
4414
4216
  /***/ }),
4415
4217
 
4416
- /***/ 63:
4218
+ /***/ 62:
4417
4219
  /***/ (function(module, exports, __webpack_require__) {
4418
4220
 
4419
4221
  "use strict";
@@ -4432,7 +4234,7 @@ var i18n_1 = __webpack_require__(2);
4432
4234
 
4433
4235
  var Message_1 = __webpack_require__(12);
4434
4236
 
4435
- var FixedSizeContainer_1 = __webpack_require__(17);
4237
+ var FixedSizeContainer_1 = __webpack_require__(18);
4436
4238
  /**
4437
4239
  * @method isMissing
4438
4240
  * @param {any} v
@@ -4494,7 +4296,7 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
4494
4296
 
4495
4297
  /***/ }),
4496
4298
 
4497
- /***/ 64:
4299
+ /***/ 63:
4498
4300
  /***/ (function(module, exports, __webpack_require__) {
4499
4301
 
4500
4302
  "use strict";
@@ -4508,14 +4310,14 @@ var React = __webpack_require__(0);
4508
4310
 
4509
4311
  var styled_components_1 = __webpack_require__(4);
4510
4312
 
4511
- var hocUtils_1 = __webpack_require__(23);
4313
+ var hocUtils_1 = __webpack_require__(24);
4512
4314
 
4513
4315
  var Cover = styled_components_1.default.div.withConfig({
4514
4316
  displayName: "withEditModeCover__Cover",
4515
4317
  componentId: "sc-1gsbnxb-0"
4516
4318
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
4517
4319
  var Blocker = styled_components_1.default.div.attrs({
4518
- 'data-splunk-visualization-version': "26.2.0 - 49b909915"
4320
+ 'data-splunk-visualization-version': "26.3.0 - a1ef240a6"
4519
4321
  }).withConfig({
4520
4322
  displayName: "withEditModeCover__Blocker",
4521
4323
  componentId: "sc-1gsbnxb-1"
@@ -4547,7 +4349,7 @@ exports.default = withEditModeCover;
4547
4349
 
4548
4350
  /***/ }),
4549
4351
 
4550
- /***/ 65:
4352
+ /***/ 64:
4551
4353
  /***/ (function(module, exports, __webpack_require__) {
4552
4354
 
4553
4355
  "use strict";
@@ -4559,15 +4361,15 @@ Object.defineProperty(exports, "__esModule", {
4559
4361
 
4560
4362
  var React = __webpack_require__(0);
4561
4363
 
4562
- var colorUtils_1 = __webpack_require__(15);
4364
+ var colorUtils_1 = __webpack_require__(16);
4563
4365
 
4564
- var variables_1 = __webpack_require__(13);
4366
+ var variables_1 = __webpack_require__(14);
4565
4367
 
4566
4368
  var IconPlaceholder_1 = __webpack_require__(37);
4567
4369
 
4568
- var VizBehavior_1 = __webpack_require__(6);
4370
+ var VizBehavior_1 = __webpack_require__(8);
4569
4371
 
4570
- var hocUtils_1 = __webpack_require__(23);
4372
+ var hocUtils_1 = __webpack_require__(24);
4571
4373
 
4572
4374
  var withPlaceholder = function withPlaceholder(Visualization) {
4573
4375
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
@@ -4612,13 +4414,13 @@ exports.default = withPlaceholder;
4612
4414
 
4613
4415
  /***/ }),
4614
4416
 
4615
- /***/ 66:
4417
+ /***/ 65:
4616
4418
  /***/ (function(module, exports, __webpack_require__) {
4617
4419
 
4618
4420
  "use strict";
4619
4421
 
4620
4422
 
4621
- var _slicedToArray = __webpack_require__(7);
4423
+ var _slicedToArray = __webpack_require__(6);
4622
4424
 
4623
4425
  Object.defineProperty(exports, "__esModule", {
4624
4426
  value: true
@@ -4628,11 +4430,11 @@ var react_1 = __webpack_require__(0);
4628
4430
 
4629
4431
  var lodash_1 = __webpack_require__(3);
4630
4432
 
4631
- var dataUtils_1 = __webpack_require__(14);
4433
+ var dataUtils_1 = __webpack_require__(15);
4632
4434
 
4633
4435
  var usePrevious_1 = __webpack_require__(33);
4634
4436
 
4635
- var useGetXAndYFields_1 = __webpack_require__(67);
4437
+ var useGetXAndYFields_1 = __webpack_require__(66);
4636
4438
 
4637
4439
  var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
4638
4440
  var dataSources = _ref.dataSources,
@@ -4702,13 +4504,13 @@ exports.default = useDownsampleDataSources;
4702
4504
 
4703
4505
  /***/ }),
4704
4506
 
4705
- /***/ 67:
4507
+ /***/ 66:
4706
4508
  /***/ (function(module, exports, __webpack_require__) {
4707
4509
 
4708
4510
  "use strict";
4709
4511
 
4710
4512
 
4711
- var _toConsumableArray = __webpack_require__(8);
4513
+ var _toConsumableArray = __webpack_require__(7);
4712
4514
 
4713
4515
  Object.defineProperty(exports, "__esModule", {
4714
4516
  value: true
@@ -4716,7 +4518,7 @@ Object.defineProperty(exports, "__esModule", {
4716
4518
 
4717
4519
  var react_1 = __webpack_require__(0);
4718
4520
 
4719
- var Options_1 = __webpack_require__(16);
4521
+ var Options_1 = __webpack_require__(17);
4720
4522
  /**
4721
4523
  * Hook that evaluates the DSL for subset of a viz's options needed to determine
4722
4524
  * its x and y fields as well as the types of all its fields.
@@ -4817,7 +4619,7 @@ exports.default = useGetXAndYFields;
4817
4619
 
4818
4620
  /***/ }),
4819
4621
 
4820
- /***/ 68:
4622
+ /***/ 67:
4821
4623
  /***/ (function(module, exports, __webpack_require__) {
4822
4624
 
4823
4625
  "use strict";
@@ -4828,7 +4630,7 @@ Object.defineProperty(exports, "__esModule", {
4828
4630
  });
4829
4631
  exports.getFeatureFlag = void 0;
4830
4632
 
4831
- var FeatureFlags_1 = __webpack_require__(69);
4633
+ var FeatureFlags_1 = __webpack_require__(68);
4832
4634
 
4833
4635
  var getFeatureFlag = function getFeatureFlag(context, flagName) {
4834
4636
  // look for feature flag in context first
@@ -4853,42 +4655,42 @@ exports.getFeatureFlag = getFeatureFlag;
4853
4655
 
4854
4656
  /***/ }),
4855
4657
 
4856
- /***/ 69:
4658
+ /***/ 68:
4857
4659
  /***/ (function(module, exports) {
4858
4660
 
4859
4661
  module.exports = require("@splunk/visualization-context/FeatureFlags");
4860
4662
 
4861
4663
  /***/ }),
4862
4664
 
4863
- /***/ 7:
4665
+ /***/ 69:
4864
4666
  /***/ (function(module, exports) {
4865
4667
 
4866
- module.exports = require("@babel/runtime/helpers/slicedToArray");
4668
+ module.exports = require("@babel/runtime/helpers/extends");
4867
4669
 
4868
4670
  /***/ }),
4869
4671
 
4870
- /***/ 70:
4672
+ /***/ 7:
4871
4673
  /***/ (function(module, exports) {
4872
4674
 
4873
- module.exports = require("@babel/runtime/helpers/extends");
4675
+ module.exports = require("@babel/runtime/helpers/toConsumableArray");
4874
4676
 
4875
4677
  /***/ }),
4876
4678
 
4877
- /***/ 71:
4679
+ /***/ 70:
4878
4680
  /***/ (function(module, exports) {
4879
4681
 
4880
4682
  module.exports = require("@splunk/visualizations-shared/colorConstants");
4881
4683
 
4882
4684
  /***/ }),
4883
4685
 
4884
- /***/ 72:
4686
+ /***/ 71:
4885
4687
  /***/ (function(module, exports) {
4886
4688
 
4887
4689
  module.exports = require("@splunk/visualization-icons/placeholders");
4888
4690
 
4889
4691
  /***/ }),
4890
4692
 
4891
- /***/ 75:
4693
+ /***/ 73:
4892
4694
  /***/ (function(module, exports, __webpack_require__) {
4893
4695
 
4894
4696
  "use strict";
@@ -4920,16 +4722,49 @@ exports.default = background;
4920
4722
  /***/ }),
4921
4723
 
4922
4724
  /***/ 8:
4923
- /***/ (function(module, exports) {
4725
+ /***/ (function(module, exports, __webpack_require__) {
4924
4726
 
4925
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
4727
+ "use strict";
4728
+
4729
+
4730
+ Object.defineProperty(exports, "__esModule", {
4731
+ value: true
4732
+ });
4733
+ exports.VizBehavior = void 0;
4734
+ var VizBehavior;
4735
+
4736
+ (function (VizBehavior) {
4737
+ /**
4738
+ * Dynamic Options Behavior.
4739
+ * This allows visualization options to be powered by data
4740
+ *
4741
+ * **Example**
4742
+ *
4743
+ * sparklineValues: ">primary|seriesByIndex(0)"
4744
+ * would configure sparklineValues with an array of data points
4745
+ * coming from the first series in the primary datasource
4746
+ *
4747
+ */
4748
+ VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
4749
+ VizBehavior["EVENTS"] = "events";
4750
+ VizBehavior["DOWNSAMPLING"] = "downsampling";
4751
+ /**
4752
+ * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
4753
+ * missing.
4754
+ * @type {string}
4755
+ */
4756
+
4757
+ VizBehavior["PLACEHOLDER"] = "placeholder";
4758
+ VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
4759
+ VizBehavior["TRELLIS"] = "trellis";
4760
+ })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
4926
4761
 
4927
4762
  /***/ }),
4928
4763
 
4929
4764
  /***/ 9:
4930
4765
  /***/ (function(module, exports) {
4931
4766
 
4932
- module.exports = require("@babel/runtime/helpers/defineProperty");
4767
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
4933
4768
 
4934
4769
  /***/ })
4935
4770