@splunk/visualizations 26.3.0 → 26.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +1 -1
- package/Area.config.js.map +1 -1
- package/Area.js +300 -290
- package/Area.js.map +1 -1
- package/Bar.config.js +1 -1
- package/Bar.config.js.map +1 -1
- package/Bar.js +303 -293
- package/Bar.js.map +1 -1
- package/Bubble.config.js +1 -1
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +292 -282
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +1 -1
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +262 -260
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +1 -1
- package/Column.config.js.map +1 -1
- package/Column.js +303 -293
- package/Column.js.map +1 -1
- package/Ellipse.js +220 -218
- package/Ellipse.js.map +1 -1
- package/Events.config.js +1 -1
- package/Events.config.js.map +1 -1
- package/Events.js +285 -283
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +1 -1
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +250 -248
- package/FillerGauge.js.map +1 -1
- package/Image.js +212 -210
- package/Image.js.map +1 -1
- package/Line.config.js +1 -1
- package/Line.config.js.map +1 -1
- package/Line.js +301 -291
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +1 -1
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +1725 -17201
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +12 -0
- package/Map.config.js +1 -1
- package/Map.config.js.map +1 -1
- package/Map.js +465 -406
- package/Map.js.map +1 -1
- package/Markdown.config.js +1 -1
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +281 -277
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +1 -1
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +926 -922
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +1 -1
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +336 -320
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +5 -1
- package/Pie.config.js.map +1 -1
- package/Pie.js +374 -332
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +1 -1
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +342 -338
- package/Punchcard.js.map +1 -1
- package/Rectangle.js +260 -256
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +1 -1
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +339 -335
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +1 -1
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +351 -339
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +10 -2
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +455 -427
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +65 -53
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +10 -2
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +449 -421
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +11 -3
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1580 -1552
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +33 -33
- package/SparkLine.js.map +1 -1
- package/Table.js +354 -350
- package/Table.js.map +1 -1
- package/common/Charting.js +25 -24
- package/common/Charting.js.map +1 -1
- package/common/utils/dataUtils.js +12 -18
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +23 -11
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/withDashboardViz.js +31 -27
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +17 -16
package/common/Charting.js
CHANGED
|
@@ -410,19 +410,21 @@ var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, thr
|
|
|
410
410
|
*/
|
|
411
411
|
|
|
412
412
|
|
|
413
|
-
var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
|
|
414
|
-
// Splunk charting allows for numbers in formats such as negative hex that
|
|
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
415
|
// Number() does not support and also allows loose coercion of hex numbers (but not other formats)
|
|
416
416
|
// We want to identify columns which contain at least one value that can be loosely coerced
|
|
417
|
+
|
|
417
418
|
var canLooselyCoerceSomeValues = column.findIndex(function (value) {
|
|
418
|
-
return (0, numberUtils_1.startsWithNumber)("".concat(value));
|
|
419
|
+
return (0, numberUtils_1.startsWithNumber)("".concat(value)) || isNullCoercionEnabled && value === null;
|
|
419
420
|
}) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
|
|
420
421
|
|
|
421
422
|
var coercedColumn = [];
|
|
422
423
|
var canDownsampleColumn = !column.some(function (value) {
|
|
423
|
-
var coercedValue = Number(value);
|
|
424
|
+
var coercedValue = Number(value);
|
|
425
|
+
var coerceValueToZero = isNullCoercionEnabled && value === null; // if it can't be parsed or isn't safe, fail
|
|
424
426
|
|
|
425
|
-
if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
|
|
427
|
+
if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number' && !coerceValueToZero) {
|
|
426
428
|
return true;
|
|
427
429
|
} // save value and continue to next
|
|
428
430
|
|
|
@@ -503,8 +505,7 @@ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_re
|
|
|
503
505
|
dataSources = _ref3.dataSources,
|
|
504
506
|
selectChartEvent = _ref3.selectChartEvent,
|
|
505
507
|
width = _ref3.width,
|
|
506
|
-
xField = _ref3.xField
|
|
507
|
-
y2Fields = _ref3.y2Fields;
|
|
508
|
+
xField = _ref3.xField;
|
|
508
509
|
|
|
509
510
|
var _a, _b, _c;
|
|
510
511
|
|
|
@@ -541,14 +542,7 @@ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_re
|
|
|
541
542
|
});
|
|
542
543
|
var lastIndex = fullSeries.findIndex(function (x) {
|
|
543
544
|
return downsampledSeries[endXIndex] === x;
|
|
544
|
-
});
|
|
545
|
-
// re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
|
|
546
|
-
// Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
|
|
547
|
-
// until SPL-259611 is fixed
|
|
548
|
-
|
|
549
|
-
if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
|
|
550
|
-
return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
|
|
551
|
-
}
|
|
545
|
+
});
|
|
552
546
|
|
|
553
547
|
if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
|
|
554
548
|
return (0, exports.calculateThresholdOnRangeSelect)({
|
|
@@ -598,7 +592,7 @@ var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fie
|
|
|
598
592
|
*/
|
|
599
593
|
|
|
600
594
|
|
|
601
|
-
var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
|
|
595
|
+
var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes, options) {
|
|
602
596
|
var xColumn = [];
|
|
603
597
|
var yColumns = [];
|
|
604
598
|
var canDownsample = !ds.data.fields.some(function (field, index) {
|
|
@@ -612,7 +606,7 @@ var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, x
|
|
|
612
606
|
if (fieldName === xField) {
|
|
613
607
|
xColumn = strictlyCoerceXColumn(column, fieldType);
|
|
614
608
|
} else if (yFields.has(fieldName)) {
|
|
615
|
-
var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
|
|
609
|
+
var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index], options),
|
|
616
610
|
coercedColumn = _strictlyCoerceYColum.coercedColumn,
|
|
617
611
|
canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
|
|
618
612
|
canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
|
|
@@ -702,7 +696,7 @@ var downsampleDataSources = function downsampleDataSources(_ref4) {
|
|
|
702
696
|
return dataSources;
|
|
703
697
|
}
|
|
704
698
|
|
|
705
|
-
var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
|
|
699
|
+
var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes, options),
|
|
706
700
|
xColumn = _tryToCoerceAllDispla.xColumn,
|
|
707
701
|
yColumns = _tryToCoerceAllDispla.yColumns;
|
|
708
702
|
|
|
@@ -1285,8 +1279,7 @@ var Charting = function Charting(props) {
|
|
|
1285
1279
|
onEventTrigger = props.onEventTrigger,
|
|
1286
1280
|
originalDataSources = props.originalDataSources,
|
|
1287
1281
|
onDownsamplingThresholdChange = props.onDownsamplingThresholdChange,
|
|
1288
|
-
xField = props.xField
|
|
1289
|
-
y2Fields = props.y2Fields;
|
|
1282
|
+
xField = props.xField;
|
|
1290
1283
|
var prevOptions = (0, usePrevious_1.default)(options);
|
|
1291
1284
|
var prevTimezone = (0, usePrevious_1.default)(timezone);
|
|
1292
1285
|
|
|
@@ -1329,14 +1322,13 @@ var Charting = function Charting(props) {
|
|
|
1329
1322
|
dataSources: originalDataSources,
|
|
1330
1323
|
width: Number(width),
|
|
1331
1324
|
selectChartEvent: selectChartEvent.current,
|
|
1332
|
-
xField: xField
|
|
1333
|
-
y2Fields: y2Fields
|
|
1325
|
+
xField: xField
|
|
1334
1326
|
});
|
|
1335
1327
|
|
|
1336
1328
|
if (Number.isFinite(newThreshold)) {
|
|
1337
1329
|
onDownsamplingThresholdChange(newThreshold);
|
|
1338
1330
|
}
|
|
1339
|
-
}, [enableSearchZoom, originalDataSources, onDownsamplingThresholdChange, width, xField
|
|
1331
|
+
}, [enableSearchZoom, originalDataSources, onDownsamplingThresholdChange, width, xField]);
|
|
1340
1332
|
React.useEffect(function () {
|
|
1341
1333
|
recalculateDownsamplingThreshold();
|
|
1342
1334
|
}, [recalculateDownsamplingThreshold]); // useEventCallback is used for these handlers to make sure that they are a stable reference and
|
|
@@ -1463,7 +1455,16 @@ var Charting = function Charting(props) {
|
|
|
1463
1455
|
charting_bundle_1.default.setColorPalette(colorPalette);
|
|
1464
1456
|
}
|
|
1465
1457
|
|
|
1466
|
-
chart.current.prepareAndDraw(chartData, updatedOptions, function () {
|
|
1458
|
+
chart.current.prepareAndDraw(chartData, updatedOptions, function () {
|
|
1459
|
+
onEventTrigger({
|
|
1460
|
+
type: 'viz.renderedWithData',
|
|
1461
|
+
payload: {
|
|
1462
|
+
width: width,
|
|
1463
|
+
height: height,
|
|
1464
|
+
currentTime: new Date().getTime()
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
});
|
|
1467
1468
|
}
|
|
1468
1469
|
|
|
1469
1470
|
if (chart.current) {
|
package/common/Charting.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"prop-types\"","webpack:///external \"styled-components\"","webpack:///external \"lodash\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/visualizations-shared/numberUtils\"","webpack:///./src/common/interfaces/VizActionHandler.ts","webpack:///./src/common/interfaces/VizBehavior.ts","webpack:///./src/common/interfaces/VizCategory.ts","webpack:///external \"@splunk/visualizations-shared/Message\"","webpack:///./src/common/utils/dataUtils.ts","webpack:///./src/common/interfaces/DataSource.ts","webpack:///external \"@splunk/visualization-context/TimezoneContext\"","webpack:///external \"@splunk/visualizations-shared/style\"","webpack:///./src/common/ChartingApi.ts","webpack:///./src/common/hooks/usePrevious.ts","webpack:///./src/common/interfaces/index.ts","webpack:///./src/common/interfaces/DataContract.ts","webpack:///./src/common/Charting.tsx","webpack:///external \"@splunk/visualization-color-palettes\"","webpack:///external \"react-event-listener\"","webpack:///external \"@splunk/visualizations-shared/i18n\"","webpack:///external \"@splunk/charting-bundle\"","webpack:///external \"@splunk/themes/useSplunkTheme\"","webpack:///external \"@splunk/visualizations-shared/themeUtils\"","webpack:///./src/common/hooks/useEventCallback.tsx"],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,kC;;;;;;ACAA,uC;;;;;;ACAA,8C;;;;;;ACAA,mC;;;;;;ACAA,kE;;;;;;ACAA,kD;;;;;;;ACAA,+D;;;;;;;ACAA,sE;;;;;;;;;;;;;;;;;;;;;;ICaa,uB;;;;;;;WACT,iBAAK,CACD;AACH;;;WAED,oBAAQ;AACJ,aAAO,IAAP,CADI,CACS;AAChB;;;;;;AAPL,0D;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jB,OAAG,CAAC,OAAJ,GAAc,EAAd;AACH,GAFD;AAGA,SAAO,yBAAY;AAAA,WAAmB,GAAG,CAAC,OAAJ,UAAG,YAAtB;AAAA,GAAZ,EAAqD,EAArD,CAAP;AACH,CAND;;AAQA,kBAAe,gBAAf,C","file":"Charting.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 73);\n","module.exports = require(\"react\");","module.exports = require(\"prop-types\");","module.exports = require(\"styled-components\");","module.exports = require(\"lodash\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/visualizations-shared/numberUtils\");","/* eslint-disable class-methods-use-this */\nexport interface VizActionHandler {\n /**\n * put focus on the visualization\n */\n focus(): void;\n\n /**\n * compute snapshot of this visualization\n */\n snapshot(): Record<string, unknown>; // (This is for pdf export)\n}\n\nexport class DefaultVizActionHandler {\n focus(): void {\n // noop\n }\n\n snapshot(): Record<string, unknown> {\n return null; // noop\n }\n}\n","export enum VizBehavior {\n /**\n * Dynamic Options Behavior.\n * This allows visualization options to be powered by data\n *\n * **Example**\n *\n * sparklineValues: \">primary|seriesByIndex(0)\"\n * would configure sparklineValues with an array of data points\n * coming from the first series in the primary datasource\n *\n */\n DYNAMIC_OPTIONS = 'dynamic-options',\n EVENTS = 'events',\n DOWNSAMPLING = 'downsampling',\n /**\n * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is\n * missing.\n * @type {string}\n */\n PLACEHOLDER = 'placeholder',\n PAGE_AND_SORT = 'page-and-sort',\n TRELLIS = 'trellis',\n}\n","export enum VizCategory {\n SINGLE_VALUE = 'Single Value',\n TRENDS = 'Trends',\n COMPARISONS = 'Comparisons',\n TABLE = 'Table',\n GAUGE = 'Gauge',\n DISTRIBUTIONS = 'Distributions',\n CHOROPLETH = 'Choropleth Maps',\n SHAPES = 'Shapes',\n MISC = 'misc',\n FLOW = 'Flow',\n CORRELATION = 'Correlation',\n SPATIAL = 'Spatial',\n}\n","module.exports = require(\"@splunk/visualizations-shared/Message\");","import type { FieldEntry } from '@splunk/visualizations-shared/dataSourceUtils';\nimport { startsWithNumber } from '@splunk/visualizations-shared/numberUtils';\nimport type { DashboardVizProps, DataSource, VizConfig } from '../interfaces';\nimport { VizBehavior } from '../interfaces';\nimport { ChartEvent } from '../interfaces/ChartEvent';\n\n// TODO: utilize this fn in ParallelCoordinates\n\nexport const convertToArrOfObjects = (columns: (string | any[])[], fields: any[]): any[] => {\n if (!columns || !columns[0] || !columns[0].length) return [];\n\n const data = [];\n\n for (let i = 0; i < columns[0].length; i += 1) {\n const newObj = {};\n fields.forEach((field, index) => {\n const fieldName = typeof field === 'string' ? field : field.name;\n if (columns[index][i] === '') {\n newObj[fieldName] = null;\n } else {\n newObj[fieldName] = columns[index][i];\n }\n });\n data.push(newObj);\n }\n\n return data;\n};\n\n// LTTB algorithm which can be used to downsample time series data while striving to maintain\n// the spikes and overall shape of the chart\n// Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js\n// Modifications include:\n// 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)\n// 2) Convert to camel case\n// 3) Convert to TS and also return the indices of the points that are in the downsampled result.\n// 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points\n// that should be used in case of a tie of the max area in a bucket\nconst largestTriangleThreeBuckets = (\n data: [Date | number, number][],\n threshold: number,\n preferredDownsampleIndices: Set<number>\n): { downsampledData: [Date | number, number][]; downsampledIndices: number[] } => {\n const dataLength = data.length;\n const downsampledIndices = [];\n if (threshold >= dataLength || threshold === 0) {\n const allIndices = data.map((values, index) => index);\n return { downsampledData: data, downsampledIndices: allIndices }; // Nothing to do\n }\n\n const sampled: [Date | number, number][] = [];\n let sampledIndex = 0;\n\n // Bucket size. Leave room for start and end data points\n const every = (dataLength - 2) / (threshold - 2);\n\n let a = 0; // Initially a is the first point in the triangle\n let maxAreaPoint: [Date | number, number];\n let maxArea: number | undefined;\n let area: number | undefined;\n let nextA: number | undefined;\n\n sampled.push(data[a]); // Always add the first point\n downsampledIndices.push(0);\n\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < threshold - 2; i++) {\n // Calculate point average for next bucket (containing c)\n let avgX = 0;\n let avgY = 0;\n let avgRangeStart = Math.floor((i + 1) * every) + 1;\n let avgRangeEnd = Math.floor((i + 2) * every) + 1;\n avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;\n\n const avgRangeLength = avgRangeEnd - avgRangeStart;\n\n // eslint-disable-next-line no-plusplus\n for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {\n avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)\n avgY += data[avgRangeStart][1] * 1;\n }\n avgX /= avgRangeLength;\n avgY /= avgRangeLength;\n\n // Get the range for this bucket\n let rangeOffs = Math.floor((i + 0) * every) + 1;\n const rangeTo = Math.floor((i + 1) * every) + 1;\n\n // Point a\n const pointAX = Number(data[a][0]); // Enforce Number (value may be Date)\n const pointAY = data[a][1] * 1;\n\n // eslint-disable-next-line no-multi-assign\n maxArea = area = -1;\n let maxAreaIndex = rangeOffs;\n\n // eslint-disable-next-line no-plusplus\n for (; rangeOffs < rangeTo; rangeOffs++) {\n // Calculate triangle area over three buckets\n area =\n Math.abs(\n (pointAX - avgX) * (data[rangeOffs][1] - pointAY) -\n (pointAX - Number(data[rangeOffs][0])) * (avgY - pointAY)\n ) * 0.5;\n // Modification: try to downsample the least amount of points possible when there are multiple series\n // If all points in a bucket have the same area, prioritize the one with an x index\n // that also existed from another series so we don't add another point unnecessarily.\n // By default LTTB picks the leftmost point in the bucket\n if (area > maxArea || (area === maxArea && preferredDownsampleIndices.has(rangeOffs))) {\n maxArea = area;\n maxAreaPoint = data[rangeOffs];\n nextA = rangeOffs; // Next a is this b\n // Modification: save the index of the point with the most area\n maxAreaIndex = rangeOffs;\n }\n }\n\n // eslint-disable-next-line no-plusplus\n sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket\n downsampledIndices.push(maxAreaIndex);\n a = nextA; // This a is the next a (chosen b)\n }\n\n // eslint-disable-next-line no-plusplus\n sampled[sampledIndex++] = data[dataLength - 1]; // Always add last\n downsampledIndices.push(dataLength - 1);\n\n return { downsampledData: sampled, downsampledIndices };\n};\n\nexport type DownsampleOptions = { threshold: number } & Pick<DashboardVizProps, 'dataSources' | 'options'>;\n\ntype CoerceYColumnResult = {\n canDownsampleColumn: boolean;\n canLooselyCoerceSomeValues: boolean;\n coercedColumn: number[];\n};\n\n/**\n * Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines\n * if at least one of the values in the column can be loosely coerced to a number.\n * If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and\n * returns that it cannot downsample the column.\n */\nconst strictlyCoerceYColumn = (column: string[] | number[]): CoerceYColumnResult => {\n // Splunk charting allows for numbers in formats such as negative hex that\n // Number() does not support and also allows loose coercion of hex numbers (but not other formats)\n // We want to identify columns which contain at least one value that can be loosely coerced\n const canLooselyCoerceSomeValues = column.findIndex(value => startsWithNumber(`${value}`)) >= 0;\n\n // If not all values in column can be strictly coerced to a number, we do not downsample\n const coercedColumn: number[] = [];\n const canDownsampleColumn = !column.some(value => {\n const coercedValue = Number(value);\n // if it can't be parsed or isn't safe, fail\n if (\n Number.isNaN(coercedValue) ||\n coercedValue <= Number.MIN_SAFE_INTEGER ||\n coercedValue >= Number.MAX_SAFE_INTEGER ||\n (typeof value !== 'string' && typeof value !== 'number')\n ) {\n return true;\n }\n // save value and continue to next\n coercedColumn.push(coercedValue);\n return false;\n });\n\n return {\n canDownsampleColumn,\n canLooselyCoerceSomeValues,\n coercedColumn: canDownsampleColumn ? coercedColumn : [],\n };\n};\n\n/**\n * Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.\n * Only strictly increasing x-columns are eligible for downsampling.\n * If the column is not eligible for downsampling, returns an empty array.\n */\nconst strictlyCoerceXColumn = (column: string[], fieldType: string): Date[] | number[] => {\n if (fieldType === 'number') {\n const coercedXColumn = column.map(xValue => Number(xValue));\n if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {\n return coercedXColumn;\n }\n } else if (fieldType === 'time') {\n const coercedXColumn = column.map(xValue => new Date(xValue));\n if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {\n return coercedXColumn;\n }\n }\n return [];\n};\n\nexport const isDownsamplingEnabledForViz = ({ vizConfig }: { vizConfig: VizConfig }) => {\n return vizConfig.supports?.includes(VizBehavior.DOWNSAMPLING);\n};\n\nexport const calculateThresholdOnRangeSelect = ({\n firstIndex,\n lastIndex,\n dataSources,\n width,\n}: Pick<DashboardVizProps, 'dataSources'> & {\n firstIndex: number;\n lastIndex: number;\n width: number | string;\n}): number => {\n const window = lastIndex - firstIndex + 1;\n const ratio = Math.round(Number(dataSources?.primary?.data?.columns[0]?.length / window) * 10) / 10;\n return Math.round(ratio * Number(width));\n};\n\n/**\n * Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,\n * then returns the width of the visualization.\n *\n * Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled\n * 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\n * in for a categorical chart.\n */\nexport const calculateDownsamplingThreshold = ({\n enableSearchZoom,\n dataSources,\n selectChartEvent,\n width,\n xField,\n y2Fields,\n}: {\n enableSearchZoom: boolean;\n dataSources: Record<string, DataSource> | null;\n selectChartEvent: ChartEvent<'chartRangeSelect'> | null;\n width: number;\n xField: string;\n y2Fields?: string[];\n}): number | null => {\n if (enableSearchZoom || !selectChartEvent) {\n return Number(width);\n }\n\n const primaryDataSource = dataSources?.primary;\n if (!primaryDataSource) {\n return null;\n }\n\n const { startXIndex, endXIndex, currentTarget } = selectChartEvent;\n\n try {\n const xFieldIndex = primaryDataSource?.data?.fields.findIndex((field: { name: string }) => {\n return field.name === xField;\n });\n const downsampledXFieldIndex = currentTarget.dataSet?.fields.findIndex(field => field === xField);\n\n if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {\n return null;\n }\n\n const fullSeries = primaryDataSource?.data?.columns[xFieldIndex];\n const downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];\n\n const firstIndex = fullSeries.findIndex(x => {\n return downsampledSeries[startXIndex] === x;\n });\n const lastIndex = fullSeries.findIndex(x => {\n return downsampledSeries[endXIndex] === x;\n });\n\n // For charts with categorical x-axis (charts with an xField that isn't _time), do not support\n // re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed\n // Also do not support re-calculating downsampling threshold for zoomed-in charts with y2\n // until SPL-259611 is fixed\n if (xField !== '_time' || y2Fields?.length) {\n return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;\n }\n\n if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {\n return calculateThresholdOnRangeSelect({\n firstIndex,\n lastIndex,\n dataSources,\n width,\n });\n }\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error('Error occurred while setting downsample threshold on range select event', e);\n }\n\n return null;\n};\n\nconst isColumnStrictlyIncreasing = (column: (number | Date)[], fieldType: 'number' | 'time') => {\n return column.every((value, index) => {\n if (fieldType === 'number') {\n if (Number.isNaN(value)) {\n return false;\n }\n }\n\n if (fieldType === 'time') {\n if (Number.isNaN((value as Date).getTime())) {\n return false;\n }\n }\n if (index === 0) {\n return true;\n }\n return value > column[index - 1];\n });\n};\n\n/**\n * Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be\n * displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.\n *\n * If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.\n * If not all columns can be downsampled, then returns empty arrays for both x and y\n */\nconst tryToCoerceAllDisplayedFields = (\n ds: DataSource,\n xField: string,\n yFields: Set<string>,\n fieldTypes: string[]\n): { xColumn: Date[] | number[]; yColumns: number[][] } => {\n let xColumn: Date[] | number[] = [];\n const yColumns: number[][] = [];\n\n const canDownsample = !ds.data.fields.some((field, index) => {\n const fieldName = (field as FieldEntry).name ?? field;\n const fieldType = fieldTypes[index] ?? 'unknown';\n const column = ds.data.columns[index];\n let hasDisplayedColumnThatCantBeDownsampled = false;\n\n if (fieldName === xField) {\n xColumn = strictlyCoerceXColumn(column, fieldType);\n } else if (yFields.has(fieldName)) {\n const { coercedColumn, canLooselyCoerceSomeValues, canDownsampleColumn } = strictlyCoerceYColumn(\n ds.data.columns[index]\n );\n // do not perform downsampling if a column can possibly be displayed but cannot\n // be downsampled using LTTB\n hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;\n if (hasDisplayedColumnThatCantBeDownsampled) {\n return true;\n }\n if (canDownsampleColumn) {\n yColumns.push(coercedColumn);\n }\n }\n return false;\n });\n\n if (canDownsample) {\n return { xColumn, yColumns };\n }\n return { xColumn: [], yColumns: [] };\n};\n\nconst pickIndicesFromDataSource = (ds: DataSource, indices: Set<number>): DataSource => {\n const sortedIndices = Array.from(indices).sort((a: number, b: number) => a - b);\n const slicedColumns = [];\n ds.data.columns.forEach(column => {\n const slicedColumn = [];\n sortedIndices.forEach(index => {\n slicedColumn.push(column[index]);\n });\n slicedColumns.push(slicedColumn);\n });\n\n // update data columns with downsampled columns\n return {\n ...ds,\n data: {\n ...ds.data,\n columns: slicedColumns,\n },\n };\n};\n\nexport const downsampleDataSources = ({ dataSources, threshold, options }: DownsampleOptions) => {\n const primaryDS = dataSources?.primary;\n // only downsample time series when number of data points are over threshold\n const numPoints = primaryDS?.data?.columns[0]?.length ?? 0;\n if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {\n return dataSources;\n }\n\n const { xField, yFields, fieldTypes } = options;\n if (!xField || !yFields?.length || !fieldTypes?.length) {\n return dataSources;\n }\n\n const nonInternalYFields = new Set<string>(yFields.filter(yField => !yField.startsWith('_')));\n const maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints);\n\n // Do not try to downsample if there are too many downsampled pts\n // At the worst case, each series has non-overlapping downsampled pts\n // which will mean that all points will be included in the downsampled result\n // This will just lead to additional overhead due to coercing each\n // x and y field to number\n if (maxPointsInDownsample >= numPoints) {\n return dataSources;\n }\n\n const { xColumn, yColumns } = tryToCoerceAllDisplayedFields(\n primaryDS,\n xField,\n nonInternalYFields,\n fieldTypes\n );\n\n if (!yColumns.length || !xColumn.length) {\n return dataSources;\n }\n\n const downsampledDataSources = { ...dataSources };\n const downsampledIndices = new Set<number>();\n\n yColumns.forEach((yColumn, columnIndex) => {\n // perform LTTB downsampling for current series, LTTB takes an [x, y] pair\n const xyPair: [Date | number, number][] = yColumn.map((yValue, index) => {\n return [xColumn[index], yValue];\n });\n\n try {\n const { downsampledIndices: downsampledIndicesForSeries } = largestTriangleThreeBuckets(\n xyPair,\n threshold,\n downsampledIndices\n );\n downsampledIndicesForSeries.forEach(downsampleIndex => downsampledIndices.add(downsampleIndex));\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(`Error occurred while downsampling column ${columnIndex}`, e);\n }\n });\n // update data columns with downsampled columns\n downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);\n\n return downsampledDataSources;\n};\n","import { FieldEntry } from '@splunk/visualizations-shared/dataSourceUtils';\nimport { validSegmentationModes } from '@splunk/visualization-schemas';\n\nexport interface JsonColumnData {\n fields: FieldEntry[] | string[];\n columns: string[][];\n}\n\nexport type HighlightedSourceMap = Record<string, Record<string, boolean>>;\nexport type TagsMap = Record<string, Record<string, string[]>>;\n\nexport interface Meta {\n totalCount: number;\n sid: string;\n app: string;\n highlighted?: HighlightedSourceMap;\n tags?: TagsMap;\n}\n\nexport const validSortDirs = ['asc', 'desc', 'none'] as const;\nexport type SortDirType = typeof validSortDirs[number];\nexport type SegmentationType = typeof validSegmentationModes[number];\nexport const validOutputModes = ['json_cols', 'json'] as const;\nexport type OutputModeType = typeof validOutputModes[number];\n\nexport interface RequestParams {\n count?: number;\n offset?: number;\n sort?: {\n [sortKey: string]: SortDirType;\n };\n segmentation?: SegmentationType;\n // eslint-disable-next-line camelcase\n output_mode?: OutputModeType;\n}\n\nexport interface DataSource {\n requestParams: Partial<RequestParams>;\n onRequestParamsChange?: (p: Record<string, unknown>) => void;\n data: JsonColumnData;\n error?: { level: string; message: string };\n meta: Partial<Meta>;\n}\n\nexport interface DataSourceMeta {\n requestParams: Partial<RequestParams>;\n meta: Partial<Meta>;\n onRequestParamsChange: (payload: RequestParams) => void;\n}\n","module.exports = require(\"@splunk/visualization-context/TimezoneContext\");","module.exports = require(\"@splunk/visualizations-shared/style\");","import jsCharting from '@splunk/charting-bundle';\n\ninterface Point {\n /**\n * Valid xValue of the chart\n *\n * @type {string|number}\n * @memberof Point\n */\n xValue?: string | number;\n\n /**\n * Valid seriesName for a chart\n *\n * @type {string}\n * @memberof Point\n */\n seriesName?: string;\n}\n\nexport class ChartingApiFunctional {\n // eslint-disable-next-line no-useless-constructor\n constructor(private chartRef: any) {}\n\n /**\n * Allows users to programmatically highlight a point on the chart\n *\n * @memberof ChartingApiFunctional\n */\n highlight({ xValue, seriesName }: Point = { xValue: '', seriesName: '' }): void {\n this.getChart().highlight(xValue, seriesName);\n }\n\n /**\n * Allows users to programmatically unhighlight all points on the chart\n *\n * @memberof ChartingApiFunctional\n */\n unHighlight(): void {\n this.getChart().unHighlight();\n }\n\n // returns chart object\n getChart(): jsCharting {\n return this.chartRef?.current;\n }\n}\n","import { useEffect, useRef } from 'react';\n\nexport default function usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T>();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n","export * from './DashboardVizProps';\nexport * from './DataContract';\nexport * from './DataSource';\nexport * from './DefaultContext';\nexport * from './Editor';\nexport * from './ExtendedDashViz';\nexport * from './Object';\nexport * from './Overview';\nexport * from './ThemedDefaults';\nexport * from './VizActionHandler';\nexport * from './VizBehavior';\nexport * from './VizCategory';\nexport * from './VizConfig';\nexport * from './VizEvent';\nexport * from './VizProps';\nexport * from './VizRegistry';\nexport * from './VizSize';\nexport * from './VizStatus';\n","/**\n * A data structure used at runtime to wire up a visualization.\n */\n\ninterface InitialRequestParams {\n [key: string]: Record<string, unknown> | ((options?: Record<string, unknown>) => Record<string, unknown>);\n}\nexport interface DataContract {\n requiredDataSources: {\n name: string;\n description: string;\n }[];\n optionalDataSources?: {\n name: string;\n description: string;\n }[];\n initialRequestParams: InitialRequestParams; // TODO define better than object?\n}\n","/* eslint-disable react/no-unused-prop-types */\nimport { pick, debounce, noop } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { VIZ_CATEGORICAL } from '@splunk/visualization-color-palettes';\nimport { useEffect, useRef, useContext } from 'react';\nimport * as React from 'react';\nimport * as T from 'prop-types';\nimport EventListener from 'react-event-listener';\nimport '@splunk/visualizations-shared/i18n'; // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions\nimport jsCharting from '@splunk/charting-bundle';\nimport TimezoneContext, { TimezoneContextInterface } from '@splunk/visualization-context/TimezoneContext';\nimport { toDimension } from '@splunk/visualizations-shared/style';\nimport styled from 'styled-components';\nimport Message from '@splunk/visualizations-shared/Message';\nimport useSplunkTheme from '@splunk/themes/useSplunkTheme';\nimport { getChartingThemeKey } from '@splunk/visualizations-shared/themeUtils';\nimport { ChartingApiFunctional } from './ChartingApi';\nimport usePrevious from './hooks/usePrevious';\nimport useEventCallback from './hooks/useEventCallback';\nimport { DataSource } from './interfaces';\nimport { calculateDownsamplingThreshold } from './utils/dataUtils';\nimport type { ChartEvent } from './interfaces/ChartEvent';\n\nexport const NO_INPLACE_PROPS = [\n 'chart',\n 'chart.orientation',\n 'layout.splitSeries',\n 'chart.style',\n 'legend.placement',\n];\n\nexport const changedOptions = (curOptions: Record<string, any>, nextOptions: Record<string, any>): string[] =>\n Object.keys(curOptions)\n .filter(key => !(key in nextOptions))\n .concat(\n Object.keys(nextOptions).filter(\n key => !(key in curOptions) || curOptions[key] !== nextOptions[key]\n )\n );\n\nexport const canUpdateInPlace = (\n curOptions: Record<string, any>,\n nextOptions: Record<string, any>\n): boolean => {\n // if either of the options are undefined\n // it cannot update in place.\n if (!curOptions || !nextOptions) {\n return false;\n }\n return (\n !NO_INPLACE_PROPS.some(p => curOptions[p] !== nextOptions[p]) &&\n !changedOptions(curOptions, nextOptions).some(p => p.toLowerCase().endsWith('color'))\n );\n};\n\n// create 'row' payloads from 'rowContext' in the flattened format:\n// row.<fieldname>.value\nexport const updateRowPayload = (\n chartEventRowContext: Record<string, any>,\n payload: Record<string, any>\n): Record<string, any> => {\n Object.keys(chartEventRowContext || {}).forEach(key => {\n // eslint-disable-next-line no-param-reassign\n payload[`${key}.value`] = chartEventRowContext[key];\n });\n\n return payload;\n};\n\nexport interface ContainerProps {\n width: string | number;\n height: string | number;\n}\n\nenum VizChartEventType {\n POINT_CLICK = 'point.click',\n POINT_MOUSE_OUT = 'point.mouseout',\n POINT_MOUSE_OVER = 'point.mouseover',\n LEGEND_CLICK = 'legend.click',\n}\n\n// @TODO(pwied): remove after HC upgrade to 8+\n// .highcharts-a11y-proxy-container rule addresses a HighCharts < 8 bug\n// caused by the accessibility plugin\n// https://github.com/highcharts/highcharts/issues/12883\nconst ChartingContainer = styled.div.attrs((props: ContainerProps) => ({\n 'data-test': 'charting-container',\n width: props.width,\n height: props.height,\n}))`\n & .highcharts-a11y-proxy-container {\n pointer-events: none;\n }\n overflow: hidden;\n position: relative;\n ${props => toDimension(pick(props, ['width', 'height']))};\n`;\n\nexport interface ChartingProps {\n // width in pixel or string, defaults to 100%\n width: string | number;\n // height in pixel or string\n height: string | number;\n // visualization formatting options\n options?: Record<string, any>;\n // charting dataset from jsCharting.extractChartReadyData\n chartData: Record<string, any>;\n // callbacks to trigger event\n onEventTrigger?: (...args: any[]) => void;\n onSelect?: (...args: any[]) => void;\n onClick?: (...args: any[]) => void;\n onPointMouseOver?: (...args: any[]) => void;\n onPointMouseOut?: (...args: any[]) => void;\n // Custom style on visualization\n style?: Record<string, any>;\n colorPalette?: Array<string>;\n visualizationApiRef?: (...args: any[]) => void;\n themeKey?: string;\n // The non-downsampled data sources used by this chart. Passed in if downsampling\n // is enabled for this chart.\n originalDataSources?: Record<string, DataSource> | null;\n // Callback for when downsampling threshold changes. Passed in if downsampling\n // is enabled for this chart.\n onDownsamplingThresholdChange?: (threshold: number) => void | null;\n // The xField for this chart if it is an axis chart\n xField?: string;\n // The y2Fields for this chart if it is specified and it is an axis chart\n y2Fields?: string[];\n}\n\nconst propTypes: Record<keyof ChartingProps, T.Validator<any>> = {\n width: T.oneOfType([T.string, T.number]),\n height: T.oneOfType([T.string, T.number]),\n options: T.object,\n chartData: T.object,\n onEventTrigger: T.func,\n onClick: T.func,\n onSelect: T.func,\n onPointMouseOver: T.func,\n onPointMouseOut: T.func,\n style: T.object,\n colorPalette: T.array,\n visualizationApiRef: T.func,\n themeKey: T.string,\n originalDataSources: T.object,\n onDownsamplingThresholdChange: T.func,\n xField: T.string,\n y2Fields: T.array,\n};\n\nconst Charting = (props: ChartingProps): React.ReactElement => {\n const container = useRef<HTMLDivElement>(null);\n const needsInit = useRef<boolean>(true);\n const chart = useRef<jsCharting>();\n const needsRedraw = useRef<boolean>(true);\n const api = useRef(new ChartingApiFunctional(chart));\n const timezone = useContext<TimezoneContextInterface>(TimezoneContext);\n const selectChartEvent = useRef<ChartEvent<'chartRangeSelect'>>(null);\n\n const computeChartingSize = () => {\n if (container.current) {\n const rect = container.current.getBoundingClientRect();\n return {\n height: rect.height,\n width: rect.width,\n };\n }\n return {};\n };\n const splunkTheme = useSplunkTheme();\n const themeKey = props.themeKey ? props.themeKey : getChartingThemeKey({ splunkThemeV1: splunkTheme });\n const {\n width,\n height,\n style,\n chartData,\n options,\n colorPalette,\n onClick,\n onSelect,\n onPointMouseOut,\n onPointMouseOver,\n onEventTrigger,\n originalDataSources,\n onDownsamplingThresholdChange,\n xField,\n y2Fields,\n } = props;\n const prevOptions = usePrevious(options);\n const prevTimezone = usePrevious(timezone);\n\n const handleClick = (\n chartEvent: ChartEvent<'pointClick' | 'legendClick'>,\n type: VizChartEventType\n ): void => {\n let payload: Partial<ChartEvent<'pointClick' | 'legendClick'>> = pick(\n chartEvent,\n 'name2',\n 'value2',\n '_span',\n 'modifierKey'\n );\n\n payload.name = payload.name2;\n delete payload.name2;\n\n if (type === VizChartEventType.POINT_CLICK) {\n payload.value = payload.value2;\n delete payload.value2;\n\n payload = updateRowPayload(chartEvent.rowContext, payload);\n }\n\n onClick({\n type,\n originalEvent: chartEvent,\n payload,\n });\n };\n\n const destroyChart = (): void => {\n if (chart.current) {\n chart.current.destroy();\n chart.current = null;\n }\n needsRedraw.current = true;\n needsInit.current = true;\n };\n\n const enableSearchZoom = chartData?.chartDataOptions?.enableSearchZoom ?? false;\n const recalculateDownsamplingThreshold = React.useCallback(() => {\n if (!onDownsamplingThresholdChange || !xField) {\n return;\n }\n\n const newThreshold = calculateDownsamplingThreshold({\n enableSearchZoom,\n dataSources: originalDataSources,\n width: Number(width),\n selectChartEvent: selectChartEvent.current,\n xField,\n y2Fields,\n });\n\n if (Number.isFinite(newThreshold)) {\n onDownsamplingThresholdChange(newThreshold);\n }\n }, [enableSearchZoom, originalDataSources, onDownsamplingThresholdChange, width, xField, y2Fields]);\n\n React.useEffect(() => {\n recalculateDownsamplingThreshold();\n }, [recalculateDownsamplingThreshold]);\n\n // useEventCallback is used for these handlers to make sure that they are a stable reference and\n // we always use the latest version of the callback\n // Since chart drawing is debounced, there is a race condition where a stale callback may be called\n // if a prop changes and the event handler is called before the chart redraws. This means that\n // it will use the old callback rather than the newer one, which can lead to inaccurate results\n const handleSelect = useEventCallback((chartEvent: ChartEvent<'chartRangeSelect'>): void => {\n selectChartEvent.current = chartEvent;\n recalculateDownsamplingThreshold();\n // todo: need change this after breaking all visualizations\n if (onSelect && typeof onSelect === 'function') {\n onSelect({\n type: 'range.select',\n originalEvent: chartEvent,\n payload: pick(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue'),\n });\n\n return;\n }\n\n // the chartEvent here is a jQuery event\n onEventTrigger({\n type: 'range.select',\n originalEvent: chartEvent,\n payload: pick(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue'),\n });\n });\n\n const handlePointMouseOut = useEventCallback(\n (chartEvent: ChartEvent<'pointMouseOut'>, type: VizChartEventType): void => {\n let payload: Partial<ChartEvent<'pointMouseOut'>> = pick(\n chartEvent,\n 'name2',\n 'value2',\n '_span',\n 'modifierKey',\n 'tooltipContext'\n );\n\n payload.name = payload.name2;\n delete payload.name2;\n payload.value = payload.value2;\n delete payload.value2;\n\n payload = updateRowPayload(chartEvent.rowContext, payload);\n\n onPointMouseOut({\n type,\n originalEvent: chartEvent,\n payload,\n });\n }\n );\n\n const handlePointMouseOver = useEventCallback(\n (chartEvent: ChartEvent<'pointMouseOver'>, type: VizChartEventType): void => {\n let payload: Partial<ChartEvent<'pointMouseOver'>> = pick(\n chartEvent,\n 'name2',\n 'value2',\n '_span',\n 'modifierKey',\n 'tooltipContext'\n );\n\n payload.name = payload.name2;\n delete payload.name2;\n payload.value = payload.value2;\n delete payload.value2;\n\n payload = updateRowPayload(chartEvent.rowContext, payload);\n\n onPointMouseOver({\n type,\n originalEvent: chartEvent,\n payload,\n });\n }\n );\n\n const drawChart = (): void => {\n const updatedOptions = { ...options, shouldColorizeTooltipData: false };\n const computedChartSize = computeChartingSize();\n const computedWidth = computedChartSize.width;\n const computedHeight = computedChartSize.height;\n const serializedTimezone = timezone?.serializedTimezone;\n const ianaTimezone = timezone?.ianaTimezone;\n const utcOffset = timezone?.utcOffset;\n if (!computedWidth || !computedHeight) {\n return;\n }\n if (!chartData || !Object.keys(chartData).length) {\n return;\n }\n\n // splunk-charting layers configuration option updates.\n // when an option is removed it needs to be set to an empty string\n // to override the previous configuration\n if (prevOptions) {\n Object.keys(prevOptions).forEach(key => {\n if (prevOptions[key] && updatedOptions[key] === undefined) {\n updatedOptions[key] = '';\n }\n });\n }\n\n try {\n if (needsInit.current) {\n destroyChart();\n jsCharting.setTheme(themeKey);\n if (colorPalette.length > 0) {\n jsCharting.setColorPalette(colorPalette);\n }\n chart.current = jsCharting.createChart(container.current, {\n ...updatedOptions,\n drilldown: 'all',\n ...(typeof serializedTimezone === 'string' && {\n 'time.serializedTz': serializedTimezone,\n }),\n ...(typeof ianaTimezone === 'string' && {\n 'time.ianaTimezone': ianaTimezone,\n }),\n ...(typeof utcOffset === 'number' && {\n 'time.timezoneOffset': utcOffset,\n }),\n });\n // bind event handlers\n chart.current.on('pointClick', e => {\n handleClick(e, VizChartEventType.POINT_CLICK);\n });\n chart.current.on('pointMouseOver', e => {\n handlePointMouseOver(e, VizChartEventType.POINT_MOUSE_OVER);\n });\n chart.current.on('pointMouseOut', e => {\n handlePointMouseOut(e, VizChartEventType.POINT_MOUSE_OUT);\n });\n chart.current.on('legendClick', e => {\n handleClick(e, VizChartEventType.LEGEND_CLICK);\n });\n chart.current.on('chartRangeSelect', handleSelect);\n }\n if (needsRedraw.current) {\n jsCharting.setTheme(themeKey);\n if (colorPalette.length > 0) {\n jsCharting.setColorPalette(colorPalette);\n }\n chart.current.prepareAndDraw(chartData, updatedOptions, () => {});\n }\n if (chart.current) {\n if (\n Math.round(chart.current.height) !== Math.round(computedHeight) ||\n Math.round(chart.current.width) !== Math.round(computedWidth)\n ) {\n chart.current.resize(computedWidth, computedHeight);\n }\n }\n needsInit.current = false;\n needsRedraw.current = false;\n } catch (e) {\n window.console.error('Caught error rendering chart:', e);\n }\n };\n\n const debouncedDrawChart = debounce(drawChart, 5);\n\n const onContainerMount = chartingContainer => {\n container.current = chartingContainer;\n debouncedDrawChart();\n };\n\n const prevTheme = usePrevious(themeKey);\n const prevOnClick = usePrevious(onClick);\n\n useEffect(() => {\n debouncedDrawChart();\n props.visualizationApiRef(api.current);\n return () => {\n props.visualizationApiRef(null);\n destroyChart();\n };\n }, []);\n\n useEffect(() => {\n // TODO: figure out why re-init is needed for functional components (i.e. PlatformViz) when changing theme\n // seems like redraw doesn't suffice to update the background colors\n if (\n !chart.current ||\n !canUpdateInPlace(prevOptions, options) ||\n // timezone is a simple object so this comparison should be fast\n JSON.stringify(prevTimezone) !== JSON.stringify(timezone) ||\n (!props.themeKey && prevTheme !== themeKey) ||\n prevOnClick !== onClick\n ) {\n needsInit.current = true;\n }\n // need to immediately call drawChart upon an option or chartData change\n // otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change\n needsRedraw.current = true;\n drawChart();\n }, [\n JSON.stringify(options),\n JSON.stringify(chartData.toJSON()),\n JSON.stringify(chartData.annotations),\n timezone?.ianaTimezone,\n timezone?.utcOffset,\n timezone?.serializedTimezone,\n themeKey,\n onClick,\n ]);\n return (\n <ChartingContainer style={style} ref={onContainerMount} width={width} height={height}>\n <EventListener target={window} onResize={debouncedDrawChart} />\n </ChartingContainer>\n );\n};\n\nconst defaultProps: Record<keyof ChartingProps, any> = {\n width: '100%',\n height: 250,\n options: {},\n style: {},\n // todo: need remove it\n onEventTrigger: noop,\n onClick: noop,\n onSelect: noop,\n onPointMouseOver: noop,\n onPointMouseOut: noop,\n colorPalette: VIZ_CATEGORICAL,\n visualizationApiRef: noop,\n chartData: null,\n themeKey: null,\n onDownsamplingThresholdChange: null,\n originalDataSources: null,\n xField: null,\n y2Fields: [],\n};\n\nCharting.propTypes = propTypes;\nCharting.defaultProps = defaultProps;\n\n// allow for early return in case of empty chartData while still following hook rules\nconst withEmptyChartMessage = (Chart): React.FunctionComponent<ChartingProps> => {\n const Wrapper = (props: ChartingProps): React.ReactElement => {\n const { chartData } = props;\n\n if (!chartData) {\n return <Message message={_('No DataSource')} level=\"warning\" />;\n }\n\n if (chartData && !Object.keys(chartData).length) {\n return <Message message={_('No Result')} level=\"info\" />;\n }\n\n return <Chart {...props} />;\n };\n\n Wrapper.displayName = 'ChartingWrapper';\n Wrapper.propTypes = propTypes;\n Wrapper.defaultProps = defaultProps;\n return Wrapper;\n};\n\n// export default Charting;\nexport default withEmptyChartMessage(Charting as any);\n","module.exports = require(\"@splunk/visualization-color-palettes\");","module.exports = require(\"react-event-listener\");","module.exports = require(\"@splunk/visualizations-shared/i18n\");","module.exports = require(\"@splunk/charting-bundle\");","module.exports = require(\"@splunk/themes/useSplunkTheme\");","module.exports = require(\"@splunk/visualizations-shared/themeUtils\");","import { useRef, useLayoutEffect, useCallback } from 'react';\n\n/**\n * This is an escape hatch for the case where an event handler function depends on some states that changes too often thus the event handle is recreated frequently which causes bugs in some edge cases.\n *\n * For example if an old callback is called, it may not use the most recent props, but the previous props when that callback was created.\n */\n\ntype Fn<ARGS extends any[], R> = (...args: ARGS) => R;\nconst useEventCallback = <A extends any[], R>(fn: Fn<A, R>): Fn<A, R> => {\n const ref = useRef<Fn<A, R>>(fn);\n useLayoutEffect(() => {\n ref.current = fn;\n });\n return useCallback((...args: A): R => ref.current(...args), []);\n};\n\nexport default useEventCallback;\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"prop-types\"","webpack:///external \"styled-components\"","webpack:///external \"lodash\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/visualizations-shared/numberUtils\"","webpack:///./src/common/interfaces/VizActionHandler.ts","webpack:///./src/common/interfaces/VizBehavior.ts","webpack:///./src/common/interfaces/VizCategory.ts","webpack:///external \"@splunk/visualizations-shared/Message\"","webpack:///./src/common/utils/dataUtils.ts","webpack:///./src/common/interfaces/DataSource.ts","webpack:///external \"@splunk/visualization-context/TimezoneContext\"","webpack:///external \"@splunk/visualizations-shared/style\"","webpack:///./src/common/ChartingApi.ts","webpack:///./src/common/hooks/usePrevious.ts","webpack:///./src/common/interfaces/index.ts","webpack:///./src/common/interfaces/DataContract.ts","webpack:///./src/common/Charting.tsx","webpack:///external \"@splunk/visualization-color-palettes\"","webpack:///external \"react-event-listener\"","webpack:///external \"@splunk/visualizations-shared/i18n\"","webpack:///external \"@splunk/charting-bundle\"","webpack:///external \"@splunk/themes/useSplunkTheme\"","webpack:///external \"@splunk/visualizations-shared/themeUtils\"","webpack:///./src/common/hooks/useEventCallback.tsx"],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,kC;;;;;;ACAA,uC;;;;;;ACAA,8C;;;;;;ACAA,mC;;;;;;ACAA,kE;;;;;;ACAA,kD;;;;;;;ACAA,+D;;;;;;;ACAA,sE;;;;;;;;;;;;;;;;;;;;;;ICaa,uB;;;;;;;WACT,iBAAK,CACD;AACH;;;WAED,oBAAQ;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AAqB,EAArB,EAA+C;AACpE,MAAM,GAAG,GAAG,oBAAiB,EAAjB,CAAZ;AACA,+BAAgB,YAAK;AACjB,OAAG,CAAC,OAAJ,GAAc,EAAd;AACH,GAFD;AAGA,SAAO,yBAAY;AAAA,WAAmB,GAAG,CAAC,OAAJ,UAAG,YAAtB;AAAA,GAAZ,EAAqD,EAArD,CAAP;AACH,CAND;;AAQA,kBAAe,gBAAf,C","file":"Charting.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 73);\n","module.exports = require(\"react\");","module.exports = require(\"prop-types\");","module.exports = require(\"styled-components\");","module.exports = require(\"lodash\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/visualizations-shared/numberUtils\");","/* eslint-disable class-methods-use-this */\nexport interface VizActionHandler {\n /**\n * put focus on the visualization\n */\n focus(): void;\n\n /**\n * compute snapshot of this visualization\n */\n snapshot(): Record<string, unknown>; // (This is for pdf export)\n}\n\nexport class DefaultVizActionHandler {\n focus(): void {\n // noop\n }\n\n snapshot(): Record<string, unknown> {\n return null; // noop\n }\n}\n","export enum VizBehavior {\n /**\n * Dynamic Options Behavior.\n * This allows visualization options to be powered by data\n *\n * **Example**\n *\n * sparklineValues: \">primary|seriesByIndex(0)\"\n * would configure sparklineValues with an array of data points\n * coming from the first series in the primary datasource\n *\n */\n DYNAMIC_OPTIONS = 'dynamic-options',\n EVENTS = 'events',\n DOWNSAMPLING = 'downsampling',\n /**\n * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is\n * missing.\n * @type {string}\n */\n PLACEHOLDER = 'placeholder',\n PAGE_AND_SORT = 'page-and-sort',\n TRELLIS = 'trellis',\n}\n","export enum VizCategory {\n SINGLE_VALUE = 'Single Value',\n TRENDS = 'Trends',\n COMPARISONS = 'Comparisons',\n TABLE = 'Table',\n GAUGE = 'Gauge',\n DISTRIBUTIONS = 'Distributions',\n CHOROPLETH = 'Choropleth Maps',\n SHAPES = 'Shapes',\n MISC = 'misc',\n FLOW = 'Flow',\n CORRELATION = 'Correlation',\n SPATIAL = 'Spatial',\n}\n","module.exports = require(\"@splunk/visualizations-shared/Message\");","import type { FieldEntry } from '@splunk/visualizations-shared/dataSourceUtils';\nimport { startsWithNumber } from '@splunk/visualizations-shared/numberUtils';\nimport type { DashboardVizProps, DataSource, VizConfig } from '../interfaces';\nimport { VizBehavior } from '../interfaces';\nimport { ChartEvent } from '../interfaces/ChartEvent';\n\n// TODO: utilize this fn in ParallelCoordinates\n\nexport const convertToArrOfObjects = (columns: (string | any[])[], fields: any[]): any[] => {\n if (!columns || !columns[0] || !columns[0].length) return [];\n\n const data = [];\n\n for (let i = 0; i < columns[0].length; i += 1) {\n const newObj = {};\n fields.forEach((field, index) => {\n const fieldName = typeof field === 'string' ? field : field.name;\n if (columns[index][i] === '') {\n newObj[fieldName] = null;\n } else {\n newObj[fieldName] = columns[index][i];\n }\n });\n data.push(newObj);\n }\n\n return data;\n};\n\n// LTTB algorithm which can be used to downsample time series data while striving to maintain\n// the spikes and overall shape of the chart\n// Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js\n// Modifications include:\n// 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)\n// 2) Convert to camel case\n// 3) Convert to TS and also return the indices of the points that are in the downsampled result.\n// 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points\n// that should be used in case of a tie of the max area in a bucket\nconst largestTriangleThreeBuckets = (\n data: [Date | number, number][],\n threshold: number,\n preferredDownsampleIndices: Set<number>\n): { downsampledData: [Date | number, number][]; downsampledIndices: number[] } => {\n const dataLength = data.length;\n const downsampledIndices = [];\n if (threshold >= dataLength || threshold === 0) {\n const allIndices = data.map((values, index) => index);\n return { downsampledData: data, downsampledIndices: allIndices }; // Nothing to do\n }\n\n const sampled: [Date | number, number][] = [];\n let sampledIndex = 0;\n\n // Bucket size. Leave room for start and end data points\n const every = (dataLength - 2) / (threshold - 2);\n\n let a = 0; // Initially a is the first point in the triangle\n let maxAreaPoint: [Date | number, number];\n let maxArea: number | undefined;\n let area: number | undefined;\n let nextA: number | undefined;\n\n sampled.push(data[a]); // Always add the first point\n downsampledIndices.push(0);\n\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < threshold - 2; i++) {\n // Calculate point average for next bucket (containing c)\n let avgX = 0;\n let avgY = 0;\n let avgRangeStart = Math.floor((i + 1) * every) + 1;\n let avgRangeEnd = Math.floor((i + 2) * every) + 1;\n avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;\n\n const avgRangeLength = avgRangeEnd - avgRangeStart;\n\n // eslint-disable-next-line no-plusplus\n for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {\n avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)\n avgY += data[avgRangeStart][1] * 1;\n }\n avgX /= avgRangeLength;\n avgY /= avgRangeLength;\n\n // Get the range for this bucket\n let rangeOffs = Math.floor((i + 0) * every) + 1;\n const rangeTo = Math.floor((i + 1) * every) + 1;\n\n // Point a\n const pointAX = Number(data[a][0]); // Enforce Number (value may be Date)\n const pointAY = data[a][1] * 1;\n\n // eslint-disable-next-line no-multi-assign\n maxArea = area = -1;\n let maxAreaIndex = rangeOffs;\n\n // eslint-disable-next-line no-plusplus\n for (; rangeOffs < rangeTo; rangeOffs++) {\n // Calculate triangle area over three buckets\n area =\n Math.abs(\n (pointAX - avgX) * (data[rangeOffs][1] - pointAY) -\n (pointAX - Number(data[rangeOffs][0])) * (avgY - pointAY)\n ) * 0.5;\n // Modification: try to downsample the least amount of points possible when there are multiple series\n // If all points in a bucket have the same area, prioritize the one with an x index\n // that also existed from another series so we don't add another point unnecessarily.\n // By default LTTB picks the leftmost point in the bucket\n if (area > maxArea || (area === maxArea && preferredDownsampleIndices.has(rangeOffs))) {\n maxArea = area;\n maxAreaPoint = data[rangeOffs];\n nextA = rangeOffs; // Next a is this b\n // Modification: save the index of the point with the most area\n maxAreaIndex = rangeOffs;\n }\n }\n\n // eslint-disable-next-line no-plusplus\n sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket\n downsampledIndices.push(maxAreaIndex);\n a = nextA; // This a is the next a (chosen b)\n }\n\n // eslint-disable-next-line no-plusplus\n sampled[sampledIndex++] = data[dataLength - 1]; // Always add last\n downsampledIndices.push(dataLength - 1);\n\n return { downsampledData: sampled, downsampledIndices };\n};\n\nexport type DownsampleOptions = { threshold: number } & Pick<DashboardVizProps, 'dataSources' | 'options'>;\n\ntype CoerceYColumnResult = {\n canDownsampleColumn: boolean;\n canLooselyCoerceSomeValues: boolean;\n coercedColumn: number[];\n};\n\n/**\n * Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines\n * if at least one of the values in the column can be loosely coerced to a number.\n * If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and\n * returns that it cannot downsample the column.\n */\nconst strictlyCoerceYColumn = (\n column: string[] | number[],\n options: DownsampleOptions['options']\n): CoerceYColumnResult => {\n const isNullCoercionEnabled = options.nullValueDisplay === 'zero';\n // Splunk charting allows for numbers in formats such as negative hex that\n // Number() does not support and also allows loose coercion of hex numbers (but not other formats)\n // We want to identify columns which contain at least one value that can be loosely coerced\n const canLooselyCoerceSomeValues =\n column.findIndex(\n value => startsWithNumber(`${value}`) || (isNullCoercionEnabled && value === null)\n ) >= 0;\n\n // If not all values in column can be strictly coerced to a number, we do not downsample\n const coercedColumn: number[] = [];\n const canDownsampleColumn = !column.some(value => {\n const coercedValue = Number(value);\n const coerceValueToZero = isNullCoercionEnabled && value === null;\n\n // if it can't be parsed or isn't safe, fail\n if (\n Number.isNaN(coercedValue) ||\n coercedValue <= Number.MIN_SAFE_INTEGER ||\n coercedValue >= Number.MAX_SAFE_INTEGER ||\n (typeof value !== 'string' && typeof value !== 'number' && !coerceValueToZero)\n ) {\n return true;\n }\n // save value and continue to next\n coercedColumn.push(coercedValue);\n return false;\n });\n\n return {\n canDownsampleColumn,\n canLooselyCoerceSomeValues,\n coercedColumn: canDownsampleColumn ? coercedColumn : [],\n };\n};\n\n/**\n * Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.\n * Only strictly increasing x-columns are eligible for downsampling.\n * If the column is not eligible for downsampling, returns an empty array.\n */\nconst strictlyCoerceXColumn = (column: string[], fieldType: string): Date[] | number[] => {\n if (fieldType === 'number') {\n const coercedXColumn = column.map(xValue => Number(xValue));\n if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {\n return coercedXColumn;\n }\n } else if (fieldType === 'time') {\n const coercedXColumn = column.map(xValue => new Date(xValue));\n if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {\n return coercedXColumn;\n }\n }\n return [];\n};\n\nexport const isDownsamplingEnabledForViz = ({ vizConfig }: { vizConfig: VizConfig }) => {\n return vizConfig.supports?.includes(VizBehavior.DOWNSAMPLING);\n};\n\nexport const calculateThresholdOnRangeSelect = ({\n firstIndex,\n lastIndex,\n dataSources,\n width,\n}: Pick<DashboardVizProps, 'dataSources'> & {\n firstIndex: number;\n lastIndex: number;\n width: number | string;\n}): number => {\n const window = lastIndex - firstIndex + 1;\n const ratio = Math.round(Number(dataSources?.primary?.data?.columns[0]?.length / window) * 10) / 10;\n return Math.round(ratio * Number(width));\n};\n\n/**\n * Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,\n * then returns the width of the visualization.\n *\n * Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled\n * 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\n * in for a categorical chart.\n */\nexport const calculateDownsamplingThreshold = ({\n enableSearchZoom,\n dataSources,\n selectChartEvent,\n width,\n xField,\n}: {\n enableSearchZoom: boolean;\n dataSources: Record<string, DataSource> | null;\n selectChartEvent: ChartEvent<'chartRangeSelect'> | null;\n width: number;\n xField: string;\n}): number | null => {\n if (enableSearchZoom || !selectChartEvent) {\n return Number(width);\n }\n\n const primaryDataSource = dataSources?.primary;\n if (!primaryDataSource) {\n return null;\n }\n\n const { startXIndex, endXIndex, currentTarget } = selectChartEvent;\n\n try {\n const xFieldIndex = primaryDataSource?.data?.fields.findIndex((field: { name: string }) => {\n return field.name === xField;\n });\n const downsampledXFieldIndex = currentTarget.dataSet?.fields.findIndex(field => field === xField);\n\n if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {\n return null;\n }\n\n const fullSeries = primaryDataSource?.data?.columns[xFieldIndex];\n const downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];\n\n const firstIndex = fullSeries.findIndex(x => {\n return downsampledSeries[startXIndex] === x;\n });\n const lastIndex = fullSeries.findIndex(x => {\n return downsampledSeries[endXIndex] === x;\n });\n\n if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {\n return calculateThresholdOnRangeSelect({\n firstIndex,\n lastIndex,\n dataSources,\n width,\n });\n }\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error('Error occurred while setting downsample threshold on range select event', e);\n }\n\n return null;\n};\n\nconst isColumnStrictlyIncreasing = (column: (number | Date)[], fieldType: 'number' | 'time') => {\n return column.every((value, index) => {\n if (fieldType === 'number') {\n if (Number.isNaN(value)) {\n return false;\n }\n }\n\n if (fieldType === 'time') {\n if (Number.isNaN((value as Date).getTime())) {\n return false;\n }\n }\n if (index === 0) {\n return true;\n }\n return value > column[index - 1];\n });\n};\n\n/**\n * Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be\n * displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.\n *\n * If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.\n * If not all columns can be downsampled, then returns empty arrays for both x and y\n */\nconst tryToCoerceAllDisplayedFields = (\n ds: DataSource,\n xField: string,\n yFields: Set<string>,\n fieldTypes: string[],\n options: DownsampleOptions['options']\n): { xColumn: Date[] | number[]; yColumns: number[][] } => {\n let xColumn: Date[] | number[] = [];\n const yColumns: number[][] = [];\n\n const canDownsample = !ds.data.fields.some((field, index) => {\n const fieldName = (field as FieldEntry).name ?? field;\n const fieldType = fieldTypes[index] ?? 'unknown';\n const column = ds.data.columns[index];\n let hasDisplayedColumnThatCantBeDownsampled = false;\n\n if (fieldName === xField) {\n xColumn = strictlyCoerceXColumn(column, fieldType);\n } else if (yFields.has(fieldName)) {\n const { coercedColumn, canLooselyCoerceSomeValues, canDownsampleColumn } = strictlyCoerceYColumn(\n ds.data.columns[index],\n options\n );\n // do not perform downsampling if a column can possibly be displayed but cannot\n // be downsampled using LTTB\n hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;\n if (hasDisplayedColumnThatCantBeDownsampled) {\n return true;\n }\n if (canDownsampleColumn) {\n yColumns.push(coercedColumn);\n }\n }\n return false;\n });\n\n if (canDownsample) {\n return { xColumn, yColumns };\n }\n return { xColumn: [], yColumns: [] };\n};\n\nconst pickIndicesFromDataSource = (ds: DataSource, indices: Set<number>): DataSource => {\n const sortedIndices = Array.from(indices).sort((a: number, b: number) => a - b);\n const slicedColumns = [];\n ds.data.columns.forEach(column => {\n const slicedColumn = [];\n sortedIndices.forEach(index => {\n slicedColumn.push(column[index]);\n });\n slicedColumns.push(slicedColumn);\n });\n\n // update data columns with downsampled columns\n return {\n ...ds,\n data: {\n ...ds.data,\n columns: slicedColumns,\n },\n };\n};\n\nexport const downsampleDataSources = ({ dataSources, threshold, options }: DownsampleOptions) => {\n const primaryDS = dataSources?.primary;\n // only downsample time series when number of data points are over threshold\n const numPoints = primaryDS?.data?.columns[0]?.length ?? 0;\n if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {\n return dataSources;\n }\n\n const { xField, yFields, fieldTypes } = options;\n if (!xField || !yFields?.length || !fieldTypes?.length) {\n return dataSources;\n }\n\n const nonInternalYFields = new Set<string>(yFields.filter(yField => !yField.startsWith('_')));\n const maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints);\n\n // Do not try to downsample if there are too many downsampled pts\n // At the worst case, each series has non-overlapping downsampled pts\n // which will mean that all points will be included in the downsampled result\n // This will just lead to additional overhead due to coercing each\n // x and y field to number\n if (maxPointsInDownsample >= numPoints) {\n return dataSources;\n }\n\n const { xColumn, yColumns } = tryToCoerceAllDisplayedFields(\n primaryDS,\n xField,\n nonInternalYFields,\n fieldTypes,\n options\n );\n\n if (!yColumns.length || !xColumn.length) {\n return dataSources;\n }\n\n const downsampledDataSources = { ...dataSources };\n const downsampledIndices = new Set<number>();\n\n yColumns.forEach((yColumn, columnIndex) => {\n // perform LTTB downsampling for current series, LTTB takes an [x, y] pair\n const xyPair: [Date | number, number][] = yColumn.map((yValue, index) => {\n return [xColumn[index], yValue];\n });\n\n try {\n const { downsampledIndices: downsampledIndicesForSeries } = largestTriangleThreeBuckets(\n xyPair,\n threshold,\n downsampledIndices\n );\n downsampledIndicesForSeries.forEach(downsampleIndex => downsampledIndices.add(downsampleIndex));\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(`Error occurred while downsampling column ${columnIndex}`, e);\n }\n });\n // update data columns with downsampled columns\n downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);\n\n return downsampledDataSources;\n};\n","import { FieldEntry } from '@splunk/visualizations-shared/dataSourceUtils';\nimport { validSegmentationModes } from '@splunk/visualization-schemas';\n\nexport interface JsonColumnData {\n fields: FieldEntry[] | string[];\n columns: string[][];\n}\n\nexport type HighlightedSourceMap = Record<string, Record<string, boolean>>;\nexport type TagsMap = Record<string, Record<string, string[]>>;\n\nexport interface Meta {\n totalCount: number;\n sid: string;\n app: string;\n highlighted?: HighlightedSourceMap;\n tags?: TagsMap;\n}\n\nexport const validSortDirs = ['asc', 'desc', 'none'] as const;\nexport type SortDirType = typeof validSortDirs[number];\nexport type SegmentationType = typeof validSegmentationModes[number];\nexport const validOutputModes = ['json_cols', 'json'] as const;\nexport type OutputModeType = typeof validOutputModes[number];\n\nexport interface RequestParams {\n count?: number;\n offset?: number;\n sort?: {\n [sortKey: string]: SortDirType;\n };\n segmentation?: SegmentationType;\n // eslint-disable-next-line camelcase\n output_mode?: OutputModeType;\n}\n\nexport interface DataSource {\n requestParams: Partial<RequestParams>;\n onRequestParamsChange?: (p: Record<string, unknown>) => void;\n data: JsonColumnData;\n error?: { level: string; message: string };\n meta: Partial<Meta>;\n}\n\nexport interface DataSourceMeta {\n requestParams: Partial<RequestParams>;\n meta: Partial<Meta>;\n onRequestParamsChange: (payload: RequestParams) => void;\n}\n","module.exports = require(\"@splunk/visualization-context/TimezoneContext\");","module.exports = require(\"@splunk/visualizations-shared/style\");","import jsCharting from '@splunk/charting-bundle';\n\ninterface Point {\n /**\n * Valid xValue of the chart\n *\n * @type {string|number}\n * @memberof Point\n */\n xValue?: string | number;\n\n /**\n * Valid seriesName for a chart\n *\n * @type {string}\n * @memberof Point\n */\n seriesName?: string;\n}\n\nexport class ChartingApiFunctional {\n // eslint-disable-next-line no-useless-constructor\n constructor(private chartRef: any) {}\n\n /**\n * Allows users to programmatically highlight a point on the chart\n *\n * @memberof ChartingApiFunctional\n */\n highlight({ xValue, seriesName }: Point = { xValue: '', seriesName: '' }): void {\n this.getChart().highlight(xValue, seriesName);\n }\n\n /**\n * Allows users to programmatically unhighlight all points on the chart\n *\n * @memberof ChartingApiFunctional\n */\n unHighlight(): void {\n this.getChart().unHighlight();\n }\n\n // returns chart object\n getChart(): jsCharting {\n return this.chartRef?.current;\n }\n}\n","import { useEffect, useRef } from 'react';\n\nexport default function usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T>();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n","export * from './DashboardVizProps';\nexport * from './DataContract';\nexport * from './DataSource';\nexport * from './DefaultContext';\nexport * from './Editor';\nexport * from './ExtendedDashViz';\nexport * from './Object';\nexport * from './Overview';\nexport * from './ThemedDefaults';\nexport * from './VizActionHandler';\nexport * from './VizBehavior';\nexport * from './VizCategory';\nexport * from './VizConfig';\nexport * from './VizEvent';\nexport * from './VizProps';\nexport * from './VizRegistry';\nexport * from './VizSize';\nexport * from './VizStatus';\n","/**\n * A data structure used at runtime to wire up a visualization.\n */\n\ninterface InitialRequestParams {\n [key: string]: Record<string, unknown> | ((options?: Record<string, unknown>) => Record<string, unknown>);\n}\nexport interface DataContract {\n requiredDataSources: {\n name: string;\n description: string;\n }[];\n optionalDataSources?: {\n name: string;\n description: string;\n }[];\n initialRequestParams: InitialRequestParams; // TODO define better than object?\n}\n","/* eslint-disable react/no-unused-prop-types */\nimport { pick, debounce, noop } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { VIZ_CATEGORICAL } from '@splunk/visualization-color-palettes';\nimport { useEffect, useRef, useContext } from 'react';\nimport * as React from 'react';\nimport * as T from 'prop-types';\nimport EventListener from 'react-event-listener';\nimport '@splunk/visualizations-shared/i18n'; // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions\nimport jsCharting from '@splunk/charting-bundle';\nimport TimezoneContext, { TimezoneContextInterface } from '@splunk/visualization-context/TimezoneContext';\nimport { toDimension } from '@splunk/visualizations-shared/style';\nimport styled from 'styled-components';\nimport Message from '@splunk/visualizations-shared/Message';\nimport useSplunkTheme from '@splunk/themes/useSplunkTheme';\nimport { getChartingThemeKey } from '@splunk/visualizations-shared/themeUtils';\nimport { ChartingApiFunctional } from './ChartingApi';\nimport usePrevious from './hooks/usePrevious';\nimport useEventCallback from './hooks/useEventCallback';\nimport { DataSource } from './interfaces';\nimport { calculateDownsamplingThreshold } from './utils/dataUtils';\nimport type { ChartEvent } from './interfaces/ChartEvent';\n\nexport const NO_INPLACE_PROPS = [\n 'chart',\n 'chart.orientation',\n 'layout.splitSeries',\n 'chart.style',\n 'legend.placement',\n];\n\nexport const changedOptions = (curOptions: Record<string, any>, nextOptions: Record<string, any>): string[] =>\n Object.keys(curOptions)\n .filter(key => !(key in nextOptions))\n .concat(\n Object.keys(nextOptions).filter(\n key => !(key in curOptions) || curOptions[key] !== nextOptions[key]\n )\n );\n\nexport const canUpdateInPlace = (\n curOptions: Record<string, any>,\n nextOptions: Record<string, any>\n): boolean => {\n // if either of the options are undefined\n // it cannot update in place.\n if (!curOptions || !nextOptions) {\n return false;\n }\n return (\n !NO_INPLACE_PROPS.some(p => curOptions[p] !== nextOptions[p]) &&\n !changedOptions(curOptions, nextOptions).some(p => p.toLowerCase().endsWith('color'))\n );\n};\n\n// create 'row' payloads from 'rowContext' in the flattened format:\n// row.<fieldname>.value\nexport const updateRowPayload = (\n chartEventRowContext: Record<string, any>,\n payload: Record<string, any>\n): Record<string, any> => {\n Object.keys(chartEventRowContext || {}).forEach(key => {\n // eslint-disable-next-line no-param-reassign\n payload[`${key}.value`] = chartEventRowContext[key];\n });\n\n return payload;\n};\n\nexport interface ContainerProps {\n width: string | number;\n height: string | number;\n}\n\nenum VizChartEventType {\n POINT_CLICK = 'point.click',\n POINT_MOUSE_OUT = 'point.mouseout',\n POINT_MOUSE_OVER = 'point.mouseover',\n LEGEND_CLICK = 'legend.click',\n}\n\n// @TODO(pwied): remove after HC upgrade to 8+\n// .highcharts-a11y-proxy-container rule addresses a HighCharts < 8 bug\n// caused by the accessibility plugin\n// https://github.com/highcharts/highcharts/issues/12883\nconst ChartingContainer = styled.div.attrs((props: ContainerProps) => ({\n 'data-test': 'charting-container',\n width: props.width,\n height: props.height,\n}))`\n & .highcharts-a11y-proxy-container {\n pointer-events: none;\n }\n overflow: hidden;\n position: relative;\n ${props => toDimension(pick(props, ['width', 'height']))};\n`;\n\nexport interface ChartingProps {\n // width in pixel or string, defaults to 100%\n width: string | number;\n // height in pixel or string\n height: string | number;\n // visualization formatting options\n options?: Record<string, any>;\n // charting dataset from jsCharting.extractChartReadyData\n chartData: Record<string, any>;\n // callbacks to trigger event\n onEventTrigger?: (...args: any[]) => void;\n onSelect?: (...args: any[]) => void;\n onClick?: (...args: any[]) => void;\n onPointMouseOver?: (...args: any[]) => void;\n onPointMouseOut?: (...args: any[]) => void;\n // Custom style on visualization\n style?: Record<string, any>;\n colorPalette?: Array<string>;\n visualizationApiRef?: (...args: any[]) => void;\n themeKey?: string;\n // The non-downsampled data sources used by this chart. Passed in if downsampling\n // is enabled for this chart.\n originalDataSources?: Record<string, DataSource> | null;\n // Callback for when downsampling threshold changes. Passed in if downsampling\n // is enabled for this chart.\n onDownsamplingThresholdChange?: (threshold: number) => void | null;\n // The xField for this chart if it is an axis chart\n xField?: string;\n // The y2Fields for this chart if it is specified and it is an axis chart\n y2Fields?: string[];\n}\n\nconst propTypes: Record<keyof ChartingProps, T.Validator<any>> = {\n width: T.oneOfType([T.string, T.number]),\n height: T.oneOfType([T.string, T.number]),\n options: T.object,\n chartData: T.object,\n onEventTrigger: T.func,\n onClick: T.func,\n onSelect: T.func,\n onPointMouseOver: T.func,\n onPointMouseOut: T.func,\n style: T.object,\n colorPalette: T.array,\n visualizationApiRef: T.func,\n themeKey: T.string,\n originalDataSources: T.object,\n onDownsamplingThresholdChange: T.func,\n xField: T.string,\n y2Fields: T.array,\n};\n\nconst Charting = (props: ChartingProps): React.ReactElement => {\n const container = useRef<HTMLDivElement>(null);\n const needsInit = useRef<boolean>(true);\n const chart = useRef<jsCharting>();\n const needsRedraw = useRef<boolean>(true);\n const api = useRef(new ChartingApiFunctional(chart));\n const timezone = useContext<TimezoneContextInterface>(TimezoneContext);\n const selectChartEvent = useRef<ChartEvent<'chartRangeSelect'>>(null);\n\n const computeChartingSize = () => {\n if (container.current) {\n const rect = container.current.getBoundingClientRect();\n return {\n height: rect.height,\n width: rect.width,\n };\n }\n return {};\n };\n const splunkTheme = useSplunkTheme();\n const themeKey = props.themeKey ? props.themeKey : getChartingThemeKey({ splunkThemeV1: splunkTheme });\n const {\n width,\n height,\n style,\n chartData,\n options,\n colorPalette,\n onClick,\n onSelect,\n onPointMouseOut,\n onPointMouseOver,\n onEventTrigger,\n originalDataSources,\n onDownsamplingThresholdChange,\n xField,\n } = props;\n const prevOptions = usePrevious(options);\n const prevTimezone = usePrevious(timezone);\n\n const handleClick = (\n chartEvent: ChartEvent<'pointClick' | 'legendClick'>,\n type: VizChartEventType\n ): void => {\n let payload: Partial<ChartEvent<'pointClick' | 'legendClick'>> = pick(\n chartEvent,\n 'name2',\n 'value2',\n '_span',\n 'modifierKey'\n );\n\n payload.name = payload.name2;\n delete payload.name2;\n\n if (type === VizChartEventType.POINT_CLICK) {\n payload.value = payload.value2;\n delete payload.value2;\n\n payload = updateRowPayload(chartEvent.rowContext, payload);\n }\n\n onClick({\n type,\n originalEvent: chartEvent,\n payload,\n });\n };\n\n const destroyChart = (): void => {\n if (chart.current) {\n chart.current.destroy();\n chart.current = null;\n }\n needsRedraw.current = true;\n needsInit.current = true;\n };\n\n const enableSearchZoom = chartData?.chartDataOptions?.enableSearchZoom ?? false;\n const recalculateDownsamplingThreshold = React.useCallback(() => {\n if (!onDownsamplingThresholdChange || !xField) {\n return;\n }\n\n const newThreshold = calculateDownsamplingThreshold({\n enableSearchZoom,\n dataSources: originalDataSources,\n width: Number(width),\n selectChartEvent: selectChartEvent.current,\n xField,\n });\n\n if (Number.isFinite(newThreshold)) {\n onDownsamplingThresholdChange(newThreshold);\n }\n }, [enableSearchZoom, originalDataSources, onDownsamplingThresholdChange, width, xField]);\n\n React.useEffect(() => {\n recalculateDownsamplingThreshold();\n }, [recalculateDownsamplingThreshold]);\n\n // useEventCallback is used for these handlers to make sure that they are a stable reference and\n // we always use the latest version of the callback\n // Since chart drawing is debounced, there is a race condition where a stale callback may be called\n // if a prop changes and the event handler is called before the chart redraws. This means that\n // it will use the old callback rather than the newer one, which can lead to inaccurate results\n const handleSelect = useEventCallback((chartEvent: ChartEvent<'chartRangeSelect'>): void => {\n selectChartEvent.current = chartEvent;\n recalculateDownsamplingThreshold();\n // todo: need change this after breaking all visualizations\n if (onSelect && typeof onSelect === 'function') {\n onSelect({\n type: 'range.select',\n originalEvent: chartEvent,\n payload: pick(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue'),\n });\n\n return;\n }\n\n // the chartEvent here is a jQuery event\n onEventTrigger({\n type: 'range.select',\n originalEvent: chartEvent,\n payload: pick(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue'),\n });\n });\n\n const handlePointMouseOut = useEventCallback(\n (chartEvent: ChartEvent<'pointMouseOut'>, type: VizChartEventType): void => {\n let payload: Partial<ChartEvent<'pointMouseOut'>> = pick(\n chartEvent,\n 'name2',\n 'value2',\n '_span',\n 'modifierKey',\n 'tooltipContext'\n );\n\n payload.name = payload.name2;\n delete payload.name2;\n payload.value = payload.value2;\n delete payload.value2;\n\n payload = updateRowPayload(chartEvent.rowContext, payload);\n\n onPointMouseOut({\n type,\n originalEvent: chartEvent,\n payload,\n });\n }\n );\n\n const handlePointMouseOver = useEventCallback(\n (chartEvent: ChartEvent<'pointMouseOver'>, type: VizChartEventType): void => {\n let payload: Partial<ChartEvent<'pointMouseOver'>> = pick(\n chartEvent,\n 'name2',\n 'value2',\n '_span',\n 'modifierKey',\n 'tooltipContext'\n );\n\n payload.name = payload.name2;\n delete payload.name2;\n payload.value = payload.value2;\n delete payload.value2;\n\n payload = updateRowPayload(chartEvent.rowContext, payload);\n\n onPointMouseOver({\n type,\n originalEvent: chartEvent,\n payload,\n });\n }\n );\n\n const drawChart = (): void => {\n const updatedOptions = { ...options, shouldColorizeTooltipData: false };\n const computedChartSize = computeChartingSize();\n const computedWidth = computedChartSize.width;\n const computedHeight = computedChartSize.height;\n const serializedTimezone = timezone?.serializedTimezone;\n const ianaTimezone = timezone?.ianaTimezone;\n const utcOffset = timezone?.utcOffset;\n if (!computedWidth || !computedHeight) {\n return;\n }\n if (!chartData || !Object.keys(chartData).length) {\n return;\n }\n\n // splunk-charting layers configuration option updates.\n // when an option is removed it needs to be set to an empty string\n // to override the previous configuration\n if (prevOptions) {\n Object.keys(prevOptions).forEach(key => {\n if (prevOptions[key] && updatedOptions[key] === undefined) {\n updatedOptions[key] = '';\n }\n });\n }\n\n try {\n if (needsInit.current) {\n destroyChart();\n jsCharting.setTheme(themeKey);\n if (colorPalette.length > 0) {\n jsCharting.setColorPalette(colorPalette);\n }\n chart.current = jsCharting.createChart(container.current, {\n ...updatedOptions,\n drilldown: 'all',\n ...(typeof serializedTimezone === 'string' && {\n 'time.serializedTz': serializedTimezone,\n }),\n ...(typeof ianaTimezone === 'string' && {\n 'time.ianaTimezone': ianaTimezone,\n }),\n ...(typeof utcOffset === 'number' && {\n 'time.timezoneOffset': utcOffset,\n }),\n });\n // bind event handlers\n chart.current.on('pointClick', e => {\n handleClick(e, VizChartEventType.POINT_CLICK);\n });\n chart.current.on('pointMouseOver', e => {\n handlePointMouseOver(e, VizChartEventType.POINT_MOUSE_OVER);\n });\n chart.current.on('pointMouseOut', e => {\n handlePointMouseOut(e, VizChartEventType.POINT_MOUSE_OUT);\n });\n chart.current.on('legendClick', e => {\n handleClick(e, VizChartEventType.LEGEND_CLICK);\n });\n chart.current.on('chartRangeSelect', handleSelect);\n }\n if (needsRedraw.current) {\n jsCharting.setTheme(themeKey);\n if (colorPalette.length > 0) {\n jsCharting.setColorPalette(colorPalette);\n }\n chart.current.prepareAndDraw(chartData, updatedOptions, () => {\n onEventTrigger({\n type: 'viz.renderedWithData',\n payload: { width, height, currentTime: new Date().getTime() },\n });\n });\n }\n if (chart.current) {\n if (\n Math.round(chart.current.height) !== Math.round(computedHeight) ||\n Math.round(chart.current.width) !== Math.round(computedWidth)\n ) {\n chart.current.resize(computedWidth, computedHeight);\n }\n }\n needsInit.current = false;\n needsRedraw.current = false;\n } catch (e) {\n window.console.error('Caught error rendering chart:', e);\n }\n };\n\n const debouncedDrawChart = debounce(drawChart, 5);\n\n const onContainerMount = chartingContainer => {\n container.current = chartingContainer;\n debouncedDrawChart();\n };\n\n const prevTheme = usePrevious(themeKey);\n const prevOnClick = usePrevious(onClick);\n\n useEffect(() => {\n debouncedDrawChart();\n props.visualizationApiRef(api.current);\n return () => {\n props.visualizationApiRef(null);\n destroyChart();\n };\n }, []);\n\n useEffect(() => {\n // TODO: figure out why re-init is needed for functional components (i.e. PlatformViz) when changing theme\n // seems like redraw doesn't suffice to update the background colors\n if (\n !chart.current ||\n !canUpdateInPlace(prevOptions, options) ||\n // timezone is a simple object so this comparison should be fast\n JSON.stringify(prevTimezone) !== JSON.stringify(timezone) ||\n (!props.themeKey && prevTheme !== themeKey) ||\n prevOnClick !== onClick\n ) {\n needsInit.current = true;\n }\n // need to immediately call drawChart upon an option or chartData change\n // otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change\n needsRedraw.current = true;\n drawChart();\n }, [\n JSON.stringify(options),\n JSON.stringify(chartData.toJSON()),\n JSON.stringify(chartData.annotations),\n timezone?.ianaTimezone,\n timezone?.utcOffset,\n timezone?.serializedTimezone,\n themeKey,\n onClick,\n ]);\n return (\n <ChartingContainer style={style} ref={onContainerMount} width={width} height={height}>\n <EventListener target={window} onResize={debouncedDrawChart} />\n </ChartingContainer>\n );\n};\n\nconst defaultProps: Record<keyof ChartingProps, any> = {\n width: '100%',\n height: 250,\n options: {},\n style: {},\n // todo: need remove it\n onEventTrigger: noop,\n onClick: noop,\n onSelect: noop,\n onPointMouseOver: noop,\n onPointMouseOut: noop,\n colorPalette: VIZ_CATEGORICAL,\n visualizationApiRef: noop,\n chartData: null,\n themeKey: null,\n onDownsamplingThresholdChange: null,\n originalDataSources: null,\n xField: null,\n y2Fields: [],\n};\n\nCharting.propTypes = propTypes;\nCharting.defaultProps = defaultProps;\n\n// allow for early return in case of empty chartData while still following hook rules\nconst withEmptyChartMessage = (Chart): React.FunctionComponent<ChartingProps> => {\n const Wrapper = (props: ChartingProps): React.ReactElement => {\n const { chartData } = props;\n\n if (!chartData) {\n return <Message message={_('No DataSource')} level=\"warning\" />;\n }\n\n if (chartData && !Object.keys(chartData).length) {\n return <Message message={_('No Result')} level=\"info\" />;\n }\n\n return <Chart {...props} />;\n };\n\n Wrapper.displayName = 'ChartingWrapper';\n Wrapper.propTypes = propTypes;\n Wrapper.defaultProps = defaultProps;\n return Wrapper;\n};\n\n// export default Charting;\nexport default withEmptyChartMessage(Charting as any);\n","module.exports = require(\"@splunk/visualization-color-palettes\");","module.exports = require(\"react-event-listener\");","module.exports = require(\"@splunk/visualizations-shared/i18n\");","module.exports = require(\"@splunk/charting-bundle\");","module.exports = require(\"@splunk/themes/useSplunkTheme\");","module.exports = require(\"@splunk/visualizations-shared/themeUtils\");","import { useRef, useLayoutEffect, useCallback } from 'react';\n\n/**\n * This is an escape hatch for the case where an event handler function depends on some states that changes too often thus the event handle is recreated frequently which causes bugs in some edge cases.\n *\n * For example if an old callback is called, it may not use the most recent props, but the previous props when that callback was created.\n */\n\ntype Fn<ARGS extends any[], R> = (...args: ARGS) => R;\nconst useEventCallback = <A extends any[], R>(fn: Fn<A, R>): Fn<A, R> => {\n const ref = useRef<Fn<A, R>>(fn);\n useLayoutEffect(() => {\n ref.current = fn;\n });\n return useCallback((...args: A): R => ref.current(...args), []);\n};\n\nexport default useEventCallback;\n"],"sourceRoot":""}
|
|
@@ -259,19 +259,21 @@ var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, thr
|
|
|
259
259
|
*/
|
|
260
260
|
|
|
261
261
|
|
|
262
|
-
var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
|
|
263
|
-
// Splunk charting allows for numbers in formats such as negative hex that
|
|
262
|
+
var strictlyCoerceYColumn = function strictlyCoerceYColumn(column, options) {
|
|
263
|
+
var isNullCoercionEnabled = options.nullValueDisplay === 'zero'; // Splunk charting allows for numbers in formats such as negative hex that
|
|
264
264
|
// Number() does not support and also allows loose coercion of hex numbers (but not other formats)
|
|
265
265
|
// We want to identify columns which contain at least one value that can be loosely coerced
|
|
266
|
+
|
|
266
267
|
var canLooselyCoerceSomeValues = column.findIndex(function (value) {
|
|
267
|
-
return (0, numberUtils_1.startsWithNumber)("".concat(value));
|
|
268
|
+
return (0, numberUtils_1.startsWithNumber)("".concat(value)) || isNullCoercionEnabled && value === null;
|
|
268
269
|
}) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
|
|
269
270
|
|
|
270
271
|
var coercedColumn = [];
|
|
271
272
|
var canDownsampleColumn = !column.some(function (value) {
|
|
272
|
-
var coercedValue = Number(value);
|
|
273
|
+
var coercedValue = Number(value);
|
|
274
|
+
var coerceValueToZero = isNullCoercionEnabled && value === null; // if it can't be parsed or isn't safe, fail
|
|
273
275
|
|
|
274
|
-
if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
|
|
276
|
+
if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number' && !coerceValueToZero) {
|
|
275
277
|
return true;
|
|
276
278
|
} // save value and continue to next
|
|
277
279
|
|
|
@@ -352,8 +354,7 @@ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_re
|
|
|
352
354
|
dataSources = _ref3.dataSources,
|
|
353
355
|
selectChartEvent = _ref3.selectChartEvent,
|
|
354
356
|
width = _ref3.width,
|
|
355
|
-
xField = _ref3.xField
|
|
356
|
-
y2Fields = _ref3.y2Fields;
|
|
357
|
+
xField = _ref3.xField;
|
|
357
358
|
|
|
358
359
|
var _a, _b, _c;
|
|
359
360
|
|
|
@@ -390,14 +391,7 @@ var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_re
|
|
|
390
391
|
});
|
|
391
392
|
var lastIndex = fullSeries.findIndex(function (x) {
|
|
392
393
|
return downsampledSeries[endXIndex] === x;
|
|
393
|
-
});
|
|
394
|
-
// re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
|
|
395
|
-
// Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
|
|
396
|
-
// until SPL-259611 is fixed
|
|
397
|
-
|
|
398
|
-
if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
|
|
399
|
-
return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
|
|
400
|
-
}
|
|
394
|
+
});
|
|
401
395
|
|
|
402
396
|
if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
|
|
403
397
|
return (0, exports.calculateThresholdOnRangeSelect)({
|
|
@@ -447,7 +441,7 @@ var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fie
|
|
|
447
441
|
*/
|
|
448
442
|
|
|
449
443
|
|
|
450
|
-
var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
|
|
444
|
+
var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes, options) {
|
|
451
445
|
var xColumn = [];
|
|
452
446
|
var yColumns = [];
|
|
453
447
|
var canDownsample = !ds.data.fields.some(function (field, index) {
|
|
@@ -461,7 +455,7 @@ var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, x
|
|
|
461
455
|
if (fieldName === xField) {
|
|
462
456
|
xColumn = strictlyCoerceXColumn(column, fieldType);
|
|
463
457
|
} else if (yFields.has(fieldName)) {
|
|
464
|
-
var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
|
|
458
|
+
var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index], options),
|
|
465
459
|
coercedColumn = _strictlyCoerceYColum.coercedColumn,
|
|
466
460
|
canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
|
|
467
461
|
canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
|
|
@@ -551,7 +545,7 @@ var downsampleDataSources = function downsampleDataSources(_ref4) {
|
|
|
551
545
|
return dataSources;
|
|
552
546
|
}
|
|
553
547
|
|
|
554
|
-
var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
|
|
548
|
+
var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes, options),
|
|
555
549
|
xColumn = _tryToCoerceAllDispla.xColumn,
|
|
556
550
|
yColumns = _tryToCoerceAllDispla.yColumns;
|
|
557
551
|
|