@splunk/visualizations 26.4.0 → 27.0.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.
- package/Area.config.js +1262 -1600
- package/Area.config.js.map +7 -1
- package/Area.js +3002 -4920
- package/Area.js.map +7 -1
- package/Bar.config.js +1247 -1574
- package/Bar.config.js.map +7 -1
- package/Bar.js +2924 -4836
- package/Bar.js.map +7 -1
- package/Bubble.config.js +896 -1213
- package/Bubble.config.js.map +7 -1
- package/Bubble.js +2520 -4476
- package/Bubble.js.map +7 -1
- package/ChoroplethSvg.config.js +282 -582
- package/ChoroplethSvg.config.js.map +7 -1
- package/ChoroplethSvg.js +2004 -3810
- package/ChoroplethSvg.js.map +7 -1
- package/Column.config.js +1208 -1541
- package/Column.config.js.map +7 -1
- package/Column.js +2933 -4879
- package/Column.js.map +7 -1
- package/Ellipse.config.js +443 -774
- package/Ellipse.config.js.map +7 -1
- package/Ellipse.js +1651 -3341
- package/Ellipse.js.map +7 -1
- package/Events.config.js +207 -492
- package/Events.config.js.map +7 -1
- package/Events.js +2615 -4649
- package/Events.js.map +7 -1
- package/FillerGauge.config.js +420 -775
- package/FillerGauge.config.js.map +7 -1
- package/FillerGauge.js +2137 -4578
- package/FillerGauge.js.map +7 -1
- package/Image.config.js +144 -411
- package/Image.config.js.map +7 -1
- package/Image.js +1395 -3048
- package/Image.js.map +7 -1
- package/Line.config.js +1278 -1625
- package/Line.config.js.map +7 -1
- package/Line.js +2957 -4919
- package/Line.js.map +7 -1
- package/LinkGraph.config.js +390 -632
- package/LinkGraph.config.js.map +7 -1
- package/LinkGraph.js +5243 -6190
- package/LinkGraph.js.map +7 -1
- package/MIGRATION.md +12 -0
- package/Map.config.js +501 -801
- package/Map.config.js.map +7 -1
- package/Map.js +3369 -5676
- package/Map.js.map +7 -1
- package/Markdown.config.js +232 -528
- package/Markdown.config.js.map +7 -1
- package/Markdown.js +1645 -3216
- package/Markdown.js.map +7 -1
- package/MarkerGauge.config.js +308 -613
- package/MarkerGauge.config.js.map +7 -1
- package/MarkerGauge.js +2189 -4535
- package/MarkerGauge.js.map +7 -1
- package/ParallelCoordinates.config.js +282 -581
- package/ParallelCoordinates.config.js.map +7 -1
- package/ParallelCoordinates.js +2023 -4720
- package/ParallelCoordinates.js.map +7 -1
- package/Pie.config.js +278 -547
- package/Pie.config.js.map +7 -1
- package/Pie.js +1998 -3982
- package/Pie.js.map +7 -1
- package/Punchcard.config.js +291 -578
- package/Punchcard.config.js.map +7 -1
- package/Punchcard.js +2709 -5042
- package/Punchcard.js.map +7 -1
- package/Rectangle.config.js +455 -770
- package/Rectangle.config.js.map +7 -1
- package/Rectangle.js +1638 -3262
- package/Rectangle.js.map +7 -1
- package/Sankey.config.js +291 -626
- package/Sankey.config.js.map +7 -1
- package/Sankey.js +2737 -4909
- package/Sankey.js.map +7 -1
- package/Scatter.config.js +876 -1194
- package/Scatter.config.js.map +7 -1
- package/Scatter.js +2532 -4470
- package/Scatter.js.map +7 -1
- package/SingleValue.config.js +819 -1251
- package/SingleValue.config.js.map +7 -1
- package/SingleValue.js +4203 -7413
- package/SingleValue.js.map +7 -1
- package/SingleValueBasic.js +382 -1527
- package/SingleValueBasic.js.map +7 -1
- package/SingleValueIcon.config.js +781 -1207
- package/SingleValueIcon.config.js.map +7 -1
- package/SingleValueIcon.js +3350 -6285
- package/SingleValueIcon.js.map +7 -1
- package/SingleValueRadial.config.js +708 -1119
- package/SingleValueRadial.config.js.map +7 -1
- package/SingleValueRadial.js +3808 -6965
- package/SingleValueRadial.js.map +7 -1
- package/SparkLine.js +439 -746
- package/SparkLine.js.map +7 -1
- package/Table.config.js +565 -887
- package/Table.config.js.map +7 -1
- package/Table.js +3277 -5386
- package/Table.js.map +7 -1
- package/common/Charting.js +484 -1462
- package/common/Charting.js.map +7 -1
- package/common/ChartingApi.js +46 -170
- package/common/ChartingApi.js.map +7 -1
- package/common/DocExampleWithVizSandbox.js +270 -473
- package/common/DocExampleWithVizSandbox.js.map +7 -1
- package/common/EventsDoc.js +172 -464
- package/common/EventsDoc.js.map +7 -1
- package/common/GaugeMajorTicks.js +249 -347
- package/common/GaugeMajorTicks.js.map +7 -1
- package/common/GaugeValueMarker.js +201 -311
- package/common/GaugeValueMarker.js.map +7 -1
- package/common/OptionsDoc.js +347 -912
- package/common/OptionsDoc.js.map +7 -1
- package/common/OverviewDoc.js +435 -769
- package/common/OverviewDoc.js.map +7 -1
- package/common/SplunkVisualization.js +116 -259
- package/common/SplunkVisualization.js.map +7 -1
- package/common/SplunkVisualizationApi.js +40 -156
- package/common/SplunkVisualizationApi.js.map +7 -1
- package/common/ThemesDoc.js +271 -420
- package/common/ThemesDoc.js.map +7 -1
- package/common/chartingUtils.js +140 -312
- package/common/chartingUtils.js.map +7 -1
- package/common/docUtils.js +148 -266
- package/common/docUtils.js.map +7 -1
- package/common/gaugeUtils.js +280 -808
- package/common/gaugeUtils.js.map +7 -1
- package/common/shapeUtils.js +106 -211
- package/common/shapeUtils.js.map +7 -1
- package/common/utils/configUtils.js +126 -252
- package/common/utils/configUtils.js.map +7 -1
- package/common/utils/dataUtils.js +217 -812
- package/common/utils/dataUtils.js.map +7 -1
- package/common/utils/featureFlagUtils.js +53 -133
- package/common/utils/featureFlagUtils.js.map +7 -1
- package/common/utils/hocUtils.js +32 -122
- package/common/utils/hocUtils.js.map +7 -1
- package/common/utils/mapUtils.js +502 -1337
- package/common/utils/mapUtils.js.map +7 -1
- package/common/utils/singleValueUtils.js +462 -1010
- package/common/utils/singleValueUtils.js.map +7 -1
- package/common/utils/testHelper.js +92 -146
- package/common/utils/testHelper.js.map +7 -1
- package/common/utils/trellisUtils.js +237 -489
- package/common/utils/trellisUtils.js.map +7 -1
- package/common/utils/urlUtils.js +28 -112
- package/common/utils/urlUtils.js.map +7 -1
- package/common/withDashboardViz.js +1168 -2438
- package/common/withDashboardViz.js.map +7 -1
- package/package.json +52 -43
package/common/Charting.js
CHANGED
|
@@ -1,1530 +1,629 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/******/ };
|
|
24
|
-
/******/
|
|
25
|
-
/******/ // Execute the module function
|
|
26
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
27
|
-
/******/
|
|
28
|
-
/******/ // Flag the module as loaded
|
|
29
|
-
/******/ module.l = true;
|
|
30
|
-
/******/
|
|
31
|
-
/******/ // Return the exports of the module
|
|
32
|
-
/******/ return module.exports;
|
|
33
|
-
/******/ }
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
37
|
-
/******/ __webpack_require__.m = modules;
|
|
38
|
-
/******/
|
|
39
|
-
/******/ // expose the module cache
|
|
40
|
-
/******/ __webpack_require__.c = installedModules;
|
|
41
|
-
/******/
|
|
42
|
-
/******/ // define getter function for harmony exports
|
|
43
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
44
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
45
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
46
|
-
/******/ }
|
|
47
|
-
/******/ };
|
|
48
|
-
/******/
|
|
49
|
-
/******/ // define __esModule on exports
|
|
50
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
51
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
52
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
53
|
-
/******/ }
|
|
54
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
55
|
-
/******/ };
|
|
56
|
-
/******/
|
|
57
|
-
/******/ // create a fake namespace object
|
|
58
|
-
/******/ // mode & 1: value is a module id, require it
|
|
59
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
60
|
-
/******/ // mode & 4: return value when already ns object
|
|
61
|
-
/******/ // mode & 8|1: behave like require
|
|
62
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
63
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
64
|
-
/******/ if(mode & 8) return value;
|
|
65
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
66
|
-
/******/ var ns = Object.create(null);
|
|
67
|
-
/******/ __webpack_require__.r(ns);
|
|
68
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
69
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
70
|
-
/******/ return ns;
|
|
71
|
-
/******/ };
|
|
72
|
-
/******/
|
|
73
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
74
|
-
/******/ __webpack_require__.n = function(module) {
|
|
75
|
-
/******/ var getter = module && module.__esModule ?
|
|
76
|
-
/******/ function getDefault() { return module['default']; } :
|
|
77
|
-
/******/ function getModuleExports() { return module; };
|
|
78
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
79
|
-
/******/ return getter;
|
|
80
|
-
/******/ };
|
|
81
|
-
/******/
|
|
82
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
83
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
84
|
-
/******/
|
|
85
|
-
/******/ // __webpack_public_path__
|
|
86
|
-
/******/ __webpack_require__.p = "";
|
|
87
|
-
/******/
|
|
88
|
-
/******/
|
|
89
|
-
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s = 73);
|
|
91
|
-
/******/ })
|
|
92
|
-
/************************************************************************/
|
|
93
|
-
/******/ ([
|
|
94
|
-
/* 0 */
|
|
95
|
-
/***/ (function(module, exports) {
|
|
96
|
-
|
|
97
|
-
module.exports = require("react");
|
|
98
|
-
|
|
99
|
-
/***/ }),
|
|
100
|
-
/* 1 */
|
|
101
|
-
/***/ (function(module, exports) {
|
|
102
|
-
|
|
103
|
-
module.exports = require("prop-types");
|
|
104
|
-
|
|
105
|
-
/***/ }),
|
|
106
|
-
/* 2 */
|
|
107
|
-
/***/ (function(module, exports) {
|
|
108
|
-
|
|
109
|
-
module.exports = require("styled-components");
|
|
110
|
-
|
|
111
|
-
/***/ }),
|
|
112
|
-
/* 3 */
|
|
113
|
-
/***/ (function(module, exports) {
|
|
114
|
-
|
|
115
|
-
module.exports = require("lodash");
|
|
116
|
-
|
|
117
|
-
/***/ }),
|
|
118
|
-
/* 4 */
|
|
119
|
-
/***/ (function(module, exports) {
|
|
120
|
-
|
|
121
|
-
module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
122
|
-
|
|
123
|
-
/***/ }),
|
|
124
|
-
/* 5 */
|
|
125
|
-
/***/ (function(module, exports) {
|
|
126
|
-
|
|
127
|
-
module.exports = require("@splunk/ui-utils/i18n");
|
|
128
|
-
|
|
129
|
-
/***/ }),
|
|
130
|
-
/* 6 */,
|
|
131
|
-
/* 7 */
|
|
132
|
-
/***/ (function(module, exports) {
|
|
133
|
-
|
|
134
|
-
module.exports = require("@babel/runtime/helpers/createClass");
|
|
135
|
-
|
|
136
|
-
/***/ }),
|
|
137
|
-
/* 8 */,
|
|
138
|
-
/* 9 */
|
|
139
|
-
/***/ (function(module, exports) {
|
|
140
|
-
|
|
141
|
-
module.exports = require("@splunk/visualizations-shared/numberUtils");
|
|
142
|
-
|
|
143
|
-
/***/ }),
|
|
144
|
-
/* 10 */,
|
|
145
|
-
/* 11 */,
|
|
146
|
-
/* 12 */,
|
|
147
|
-
/* 13 */,
|
|
148
|
-
/* 14 */
|
|
149
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
150
|
-
|
|
151
|
-
"use strict";
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
var _classCallCheck = __webpack_require__(4);
|
|
155
|
-
|
|
156
|
-
var _createClass = __webpack_require__(7);
|
|
157
|
-
|
|
158
|
-
Object.defineProperty(exports, "__esModule", {
|
|
159
|
-
value: true
|
|
160
|
-
});
|
|
161
|
-
exports.DefaultVizActionHandler = void 0;
|
|
162
|
-
|
|
163
|
-
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
164
|
-
function DefaultVizActionHandler() {
|
|
165
|
-
_classCallCheck(this, DefaultVizActionHandler);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
_createClass(DefaultVizActionHandler, [{
|
|
169
|
-
key: "focus",
|
|
170
|
-
value: function focus() {// noop
|
|
171
|
-
}
|
|
172
|
-
}, {
|
|
173
|
-
key: "snapshot",
|
|
174
|
-
value: function snapshot() {
|
|
175
|
-
return null; // noop
|
|
1
|
+
/* Copyright © 2020 Splunk Inc.
|
|
2
|
+
SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
3
|
+
in part without a valid written license from Splunk Inc. is PROHIBITED. */
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defProps = Object.defineProperties;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
14
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15
|
+
var __spreadValues = (a, b) => {
|
|
16
|
+
for (var prop in b || (b = {}))
|
|
17
|
+
if (__hasOwnProp.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
if (__getOwnPropSymbols)
|
|
20
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
21
|
+
if (__propIsEnum.call(b, prop))
|
|
22
|
+
__defNormalProp(a, prop, b[prop]);
|
|
176
23
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
24
|
+
return a;
|
|
25
|
+
};
|
|
26
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
27
|
+
var __export = (target, all) => {
|
|
28
|
+
for (var name in all)
|
|
29
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
30
|
+
};
|
|
31
|
+
var __copyProps = (to, from, except, desc) => {
|
|
32
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
33
|
+
for (let key of __getOwnPropNames(from))
|
|
34
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
35
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
36
|
+
}
|
|
37
|
+
return to;
|
|
38
|
+
};
|
|
39
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
40
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
41
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
42
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
43
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
44
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
45
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
46
|
+
mod
|
|
47
|
+
));
|
|
48
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
49
|
+
|
|
50
|
+
// src/common/Charting.tsx
|
|
51
|
+
var Charting_exports = {};
|
|
52
|
+
__export(Charting_exports, {
|
|
53
|
+
NO_INPLACE_PROPS: () => NO_INPLACE_PROPS,
|
|
54
|
+
canUpdateInPlace: () => canUpdateInPlace,
|
|
55
|
+
changedOptions: () => changedOptions,
|
|
56
|
+
default: () => Charting_default,
|
|
57
|
+
updateRowPayload: () => updateRowPayload
|
|
58
|
+
});
|
|
59
|
+
module.exports = __toCommonJS(Charting_exports);
|
|
193
60
|
|
|
194
|
-
|
|
195
|
-
|
|
61
|
+
// esm-externals:lodash
|
|
62
|
+
var lodash_exports = {};
|
|
63
|
+
__export(lodash_exports, {
|
|
64
|
+
default: () => lodash_default
|
|
65
|
+
});
|
|
66
|
+
var defaultImport = __toESM(require("lodash"));
|
|
67
|
+
__reExport(lodash_exports, require("lodash"));
|
|
68
|
+
var lodash_default = "default" in defaultImport ? defaultImport.default : defaultImport;
|
|
69
|
+
|
|
70
|
+
// esm-externals:@splunk/ui-utils/i18n
|
|
71
|
+
var i18n_exports = {};
|
|
72
|
+
__export(i18n_exports, {
|
|
73
|
+
default: () => i18n_default
|
|
74
|
+
});
|
|
75
|
+
var defaultImport2 = __toESM(require("@splunk/ui-utils/i18n"));
|
|
76
|
+
__reExport(i18n_exports, require("@splunk/ui-utils/i18n"));
|
|
77
|
+
var i18n_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
78
|
+
|
|
79
|
+
// esm-externals:@splunk/visualization-color-palettes
|
|
80
|
+
var visualization_color_palettes_exports = {};
|
|
81
|
+
__export(visualization_color_palettes_exports, {
|
|
82
|
+
default: () => visualization_color_palettes_default
|
|
83
|
+
});
|
|
84
|
+
var defaultImport3 = __toESM(require("@splunk/visualization-color-palettes"));
|
|
85
|
+
__reExport(visualization_color_palettes_exports, require("@splunk/visualization-color-palettes"));
|
|
86
|
+
var visualization_color_palettes_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
|
|
87
|
+
|
|
88
|
+
// esm-externals:react
|
|
89
|
+
var react_exports = {};
|
|
90
|
+
__export(react_exports, {
|
|
91
|
+
default: () => react_default
|
|
92
|
+
});
|
|
93
|
+
var defaultImport4 = __toESM(require("react"));
|
|
94
|
+
__reExport(react_exports, require("react"));
|
|
95
|
+
var react_default = "default" in defaultImport4 ? defaultImport4.default : defaultImport4;
|
|
96
|
+
|
|
97
|
+
// esm-externals:prop-types
|
|
98
|
+
var prop_types_exports = {};
|
|
99
|
+
__export(prop_types_exports, {
|
|
100
|
+
default: () => prop_types_default
|
|
101
|
+
});
|
|
102
|
+
var defaultImport5 = __toESM(require("prop-types"));
|
|
103
|
+
__reExport(prop_types_exports, require("prop-types"));
|
|
104
|
+
var prop_types_default = "default" in defaultImport5 ? defaultImport5.default : defaultImport5;
|
|
105
|
+
|
|
106
|
+
// esm-externals:react-event-listener
|
|
107
|
+
var react_event_listener_exports = {};
|
|
108
|
+
__export(react_event_listener_exports, {
|
|
109
|
+
default: () => react_event_listener_default
|
|
110
|
+
});
|
|
111
|
+
var defaultImport6 = __toESM(require("react-event-listener"));
|
|
112
|
+
__reExport(react_event_listener_exports, require("react-event-listener"));
|
|
113
|
+
var react_event_listener_default = "default" in defaultImport6 ? defaultImport6.default : defaultImport6;
|
|
114
|
+
|
|
115
|
+
// esm-externals:@splunk/visualizations-shared/i18n
|
|
116
|
+
var i18n_exports2 = {};
|
|
117
|
+
__export(i18n_exports2, {
|
|
118
|
+
default: () => i18n_default2
|
|
119
|
+
});
|
|
120
|
+
var defaultImport7 = __toESM(require("@splunk/visualizations-shared/i18n"));
|
|
121
|
+
__reExport(i18n_exports2, require("@splunk/visualizations-shared/i18n"));
|
|
122
|
+
var i18n_default2 = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
|
|
123
|
+
|
|
124
|
+
// esm-externals:@splunk/charting-bundle
|
|
125
|
+
var charting_bundle_exports = {};
|
|
126
|
+
__export(charting_bundle_exports, {
|
|
127
|
+
default: () => charting_bundle_default
|
|
128
|
+
});
|
|
129
|
+
var defaultImport8 = __toESM(require("@splunk/charting-bundle"));
|
|
130
|
+
__reExport(charting_bundle_exports, require("@splunk/charting-bundle"));
|
|
131
|
+
var charting_bundle_default = "default" in defaultImport8 ? defaultImport8.default : defaultImport8;
|
|
132
|
+
|
|
133
|
+
// esm-externals:@splunk/visualization-context/TimezoneContext
|
|
134
|
+
var TimezoneContext_exports = {};
|
|
135
|
+
__export(TimezoneContext_exports, {
|
|
136
|
+
default: () => TimezoneContext_default
|
|
137
|
+
});
|
|
138
|
+
var defaultImport9 = __toESM(require("@splunk/visualization-context/TimezoneContext"));
|
|
139
|
+
__reExport(TimezoneContext_exports, require("@splunk/visualization-context/TimezoneContext"));
|
|
140
|
+
var TimezoneContext_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
|
|
141
|
+
|
|
142
|
+
// esm-externals:@splunk/visualizations-shared/style
|
|
143
|
+
var style_exports = {};
|
|
144
|
+
__export(style_exports, {
|
|
145
|
+
default: () => style_default
|
|
146
|
+
});
|
|
147
|
+
var defaultImport10 = __toESM(require("@splunk/visualizations-shared/style"));
|
|
148
|
+
__reExport(style_exports, require("@splunk/visualizations-shared/style"));
|
|
149
|
+
var style_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
|
|
150
|
+
|
|
151
|
+
// esm-externals:styled-components
|
|
152
|
+
var styled_components_exports = {};
|
|
153
|
+
__export(styled_components_exports, {
|
|
154
|
+
default: () => styled_components_default
|
|
155
|
+
});
|
|
156
|
+
var defaultImport11 = __toESM(require("styled-components"));
|
|
157
|
+
__reExport(styled_components_exports, require("styled-components"));
|
|
158
|
+
var styled_components_default = "default" in defaultImport11 ? defaultImport11.default : defaultImport11;
|
|
159
|
+
|
|
160
|
+
// esm-externals:@splunk/visualizations-shared/Message
|
|
161
|
+
var Message_exports = {};
|
|
162
|
+
__export(Message_exports, {
|
|
163
|
+
default: () => Message_default
|
|
164
|
+
});
|
|
165
|
+
var defaultImport12 = __toESM(require("@splunk/visualizations-shared/Message"));
|
|
166
|
+
__reExport(Message_exports, require("@splunk/visualizations-shared/Message"));
|
|
167
|
+
var Message_default = "default" in defaultImport12 ? defaultImport12.default : defaultImport12;
|
|
168
|
+
|
|
169
|
+
// esm-externals:@splunk/themes/useSplunkTheme
|
|
170
|
+
var useSplunkTheme_exports = {};
|
|
171
|
+
__export(useSplunkTheme_exports, {
|
|
172
|
+
default: () => useSplunkTheme_default
|
|
196
173
|
});
|
|
197
|
-
|
|
198
|
-
|
|
174
|
+
var defaultImport13 = __toESM(require("@splunk/themes/useSplunkTheme"));
|
|
175
|
+
__reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
|
|
176
|
+
var useSplunkTheme_default = "default" in defaultImport13 ? defaultImport13.default : defaultImport13;
|
|
177
|
+
|
|
178
|
+
// esm-externals:@splunk/visualizations-shared/themeUtils
|
|
179
|
+
var themeUtils_exports = {};
|
|
180
|
+
__export(themeUtils_exports, {
|
|
181
|
+
default: () => themeUtils_default
|
|
182
|
+
});
|
|
183
|
+
var defaultImport14 = __toESM(require("@splunk/visualizations-shared/themeUtils"));
|
|
184
|
+
__reExport(themeUtils_exports, require("@splunk/visualizations-shared/themeUtils"));
|
|
185
|
+
var themeUtils_default = "default" in defaultImport14 ? defaultImport14.default : defaultImport14;
|
|
199
186
|
|
|
200
|
-
|
|
187
|
+
// src/common/ChartingApi.ts
|
|
188
|
+
var ChartingApiFunctional = class {
|
|
189
|
+
// eslint-disable-next-line no-useless-constructor
|
|
190
|
+
constructor(chartRef) {
|
|
191
|
+
this.chartRef = chartRef;
|
|
192
|
+
}
|
|
201
193
|
/**
|
|
202
|
-
*
|
|
203
|
-
* This allows visualization options to be powered by data
|
|
204
|
-
*
|
|
205
|
-
* **Example**
|
|
206
|
-
*
|
|
207
|
-
* sparklineValues: ">primary|seriesByIndex(0)"
|
|
208
|
-
* would configure sparklineValues with an array of data points
|
|
209
|
-
* coming from the first series in the primary datasource
|
|
194
|
+
* Allows users to programmatically highlight a point on the chart
|
|
210
195
|
*
|
|
196
|
+
* @memberof ChartingApiFunctional
|
|
211
197
|
*/
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
198
|
+
highlight({ xValue, seriesName } = { xValue: "", seriesName: "" }) {
|
|
199
|
+
this.getChart().highlight(xValue, seriesName);
|
|
200
|
+
}
|
|
215
201
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* @
|
|
202
|
+
* Allows users to programmatically unhighlight all points on the chart
|
|
203
|
+
*
|
|
204
|
+
* @memberof ChartingApiFunctional
|
|
219
205
|
*/
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
223
|
-
VizBehavior["TRELLIS"] = "trellis";
|
|
224
|
-
})(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
|
|
225
|
-
|
|
226
|
-
/***/ }),
|
|
227
|
-
/* 19 */
|
|
228
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
229
|
-
|
|
230
|
-
"use strict";
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
Object.defineProperty(exports, "__esModule", {
|
|
234
|
-
value: true
|
|
235
|
-
});
|
|
236
|
-
exports.VizCategory = void 0;
|
|
237
|
-
var VizCategory;
|
|
238
|
-
|
|
239
|
-
(function (VizCategory) {
|
|
240
|
-
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
241
|
-
VizCategory["TRENDS"] = "Trends";
|
|
242
|
-
VizCategory["COMPARISONS"] = "Comparisons";
|
|
243
|
-
VizCategory["TABLE"] = "Table";
|
|
244
|
-
VizCategory["GAUGE"] = "Gauge";
|
|
245
|
-
VizCategory["DISTRIBUTIONS"] = "Distributions";
|
|
246
|
-
VizCategory["CHOROPLETH"] = "Choropleth Maps";
|
|
247
|
-
VizCategory["SHAPES"] = "Shapes";
|
|
248
|
-
VizCategory["MISC"] = "misc";
|
|
249
|
-
VizCategory["FLOW"] = "Flow";
|
|
250
|
-
VizCategory["CORRELATION"] = "Correlation";
|
|
251
|
-
VizCategory["SPATIAL"] = "Spatial";
|
|
252
|
-
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
253
|
-
|
|
254
|
-
/***/ }),
|
|
255
|
-
/* 20 */,
|
|
256
|
-
/* 21 */,
|
|
257
|
-
/* 22 */,
|
|
258
|
-
/* 23 */,
|
|
259
|
-
/* 24 */
|
|
260
|
-
/***/ (function(module, exports) {
|
|
261
|
-
|
|
262
|
-
module.exports = require("@splunk/visualizations-shared/Message");
|
|
263
|
-
|
|
264
|
-
/***/ }),
|
|
265
|
-
/* 25 */
|
|
266
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
267
|
-
|
|
268
|
-
"use strict";
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
Object.defineProperty(exports, "__esModule", {
|
|
272
|
-
value: true
|
|
273
|
-
});
|
|
274
|
-
exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
|
|
275
|
-
|
|
276
|
-
var numberUtils_1 = __webpack_require__(9);
|
|
277
|
-
|
|
278
|
-
var interfaces_1 = __webpack_require__(32); // TODO: utilize this fn in ParallelCoordinates
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
|
|
282
|
-
if (!columns || !columns[0] || !columns[0].length) return [];
|
|
283
|
-
var data = [];
|
|
284
|
-
|
|
285
|
-
var _loop = function _loop(i) {
|
|
286
|
-
var newObj = {};
|
|
287
|
-
fields.forEach(function (field, index) {
|
|
288
|
-
var fieldName = typeof field === 'string' ? field : field.name;
|
|
289
|
-
|
|
290
|
-
if (columns[index][i] === '') {
|
|
291
|
-
newObj[fieldName] = null;
|
|
292
|
-
} else {
|
|
293
|
-
newObj[fieldName] = columns[index][i];
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
data.push(newObj);
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
for (var i = 0; i < columns[0].length; i += 1) {
|
|
300
|
-
_loop(i);
|
|
206
|
+
unHighlight() {
|
|
207
|
+
this.getChart().unHighlight();
|
|
301
208
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
exports.convertToArrOfObjects = convertToArrOfObjects; // LTTB algorithm which can be used to downsample time series data while striving to maintain
|
|
307
|
-
// the spikes and overall shape of the chart
|
|
308
|
-
// Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js
|
|
309
|
-
// Modifications include:
|
|
310
|
-
// 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)
|
|
311
|
-
// 2) Convert to camel case
|
|
312
|
-
// 3) Convert to TS and also return the indices of the points that are in the downsampled result.
|
|
313
|
-
// 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points
|
|
314
|
-
// that should be used in case of a tie of the max area in a bucket
|
|
315
|
-
|
|
316
|
-
var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, threshold, preferredDownsampleIndices) {
|
|
317
|
-
var dataLength = data.length;
|
|
318
|
-
var downsampledIndices = [];
|
|
319
|
-
|
|
320
|
-
if (threshold >= dataLength || threshold === 0) {
|
|
321
|
-
var allIndices = data.map(function (values, index) {
|
|
322
|
-
return index;
|
|
323
|
-
});
|
|
324
|
-
return {
|
|
325
|
-
downsampledData: data,
|
|
326
|
-
downsampledIndices: allIndices
|
|
327
|
-
}; // Nothing to do
|
|
209
|
+
// returns chart object
|
|
210
|
+
getChart() {
|
|
211
|
+
var _a;
|
|
212
|
+
return (_a = this.chartRef) == null ? void 0 : _a.current;
|
|
328
213
|
}
|
|
329
|
-
|
|
330
|
-
var sampled = [];
|
|
331
|
-
var sampledIndex = 0; // Bucket size. Leave room for start and end data points
|
|
332
|
-
|
|
333
|
-
var every = (dataLength - 2) / (threshold - 2);
|
|
334
|
-
var a = 0; // Initially a is the first point in the triangle
|
|
335
|
-
|
|
336
|
-
var maxAreaPoint;
|
|
337
|
-
var maxArea;
|
|
338
|
-
var area;
|
|
339
|
-
var nextA;
|
|
340
|
-
sampled.push(data[a]); // Always add the first point
|
|
341
|
-
|
|
342
|
-
downsampledIndices.push(0); // eslint-disable-next-line no-plusplus
|
|
343
|
-
|
|
344
|
-
for (var i = 0; i < threshold - 2; i++) {
|
|
345
|
-
// Calculate point average for next bucket (containing c)
|
|
346
|
-
var avgX = 0;
|
|
347
|
-
var avgY = 0;
|
|
348
|
-
var avgRangeStart = Math.floor((i + 1) * every) + 1;
|
|
349
|
-
var avgRangeEnd = Math.floor((i + 2) * every) + 1;
|
|
350
|
-
avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
|
|
351
|
-
var avgRangeLength = avgRangeEnd - avgRangeStart; // eslint-disable-next-line no-plusplus
|
|
352
|
-
|
|
353
|
-
for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
|
|
354
|
-
avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)
|
|
355
|
-
|
|
356
|
-
avgY += data[avgRangeStart][1] * 1;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
avgX /= avgRangeLength;
|
|
360
|
-
avgY /= avgRangeLength; // Get the range for this bucket
|
|
361
|
-
|
|
362
|
-
var rangeOffs = Math.floor((i + 0) * every) + 1;
|
|
363
|
-
var rangeTo = Math.floor((i + 1) * every) + 1; // Point a
|
|
364
|
-
|
|
365
|
-
var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
|
|
366
|
-
|
|
367
|
-
var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
|
|
368
|
-
|
|
369
|
-
maxArea = area = -1;
|
|
370
|
-
var maxAreaIndex = rangeOffs; // eslint-disable-next-line no-plusplus
|
|
371
|
-
|
|
372
|
-
for (; rangeOffs < rangeTo; rangeOffs++) {
|
|
373
|
-
// Calculate triangle area over three buckets
|
|
374
|
-
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
|
|
375
|
-
// If all points in a bucket have the same area, prioritize the one with an x index
|
|
376
|
-
// that also existed from another series so we don't add another point unnecessarily.
|
|
377
|
-
// By default LTTB picks the leftmost point in the bucket
|
|
378
|
-
|
|
379
|
-
if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
|
|
380
|
-
maxArea = area;
|
|
381
|
-
maxAreaPoint = data[rangeOffs];
|
|
382
|
-
nextA = rangeOffs; // Next a is this b
|
|
383
|
-
// Modification: save the index of the point with the most area
|
|
384
|
-
|
|
385
|
-
maxAreaIndex = rangeOffs;
|
|
386
|
-
}
|
|
387
|
-
} // eslint-disable-next-line no-plusplus
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
|
|
391
|
-
|
|
392
|
-
downsampledIndices.push(maxAreaIndex);
|
|
393
|
-
a = nextA; // This a is the next a (chosen b)
|
|
394
|
-
} // eslint-disable-next-line no-plusplus
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
|
|
398
|
-
|
|
399
|
-
downsampledIndices.push(dataLength - 1);
|
|
400
|
-
return {
|
|
401
|
-
downsampledData: sampled,
|
|
402
|
-
downsampledIndices: downsampledIndices
|
|
403
|
-
};
|
|
404
214
|
};
|
|
405
|
-
/**
|
|
406
|
-
* Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines
|
|
407
|
-
* if at least one of the values in the column can be loosely coerced to a number.
|
|
408
|
-
* If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and
|
|
409
|
-
* returns that it cannot downsample the column.
|
|
410
|
-
*/
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
var strictlyCoerceYColumn = function strictlyCoerceYColumn(column, options) {
|
|
414
|
-
var isNullCoercionEnabled = options.nullValueDisplay === 'zero'; // Splunk charting allows for numbers in formats such as negative hex that
|
|
415
|
-
// Number() does not support and also allows loose coercion of hex numbers (but not other formats)
|
|
416
|
-
// We want to identify columns which contain at least one value that can be loosely coerced
|
|
417
|
-
|
|
418
|
-
var canLooselyCoerceSomeValues = column.findIndex(function (value) {
|
|
419
|
-
return (0, numberUtils_1.startsWithNumber)("".concat(value)) || isNullCoercionEnabled && value === null;
|
|
420
|
-
}) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
|
|
421
215
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number' && !coerceValueToZero) {
|
|
428
|
-
return true;
|
|
429
|
-
} // save value and continue to next
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
coercedColumn.push(coercedValue);
|
|
433
|
-
return false;
|
|
216
|
+
// src/common/hooks/usePrevious.ts
|
|
217
|
+
function usePrevious(value) {
|
|
218
|
+
const ref = (0, react_exports.useRef)();
|
|
219
|
+
(0, react_exports.useEffect)(() => {
|
|
220
|
+
ref.current = value;
|
|
434
221
|
});
|
|
435
|
-
return
|
|
436
|
-
|
|
437
|
-
canLooselyCoerceSomeValues: canLooselyCoerceSomeValues,
|
|
438
|
-
coercedColumn: canDownsampleColumn ? coercedColumn : []
|
|
439
|
-
};
|
|
440
|
-
};
|
|
441
|
-
/**
|
|
442
|
-
* Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.
|
|
443
|
-
* Only strictly increasing x-columns are eligible for downsampling.
|
|
444
|
-
* If the column is not eligible for downsampling, returns an empty array.
|
|
445
|
-
*/
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
|
|
449
|
-
if (fieldType === 'number') {
|
|
450
|
-
var coercedXColumn = column.map(function (xValue) {
|
|
451
|
-
return Number(xValue);
|
|
452
|
-
});
|
|
453
|
-
|
|
454
|
-
if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
|
|
455
|
-
return coercedXColumn;
|
|
456
|
-
}
|
|
457
|
-
} else if (fieldType === 'time') {
|
|
458
|
-
var _coercedXColumn = column.map(function (xValue) {
|
|
459
|
-
return new Date(xValue);
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
|
|
463
|
-
return _coercedXColumn;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
return [];
|
|
468
|
-
};
|
|
469
|
-
|
|
470
|
-
var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
|
|
471
|
-
var vizConfig = _ref.vizConfig;
|
|
472
|
-
|
|
473
|
-
var _a;
|
|
222
|
+
return ref.current;
|
|
223
|
+
}
|
|
474
224
|
|
|
475
|
-
|
|
225
|
+
// src/common/hooks/useEventCallback.tsx
|
|
226
|
+
var useEventCallback = (fn) => {
|
|
227
|
+
const ref = (0, react_exports.useRef)(fn);
|
|
228
|
+
(0, react_exports.useLayoutEffect)(() => {
|
|
229
|
+
ref.current = fn;
|
|
230
|
+
});
|
|
231
|
+
return (0, react_exports.useCallback)((...args) => ref.current(...args), []);
|
|
476
232
|
};
|
|
233
|
+
var useEventCallback_default = useEventCallback;
|
|
477
234
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
235
|
+
// esm-externals:@splunk/visualizations-shared/numberUtils
|
|
236
|
+
var numberUtils_exports = {};
|
|
237
|
+
__export(numberUtils_exports, {
|
|
238
|
+
default: () => numberUtils_default
|
|
239
|
+
});
|
|
240
|
+
var defaultImport15 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
|
|
241
|
+
__reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUtils"));
|
|
242
|
+
var numberUtils_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
|
|
243
|
+
|
|
244
|
+
// src/common/utils/dataUtils.ts
|
|
245
|
+
var calculateThresholdOnRangeSelect = ({
|
|
246
|
+
firstIndex,
|
|
247
|
+
lastIndex,
|
|
248
|
+
dataSources,
|
|
249
|
+
width
|
|
250
|
+
}) => {
|
|
486
251
|
var _a, _b, _c;
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
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;
|
|
252
|
+
const window2 = lastIndex - firstIndex + 1;
|
|
253
|
+
const ratio = Math.round(Number(((_c = (_b = (_a = dataSources == null ? void 0 : dataSources.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.columns[0]) == null ? void 0 : _c.length) / window2) * 10) / 10;
|
|
490
254
|
return Math.round(ratio * Number(width));
|
|
491
255
|
};
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
* 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
|
|
500
|
-
* in for a categorical chart.
|
|
501
|
-
*/
|
|
502
|
-
|
|
503
|
-
var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
|
|
504
|
-
var enableSearchZoom = _ref3.enableSearchZoom,
|
|
505
|
-
dataSources = _ref3.dataSources,
|
|
506
|
-
selectChartEvent = _ref3.selectChartEvent,
|
|
507
|
-
width = _ref3.width,
|
|
508
|
-
xField = _ref3.xField;
|
|
509
|
-
|
|
256
|
+
var calculateDownsamplingThreshold = ({
|
|
257
|
+
enableSearchZoom,
|
|
258
|
+
dataSources,
|
|
259
|
+
selectChartEvent,
|
|
260
|
+
width,
|
|
261
|
+
xField
|
|
262
|
+
}) => {
|
|
510
263
|
var _a, _b, _c;
|
|
511
|
-
|
|
512
264
|
if (enableSearchZoom || !selectChartEvent) {
|
|
513
265
|
return Number(width);
|
|
514
266
|
}
|
|
515
|
-
|
|
516
|
-
var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
|
|
517
|
-
|
|
267
|
+
const primaryDataSource = dataSources == null ? void 0 : dataSources.primary;
|
|
518
268
|
if (!primaryDataSource) {
|
|
519
269
|
return null;
|
|
520
270
|
}
|
|
521
|
-
|
|
522
|
-
var startXIndex = selectChartEvent.startXIndex,
|
|
523
|
-
endXIndex = selectChartEvent.endXIndex,
|
|
524
|
-
currentTarget = selectChartEvent.currentTarget;
|
|
525
|
-
|
|
271
|
+
const { startXIndex, endXIndex, currentTarget } = selectChartEvent;
|
|
526
272
|
try {
|
|
527
|
-
|
|
273
|
+
const xFieldIndex = (_a = primaryDataSource == null ? void 0 : primaryDataSource.data) == null ? void 0 : _a.fields.findIndex((field) => {
|
|
528
274
|
return field.name === xField;
|
|
529
275
|
});
|
|
530
|
-
|
|
531
|
-
return field === xField;
|
|
532
|
-
});
|
|
533
|
-
|
|
276
|
+
const downsampledXFieldIndex = (_b = currentTarget.dataSet) == null ? void 0 : _b.fields.findIndex((field) => field === xField);
|
|
534
277
|
if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
|
|
535
278
|
return null;
|
|
536
279
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
var firstIndex = fullSeries.findIndex(function (x) {
|
|
280
|
+
const fullSeries = (_c = primaryDataSource == null ? void 0 : primaryDataSource.data) == null ? void 0 : _c.columns[xFieldIndex];
|
|
281
|
+
const downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
|
|
282
|
+
const firstIndex = fullSeries.findIndex((x) => {
|
|
541
283
|
return downsampledSeries[startXIndex] === x;
|
|
542
284
|
});
|
|
543
|
-
|
|
285
|
+
const lastIndex = fullSeries.findIndex((x) => {
|
|
544
286
|
return downsampledSeries[endXIndex] === x;
|
|
545
287
|
});
|
|
546
|
-
|
|
547
288
|
if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
|
|
548
|
-
return
|
|
549
|
-
firstIndex
|
|
550
|
-
lastIndex
|
|
551
|
-
dataSources
|
|
552
|
-
width
|
|
289
|
+
return calculateThresholdOnRangeSelect({
|
|
290
|
+
firstIndex,
|
|
291
|
+
lastIndex,
|
|
292
|
+
dataSources,
|
|
293
|
+
width
|
|
553
294
|
});
|
|
554
295
|
}
|
|
555
296
|
} catch (e) {
|
|
556
|
-
|
|
557
|
-
console.error('Error occurred while setting downsample threshold on range select event', e);
|
|
297
|
+
console.error("Error occurred while setting downsample threshold on range select event", e);
|
|
558
298
|
}
|
|
559
|
-
|
|
560
299
|
return null;
|
|
561
300
|
};
|
|
562
301
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
if (index === 0) {
|
|
580
|
-
return true;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
return value > column[index - 1];
|
|
584
|
-
});
|
|
585
|
-
};
|
|
586
|
-
/**
|
|
587
|
-
* Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be
|
|
588
|
-
* displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.
|
|
589
|
-
*
|
|
590
|
-
* If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
|
|
591
|
-
* If not all columns can be downsampled, then returns empty arrays for both x and y
|
|
592
|
-
*/
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes, options) {
|
|
596
|
-
var xColumn = [];
|
|
597
|
-
var yColumns = [];
|
|
598
|
-
var canDownsample = !ds.data.fields.some(function (field, index) {
|
|
599
|
-
var _a, _b;
|
|
600
|
-
|
|
601
|
-
var fieldName = (_a = field.name) !== null && _a !== void 0 ? _a : field;
|
|
602
|
-
var fieldType = (_b = fieldTypes[index]) !== null && _b !== void 0 ? _b : 'unknown';
|
|
603
|
-
var column = ds.data.columns[index];
|
|
604
|
-
var hasDisplayedColumnThatCantBeDownsampled = false;
|
|
605
|
-
|
|
606
|
-
if (fieldName === xField) {
|
|
607
|
-
xColumn = strictlyCoerceXColumn(column, fieldType);
|
|
608
|
-
} else if (yFields.has(fieldName)) {
|
|
609
|
-
var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index], options),
|
|
610
|
-
coercedColumn = _strictlyCoerceYColum.coercedColumn,
|
|
611
|
-
canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
|
|
612
|
-
canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
|
|
613
|
-
// be downsampled using LTTB
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
|
|
617
|
-
|
|
618
|
-
if (hasDisplayedColumnThatCantBeDownsampled) {
|
|
619
|
-
return true;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
if (canDownsampleColumn) {
|
|
623
|
-
yColumns.push(coercedColumn);
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
return false;
|
|
628
|
-
});
|
|
629
|
-
|
|
630
|
-
if (canDownsample) {
|
|
631
|
-
return {
|
|
632
|
-
xColumn: xColumn,
|
|
633
|
-
yColumns: yColumns
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
return {
|
|
638
|
-
xColumn: [],
|
|
639
|
-
yColumns: []
|
|
640
|
-
};
|
|
641
|
-
};
|
|
642
|
-
|
|
643
|
-
var pickIndicesFromDataSource = function pickIndicesFromDataSource(ds, indices) {
|
|
644
|
-
var sortedIndices = Array.from(indices).sort(function (a, b) {
|
|
645
|
-
return a - b;
|
|
646
|
-
});
|
|
647
|
-
var slicedColumns = [];
|
|
648
|
-
ds.data.columns.forEach(function (column) {
|
|
649
|
-
var slicedColumn = [];
|
|
650
|
-
sortedIndices.forEach(function (index) {
|
|
651
|
-
slicedColumn.push(column[index]);
|
|
652
|
-
});
|
|
653
|
-
slicedColumns.push(slicedColumn);
|
|
654
|
-
}); // update data columns with downsampled columns
|
|
655
|
-
|
|
656
|
-
return Object.assign(Object.assign({}, ds), {
|
|
657
|
-
data: Object.assign(Object.assign({}, ds.data), {
|
|
658
|
-
columns: slicedColumns
|
|
659
|
-
})
|
|
660
|
-
});
|
|
661
|
-
};
|
|
662
|
-
|
|
663
|
-
var downsampleDataSources = function downsampleDataSources(_ref4) {
|
|
664
|
-
var dataSources = _ref4.dataSources,
|
|
665
|
-
threshold = _ref4.threshold,
|
|
666
|
-
options = _ref4.options;
|
|
667
|
-
|
|
668
|
-
var _a, _b, _c;
|
|
669
|
-
|
|
670
|
-
var primaryDS = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary; // only downsample time series when number of data points are over threshold
|
|
671
|
-
|
|
672
|
-
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;
|
|
673
|
-
|
|
674
|
-
if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
|
|
675
|
-
return dataSources;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
var xField = options.xField,
|
|
679
|
-
yFields = options.yFields,
|
|
680
|
-
fieldTypes = options.fieldTypes;
|
|
681
|
-
|
|
682
|
-
if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
|
|
683
|
-
return dataSources;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
var nonInternalYFields = new Set(yFields.filter(function (yField) {
|
|
687
|
-
return !yField.startsWith('_');
|
|
688
|
-
}));
|
|
689
|
-
var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
|
|
690
|
-
// At the worst case, each series has non-overlapping downsampled pts
|
|
691
|
-
// which will mean that all points will be included in the downsampled result
|
|
692
|
-
// This will just lead to additional overhead due to coercing each
|
|
693
|
-
// x and y field to number
|
|
694
|
-
|
|
695
|
-
if (maxPointsInDownsample >= numPoints) {
|
|
696
|
-
return dataSources;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes, options),
|
|
700
|
-
xColumn = _tryToCoerceAllDispla.xColumn,
|
|
701
|
-
yColumns = _tryToCoerceAllDispla.yColumns;
|
|
702
|
-
|
|
703
|
-
if (!yColumns.length || !xColumn.length) {
|
|
704
|
-
return dataSources;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
var downsampledDataSources = Object.assign({}, dataSources);
|
|
708
|
-
var downsampledIndices = new Set();
|
|
709
|
-
yColumns.forEach(function (yColumn, columnIndex) {
|
|
710
|
-
// perform LTTB downsampling for current series, LTTB takes an [x, y] pair
|
|
711
|
-
var xyPair = yColumn.map(function (yValue, index) {
|
|
712
|
-
return [xColumn[index], yValue];
|
|
713
|
-
});
|
|
714
|
-
|
|
715
|
-
try {
|
|
716
|
-
var _largestTriangleThree = largestTriangleThreeBuckets(xyPair, threshold, downsampledIndices),
|
|
717
|
-
downsampledIndicesForSeries = _largestTriangleThree.downsampledIndices;
|
|
718
|
-
|
|
719
|
-
downsampledIndicesForSeries.forEach(function (downsampleIndex) {
|
|
720
|
-
return downsampledIndices.add(downsampleIndex);
|
|
721
|
-
});
|
|
722
|
-
} catch (e) {
|
|
723
|
-
// eslint-disable-next-line no-console
|
|
724
|
-
console.error("Error occurred while downsampling column ".concat(columnIndex), e);
|
|
725
|
-
}
|
|
726
|
-
}); // update data columns with downsampled columns
|
|
727
|
-
|
|
728
|
-
downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
|
|
729
|
-
return downsampledDataSources;
|
|
730
|
-
};
|
|
731
|
-
|
|
732
|
-
exports.downsampleDataSources = downsampleDataSources;
|
|
733
|
-
|
|
734
|
-
/***/ }),
|
|
735
|
-
/* 26 */
|
|
736
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
737
|
-
|
|
738
|
-
"use strict";
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
Object.defineProperty(exports, "__esModule", {
|
|
742
|
-
value: true
|
|
743
|
-
});
|
|
744
|
-
exports.validOutputModes = exports.validSortDirs = void 0;
|
|
745
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
746
|
-
exports.validOutputModes = ['json_cols', 'json'];
|
|
747
|
-
|
|
748
|
-
/***/ }),
|
|
749
|
-
/* 27 */,
|
|
750
|
-
/* 28 */
|
|
751
|
-
/***/ (function(module, exports) {
|
|
752
|
-
|
|
753
|
-
module.exports = require("@splunk/visualization-context/TimezoneContext");
|
|
754
|
-
|
|
755
|
-
/***/ }),
|
|
756
|
-
/* 29 */
|
|
757
|
-
/***/ (function(module, exports) {
|
|
758
|
-
|
|
759
|
-
module.exports = require("@splunk/visualizations-shared/style");
|
|
760
|
-
|
|
761
|
-
/***/ }),
|
|
762
|
-
/* 30 */
|
|
763
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
764
|
-
|
|
765
|
-
"use strict";
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
var _classCallCheck = __webpack_require__(4);
|
|
769
|
-
|
|
770
|
-
var _createClass = __webpack_require__(7);
|
|
771
|
-
|
|
772
|
-
Object.defineProperty(exports, "__esModule", {
|
|
773
|
-
value: true
|
|
774
|
-
});
|
|
775
|
-
exports.ChartingApiFunctional = void 0;
|
|
776
|
-
|
|
777
|
-
var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
778
|
-
// eslint-disable-next-line no-useless-constructor
|
|
779
|
-
function ChartingApiFunctional(chartRef) {
|
|
780
|
-
_classCallCheck(this, ChartingApiFunctional);
|
|
781
|
-
|
|
782
|
-
this.chartRef = chartRef;
|
|
783
|
-
}
|
|
784
|
-
/**
|
|
785
|
-
* Allows users to programmatically highlight a point on the chart
|
|
786
|
-
*
|
|
787
|
-
* @memberof ChartingApiFunctional
|
|
788
|
-
*/
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
_createClass(ChartingApiFunctional, [{
|
|
792
|
-
key: "highlight",
|
|
793
|
-
value: function highlight() {
|
|
794
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
795
|
-
xValue: '',
|
|
796
|
-
seriesName: ''
|
|
797
|
-
},
|
|
798
|
-
xValue = _ref.xValue,
|
|
799
|
-
seriesName = _ref.seriesName;
|
|
800
|
-
|
|
801
|
-
this.getChart().highlight(xValue, seriesName);
|
|
802
|
-
}
|
|
803
|
-
/**
|
|
804
|
-
* Allows users to programmatically unhighlight all points on the chart
|
|
805
|
-
*
|
|
806
|
-
* @memberof ChartingApiFunctional
|
|
807
|
-
*/
|
|
808
|
-
|
|
809
|
-
}, {
|
|
810
|
-
key: "unHighlight",
|
|
811
|
-
value: function unHighlight() {
|
|
812
|
-
this.getChart().unHighlight();
|
|
813
|
-
} // returns chart object
|
|
814
|
-
|
|
815
|
-
}, {
|
|
816
|
-
key: "getChart",
|
|
817
|
-
value: function getChart() {
|
|
818
|
-
var _a;
|
|
819
|
-
|
|
820
|
-
return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
|
|
821
|
-
}
|
|
822
|
-
}]);
|
|
823
|
-
|
|
824
|
-
return ChartingApiFunctional;
|
|
825
|
-
}();
|
|
826
|
-
|
|
827
|
-
exports.ChartingApiFunctional = ChartingApiFunctional;
|
|
828
|
-
|
|
829
|
-
/***/ }),
|
|
830
|
-
/* 31 */
|
|
831
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
832
|
-
|
|
833
|
-
"use strict";
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
Object.defineProperty(exports, "__esModule", {
|
|
837
|
-
value: true
|
|
838
|
-
});
|
|
839
|
-
|
|
840
|
-
var react_1 = __webpack_require__(0);
|
|
841
|
-
|
|
842
|
-
function usePrevious(value) {
|
|
843
|
-
var ref = (0, react_1.useRef)();
|
|
844
|
-
(0, react_1.useEffect)(function () {
|
|
845
|
-
ref.current = value;
|
|
846
|
-
});
|
|
847
|
-
return ref.current;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
exports.default = usePrevious;
|
|
851
|
-
|
|
852
|
-
/***/ }),
|
|
853
|
-
/* 32 */
|
|
854
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
855
|
-
|
|
856
|
-
"use strict";
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
860
|
-
if (k2 === undefined) k2 = k;
|
|
861
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
862
|
-
|
|
863
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
864
|
-
desc = {
|
|
865
|
-
enumerable: true,
|
|
866
|
-
get: function get() {
|
|
867
|
-
return m[k];
|
|
868
|
-
}
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
Object.defineProperty(o, k2, desc);
|
|
873
|
-
} : function (o, m, k, k2) {
|
|
874
|
-
if (k2 === undefined) k2 = k;
|
|
875
|
-
o[k2] = m[k];
|
|
876
|
-
});
|
|
877
|
-
|
|
878
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
879
|
-
for (var p in m) {
|
|
880
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
881
|
-
}
|
|
882
|
-
};
|
|
883
|
-
|
|
884
|
-
Object.defineProperty(exports, "__esModule", {
|
|
885
|
-
value: true
|
|
886
|
-
});
|
|
887
|
-
|
|
888
|
-
__exportStar(__webpack_require__(33), exports);
|
|
889
|
-
|
|
890
|
-
__exportStar(__webpack_require__(34), exports);
|
|
891
|
-
|
|
892
|
-
__exportStar(__webpack_require__(26), exports);
|
|
893
|
-
|
|
894
|
-
__exportStar(__webpack_require__(35), exports);
|
|
895
|
-
|
|
896
|
-
__exportStar(__webpack_require__(36), exports);
|
|
897
|
-
|
|
898
|
-
__exportStar(__webpack_require__(37), exports);
|
|
899
|
-
|
|
900
|
-
__exportStar(__webpack_require__(38), exports);
|
|
901
|
-
|
|
902
|
-
__exportStar(__webpack_require__(39), exports);
|
|
903
|
-
|
|
904
|
-
__exportStar(__webpack_require__(40), exports);
|
|
905
|
-
|
|
906
|
-
__exportStar(__webpack_require__(14), exports);
|
|
907
|
-
|
|
908
|
-
__exportStar(__webpack_require__(18), exports);
|
|
909
|
-
|
|
910
|
-
__exportStar(__webpack_require__(19), exports);
|
|
911
|
-
|
|
912
|
-
__exportStar(__webpack_require__(41), exports);
|
|
913
|
-
|
|
914
|
-
__exportStar(__webpack_require__(42), exports);
|
|
915
|
-
|
|
916
|
-
__exportStar(__webpack_require__(43), exports);
|
|
917
|
-
|
|
918
|
-
__exportStar(__webpack_require__(44), exports);
|
|
919
|
-
|
|
920
|
-
__exportStar(__webpack_require__(45), exports);
|
|
921
|
-
|
|
922
|
-
__exportStar(__webpack_require__(46), exports);
|
|
923
|
-
|
|
924
|
-
/***/ }),
|
|
925
|
-
/* 33 */
|
|
926
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
927
|
-
|
|
928
|
-
"use strict";
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
Object.defineProperty(exports, "__esModule", {
|
|
932
|
-
value: true
|
|
933
|
-
});
|
|
934
|
-
|
|
935
|
-
/***/ }),
|
|
936
|
-
/* 34 */
|
|
937
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
938
|
-
|
|
939
|
-
"use strict";
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* A data structure used at runtime to wire up a visualization.
|
|
943
|
-
*/
|
|
944
|
-
|
|
945
|
-
Object.defineProperty(exports, "__esModule", {
|
|
946
|
-
value: true
|
|
947
|
-
});
|
|
948
|
-
|
|
949
|
-
/***/ }),
|
|
950
|
-
/* 35 */
|
|
951
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
952
|
-
|
|
953
|
-
"use strict";
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
Object.defineProperty(exports, "__esModule", {
|
|
957
|
-
value: true
|
|
958
|
-
});
|
|
959
|
-
|
|
960
|
-
/***/ }),
|
|
961
|
-
/* 36 */
|
|
962
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
963
|
-
|
|
964
|
-
"use strict";
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
Object.defineProperty(exports, "__esModule", {
|
|
968
|
-
value: true
|
|
969
|
-
});
|
|
970
|
-
|
|
971
|
-
/***/ }),
|
|
972
|
-
/* 37 */
|
|
973
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
974
|
-
|
|
975
|
-
"use strict";
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
Object.defineProperty(exports, "__esModule", {
|
|
979
|
-
value: true
|
|
980
|
-
});
|
|
981
|
-
|
|
982
|
-
/***/ }),
|
|
983
|
-
/* 38 */
|
|
984
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
985
|
-
|
|
986
|
-
"use strict";
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
Object.defineProperty(exports, "__esModule", {
|
|
990
|
-
value: true
|
|
991
|
-
});
|
|
992
|
-
|
|
993
|
-
/***/ }),
|
|
994
|
-
/* 39 */
|
|
995
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
996
|
-
|
|
997
|
-
"use strict";
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1001
|
-
value: true
|
|
1002
|
-
});
|
|
1003
|
-
|
|
1004
|
-
/***/ }),
|
|
1005
|
-
/* 40 */
|
|
1006
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1007
|
-
|
|
1008
|
-
"use strict";
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1012
|
-
value: true
|
|
1013
|
-
});
|
|
1014
|
-
|
|
1015
|
-
/***/ }),
|
|
1016
|
-
/* 41 */
|
|
1017
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1018
|
-
|
|
1019
|
-
"use strict";
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1023
|
-
value: true
|
|
1024
|
-
});
|
|
1025
|
-
|
|
1026
|
-
/***/ }),
|
|
1027
|
-
/* 42 */
|
|
1028
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1029
|
-
|
|
1030
|
-
"use strict";
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1034
|
-
value: true
|
|
1035
|
-
});
|
|
1036
|
-
|
|
1037
|
-
/***/ }),
|
|
1038
|
-
/* 43 */
|
|
1039
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1040
|
-
|
|
1041
|
-
"use strict";
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1045
|
-
value: true
|
|
1046
|
-
});
|
|
1047
|
-
|
|
1048
|
-
/***/ }),
|
|
1049
|
-
/* 44 */
|
|
1050
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1051
|
-
|
|
1052
|
-
"use strict";
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1056
|
-
value: true
|
|
1057
|
-
});
|
|
1058
|
-
|
|
1059
|
-
/***/ }),
|
|
1060
|
-
/* 45 */
|
|
1061
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1062
|
-
|
|
1063
|
-
"use strict";
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1067
|
-
value: true
|
|
1068
|
-
});
|
|
1069
|
-
|
|
1070
|
-
/***/ }),
|
|
1071
|
-
/* 46 */
|
|
1072
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1073
|
-
|
|
1074
|
-
"use strict";
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1078
|
-
value: true
|
|
1079
|
-
});
|
|
1080
|
-
|
|
1081
|
-
/***/ }),
|
|
1082
|
-
/* 47 */,
|
|
1083
|
-
/* 48 */,
|
|
1084
|
-
/* 49 */,
|
|
1085
|
-
/* 50 */,
|
|
1086
|
-
/* 51 */,
|
|
1087
|
-
/* 52 */,
|
|
1088
|
-
/* 53 */,
|
|
1089
|
-
/* 54 */,
|
|
1090
|
-
/* 55 */,
|
|
1091
|
-
/* 56 */,
|
|
1092
|
-
/* 57 */,
|
|
1093
|
-
/* 58 */,
|
|
1094
|
-
/* 59 */,
|
|
1095
|
-
/* 60 */,
|
|
1096
|
-
/* 61 */,
|
|
1097
|
-
/* 62 */,
|
|
1098
|
-
/* 63 */,
|
|
1099
|
-
/* 64 */,
|
|
1100
|
-
/* 65 */,
|
|
1101
|
-
/* 66 */,
|
|
1102
|
-
/* 67 */,
|
|
1103
|
-
/* 68 */,
|
|
1104
|
-
/* 69 */,
|
|
1105
|
-
/* 70 */,
|
|
1106
|
-
/* 71 */,
|
|
1107
|
-
/* 72 */,
|
|
1108
|
-
/* 73 */
|
|
1109
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1110
|
-
|
|
1111
|
-
"use strict";
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1115
|
-
value: true
|
|
1116
|
-
});
|
|
1117
|
-
exports.updateRowPayload = exports.canUpdateInPlace = exports.changedOptions = exports.NO_INPLACE_PROPS = void 0;
|
|
1118
|
-
/* eslint-disable react/no-unused-prop-types */
|
|
1119
|
-
|
|
1120
|
-
var lodash_1 = __webpack_require__(3);
|
|
1121
|
-
|
|
1122
|
-
var i18n_1 = __webpack_require__(5);
|
|
1123
|
-
|
|
1124
|
-
var visualization_color_palettes_1 = __webpack_require__(74);
|
|
1125
|
-
|
|
1126
|
-
var react_1 = __webpack_require__(0);
|
|
1127
|
-
|
|
1128
|
-
var React = __webpack_require__(0);
|
|
1129
|
-
|
|
1130
|
-
var T = __webpack_require__(1);
|
|
1131
|
-
|
|
1132
|
-
var react_event_listener_1 = __webpack_require__(75);
|
|
1133
|
-
|
|
1134
|
-
__webpack_require__(76); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
var charting_bundle_1 = __webpack_require__(77);
|
|
1138
|
-
|
|
1139
|
-
var TimezoneContext_1 = __webpack_require__(28);
|
|
1140
|
-
|
|
1141
|
-
var style_1 = __webpack_require__(29);
|
|
1142
|
-
|
|
1143
|
-
var styled_components_1 = __webpack_require__(2);
|
|
1144
|
-
|
|
1145
|
-
var Message_1 = __webpack_require__(24);
|
|
1146
|
-
|
|
1147
|
-
var useSplunkTheme_1 = __webpack_require__(78);
|
|
1148
|
-
|
|
1149
|
-
var themeUtils_1 = __webpack_require__(79);
|
|
1150
|
-
|
|
1151
|
-
var ChartingApi_1 = __webpack_require__(30);
|
|
1152
|
-
|
|
1153
|
-
var usePrevious_1 = __webpack_require__(31);
|
|
1154
|
-
|
|
1155
|
-
var useEventCallback_1 = __webpack_require__(80);
|
|
1156
|
-
|
|
1157
|
-
var dataUtils_1 = __webpack_require__(25);
|
|
1158
|
-
|
|
1159
|
-
exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
|
|
1160
|
-
|
|
1161
|
-
var changedOptions = function changedOptions(curOptions, nextOptions) {
|
|
1162
|
-
return Object.keys(curOptions).filter(function (key) {
|
|
1163
|
-
return !(key in nextOptions);
|
|
1164
|
-
}).concat(Object.keys(nextOptions).filter(function (key) {
|
|
1165
|
-
return !(key in curOptions) || curOptions[key] !== nextOptions[key];
|
|
1166
|
-
}));
|
|
1167
|
-
};
|
|
1168
|
-
|
|
1169
|
-
exports.changedOptions = changedOptions;
|
|
1170
|
-
|
|
1171
|
-
var canUpdateInPlace = function canUpdateInPlace(curOptions, nextOptions) {
|
|
1172
|
-
// if either of the options are undefined
|
|
1173
|
-
// it cannot update in place.
|
|
302
|
+
// src/common/Charting.tsx
|
|
303
|
+
var NO_INPLACE_PROPS = [
|
|
304
|
+
"chart",
|
|
305
|
+
"chart.orientation",
|
|
306
|
+
"layout.splitSeries",
|
|
307
|
+
"chart.style",
|
|
308
|
+
"legend.placement"
|
|
309
|
+
];
|
|
310
|
+
var changedOptions = (curOptions, nextOptions) => Object.keys(curOptions).filter((key) => !(key in nextOptions)).concat(
|
|
311
|
+
Object.keys(nextOptions).filter(
|
|
312
|
+
(key) => !(key in curOptions) || curOptions[key] !== nextOptions[key]
|
|
313
|
+
)
|
|
314
|
+
);
|
|
315
|
+
var canUpdateInPlace = (curOptions, nextOptions) => {
|
|
1174
316
|
if (!curOptions || !nextOptions) {
|
|
1175
317
|
return false;
|
|
1176
318
|
}
|
|
1177
|
-
|
|
1178
|
-
return !exports.NO_INPLACE_PROPS.some(function (p) {
|
|
1179
|
-
return curOptions[p] !== nextOptions[p];
|
|
1180
|
-
}) && !(0, exports.changedOptions)(curOptions, nextOptions).some(function (p) {
|
|
1181
|
-
return p.toLowerCase().endsWith('color');
|
|
1182
|
-
});
|
|
319
|
+
return !NO_INPLACE_PROPS.some((p) => curOptions[p] !== nextOptions[p]) && !changedOptions(curOptions, nextOptions).some((p) => p.toLowerCase().endsWith("color"));
|
|
1183
320
|
};
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
var updateRowPayload = function updateRowPayload(chartEventRowContext, payload) {
|
|
1189
|
-
Object.keys(chartEventRowContext || {}).forEach(function (key) {
|
|
1190
|
-
// eslint-disable-next-line no-param-reassign
|
|
1191
|
-
payload["".concat(key, ".value")] = chartEventRowContext[key];
|
|
321
|
+
var updateRowPayload = (chartEventRowContext, payload) => {
|
|
322
|
+
Object.keys(chartEventRowContext || {}).forEach((key) => {
|
|
323
|
+
payload[`${key}.value`] = chartEventRowContext[key];
|
|
1192
324
|
});
|
|
1193
325
|
return payload;
|
|
1194
326
|
};
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
// https://github.com/highcharts/highcharts/issues/12883
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
var ChartingContainer = styled_components_1.default.div.attrs(function (props) {
|
|
1211
|
-
return {
|
|
1212
|
-
'data-test': 'charting-container',
|
|
1213
|
-
width: props.width,
|
|
1214
|
-
height: props.height
|
|
1215
|
-
};
|
|
1216
|
-
}).withConfig({
|
|
1217
|
-
displayName: "Charting__ChartingContainer",
|
|
1218
|
-
componentId: "sc-3wbgm0-0"
|
|
1219
|
-
})(["& .highcharts-a11y-proxy-container{pointer-events:none;}overflow:hidden;position:relative;", ";"], function (props) {
|
|
1220
|
-
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
1221
|
-
});
|
|
327
|
+
var ChartingContainer = styled_components_default.div.attrs((props) => ({
|
|
328
|
+
"data-test": "charting-container",
|
|
329
|
+
width: props.width,
|
|
330
|
+
height: props.height
|
|
331
|
+
}))`
|
|
332
|
+
& .highcharts-a11y-proxy-container {
|
|
333
|
+
pointer-events: none;
|
|
334
|
+
}
|
|
335
|
+
overflow: hidden;
|
|
336
|
+
position: relative;
|
|
337
|
+
${(props) => (0, style_exports.toDimension)((0, lodash_exports.pick)(props, ["width", "height"]))};
|
|
338
|
+
`;
|
|
1222
339
|
var propTypes = {
|
|
1223
|
-
width:
|
|
1224
|
-
height:
|
|
1225
|
-
options:
|
|
1226
|
-
chartData:
|
|
1227
|
-
onEventTrigger:
|
|
1228
|
-
onClick:
|
|
1229
|
-
onSelect:
|
|
1230
|
-
onPointMouseOver:
|
|
1231
|
-
onPointMouseOut:
|
|
1232
|
-
style:
|
|
1233
|
-
colorPalette:
|
|
1234
|
-
visualizationApiRef:
|
|
1235
|
-
themeKey:
|
|
1236
|
-
originalDataSources:
|
|
1237
|
-
onDownsamplingThresholdChange:
|
|
1238
|
-
xField:
|
|
1239
|
-
y2Fields:
|
|
340
|
+
width: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
|
|
341
|
+
height: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
|
|
342
|
+
options: prop_types_exports.object,
|
|
343
|
+
chartData: prop_types_exports.object,
|
|
344
|
+
onEventTrigger: prop_types_exports.func,
|
|
345
|
+
onClick: prop_types_exports.func,
|
|
346
|
+
onSelect: prop_types_exports.func,
|
|
347
|
+
onPointMouseOver: prop_types_exports.func,
|
|
348
|
+
onPointMouseOut: prop_types_exports.func,
|
|
349
|
+
style: prop_types_exports.object,
|
|
350
|
+
colorPalette: prop_types_exports.array,
|
|
351
|
+
visualizationApiRef: prop_types_exports.func,
|
|
352
|
+
themeKey: prop_types_exports.string,
|
|
353
|
+
originalDataSources: prop_types_exports.object,
|
|
354
|
+
onDownsamplingThresholdChange: prop_types_exports.func,
|
|
355
|
+
xField: prop_types_exports.string,
|
|
356
|
+
y2Fields: prop_types_exports.array
|
|
1240
357
|
};
|
|
1241
|
-
|
|
1242
|
-
var Charting = function Charting(props) {
|
|
358
|
+
var Charting = (props) => {
|
|
1243
359
|
var _a, _b;
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
var computeChartingSize = function computeChartingSize() {
|
|
360
|
+
const container = (0, react_exports.useRef)(null);
|
|
361
|
+
const needsInit = (0, react_exports.useRef)(true);
|
|
362
|
+
const chart = (0, react_exports.useRef)();
|
|
363
|
+
const needsRedraw = (0, react_exports.useRef)(true);
|
|
364
|
+
const api = (0, react_exports.useRef)(new ChartingApiFunctional(chart));
|
|
365
|
+
const timezone = (0, react_exports.useContext)(TimezoneContext_default);
|
|
366
|
+
const selectChartEvent = (0, react_exports.useRef)(null);
|
|
367
|
+
const computeChartingSize = () => {
|
|
1254
368
|
if (container.current) {
|
|
1255
|
-
|
|
369
|
+
const rect = container.current.getBoundingClientRect();
|
|
1256
370
|
return {
|
|
1257
371
|
height: rect.height,
|
|
1258
372
|
width: rect.width
|
|
1259
373
|
};
|
|
1260
374
|
}
|
|
1261
|
-
|
|
1262
375
|
return {};
|
|
1263
376
|
};
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
377
|
+
const splunkTheme = useSplunkTheme_default();
|
|
378
|
+
const themeKey = props.themeKey ? props.themeKey : (0, themeUtils_exports.getChartingThemeKey)({ splunkThemeV1: splunkTheme });
|
|
379
|
+
const {
|
|
380
|
+
width,
|
|
381
|
+
height,
|
|
382
|
+
style,
|
|
383
|
+
chartData,
|
|
384
|
+
options,
|
|
385
|
+
colorPalette,
|
|
386
|
+
onClick,
|
|
387
|
+
onSelect,
|
|
388
|
+
onPointMouseOut,
|
|
389
|
+
onPointMouseOver,
|
|
390
|
+
onEventTrigger,
|
|
391
|
+
originalDataSources,
|
|
392
|
+
onDownsamplingThresholdChange,
|
|
393
|
+
xField
|
|
394
|
+
} = props;
|
|
395
|
+
const prevOptions = usePrevious(options);
|
|
396
|
+
const prevTimezone = usePrevious(timezone);
|
|
397
|
+
const handleClick = (chartEvent, type) => {
|
|
398
|
+
let payload = (0, lodash_exports.pick)(
|
|
399
|
+
chartEvent,
|
|
400
|
+
"name2",
|
|
401
|
+
"value2",
|
|
402
|
+
"_span",
|
|
403
|
+
"modifierKey"
|
|
404
|
+
);
|
|
1288
405
|
payload.name = payload.name2;
|
|
1289
406
|
delete payload.name2;
|
|
1290
|
-
|
|
1291
|
-
if (type === VizChartEventType.POINT_CLICK) {
|
|
407
|
+
if (type === "point.click" /* POINT_CLICK */) {
|
|
1292
408
|
payload.value = payload.value2;
|
|
1293
409
|
delete payload.value2;
|
|
1294
|
-
payload =
|
|
410
|
+
payload = updateRowPayload(chartEvent.rowContext, payload);
|
|
1295
411
|
}
|
|
1296
|
-
|
|
1297
412
|
onClick({
|
|
1298
|
-
type
|
|
413
|
+
type,
|
|
1299
414
|
originalEvent: chartEvent,
|
|
1300
|
-
payload
|
|
415
|
+
payload
|
|
1301
416
|
});
|
|
1302
417
|
};
|
|
1303
|
-
|
|
1304
|
-
var destroyChart = function destroyChart() {
|
|
418
|
+
const destroyChart = () => {
|
|
1305
419
|
if (chart.current) {
|
|
1306
420
|
chart.current.destroy();
|
|
1307
421
|
chart.current = null;
|
|
1308
422
|
}
|
|
1309
|
-
|
|
1310
423
|
needsRedraw.current = true;
|
|
1311
424
|
needsInit.current = true;
|
|
1312
425
|
};
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
var recalculateDownsamplingThreshold = React.useCallback(function () {
|
|
426
|
+
const enableSearchZoom = (_b = (_a = chartData == null ? void 0 : chartData.chartDataOptions) == null ? void 0 : _a.enableSearchZoom) != null ? _b : false;
|
|
427
|
+
const recalculateDownsamplingThreshold = react_exports.useCallback(() => {
|
|
1316
428
|
if (!onDownsamplingThresholdChange || !xField) {
|
|
1317
429
|
return;
|
|
1318
430
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
enableSearchZoom: enableSearchZoom,
|
|
431
|
+
const newThreshold = calculateDownsamplingThreshold({
|
|
432
|
+
enableSearchZoom,
|
|
1322
433
|
dataSources: originalDataSources,
|
|
1323
434
|
width: Number(width),
|
|
1324
435
|
selectChartEvent: selectChartEvent.current,
|
|
1325
|
-
xField
|
|
436
|
+
xField
|
|
1326
437
|
});
|
|
1327
|
-
|
|
1328
438
|
if (Number.isFinite(newThreshold)) {
|
|
1329
439
|
onDownsamplingThresholdChange(newThreshold);
|
|
1330
440
|
}
|
|
1331
441
|
}, [enableSearchZoom, originalDataSources, onDownsamplingThresholdChange, width, xField]);
|
|
1332
|
-
|
|
442
|
+
react_exports.useEffect(() => {
|
|
1333
443
|
recalculateDownsamplingThreshold();
|
|
1334
|
-
}, [recalculateDownsamplingThreshold]);
|
|
1335
|
-
|
|
1336
|
-
// Since chart drawing is debounced, there is a race condition where a stale callback may be called
|
|
1337
|
-
// if a prop changes and the event handler is called before the chart redraws. This means that
|
|
1338
|
-
// it will use the old callback rather than the newer one, which can lead to inaccurate results
|
|
1339
|
-
|
|
1340
|
-
var handleSelect = (0, useEventCallback_1.default)(function (chartEvent) {
|
|
444
|
+
}, [recalculateDownsamplingThreshold]);
|
|
445
|
+
const handleSelect = useEventCallback_default((chartEvent) => {
|
|
1341
446
|
selectChartEvent.current = chartEvent;
|
|
1342
|
-
recalculateDownsamplingThreshold();
|
|
1343
|
-
|
|
1344
|
-
if (onSelect && typeof onSelect === 'function') {
|
|
447
|
+
recalculateDownsamplingThreshold();
|
|
448
|
+
if (onSelect && typeof onSelect === "function") {
|
|
1345
449
|
onSelect({
|
|
1346
|
-
type:
|
|
450
|
+
type: "range.select",
|
|
1347
451
|
originalEvent: chartEvent,
|
|
1348
|
-
payload: (0,
|
|
452
|
+
payload: (0, lodash_exports.pick)(chartEvent, "startXIndex", "endXIndex", "startXValue", "endXValue")
|
|
1349
453
|
});
|
|
1350
454
|
return;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
|
|
455
|
+
}
|
|
1354
456
|
onEventTrigger({
|
|
1355
|
-
type:
|
|
1356
|
-
originalEvent: chartEvent,
|
|
1357
|
-
payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
1358
|
-
});
|
|
1359
|
-
});
|
|
1360
|
-
var handlePointMouseOut = (0, useEventCallback_1.default)(function (chartEvent, type) {
|
|
1361
|
-
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
1362
|
-
payload.name = payload.name2;
|
|
1363
|
-
delete payload.name2;
|
|
1364
|
-
payload.value = payload.value2;
|
|
1365
|
-
delete payload.value2;
|
|
1366
|
-
payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
|
|
1367
|
-
onPointMouseOut({
|
|
1368
|
-
type: type,
|
|
457
|
+
type: "range.select",
|
|
1369
458
|
originalEvent: chartEvent,
|
|
1370
|
-
payload:
|
|
459
|
+
payload: (0, lodash_exports.pick)(chartEvent, "startXIndex", "endXIndex", "startXValue", "endXValue")
|
|
1371
460
|
});
|
|
1372
461
|
});
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
payload
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
462
|
+
const handlePointMouseOut = useEventCallback_default(
|
|
463
|
+
(chartEvent, type) => {
|
|
464
|
+
let payload = (0, lodash_exports.pick)(
|
|
465
|
+
chartEvent,
|
|
466
|
+
"name2",
|
|
467
|
+
"value2",
|
|
468
|
+
"_span",
|
|
469
|
+
"modifierKey",
|
|
470
|
+
"tooltipContext"
|
|
471
|
+
);
|
|
472
|
+
payload.name = payload.name2;
|
|
473
|
+
delete payload.name2;
|
|
474
|
+
payload.value = payload.value2;
|
|
475
|
+
delete payload.value2;
|
|
476
|
+
payload = updateRowPayload(chartEvent.rowContext, payload);
|
|
477
|
+
onPointMouseOut({
|
|
478
|
+
type,
|
|
479
|
+
originalEvent: chartEvent,
|
|
480
|
+
payload
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
);
|
|
484
|
+
const handlePointMouseOver = useEventCallback_default(
|
|
485
|
+
(chartEvent, type) => {
|
|
486
|
+
let payload = (0, lodash_exports.pick)(
|
|
487
|
+
chartEvent,
|
|
488
|
+
"name2",
|
|
489
|
+
"value2",
|
|
490
|
+
"_span",
|
|
491
|
+
"modifierKey",
|
|
492
|
+
"tooltipContext"
|
|
493
|
+
);
|
|
494
|
+
payload.name = payload.name2;
|
|
495
|
+
delete payload.name2;
|
|
496
|
+
payload.value = payload.value2;
|
|
497
|
+
delete payload.value2;
|
|
498
|
+
payload = updateRowPayload(chartEvent.rowContext, payload);
|
|
499
|
+
onPointMouseOver({
|
|
500
|
+
type,
|
|
501
|
+
originalEvent: chartEvent,
|
|
502
|
+
payload
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
const drawChart = () => {
|
|
507
|
+
const updatedOptions = __spreadProps(__spreadValues({}, options), { shouldColorizeTooltipData: false });
|
|
508
|
+
const computedChartSize = computeChartingSize();
|
|
509
|
+
const computedWidth = computedChartSize.width;
|
|
510
|
+
const computedHeight = computedChartSize.height;
|
|
511
|
+
const serializedTimezone = timezone == null ? void 0 : timezone.serializedTimezone;
|
|
512
|
+
const ianaTimezone = timezone == null ? void 0 : timezone.ianaTimezone;
|
|
513
|
+
const utcOffset = timezone == null ? void 0 : timezone.utcOffset;
|
|
1398
514
|
if (!computedWidth || !computedHeight) {
|
|
1399
515
|
return;
|
|
1400
516
|
}
|
|
1401
|
-
|
|
1402
517
|
if (!chartData || !Object.keys(chartData).length) {
|
|
1403
518
|
return;
|
|
1404
|
-
}
|
|
1405
|
-
// when an option is removed it needs to be set to an empty string
|
|
1406
|
-
// to override the previous configuration
|
|
1407
|
-
|
|
1408
|
-
|
|
519
|
+
}
|
|
1409
520
|
if (prevOptions) {
|
|
1410
|
-
Object.keys(prevOptions).forEach(
|
|
1411
|
-
if (prevOptions[key] && updatedOptions[key] ===
|
|
1412
|
-
updatedOptions[key] =
|
|
521
|
+
Object.keys(prevOptions).forEach((key) => {
|
|
522
|
+
if (prevOptions[key] && updatedOptions[key] === void 0) {
|
|
523
|
+
updatedOptions[key] = "";
|
|
1413
524
|
}
|
|
1414
525
|
});
|
|
1415
526
|
}
|
|
1416
|
-
|
|
1417
527
|
try {
|
|
1418
528
|
if (needsInit.current) {
|
|
1419
529
|
destroyChart();
|
|
1420
|
-
|
|
1421
|
-
|
|
530
|
+
charting_bundle_default.setTheme(themeKey);
|
|
1422
531
|
if (colorPalette.length > 0) {
|
|
1423
|
-
|
|
532
|
+
charting_bundle_default.setColorPalette(colorPalette);
|
|
1424
533
|
}
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
chart.current.on('pointClick', function (e) {
|
|
1437
|
-
handleClick(e, VizChartEventType.POINT_CLICK);
|
|
534
|
+
chart.current = charting_bundle_default.createChart(container.current, __spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, updatedOptions), {
|
|
535
|
+
drilldown: "all"
|
|
536
|
+
}), typeof serializedTimezone === "string" && {
|
|
537
|
+
"time.serializedTz": serializedTimezone
|
|
538
|
+
}), typeof ianaTimezone === "string" && {
|
|
539
|
+
"time.ianaTimezone": ianaTimezone
|
|
540
|
+
}), typeof utcOffset === "number" && {
|
|
541
|
+
"time.timezoneOffset": utcOffset
|
|
542
|
+
}));
|
|
543
|
+
chart.current.on("pointClick", (e) => {
|
|
544
|
+
handleClick(e, "point.click" /* POINT_CLICK */);
|
|
1438
545
|
});
|
|
1439
|
-
chart.current.on(
|
|
1440
|
-
handlePointMouseOver(e,
|
|
546
|
+
chart.current.on("pointMouseOver", (e) => {
|
|
547
|
+
handlePointMouseOver(e, "point.mouseover" /* POINT_MOUSE_OVER */);
|
|
1441
548
|
});
|
|
1442
|
-
chart.current.on(
|
|
1443
|
-
handlePointMouseOut(e,
|
|
549
|
+
chart.current.on("pointMouseOut", (e) => {
|
|
550
|
+
handlePointMouseOut(e, "point.mouseout" /* POINT_MOUSE_OUT */);
|
|
1444
551
|
});
|
|
1445
|
-
chart.current.on(
|
|
1446
|
-
handleClick(e,
|
|
552
|
+
chart.current.on("legendClick", (e) => {
|
|
553
|
+
handleClick(e, "legend.click" /* LEGEND_CLICK */);
|
|
1447
554
|
});
|
|
1448
|
-
chart.current.on(
|
|
555
|
+
chart.current.on("chartRangeSelect", handleSelect);
|
|
1449
556
|
}
|
|
1450
|
-
|
|
1451
557
|
if (needsRedraw.current) {
|
|
1452
|
-
|
|
1453
|
-
|
|
558
|
+
charting_bundle_default.setTheme(themeKey);
|
|
1454
559
|
if (colorPalette.length > 0) {
|
|
1455
|
-
|
|
560
|
+
charting_bundle_default.setColorPalette(colorPalette);
|
|
1456
561
|
}
|
|
1457
|
-
|
|
1458
|
-
|
|
562
|
+
chart.current.prepareAndDraw(chartData, updatedOptions, () => {
|
|
563
|
+
onEventTrigger({
|
|
564
|
+
type: "viz.renderedWithData",
|
|
565
|
+
payload: { width, height, currentTime: (/* @__PURE__ */ new Date()).getTime() }
|
|
566
|
+
});
|
|
567
|
+
});
|
|
1459
568
|
}
|
|
1460
|
-
|
|
1461
569
|
if (chart.current) {
|
|
1462
570
|
if (Math.round(chart.current.height) !== Math.round(computedHeight) || Math.round(chart.current.width) !== Math.round(computedWidth)) {
|
|
1463
571
|
chart.current.resize(computedWidth, computedHeight);
|
|
1464
572
|
}
|
|
1465
573
|
}
|
|
1466
|
-
|
|
1467
574
|
needsInit.current = false;
|
|
1468
575
|
needsRedraw.current = false;
|
|
1469
576
|
} catch (e) {
|
|
1470
|
-
window.console.error(
|
|
577
|
+
window.console.error("Caught error rendering chart:", e);
|
|
1471
578
|
}
|
|
1472
579
|
};
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
var onContainerMount = function onContainerMount(chartingContainer) {
|
|
580
|
+
const debouncedDrawChart = (0, lodash_exports.debounce)(drawChart, 5);
|
|
581
|
+
const onContainerMount = (chartingContainer) => {
|
|
1477
582
|
container.current = chartingContainer;
|
|
1478
583
|
debouncedDrawChart();
|
|
1479
584
|
};
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
(0, react_1.useEffect)(function () {
|
|
585
|
+
const prevTheme = usePrevious(themeKey);
|
|
586
|
+
const prevOnClick = usePrevious(onClick);
|
|
587
|
+
(0, react_exports.useEffect)(() => {
|
|
1484
588
|
debouncedDrawChart();
|
|
1485
589
|
props.visualizationApiRef(api.current);
|
|
1486
|
-
return
|
|
590
|
+
return () => {
|
|
1487
591
|
props.visualizationApiRef(null);
|
|
1488
592
|
destroyChart();
|
|
1489
593
|
};
|
|
1490
594
|
}, []);
|
|
1491
|
-
(0,
|
|
1492
|
-
|
|
1493
|
-
// seems like redraw doesn't suffice to update the background colors
|
|
1494
|
-
if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) || // timezone is a simple object so this comparison should be fast
|
|
595
|
+
(0, react_exports.useEffect)(() => {
|
|
596
|
+
if (!chart.current || !canUpdateInPlace(prevOptions, options) || // timezone is a simple object so this comparison should be fast
|
|
1495
597
|
JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
|
|
1496
598
|
needsInit.current = true;
|
|
1497
|
-
}
|
|
1498
|
-
// otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
|
|
1499
|
-
|
|
1500
|
-
|
|
599
|
+
}
|
|
1501
600
|
needsRedraw.current = true;
|
|
1502
601
|
drawChart();
|
|
1503
|
-
}, [
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
602
|
+
}, [
|
|
603
|
+
JSON.stringify(options),
|
|
604
|
+
JSON.stringify(chartData.toJSON()),
|
|
605
|
+
JSON.stringify(chartData.annotations),
|
|
606
|
+
timezone == null ? void 0 : timezone.ianaTimezone,
|
|
607
|
+
timezone == null ? void 0 : timezone.utcOffset,
|
|
608
|
+
timezone == null ? void 0 : timezone.serializedTimezone,
|
|
609
|
+
themeKey,
|
|
610
|
+
onClick
|
|
611
|
+
]);
|
|
612
|
+
return /* @__PURE__ */ react_exports.createElement(ChartingContainer, { style, ref: onContainerMount, width, height }, /* @__PURE__ */ react_exports.createElement(react_event_listener_default, { target: window, onResize: debouncedDrawChart }));
|
|
1513
613
|
};
|
|
1514
|
-
|
|
1515
614
|
var defaultProps = {
|
|
1516
|
-
width:
|
|
615
|
+
width: "100%",
|
|
1517
616
|
height: 250,
|
|
1518
617
|
options: {},
|
|
1519
618
|
style: {},
|
|
1520
619
|
// todo: need remove it
|
|
1521
|
-
onEventTrigger:
|
|
1522
|
-
onClick:
|
|
1523
|
-
onSelect:
|
|
1524
|
-
onPointMouseOver:
|
|
1525
|
-
onPointMouseOut:
|
|
1526
|
-
colorPalette:
|
|
1527
|
-
visualizationApiRef:
|
|
620
|
+
onEventTrigger: lodash_exports.noop,
|
|
621
|
+
onClick: lodash_exports.noop,
|
|
622
|
+
onSelect: lodash_exports.noop,
|
|
623
|
+
onPointMouseOver: lodash_exports.noop,
|
|
624
|
+
onPointMouseOut: lodash_exports.noop,
|
|
625
|
+
colorPalette: visualization_color_palettes_exports.VIZ_CATEGORICAL,
|
|
626
|
+
visualizationApiRef: lodash_exports.noop,
|
|
1528
627
|
chartData: null,
|
|
1529
628
|
themeKey: null,
|
|
1530
629
|
onDownsamplingThresholdChange: null,
|
|
@@ -1533,99 +632,22 @@ var defaultProps = {
|
|
|
1533
632
|
y2Fields: []
|
|
1534
633
|
};
|
|
1535
634
|
Charting.propTypes = propTypes;
|
|
1536
|
-
Charting.defaultProps = defaultProps;
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
var chartData = props.chartData;
|
|
1541
|
-
|
|
635
|
+
Charting.defaultProps = defaultProps;
|
|
636
|
+
var withEmptyChartMessage = (Chart) => {
|
|
637
|
+
const Wrapper = (props) => {
|
|
638
|
+
const { chartData } = props;
|
|
1542
639
|
if (!chartData) {
|
|
1543
|
-
return
|
|
1544
|
-
message: (0, i18n_1._)('No DataSource'),
|
|
1545
|
-
level: "warning"
|
|
1546
|
-
});
|
|
640
|
+
return /* @__PURE__ */ react_exports.createElement(Message_default, { message: (0, i18n_exports._)("No DataSource"), level: "warning" });
|
|
1547
641
|
}
|
|
1548
|
-
|
|
1549
642
|
if (chartData && !Object.keys(chartData).length) {
|
|
1550
|
-
return
|
|
1551
|
-
message: (0, i18n_1._)('No Result'),
|
|
1552
|
-
level: "info"
|
|
1553
|
-
});
|
|
643
|
+
return /* @__PURE__ */ react_exports.createElement(Message_default, { message: (0, i18n_exports._)("No Result"), level: "info" });
|
|
1554
644
|
}
|
|
1555
|
-
|
|
1556
|
-
return React.createElement(Chart, Object.assign({}, props));
|
|
645
|
+
return /* @__PURE__ */ react_exports.createElement(Chart, __spreadValues({}, props));
|
|
1557
646
|
};
|
|
1558
|
-
|
|
1559
|
-
Wrapper.displayName = 'ChartingWrapper';
|
|
647
|
+
Wrapper.displayName = "ChartingWrapper";
|
|
1560
648
|
Wrapper.propTypes = propTypes;
|
|
1561
649
|
Wrapper.defaultProps = defaultProps;
|
|
1562
650
|
return Wrapper;
|
|
1563
|
-
}; // export default Charting;
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
exports.default = withEmptyChartMessage(Charting);
|
|
1567
|
-
|
|
1568
|
-
/***/ }),
|
|
1569
|
-
/* 74 */
|
|
1570
|
-
/***/ (function(module, exports) {
|
|
1571
|
-
|
|
1572
|
-
module.exports = require("@splunk/visualization-color-palettes");
|
|
1573
|
-
|
|
1574
|
-
/***/ }),
|
|
1575
|
-
/* 75 */
|
|
1576
|
-
/***/ (function(module, exports) {
|
|
1577
|
-
|
|
1578
|
-
module.exports = require("react-event-listener");
|
|
1579
|
-
|
|
1580
|
-
/***/ }),
|
|
1581
|
-
/* 76 */
|
|
1582
|
-
/***/ (function(module, exports) {
|
|
1583
|
-
|
|
1584
|
-
module.exports = require("@splunk/visualizations-shared/i18n");
|
|
1585
|
-
|
|
1586
|
-
/***/ }),
|
|
1587
|
-
/* 77 */
|
|
1588
|
-
/***/ (function(module, exports) {
|
|
1589
|
-
|
|
1590
|
-
module.exports = require("@splunk/charting-bundle");
|
|
1591
|
-
|
|
1592
|
-
/***/ }),
|
|
1593
|
-
/* 78 */
|
|
1594
|
-
/***/ (function(module, exports) {
|
|
1595
|
-
|
|
1596
|
-
module.exports = require("@splunk/themes/useSplunkTheme");
|
|
1597
|
-
|
|
1598
|
-
/***/ }),
|
|
1599
|
-
/* 79 */
|
|
1600
|
-
/***/ (function(module, exports) {
|
|
1601
|
-
|
|
1602
|
-
module.exports = require("@splunk/visualizations-shared/themeUtils");
|
|
1603
|
-
|
|
1604
|
-
/***/ }),
|
|
1605
|
-
/* 80 */
|
|
1606
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1607
|
-
|
|
1608
|
-
"use strict";
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1612
|
-
value: true
|
|
1613
|
-
});
|
|
1614
|
-
|
|
1615
|
-
var react_1 = __webpack_require__(0);
|
|
1616
|
-
|
|
1617
|
-
var useEventCallback = function useEventCallback(fn) {
|
|
1618
|
-
var ref = (0, react_1.useRef)(fn);
|
|
1619
|
-
(0, react_1.useLayoutEffect)(function () {
|
|
1620
|
-
ref.current = fn;
|
|
1621
|
-
});
|
|
1622
|
-
return (0, react_1.useCallback)(function () {
|
|
1623
|
-
return ref.current.apply(ref, arguments);
|
|
1624
|
-
}, []);
|
|
1625
651
|
};
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
/***/ })
|
|
1630
|
-
/******/ ]);
|
|
1631
|
-
//# sourceMappingURL=Charting.js.map
|
|
652
|
+
var Charting_default = withEmptyChartMessage(Charting);
|
|
653
|
+
//# sourceMappingURL=Charting.js.map
|