@splunk/visualizations 25.13.1 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +318 -234
- package/Area.config.js.map +1 -1
- package/Area.js +1131 -766
- package/Area.js.map +1 -1
- package/Bar.config.js +317 -233
- package/Bar.config.js.map +1 -1
- package/Bar.js +1007 -594
- package/Bar.js.map +1 -1
- package/Bubble.config.js +234 -160
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +912 -509
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +80 -29
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +691 -319
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +308 -223
- package/Column.config.js.map +1 -1
- package/Column.js +1011 -587
- package/Column.js.map +1 -1
- package/Ellipse.config.js +127 -62
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +576 -286
- package/Ellipse.js.map +1 -1
- package/Events.config.js +111 -29
- package/Events.config.js.map +1 -1
- package/Events.js +998 -527
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +142 -73
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +962 -572
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +70 -26
- package/Image.config.js.map +1 -1
- package/Image.js +524 -253
- package/Image.js.map +1 -1
- package/Line.config.js +326 -242
- package/Line.config.js.map +1 -1
- package/Line.js +1022 -606
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +99 -49
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +1184 -762
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +311 -167
- package/Map.config.js.map +1 -1
- package/Map.js +1479 -873
- package/Map.js.map +1 -1
- package/Markdown.config.js +93 -43
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +603 -332
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +163 -105
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +1025 -628
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +95 -41
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +993 -622
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +99 -46
- package/Pie.config.js.map +1 -1
- package/Pie.js +847 -442
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +114 -62
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +1097 -633
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +131 -65
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +580 -288
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +103 -41
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +1128 -586
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +231 -157
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +904 -504
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +212 -142
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1506 -956
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +294 -233
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +208 -138
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +1375 -914
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +252 -137
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +2194 -1069
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +172 -83
- package/SparkLine.js.map +1 -1
- package/Table.config.js +123 -70
- package/Table.config.js.map +1 -1
- package/Table.js +1094 -590
- package/Table.js.map +1 -1
- package/common/Charting.js +147 -75
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +91 -36
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +70 -60
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +45 -36
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +177 -86
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +65 -32
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +34 -7
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +10 -4
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +41 -28
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +56 -24
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +15 -5
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +238 -155
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +34 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +59 -23
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +9 -4
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +5 -3
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +3 -2
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +370 -206
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +243 -198
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +36 -9
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +87 -26
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +4 -2
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +375 -193
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +25 -27
package/common/Charting.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 =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 42);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ([
|
|
@@ -170,15 +170,19 @@ module.exports = require("@splunk/visualizations-shared/style");
|
|
|
170
170
|
|
|
171
171
|
|
|
172
172
|
var _classCallCheck = __webpack_require__(4);
|
|
173
|
+
|
|
173
174
|
var _createClass = __webpack_require__(6);
|
|
175
|
+
|
|
174
176
|
Object.defineProperty(exports, "__esModule", {
|
|
175
177
|
value: true
|
|
176
178
|
});
|
|
177
179
|
exports.ChartingApiFunctional = void 0;
|
|
180
|
+
|
|
178
181
|
var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
179
182
|
// eslint-disable-next-line no-useless-constructor
|
|
180
183
|
function ChartingApiFunctional(chartRef) {
|
|
181
184
|
_classCallCheck(this, ChartingApiFunctional);
|
|
185
|
+
|
|
182
186
|
this.chartRef = chartRef;
|
|
183
187
|
}
|
|
184
188
|
/**
|
|
@@ -186,15 +190,18 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
|
186
190
|
*
|
|
187
191
|
* @memberof ChartingApiFunctional
|
|
188
192
|
*/
|
|
193
|
+
|
|
194
|
+
|
|
189
195
|
_createClass(ChartingApiFunctional, [{
|
|
190
196
|
key: "highlight",
|
|
191
197
|
value: function highlight() {
|
|
192
198
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
199
|
+
xValue: '',
|
|
200
|
+
seriesName: ''
|
|
201
|
+
},
|
|
202
|
+
xValue = _ref.xValue,
|
|
203
|
+
seriesName = _ref.seriesName;
|
|
204
|
+
|
|
198
205
|
this.getChart().highlight(xValue, seriesName);
|
|
199
206
|
}
|
|
200
207
|
/**
|
|
@@ -202,21 +209,25 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
|
202
209
|
*
|
|
203
210
|
* @memberof ChartingApiFunctional
|
|
204
211
|
*/
|
|
212
|
+
|
|
205
213
|
}, {
|
|
206
214
|
key: "unHighlight",
|
|
207
215
|
value: function unHighlight() {
|
|
208
216
|
this.getChart().unHighlight();
|
|
209
|
-
}
|
|
210
|
-
|
|
217
|
+
} // returns chart object
|
|
218
|
+
|
|
211
219
|
}, {
|
|
212
220
|
key: "getChart",
|
|
213
221
|
value: function getChart() {
|
|
214
222
|
var _a;
|
|
223
|
+
|
|
215
224
|
return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
|
|
216
225
|
}
|
|
217
226
|
}]);
|
|
227
|
+
|
|
218
228
|
return ChartingApiFunctional;
|
|
219
229
|
}();
|
|
230
|
+
|
|
220
231
|
exports.ChartingApiFunctional = ChartingApiFunctional;
|
|
221
232
|
|
|
222
233
|
/***/ }),
|
|
@@ -238,7 +249,8 @@ exports.ChartingApiFunctional = ChartingApiFunctional;
|
|
|
238
249
|
/* 38 */,
|
|
239
250
|
/* 39 */,
|
|
240
251
|
/* 40 */,
|
|
241
|
-
/* 41
|
|
252
|
+
/* 41 */,
|
|
253
|
+
/* 42 */
|
|
242
254
|
/***/ (function(module, exports, __webpack_require__) {
|
|
243
255
|
|
|
244
256
|
"use strict";
|
|
@@ -249,23 +261,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
249
261
|
});
|
|
250
262
|
exports.updateRowPayload = exports.canUpdateInPlace = exports.changedOptions = exports.NO_INPLACE_PROPS = void 0;
|
|
251
263
|
/* eslint-disable react/no-unused-prop-types */
|
|
264
|
+
|
|
252
265
|
var lodash_1 = __webpack_require__(3);
|
|
266
|
+
|
|
253
267
|
var i18n_1 = __webpack_require__(7);
|
|
254
|
-
|
|
268
|
+
|
|
269
|
+
var visualization_color_palettes_1 = __webpack_require__(43);
|
|
270
|
+
|
|
255
271
|
var react_1 = __webpack_require__(0);
|
|
272
|
+
|
|
256
273
|
var React = __webpack_require__(0);
|
|
274
|
+
|
|
257
275
|
var T = __webpack_require__(1);
|
|
258
|
-
|
|
259
|
-
__webpack_require__(44);
|
|
260
|
-
|
|
276
|
+
|
|
277
|
+
var react_event_listener_1 = __webpack_require__(44);
|
|
278
|
+
|
|
279
|
+
__webpack_require__(45); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
var charting_bundle_1 = __webpack_require__(46);
|
|
283
|
+
|
|
261
284
|
var TimezoneContext_1 = __webpack_require__(20);
|
|
285
|
+
|
|
262
286
|
var style_1 = __webpack_require__(21);
|
|
287
|
+
|
|
263
288
|
var styled_components_1 = __webpack_require__(2);
|
|
289
|
+
|
|
264
290
|
var Message_1 = __webpack_require__(18);
|
|
265
|
-
|
|
266
|
-
var
|
|
291
|
+
|
|
292
|
+
var useSplunkTheme_1 = __webpack_require__(47);
|
|
293
|
+
|
|
294
|
+
var themeUtils_1 = __webpack_require__(48);
|
|
295
|
+
|
|
267
296
|
var ChartingApi_1 = __webpack_require__(22);
|
|
297
|
+
|
|
268
298
|
exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
|
|
299
|
+
|
|
269
300
|
var changedOptions = function changedOptions(curOptions, nextOptions) {
|
|
270
301
|
return Object.keys(curOptions).filter(function (key) {
|
|
271
302
|
return !(key in nextOptions);
|
|
@@ -273,30 +304,34 @@ var changedOptions = function changedOptions(curOptions, nextOptions) {
|
|
|
273
304
|
return !(key in curOptions) || curOptions[key] !== nextOptions[key];
|
|
274
305
|
}));
|
|
275
306
|
};
|
|
307
|
+
|
|
276
308
|
exports.changedOptions = changedOptions;
|
|
277
|
-
|
|
309
|
+
|
|
278
310
|
function usePrevious(value) {
|
|
279
|
-
var ref = react_1.useRef();
|
|
280
|
-
react_1.useEffect(function () {
|
|
311
|
+
var ref = (0, react_1.useRef)();
|
|
312
|
+
(0, react_1.useEffect)(function () {
|
|
281
313
|
ref.current = value;
|
|
282
314
|
});
|
|
283
315
|
return ref.current;
|
|
284
316
|
}
|
|
317
|
+
|
|
285
318
|
var canUpdateInPlace = function canUpdateInPlace(curOptions, nextOptions) {
|
|
286
319
|
// if either of the options are undefined
|
|
287
320
|
// it cannot update in place.
|
|
288
321
|
if (!curOptions || !nextOptions) {
|
|
289
322
|
return false;
|
|
290
323
|
}
|
|
324
|
+
|
|
291
325
|
return !exports.NO_INPLACE_PROPS.some(function (p) {
|
|
292
326
|
return curOptions[p] !== nextOptions[p];
|
|
293
|
-
}) && !exports.changedOptions(curOptions, nextOptions).some(function (p) {
|
|
327
|
+
}) && !(0, exports.changedOptions)(curOptions, nextOptions).some(function (p) {
|
|
294
328
|
return p.toLowerCase().endsWith('color');
|
|
295
329
|
});
|
|
296
330
|
};
|
|
297
|
-
|
|
298
|
-
// create 'row' payloads from 'rowContext' in the flattened format:
|
|
331
|
+
|
|
332
|
+
exports.canUpdateInPlace = canUpdateInPlace; // create 'row' payloads from 'rowContext' in the flattened format:
|
|
299
333
|
// row.<fieldname>.value
|
|
334
|
+
|
|
300
335
|
var updateRowPayload = function updateRowPayload(chartEventRowContext, payload) {
|
|
301
336
|
Object.keys(chartEventRowContext || {}).forEach(function (key) {
|
|
302
337
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -304,18 +339,21 @@ var updateRowPayload = function updateRowPayload(chartEventRowContext, payload)
|
|
|
304
339
|
});
|
|
305
340
|
return payload;
|
|
306
341
|
};
|
|
342
|
+
|
|
307
343
|
exports.updateRowPayload = updateRowPayload;
|
|
308
344
|
var VizChartEventType;
|
|
345
|
+
|
|
309
346
|
(function (VizChartEventType) {
|
|
310
347
|
VizChartEventType["POINT_CLICK"] = "point.click";
|
|
311
348
|
VizChartEventType["POINT_MOUSE_OUT"] = "point.mouseout";
|
|
312
349
|
VizChartEventType["POINT_MOUSE_OVER"] = "point.mouseover";
|
|
313
350
|
VizChartEventType["LEGEND_CLICK"] = "legend.click";
|
|
314
|
-
})(VizChartEventType || (VizChartEventType = {}));
|
|
315
|
-
// @TODO(pwied): remove after HC upgrade to 8+
|
|
351
|
+
})(VizChartEventType || (VizChartEventType = {})); // @TODO(pwied): remove after HC upgrade to 8+
|
|
316
352
|
// .highcharts-a11y-proxy-container rule addresses a HighCharts < 8 bug
|
|
317
353
|
// caused by the accessibility plugin
|
|
318
354
|
// https://github.com/highcharts/highcharts/issues/12883
|
|
355
|
+
|
|
356
|
+
|
|
319
357
|
var ChartingContainer = styled_components_1.default.div.attrs(function (props) {
|
|
320
358
|
return {
|
|
321
359
|
'data-test': 'charting-container',
|
|
@@ -326,7 +364,7 @@ var ChartingContainer = styled_components_1.default.div.attrs(function (props) {
|
|
|
326
364
|
displayName: "Charting__ChartingContainer",
|
|
327
365
|
componentId: "sc-3wbgm0-0"
|
|
328
366
|
})(["& .highcharts-a11y-proxy-container{pointer-events:none;}overflow:hidden;position:relative;", ";"], function (props) {
|
|
329
|
-
return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
|
|
367
|
+
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
330
368
|
});
|
|
331
369
|
var propTypes = {
|
|
332
370
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -343,13 +381,15 @@ var propTypes = {
|
|
|
343
381
|
visualizationApiRef: T.func,
|
|
344
382
|
themeKey: T.string
|
|
345
383
|
};
|
|
384
|
+
|
|
346
385
|
var Charting = function Charting(props) {
|
|
347
|
-
var container = react_1.useRef(null);
|
|
348
|
-
var needsInit = react_1.useRef(true);
|
|
349
|
-
var chart = react_1.useRef();
|
|
350
|
-
var needsRedraw = react_1.useRef(true);
|
|
351
|
-
var api = react_1.useRef(new ChartingApi_1.ChartingApiFunctional(chart));
|
|
352
|
-
var timezone = react_1.useContext(TimezoneContext_1.default);
|
|
386
|
+
var container = (0, react_1.useRef)(null);
|
|
387
|
+
var needsInit = (0, react_1.useRef)(true);
|
|
388
|
+
var chart = (0, react_1.useRef)();
|
|
389
|
+
var needsRedraw = (0, react_1.useRef)(true);
|
|
390
|
+
var api = (0, react_1.useRef)(new ChartingApi_1.ChartingApiFunctional(chart));
|
|
391
|
+
var timezone = (0, react_1.useContext)(TimezoneContext_1.default);
|
|
392
|
+
|
|
353
393
|
var computeChartingSize = function computeChartingSize() {
|
|
354
394
|
if (container.current) {
|
|
355
395
|
var rect = container.current.getBoundingClientRect();
|
|
@@ -358,91 +398,103 @@ var Charting = function Charting(props) {
|
|
|
358
398
|
width: rect.width
|
|
359
399
|
};
|
|
360
400
|
}
|
|
401
|
+
|
|
361
402
|
return {};
|
|
362
403
|
};
|
|
363
|
-
|
|
364
|
-
var
|
|
404
|
+
|
|
405
|
+
var splunkTheme = (0, useSplunkTheme_1.default)();
|
|
406
|
+
var themeKey = props.themeKey ? props.themeKey : (0, themeUtils_1.getChartingThemeKey)({
|
|
365
407
|
splunkThemeV1: splunkTheme
|
|
366
408
|
});
|
|
367
409
|
var width = props.width,
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
410
|
+
height = props.height,
|
|
411
|
+
style = props.style,
|
|
412
|
+
chartData = props.chartData,
|
|
413
|
+
options = props.options,
|
|
414
|
+
colorPalette = props.colorPalette,
|
|
415
|
+
onClick = props.onClick,
|
|
416
|
+
onSelect = props.onSelect,
|
|
417
|
+
onPointMouseOut = props.onPointMouseOut,
|
|
418
|
+
onPointMouseOver = props.onPointMouseOver,
|
|
419
|
+
onEventTrigger = props.onEventTrigger;
|
|
378
420
|
var prevOptions = usePrevious(options);
|
|
379
421
|
var prevTimezone = usePrevious(timezone);
|
|
422
|
+
|
|
380
423
|
var handleClick = function handleClick(chartEvent, type) {
|
|
381
|
-
var payload = lodash_1.pick(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
|
|
424
|
+
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
|
|
382
425
|
payload.name = payload.name2;
|
|
383
426
|
delete payload.name2;
|
|
427
|
+
|
|
384
428
|
if (type === VizChartEventType.POINT_CLICK) {
|
|
385
429
|
payload.value = payload.value2;
|
|
386
430
|
delete payload.value2;
|
|
387
|
-
payload = exports.updateRowPayload(chartEvent.rowContext, payload);
|
|
431
|
+
payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
|
|
388
432
|
}
|
|
433
|
+
|
|
389
434
|
onClick({
|
|
390
435
|
type: type,
|
|
391
436
|
originalEvent: chartEvent,
|
|
392
437
|
payload: payload
|
|
393
438
|
});
|
|
394
439
|
};
|
|
440
|
+
|
|
395
441
|
var destroyChart = function destroyChart() {
|
|
396
442
|
if (chart.current) {
|
|
397
443
|
chart.current.destroy();
|
|
398
444
|
chart.current = null;
|
|
399
445
|
}
|
|
446
|
+
|
|
400
447
|
needsRedraw.current = true;
|
|
401
448
|
needsInit.current = true;
|
|
402
449
|
};
|
|
450
|
+
|
|
403
451
|
var handleSelect = function handleSelect(chartEvent) {
|
|
404
452
|
// todo: need change this after breaking all visualizations
|
|
405
453
|
if (onSelect && typeof onSelect === 'function') {
|
|
406
454
|
onSelect({
|
|
407
455
|
type: 'range.select',
|
|
408
456
|
originalEvent: chartEvent,
|
|
409
|
-
payload: lodash_1.pick(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
457
|
+
payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
410
458
|
});
|
|
411
459
|
return;
|
|
412
|
-
}
|
|
413
|
-
|
|
460
|
+
} // the chartEvent here is a jQuery event
|
|
461
|
+
|
|
462
|
+
|
|
414
463
|
onEventTrigger({
|
|
415
464
|
type: 'range.select',
|
|
416
465
|
originalEvent: chartEvent,
|
|
417
|
-
payload: lodash_1.pick(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
466
|
+
payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
418
467
|
});
|
|
419
468
|
};
|
|
469
|
+
|
|
420
470
|
var handlePointMouseOut = function handlePointMouseOut(chartEvent, type) {
|
|
421
|
-
var payload = lodash_1.pick(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
471
|
+
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
422
472
|
payload.name = payload.name2;
|
|
423
473
|
delete payload.name2;
|
|
424
474
|
payload.value = payload.value2;
|
|
425
475
|
delete payload.value2;
|
|
426
|
-
payload = exports.updateRowPayload(chartEvent.rowContext, payload);
|
|
476
|
+
payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
|
|
427
477
|
onPointMouseOut({
|
|
428
478
|
type: type,
|
|
429
479
|
originalEvent: chartEvent,
|
|
430
480
|
payload: payload
|
|
431
481
|
});
|
|
432
482
|
};
|
|
483
|
+
|
|
433
484
|
var handlePointMouseOver = function handlePointMouseOver(chartEvent, type) {
|
|
434
|
-
var payload = lodash_1.pick(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
485
|
+
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
435
486
|
payload.name = payload.name2;
|
|
436
487
|
delete payload.name2;
|
|
437
488
|
payload.value = payload.value2;
|
|
438
489
|
delete payload.value2;
|
|
439
|
-
payload = exports.updateRowPayload(chartEvent.rowContext, payload);
|
|
490
|
+
payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
|
|
440
491
|
onPointMouseOver({
|
|
441
492
|
type: type,
|
|
442
493
|
originalEvent: chartEvent,
|
|
443
494
|
payload: payload
|
|
444
495
|
});
|
|
445
496
|
};
|
|
497
|
+
|
|
446
498
|
var drawChart = function drawChart() {
|
|
447
499
|
var updatedOptions = Object.assign(Object.assign({}, options), {
|
|
448
500
|
shouldColorizeTooltipData: false
|
|
@@ -453,15 +505,18 @@ var Charting = function Charting(props) {
|
|
|
453
505
|
var serializedTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone;
|
|
454
506
|
var ianaTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone;
|
|
455
507
|
var utcOffset = timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset;
|
|
508
|
+
|
|
456
509
|
if (!computedWidth || !computedHeight) {
|
|
457
510
|
return;
|
|
458
511
|
}
|
|
512
|
+
|
|
459
513
|
if (!chartData || !Object.keys(chartData).length) {
|
|
460
514
|
return;
|
|
461
|
-
}
|
|
462
|
-
// splunk-charting layers configuration option updates.
|
|
515
|
+
} // splunk-charting layers configuration option updates.
|
|
463
516
|
// when an option is removed it needs to be set to an empty string
|
|
464
517
|
// to override the previous configuration
|
|
518
|
+
|
|
519
|
+
|
|
465
520
|
if (prevOptions) {
|
|
466
521
|
Object.keys(prevOptions).forEach(function (key) {
|
|
467
522
|
if (updatedOptions[key] === undefined) {
|
|
@@ -469,13 +524,16 @@ var Charting = function Charting(props) {
|
|
|
469
524
|
}
|
|
470
525
|
});
|
|
471
526
|
}
|
|
527
|
+
|
|
472
528
|
try {
|
|
473
529
|
if (needsInit.current) {
|
|
474
530
|
destroyChart();
|
|
475
531
|
charting_bundle_1.default.setTheme(themeKey);
|
|
532
|
+
|
|
476
533
|
if (colorPalette.length > 0) {
|
|
477
534
|
charting_bundle_1.default.setColorPalette(colorPalette);
|
|
478
535
|
}
|
|
536
|
+
|
|
479
537
|
chart.current = charting_bundle_1.default.createChart(container.current, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, updatedOptions), {
|
|
480
538
|
drilldown: 'all'
|
|
481
539
|
}), typeof serializedTimezone === 'string' && {
|
|
@@ -484,8 +542,8 @@ var Charting = function Charting(props) {
|
|
|
484
542
|
'time.ianaTimezone': ianaTimezone
|
|
485
543
|
}), typeof utcOffset === 'number' && {
|
|
486
544
|
'time.timezoneOffset': utcOffset
|
|
487
|
-
}));
|
|
488
|
-
|
|
545
|
+
})); // bind event handlers
|
|
546
|
+
|
|
489
547
|
chart.current.on('pointClick', function (e) {
|
|
490
548
|
handleClick(e, VizChartEventType.POINT_CLICK);
|
|
491
549
|
});
|
|
@@ -500,32 +558,40 @@ var Charting = function Charting(props) {
|
|
|
500
558
|
});
|
|
501
559
|
chart.current.on('chartRangeSelect', handleSelect);
|
|
502
560
|
}
|
|
561
|
+
|
|
503
562
|
if (needsRedraw.current) {
|
|
504
563
|
charting_bundle_1.default.setTheme(themeKey);
|
|
564
|
+
|
|
505
565
|
if (colorPalette.length > 0) {
|
|
506
566
|
charting_bundle_1.default.setColorPalette(colorPalette);
|
|
507
567
|
}
|
|
568
|
+
|
|
508
569
|
chart.current.prepareAndDraw(chartData, updatedOptions, function () {});
|
|
509
570
|
}
|
|
571
|
+
|
|
510
572
|
if (chart.current) {
|
|
511
573
|
if (Math.round(chart.current.height) !== Math.round(computedHeight) || Math.round(chart.current.width) !== Math.round(computedWidth)) {
|
|
512
574
|
chart.current.resize(computedWidth, computedHeight);
|
|
513
575
|
}
|
|
514
576
|
}
|
|
577
|
+
|
|
515
578
|
needsInit.current = false;
|
|
516
579
|
needsRedraw.current = false;
|
|
517
580
|
} catch (e) {
|
|
518
581
|
window.console.error('Caught error rendering chart:', e);
|
|
519
582
|
}
|
|
520
583
|
};
|
|
521
|
-
|
|
584
|
+
|
|
585
|
+
var debouncedDrawChart = (0, lodash_1.debounce)(drawChart, 5);
|
|
586
|
+
|
|
522
587
|
var onContainerMount = function onContainerMount(chartingContainer) {
|
|
523
588
|
container.current = chartingContainer;
|
|
524
589
|
debouncedDrawChart();
|
|
525
590
|
};
|
|
591
|
+
|
|
526
592
|
var prevTheme = usePrevious(themeKey);
|
|
527
593
|
var prevOnClick = usePrevious(onClick);
|
|
528
|
-
react_1.useEffect(function () {
|
|
594
|
+
(0, react_1.useEffect)(function () {
|
|
529
595
|
debouncedDrawChart();
|
|
530
596
|
props.visualizationApiRef(api.current);
|
|
531
597
|
return function () {
|
|
@@ -533,17 +599,17 @@ var Charting = function Charting(props) {
|
|
|
533
599
|
destroyChart();
|
|
534
600
|
};
|
|
535
601
|
}, []);
|
|
536
|
-
react_1.useEffect(function () {
|
|
602
|
+
(0, react_1.useEffect)(function () {
|
|
537
603
|
// TODO: figure out why re-init is needed for functional components (i.e. PlatformViz) when changing theme
|
|
538
604
|
// seems like redraw doesn't suffice to update the background colors
|
|
539
|
-
if (!chart.current || !exports.canUpdateInPlace(prevOptions, options) ||
|
|
540
|
-
// timezone is a simple object so this comparison should be fast
|
|
605
|
+
if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) || // timezone is a simple object so this comparison should be fast
|
|
541
606
|
JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
|
|
542
607
|
needsInit.current = true;
|
|
543
608
|
}
|
|
544
|
-
|
|
545
|
-
// need to immediately call drawChart upon an option or chartData change
|
|
609
|
+
|
|
610
|
+
needsRedraw.current = true; // need to immediately call drawChart upon an option or chartData change
|
|
546
611
|
// otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
|
|
612
|
+
|
|
547
613
|
drawChart();
|
|
548
614
|
}, [JSON.stringify(options), JSON.stringify(chartData.toJSON()), JSON.stringify(chartData.annotations), timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone, timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset, timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone, themeKey, onClick]);
|
|
549
615
|
return React.createElement(ChartingContainer, {
|
|
@@ -556,6 +622,7 @@ var Charting = function Charting(props) {
|
|
|
556
622
|
onResize: debouncedDrawChart
|
|
557
623
|
}));
|
|
558
624
|
};
|
|
625
|
+
|
|
559
626
|
var defaultProps = {
|
|
560
627
|
width: '100%',
|
|
561
628
|
height: 250,
|
|
@@ -573,65 +640,70 @@ var defaultProps = {
|
|
|
573
640
|
themeKey: null
|
|
574
641
|
};
|
|
575
642
|
Charting.propTypes = propTypes;
|
|
576
|
-
Charting.defaultProps = defaultProps;
|
|
577
|
-
|
|
643
|
+
Charting.defaultProps = defaultProps; // allow for early return in case of empty chartData while still following hook rules
|
|
644
|
+
|
|
578
645
|
var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
|
|
579
646
|
var Wrapper = function Wrapper(props) {
|
|
580
647
|
var chartData = props.chartData;
|
|
648
|
+
|
|
581
649
|
if (!chartData) {
|
|
582
650
|
return React.createElement(Message_1.default, {
|
|
583
|
-
message: i18n_1._('No DataSource'),
|
|
651
|
+
message: (0, i18n_1._)('No DataSource'),
|
|
584
652
|
level: "warning"
|
|
585
653
|
});
|
|
586
654
|
}
|
|
655
|
+
|
|
587
656
|
if (chartData && !Object.keys(chartData).length) {
|
|
588
657
|
return React.createElement(Message_1.default, {
|
|
589
|
-
message: i18n_1._('No Result'),
|
|
658
|
+
message: (0, i18n_1._)('No Result'),
|
|
590
659
|
level: "info"
|
|
591
660
|
});
|
|
592
661
|
}
|
|
662
|
+
|
|
593
663
|
return React.createElement(Chart, Object.assign({}, props));
|
|
594
664
|
};
|
|
665
|
+
|
|
595
666
|
Wrapper.displayName = 'ChartingWrapper';
|
|
596
667
|
Wrapper.propTypes = propTypes;
|
|
597
668
|
Wrapper.defaultProps = defaultProps;
|
|
598
669
|
return Wrapper;
|
|
599
|
-
};
|
|
600
|
-
|
|
670
|
+
}; // export default Charting;
|
|
671
|
+
|
|
672
|
+
|
|
601
673
|
exports.default = withEmptyChartMessage(Charting);
|
|
602
674
|
|
|
603
675
|
/***/ }),
|
|
604
|
-
/*
|
|
676
|
+
/* 43 */
|
|
605
677
|
/***/ (function(module, exports) {
|
|
606
678
|
|
|
607
679
|
module.exports = require("@splunk/visualization-color-palettes");
|
|
608
680
|
|
|
609
681
|
/***/ }),
|
|
610
|
-
/*
|
|
682
|
+
/* 44 */
|
|
611
683
|
/***/ (function(module, exports) {
|
|
612
684
|
|
|
613
685
|
module.exports = require("react-event-listener");
|
|
614
686
|
|
|
615
687
|
/***/ }),
|
|
616
|
-
/*
|
|
688
|
+
/* 45 */
|
|
617
689
|
/***/ (function(module, exports) {
|
|
618
690
|
|
|
619
691
|
module.exports = require("@splunk/visualizations-shared/i18n");
|
|
620
692
|
|
|
621
693
|
/***/ }),
|
|
622
|
-
/*
|
|
694
|
+
/* 46 */
|
|
623
695
|
/***/ (function(module, exports) {
|
|
624
696
|
|
|
625
697
|
module.exports = require("@splunk/charting-bundle");
|
|
626
698
|
|
|
627
699
|
/***/ }),
|
|
628
|
-
/*
|
|
700
|
+
/* 47 */
|
|
629
701
|
/***/ (function(module, exports) {
|
|
630
702
|
|
|
631
703
|
module.exports = require("@splunk/themes/useSplunkTheme");
|
|
632
704
|
|
|
633
705
|
/***/ }),
|
|
634
|
-
/*
|
|
706
|
+
/* 48 */
|
|
635
707
|
/***/ (function(module, exports) {
|
|
636
708
|
|
|
637
709
|
module.exports = require("@splunk/visualizations-shared/themeUtils");
|