@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/visualizations-shared/numberUtils\"","webpack:///./src/common/utils/dataUtils.ts","webpack:///./src/common/interfaces/index.ts","webpack:///./src/common/interfaces/DataContract.ts","webpack:///./src/common/interfaces/DataSource.ts","webpack:///./src/common/interfaces/VizActionHandler.ts","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///./src/common/interfaces/VizBehavior.ts","webpack:///./src/common/interfaces/VizCategory.ts"],"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,sE;;;;;;;;;;;;;;;;;;;;;;;;;;;ACCA;;AAEA,2C,CAGA;;;AAEO,IAAM,qBAAqB,GAAG,SAAxB,qBAAwB,CAAC,OAAD,EAA8B,MAA9B,EAAsD;AACvF,MAAI,CAAC,OAAD,IAAY,CAAC,OAAO,CAAC,CAAD,CAApB,IAA2B,CAAC,OAAO,CAAC,CAAD,CAAP,CAAW,MAA3C,EAAmD,OAAO,EAAP;AAEnD,MAAM,IAAI,GAAG,EAAb;;AAHuF,6BAK9E,CAL8E;AAMnF,QAAM,MAAM,GAAG,EAAf;AACA,UAAM,CAAC,OAAP,CAAe,UAAC,KAAD,EAAQ,KAAR,EAAiB;AAC5B,UAAM,SAAS,GAAG,OAAO,KAAP,KAAiB,QAAjB,GAA4B,KAA5B,GAAo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;;;;;;;;;;;;AC5Xb;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA,+C;;;;;;;;;;;;;;;;;;;ACjBA;;AAEG;;;;;;;;;;;;;;;;;ACiBU,wBAAgB,CAAC,KAAD,EAAQ,MAAR,EAAgB,MAAhB,CAAhB;AAGA,2BAAmB,CAAC,WAAD,EAAc,MAAd,CAAnB,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICTA,uB;;;;;;;WACT,iBAAK,CACD;AACH;;;WAED,oBAAQ;AACJ,aAAO,IAAP,CADI,CACS;AAChB;;;;;;AAPL,0D;;;;;;ACbA,kE;;;;;;ACAA,+D;;;;;;;;;;;;;ACAA,IAAY,WAAZ;;AAAA,WAAY,WAAZ,EAAuB;AACnB;;;;;;;;;;AAUG;AACH;AACA;AACA;AACA;;;;AAIG;;AACH;AACA;AACA;AACH,CAvBD,EAAY,WAAW,GAAX,8CAAW,EAAX,CAAZ,E;;;;;;;;;;;;;ACAA,IAAY,WAAZ;;AAAA,WAAY,WAAZ,EAAuB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACH,CAbD,EAAY,WAAW,GAAX,8CAAW,EAAX,CAAZ,E","file":"dataUtils.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 = 15);\n","module.exports = require(\"@splunk/visualizations-shared/numberUtils\");","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","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","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","/* 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","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","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"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/visualizations-shared/numberUtils\"","webpack:///./src/common/utils/dataUtils.ts","webpack:///./src/common/interfaces/index.ts","webpack:///./src/common/interfaces/DataContract.ts","webpack:///./src/common/interfaces/DataSource.ts","webpack:///./src/common/interfaces/VizActionHandler.ts","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///./src/common/interfaces/VizBehavior.ts","webpack:///./src/common/interfaces/VizCategory.ts"],"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;Q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;AACH;AACA;AACA;AACA;;;;AAIG;;AACH;AACA;AACA;AACH,CAvBD,EAAY,WAAW,GAAX,8CAAW,EAAX,CAAZ,E;;;;;;;;;;;;;ACAA,IAAY,WAAZ;;AAAA,WAAY,WAAZ,EAAuB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACH,CAbD,EAAY,WAAW,GAAX,8CAAW,EAAX,CAAZ,E","file":"dataUtils.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 = 15);\n","module.exports = require(\"@splunk/visualizations-shared/numberUtils\");","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","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","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","/* 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","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","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"],"sourceRoot":""}
|
|
@@ -416,7 +416,7 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
416
416
|
* @param {Number} props.value // The major/trend value
|
|
417
417
|
* @param {Number} props.numberPrecision
|
|
418
418
|
* @param {Bool} props.shouldUseThousandSeparators
|
|
419
|
-
* @param {Bool} props.
|
|
419
|
+
* @param {Bool} props.shouldAbbreviateValue
|
|
420
420
|
* @returns {Number} major or trend text
|
|
421
421
|
*/
|
|
422
422
|
|
|
@@ -424,11 +424,11 @@ var computeText = function computeText(_ref4) {
|
|
|
424
424
|
var value = _ref4.value,
|
|
425
425
|
numberPrecision = _ref4.numberPrecision,
|
|
426
426
|
shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
|
|
427
|
-
|
|
427
|
+
shouldAbbreviateValue = _ref4.shouldAbbreviateValue;
|
|
428
428
|
var text = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(value) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["formatNumber"])(value, numberPrecision, {
|
|
429
429
|
useThousandSeparators: shouldUseThousandSeparators,
|
|
430
430
|
// todo: need update formatNumber
|
|
431
|
-
useTrendUnits:
|
|
431
|
+
useTrendUnits: shouldAbbreviateValue
|
|
432
432
|
}) : value; // When text is undefined, return empty string
|
|
433
433
|
|
|
434
434
|
text = text || '';
|
|
@@ -440,19 +440,21 @@ var computeText = function computeText(_ref4) {
|
|
|
440
440
|
* @param {Number} props.majorValue
|
|
441
441
|
* @param {Number} props.numberPrecision
|
|
442
442
|
* @param {Bool} props.shouldUseThousandSeparators
|
|
443
|
+
* @param {Bool} props.shouldAbbreviateMajorValue
|
|
443
444
|
* @returns {String} majorText
|
|
444
445
|
*/
|
|
445
446
|
|
|
446
447
|
var getMajorText = function getMajorText(_ref5) {
|
|
447
448
|
var majorValue = _ref5.majorValue,
|
|
448
449
|
numberPrecision = _ref5.numberPrecision,
|
|
449
|
-
shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators
|
|
450
|
+
shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators,
|
|
451
|
+
shouldAbbreviateMajorValue = _ref5.shouldAbbreviateMajorValue;
|
|
450
452
|
return computeText({
|
|
451
453
|
value: majorValue === null ? 'N/A' : majorValue,
|
|
452
454
|
// if majorValue is null, use `N/A`.
|
|
453
455
|
numberPrecision: numberPrecision,
|
|
454
456
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
455
|
-
|
|
457
|
+
shouldAbbreviateValue: shouldAbbreviateMajorValue
|
|
456
458
|
});
|
|
457
459
|
};
|
|
458
460
|
/*
|
|
@@ -480,7 +482,7 @@ var getTrendText = function getTrendText(_ref6) {
|
|
|
480
482
|
value: value,
|
|
481
483
|
numberPrecision: numberPrecision,
|
|
482
484
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
483
|
-
|
|
485
|
+
shouldAbbreviateValue: shouldAbbreviateTrendValue
|
|
484
486
|
});
|
|
485
487
|
};
|
|
486
488
|
|
|
@@ -624,6 +626,7 @@ var getUnderLabel = function getUnderLabel(_ref10) {
|
|
|
624
626
|
* @param {Number} props.numberPrecision
|
|
625
627
|
* @param {Bool} props.shouldUseThousandSeparators
|
|
626
628
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
629
|
+
* @param {Bool} props.shouldAbbreviateMajorValue
|
|
627
630
|
* @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size
|
|
628
631
|
*/
|
|
629
632
|
|
|
@@ -638,14 +641,16 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
|
638
641
|
unit = _ref11.unit,
|
|
639
642
|
numberPrecision = _ref11.numberPrecision,
|
|
640
643
|
shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
|
|
641
|
-
shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue
|
|
644
|
+
shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue,
|
|
645
|
+
shouldAbbreviateMajorValue = _ref11.shouldAbbreviateMajorValue;
|
|
642
646
|
var majorTextSpaceRatio = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;
|
|
643
647
|
var textContentWidth = width * 0.9;
|
|
644
648
|
var textContentHeight = height * 0.9;
|
|
645
649
|
var majorText = getMajorText({
|
|
646
650
|
majorValue: majorValue,
|
|
647
651
|
numberPrecision: numberPrecision,
|
|
648
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators
|
|
652
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
653
|
+
shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
|
|
649
654
|
});
|
|
650
655
|
var majorTextFontSize = majorFontSize || getMajorFontSize({
|
|
651
656
|
width: textContentWidth,
|
|
@@ -771,6 +776,7 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
771
776
|
* @param {Number} props.numberPrecision
|
|
772
777
|
* @param {Bool} props.shouldUseThousandSeparators
|
|
773
778
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
779
|
+
* @param {Bool} props.shouldAbbreviateMajorValue
|
|
774
780
|
* @param {Object} props.toRemoveList
|
|
775
781
|
* @returns {Object} results
|
|
776
782
|
* @returns {String} results.majorText
|
|
@@ -795,6 +801,7 @@ var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
|
795
801
|
numberPrecision = _ref13.numberPrecision,
|
|
796
802
|
shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
|
|
797
803
|
shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
|
|
804
|
+
shouldAbbreviateMajorValue = _ref13.shouldAbbreviateMajorValue,
|
|
798
805
|
toRemoveList = _ref13.toRemoveList;
|
|
799
806
|
|
|
800
807
|
var _getMajorAndTrend = getMajorAndTrend({
|
|
@@ -808,7 +815,8 @@ var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
|
808
815
|
unit: unit,
|
|
809
816
|
numberPrecision: numberPrecision,
|
|
810
817
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
811
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
818
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
819
|
+
shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
|
|
812
820
|
}),
|
|
813
821
|
majorText = _getMajorAndTrend.majorText,
|
|
814
822
|
trendText = _getMajorAndTrend.trendText,
|
|
@@ -897,6 +905,7 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
|
|
|
897
905
|
* @param {Number} props.numberPrecision
|
|
898
906
|
* @param {Bool} props.shouldUseThousandSeparators
|
|
899
907
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
908
|
+
* @param {Bool} props.shouldAbbreviateMajorValue,
|
|
900
909
|
* @param {Object} props.toRemoveList
|
|
901
910
|
* @param {Bool} props.smallViz
|
|
902
911
|
* @returns {Object} results
|
|
@@ -922,6 +931,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
922
931
|
numberPrecision = _ref15.numberPrecision,
|
|
923
932
|
shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
|
|
924
933
|
shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
|
|
934
|
+
shouldAbbreviateMajorValue = _ref15.shouldAbbreviateMajorValue,
|
|
925
935
|
smallViz = _ref15.smallViz;
|
|
926
936
|
|
|
927
937
|
var _getMajorAndTrend2 = getMajorAndTrend({
|
|
@@ -935,7 +945,8 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
935
945
|
unit: unit,
|
|
936
946
|
numberPrecision: numberPrecision,
|
|
937
947
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
938
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
948
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
949
|
+
shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
|
|
939
950
|
}),
|
|
940
951
|
majorText = _getMajorAndTrend2.majorText,
|
|
941
952
|
trendText = _getMajorAndTrend2.trendText,
|
|
@@ -966,7 +977,8 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
966
977
|
trendDisplay: trendDisplay,
|
|
967
978
|
numberPrecision: numberPrecision,
|
|
968
979
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
969
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
980
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
981
|
+
shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
|
|
970
982
|
});
|
|
971
983
|
|
|
972
984
|
majorText = _getMajorAndTrend3.majorText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"lodash\"","webpack:///external \"@splunk/visualizations-shared/numberUtils\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@splunk/visualizations-shared/domUtils\"","webpack:///./src/common/utils/singleValueUtils.js","webpack:///external \"@splunk/visualizations-shared/propUtils\"","webpack:///external \"@splunk/visualizations-shared/colorConstants\""],"names":["DEFAULT_FONT","DEFAULT_FONT_FAMILY","SVR_PADDING","top","bottom","left","right","getAligment","alignMap","center","shouldShowTrend","trendDisplay","isLoadingOrNoColumns","data","get","noColumns","loading","getFormattedColor","formatColor","hasBackground","backgroundColor","isIdenticalColor","colorA","colorB","getDefaultColorWithBg","defaultFontColor","defaultBlockFontColor","getMajorColor","majorColor","getTrendColor","trendColor","trendValue","majorValue","customizedBgColor","defaultColors","Number","defaultBackgroundColor","isInvalidTrend","parseFloat","computeColors","props","backgroundEnabled","underLabelColor","computeText","value","numberPrecision","shouldUseThousandSeparators","shouldAbbreviateTrendValue","text","formatNumber","useThousandSeparators","useTrendUnits","getMajorText","getTrendText","compute","isNumerial","showPercent","diff","Math","val","computeFontSize","width","height","fontFamily","fontWeight","widthInDefaultFont","computeTextSize","fontSize","parseInt","getMajorFontSize","unit","majorText","spaceRatio","majorTextCalc","getTrendFontSize","trendText","trendFontSize","getUnderLabelHeight","getUnderLabel","underLabel","getMajorAndTrend","majorFontSize","majorTextSpaceRatio","textContentWidth","textContentHeight","majorTextFontSize","trendTextFontSize","updateVizInSmallSpace","toRemoveList","removeIndex","newProps","newMajorAndTrend","newTextSize","toRemove","truncateValue","updatedProps","computeSingleValueContent","contentWidth","contentHeight","containerWidth","containerHeight","majorValueTitle","smallVizProps","minimallyTruncateStringToWidth","textWidth","modifiedText","ellipsesLength","computeSingleValueRadialContent","smallViz","getGraphColors","customColorFormatter","adjustRGB","rgb","changeColor","hex","color","r","g","b","newR","newG","newB","ratio","lighten","darken","handleValueClickCallback","trellisEnabled","trellisSplityBy","trellisKey","payload","name","majorValueField","onValueClick"],"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,mC;;;;;;;ACAA,sE;;;;;;;ACAA,kE;;;;;;;ACAA,mE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AAEO,IAAMA,YAAY,GAAlB;AACA,IAAMC,mBAAmB,GAAzB;AAGA,IAAMC,WAAW,GAAG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AGT,SAAS,OAAhBS,EAAgB,CAAhBA;AACAC,YAAI,GAAGV,SAAS,OAAhBU,EAAgB,CAAhBA;AACH;AATE,WAUA;AACHF,UAAI,GAAGR,SAAS,OAAhBQ,EAAgB,CAAhBA;AACAC,UAAI,GAAGT,SAAS,OAAhBS,EAAgB,CAAhBA;AACAC,UAAI,GAAGV,SAAS,OAAhBU,EAAgB,CAAhBA;AACH;AACJ;;AAED,SACI,WAAIF,IAAI,CAAJA,yBAAJ,CAAIA,CAAJ,cACGC,IAAI,CAAJA,yBADH,CACGA,CADH,cAEGC,IAAI,CAAJA,yBAHP,CAGOA,CAFH,CADJ;AAhDJ;AAuDA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,IAAME,OAAO,GAAG,SAAVA,OAAU,QAAK;AAAA,SAAIV,WAAW,QAAf,GAAe,CAAf;AAArB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,IAAMW,MAAM,GAAG,SAATA,MAAS,QAAK;AAAA,SAAIX,WAAW,QAAf,GAAe,CAAf;AAApB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,IAAMY,wBAAwB,GAAG,SAA3BA,wBAA2B,4DASnC;AAAA,MAHDC,cAGC,uEAHgB,KAGhB;AAAA,MAFDC,eAEC,uEAFiB,EAEjB;AAAA,MADDC,UACC,uEADY,EACZ;AACD,MAAIC,OAAO,GAAG;AACVlG,cAAU,EADA;AAEVa,SAAK,EAFK;AAGVsF,QAAI,EAAEC;AAHI,GAAd;;AAKA,sBAAoB;AAChBF,WAAO;AAAiB,sBAAjB;AAAkD,uBAAiBD;AAAnE,MAAPC;AACH;;AACD,SAAOG,YAAY;AAAUH,WAAO,EAAPA;AAAV,KAAnB;AAlBG,E;;;;;;;ACj3BP,oE;;;;;;;ACAA,yE","file":"singleValueUtils.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 = 54);\n","module.exports = require(\"lodash\");","module.exports = require(\"@splunk/visualizations-shared/numberUtils\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@splunk/visualizations-shared/domUtils\");","import { get } from 'lodash';\nimport { isNumerial, formatNumber } from '@splunk/visualizations-shared/numberUtils';\nimport { computeTextSize } from '@splunk/visualizations-shared/domUtils';\nimport { formatColor } from '@splunk/visualizations-shared/propUtils';\nimport { DELTA_GREEN, DELTA_RED } from '@splunk/visualizations-shared/colorConstants';\n\nexport const DEFAULT_FONT = 12;\nexport const DEFAULT_FONT_FAMILY =\n '\"Splunk Platform Sans\", \"Proxima Nova\", \"Helvetica Neue\", Helvetica, Arial, sans-serif';\n\nexport const SVR_PADDING = { top: 12, bottom: 12, left: 16, right: 16 };\n\nexport const getAligment = align => {\n const alignMap = {\n left: 'start',\n center: 'center',\n right: 'end',\n };\n return alignMap[align] || 'center';\n};\n\n/**\n * @method shouldShowTrend\n * @param {String} trendDisplay\n * @returns {Bool}\n */\nexport const shouldShowTrend = trendDisplay => trendDisplay === 'absolute' || trendDisplay === 'percent';\n\n/**\n * @method isLoadingOrNoColumns\n * @param {Object} dataSources\n * @param {Boolean} loading\n * @returns {Boolean} return true if loading or without columns in dataSources\n */\nexport const isLoadingOrNoColumns = (dataSources, loading) => {\n const data = get(dataSources, 'primary.data.columns[0]', undefined);\n const noColumns = data === undefined;\n return loading || noColumns;\n};\n\n/**\n * Retrieve the valid formatted color\n * @method getFormattedColor\n * @param {String} color\n * @param {String} defaultColor\n * @returns {String} the formatted color\n */\nexport const getFormattedColor = (color, defaultColor) => formatColor(color) || formatColor(defaultColor);\n\n/**\n * Determines if there is a background color\n * @method hasBackground\n * @param {String} backgroundColor\n * @returns true for non-transparent background color\n */\nexport const hasBackground = backgroundColor => !!backgroundColor && backgroundColor !== 'transparent';\n\n/**\n * @method isIdenticalColor\n * @param {String} colorA\n * @param {String} colorB\n * @returns {Boolean}\n */\nexport const isIdenticalColor = (colorA, colorB) =>\n !!colorA && !!colorB && formatColor(colorA.toLowerCase()) === formatColor(colorB.toLowerCase());\n\n/*\n * @method getDefaultColorWithBg\n * @param {Object} props\n * @param {String} props.backgroundColor\n * @param {String} props.defaultFontColor\n * @param {String} props.defaultBlockFontColor\n * @returns {String} defaultColor\n */\nexport const getDefaultColorWithBg = ({ backgroundColor, defaultFontColor, defaultBlockFontColor }) =>\n isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;\n\n/*\n * @method getMajorColor\n * return formatted majorColor.\n * @param {Object} props\n * @param {String} props.majorColor\n * @param {String} props.backgroundColor\n * @param {String} props.defaultFontColor\n * @param {String} props.defaultBlockFontColor\n * @returns {String} majorColor\n */\nexport const getMajorColor = ({ majorColor, backgroundColor, defaultFontColor, defaultBlockFontColor }) => {\n // If backgroundColor is set, but no majorColor,\n // the default majorColor will turn to be defaultBlockFontColor.\n // eg: major color will turn to be white in enterprise mode.\n // however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.\n if (hasBackground(backgroundColor) && !majorColor) {\n return getDefaultColorWithBg({\n backgroundColor,\n defaultFontColor,\n defaultBlockFontColor,\n });\n }\n\n return getFormattedColor(majorColor, defaultFontColor);\n};\n\n/**\n * Get the color for the trend components\n * @method getTrendColor\n * @param {Object} props\n * @param {String} props.trendColor The trendColor value determined from encoding\n * @param {Number} props.trendValue\n * @param {Number} props.majorValue\n * @param {String} props.customizedBgColor\n * @param {String} props.trendDisplay absolute || percent || off\n * @param {Object} defaultColors\n * @returns {String} trendColor\n */\nexport const getTrendColor = ({\n trendColor,\n trendValue,\n majorValue,\n customizedBgColor,\n trendDisplay,\n defaultColors,\n}) => {\n if (trendColor) {\n return trendColor;\n }\n\n if (Number.isNaN(Number(trendValue))) {\n return undefined;\n }\n\n const { defaultFontColor, defaultBlockFontColor, defaultBackgroundColor } = defaultColors;\n\n // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor\n if (\n hasBackground(customizedBgColor) &&\n !isIdenticalColor(customizedBgColor, defaultBackgroundColor) &&\n !isIdenticalColor(customizedBgColor, defaultBlockFontColor)\n ) {\n return defaultBlockFontColor;\n }\n\n // if trendDisplay is percent, and trendValue === value\n // the trend percent = trendValue / (value - trendValue) will return Infinity\n const isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);\n\n if (trendValue === 0 || isInvalidTrend) {\n return defaultFontColor;\n }\n\n return trendValue > 0 ? DELTA_GREEN : DELTA_RED;\n};\n\n/**\n * Computes visualization properties for display component\n * @method computeColors\n * @param {Object} props all viz props\n * @param {Object} defaultColors defaultColors from theme\n * @returns {Object} result\n * @returns {Boolean} backgroundEnabled\n * @returns {String} backgroundColor\n * @returns {String} majorColor\n * @returns {String} trendColor\n * @returns {String} underLabelColor\n */\nexport const computeColors = (props, defaultColors) => {\n const backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);\n const backgroundEnabled = hasBackground(backgroundColor);\n const majorColor = getMajorColor({\n majorColor: props.majorColor,\n backgroundColor,\n defaultFontColor: defaultColors.defaultFontColor,\n defaultBlockFontColor: defaultColors.defaultBlockFontColor,\n });\n const trendColor = getTrendColor({\n trendColor: props.trendColor,\n trendValue: props.trendValue,\n majorValue: props.majorValue,\n customizedBgColor: props.backgroundColor,\n trendDisplay: props.trendDisplay,\n defaultColors,\n });\n // todo: need change it to not depend on majorColor\n const underLabelColor = majorColor;\n\n return {\n backgroundColor,\n backgroundEnabled,\n majorColor,\n trendColor,\n underLabelColor,\n };\n};\n\n/**\n * Format and return the value (major/trend)\n * @method computeText\n * @param {Object} props\n * @param {Number} props.value // The major/trend value\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @returns {Number} major or trend text\n */\nexport const computeText = ({\n value,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n}) => {\n let text = isNumerial(value)\n ? formatNumber(value, numberPrecision, {\n useThousandSeparators: shouldUseThousandSeparators, // todo: need update formatNumber\n useTrendUnits: shouldAbbreviateTrendValue,\n })\n : value;\n // When text is undefined, return empty string\n text = text || '';\n return text;\n};\n\n/*\n * @method getMajorText\n * @param {Object} props\n * @param {Number} props.majorValue\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @returns {String} majorText\n */\nexport const getMajorText = ({ majorValue, numberPrecision, shouldUseThousandSeparators }) =>\n computeText({\n value: majorValue === null ? 'N/A' : majorValue, // if majorValue is null, use `N/A`.\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue: false,\n });\n\n/*\n * @method getTrendText\n * @param {Object} props\n * @param {Number} props.majorValue\n * @param {Number} props.trendValue\n * @param {String} props.trendDisplay\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @returns {String} trendText\n */\nexport const getTrendText = ({\n majorValue,\n trendValue,\n trendDisplay,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n}) => {\n const compute = value =>\n computeText({\n value,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n });\n\n if (trendValue === '' || !isNumerial(trendValue)) {\n return '';\n }\n const showPercent = trendDisplay === 'percent';\n if (!showPercent) {\n return compute(trendValue);\n }\n\n const diff = Math.abs(trendValue - majorValue);\n let val = Math.round((trendValue / diff) * 100);\n if (trendValue === 0 && diff === 0) {\n val = 0;\n }\n\n if (!Number.isFinite(val)) {\n return 'N/A';\n }\n const text = compute(val);\n\n return `${text}%`;\n};\n\n/**\n * Helper to determine the font size for an element\n * @method computeFontSize\n * @param {String} text The string to find a size for\n * @param {Object} dimensions\n * @param {Number} dimensions.width The width of the container\n * @param {Number} dimensions.height The height of the container\n * @param {String} [fontFamily='\"Splunk Platform Sans\" ...'] The font being used\n * @param {String} [fontWeight='normal'] Boldness of font\n * @returns {Number} The size to use for fontSize styles\n */\nexport const computeFontSize = (\n text,\n { width, height },\n fontFamily = DEFAULT_FONT_FAMILY,\n fontWeight = 'normal'\n) => {\n const widthInDefaultFont = computeTextSize(text, `${fontWeight} ${DEFAULT_FONT}px ${fontFamily}`);\n const fontSize = Math.min(\n (width / widthInDefaultFont) * DEFAULT_FONT,\n (height / DEFAULT_FONT) * DEFAULT_FONT\n );\n return parseInt(fontSize, 10);\n};\n\n/*\n * @method getMajorFontSize\n * @param {Object} props\n * @param {Number} props.width\n * @param {Number} props.height\n * @param {String} props.unit\n * @param {String} props.majorText\n * @param {Number} props.spaceRatio\n * @returns {Number} majorFontSize\n */\nexport const getMajorFontSize = ({ width, height, unit, majorText, spaceRatio = 1 }) => {\n const majorTextCalc = unit ? `${unit}${majorText}` : majorText;\n return computeFontSize(majorTextCalc, {\n width: width * spaceRatio,\n height,\n });\n};\n\n/*\n * @method getTrendFontSize\n * @param {Object} props\n * @param {Number} props.width\n * @param {Number} props.height\n * @param {String} props.trendText\n * @param {Number} props.spaceRatio\n * @returns {Number} trendFontSize\n */\nexport const getTrendFontSize = ({ width, height, trendText, spaceRatio = 1 }) => {\n let trendFontSize = 12;\n if (spaceRatio > 0) {\n trendFontSize = computeFontSize(trendText, {\n width: width * spaceRatio,\n height,\n });\n trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;\n }\n return trendFontSize;\n};\n\n/*\n * The height of underLabel should no more than 12px\n * @param {Number} height\n * @return {Number} height || DEFAULT_FONT\n */\nexport const getUnderLabelHeight = height => (height > DEFAULT_FONT ? DEFAULT_FONT : height);\n\n/*\n * @param {Object} config\n * @param {String} underLabel\n * @param {Number} width width of underLabel\n * @param {Number} height height of underLabel\n * @param {Number} fond size of underLabel\n */\nexport const getUnderLabel = ({ underLabel, width, height }) =>\n // todo: may need truncate underLabel later\n computeFontSize(underLabel, {\n width,\n height,\n });\n\n/**\n * Compute value and font size for major and trend\n * @method getMajorAndTrend\n * @param {Object} props\n * @param {Number} props.width // Width of the text container\n * @param {Number} props.height // Height of the text container\n * @param {Number} props.majorValue // Major value\n * @param {Number} props.trendValue // Trend value\n * @param {Number} props.majorFontSize\n * @param {Number} props.trendFontSize\n * @param {String} props.trendDisplay\n * @param {String} props.unit // Unit for the value\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size\n */\nexport const getMajorAndTrend = ({\n width,\n height,\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n trendDisplay,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n}) => {\n const majorTextSpaceRatio = isNumerial(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;\n const textContentWidth = width * 0.9;\n const textContentHeight = height * 0.9;\n const majorText = getMajorText({ majorValue, numberPrecision, shouldUseThousandSeparators });\n const majorTextFontSize =\n majorFontSize ||\n getMajorFontSize({\n width: textContentWidth,\n height: textContentHeight,\n unit,\n majorText,\n spaceRatio: majorTextSpaceRatio,\n });\n const trendText = getTrendText({\n majorValue,\n trendValue,\n trendDisplay,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n });\n\n const trendTextFontSize =\n trendFontSize ||\n getTrendFontSize({\n width: textContentWidth,\n height: textContentHeight,\n trendText,\n spaceRatio: 1 - majorTextSpaceRatio,\n });\n\n return {\n majorText,\n majorTextFontSize,\n trendText,\n trendTextFontSize,\n };\n};\n\n/*\n * @method updateVizInSmallSpace\n * @param {Object} props\n * @param {Number} props.width // Width of the text container\n * @param {Number} props.height // Height of the text container\n * @param {Object} props.toRemoveList\n * @param {Number} props.majorValue // Major value\n * @param {Number} props.trendValue // Trend value\n * @param {Number} props.majorFontSize\n * @param {Number} props.trendFontSize\n * @param {Number} props.majorTextFontSize\n * @param {String} props.unit // Unit for the value\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @returns {Object} results\n * @returns {Object} results.newMajorAndTrend\n * @returns {Object} results.updatedProps\n */\nexport const updateVizInSmallSpace = ({\n width,\n height,\n toRemoveList,\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n majorTextFontSize,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n}) => {\n let removeIndex = 0;\n let newProps = {}; // options need to be updated\n let newMajorAndTrend = {};\n let newTextSize = majorTextFontSize;\n\n // remove info on viz to make textFontSize >= 12px;\n while (newTextSize < 12 && removeIndex < toRemoveList.length) {\n const toRemove = toRemoveList[removeIndex];\n newProps = {\n ...newProps,\n ...{\n [toRemove.key]: toRemove.value,\n },\n };\n\n newMajorAndTrend = getMajorAndTrend({\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n width,\n height,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n ...newProps,\n });\n\n newTextSize = newMajorAndTrend.majorTextFontSize;\n removeIndex += 1;\n }\n\n // truncate text if textFontSize is still less than 12\n if (newTextSize < 12) {\n const truncateValue = `${majorValue.toString().slice(0, 3)}...`;\n newMajorAndTrend = getMajorAndTrend({\n majorValue: truncateValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n width,\n height,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n ...newProps,\n });\n }\n\n return { newMajorAndTrend, updatedProps: newProps };\n};\n\n/*\n * @method computeSingleValueContent\n * @param {Object} props\n * @param {Number} props.contentWidth\n * @param {Number} props.contentHeight\n * @param {Number} props.containerWidth\n * @param {Number} props.containerHeight\n * @param {Number} props.majorValue // Major value\n * @param {Number} props.trendValue // Trend value\n * @param {Number} props.majorFontSize\n * @param {Number} props.trendFontSize\n * @param {String} props.trendDisplay\n * @param {String} props.unit // Unit for the value\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @param {Object} props.toRemoveList\n * @returns {Object} results\n * @returns {String} results.majorText\n * @returns {String} results.trendText\n * @returns {Number} results.majorTextFontSize\n * @returns {Number} results.trendTextFontSize\n * @returns {String} results.majorValueTitle\n * @returns {Object} results.smallVizProps\n */\nexport const computeSingleValueContent = ({\n contentWidth,\n contentHeight,\n containerWidth,\n containerHeight,\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n trendDisplay,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n toRemoveList,\n}) => {\n let { majorText, trendText, majorTextFontSize, trendTextFontSize } = getMajorAndTrend({\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n trendDisplay,\n width: contentWidth,\n height: contentHeight,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n });\n const majorValueTitle = majorText;\n let smallVizProps = {};\n\n // update viz in small space\n // if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit\n // or truncate major value to make the major font size >= 12\n if (majorTextFontSize < 12) {\n const { newMajorAndTrend, updatedProps } = updateVizInSmallSpace({\n width: containerWidth,\n height: containerHeight,\n toRemoveList,\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n majorTextFontSize,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n });\n\n ({ majorText, trendText, majorTextFontSize, trendTextFontSize } = newMajorAndTrend);\n smallVizProps = updatedProps;\n }\n return {\n majorText,\n trendText,\n majorTextFontSize,\n trendTextFontSize,\n majorValueTitle,\n smallVizProps,\n };\n};\n\nexport const minimallyTruncateStringToWidth = ({\n text,\n fontSize = DEFAULT_FONT,\n fontFamily = DEFAULT_FONT_FAMILY,\n fontWeight = 'normal',\n containerWidth,\n}) => {\n let textWidth = computeTextSize(text, `${fontWeight} ${fontSize}px ${fontFamily}`);\n let modifiedText = text;\n\n const ellipsesLength = computeTextSize('...', `${fontWeight} ${fontSize}px ${fontFamily}`);\n // `containerWidth - ellipsesLength > 0` condition ensures space even exists for text.\n if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {\n // Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.\n // `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.\n // `text.length > 1` condition included to keep at least the first number.\n while (textWidth + ellipsesLength > containerWidth && modifiedText.length > 1) {\n modifiedText = modifiedText.substring(0, modifiedText.length - 1);\n textWidth = computeTextSize(modifiedText, `normal ${fontSize}px ${fontFamily}`);\n }\n\n modifiedText = `${modifiedText}...`;\n }\n\n return modifiedText;\n};\n\n/*\n * @method computeSingleValueRadialContent\n * @param {Object} props\n * @param {Number} props.contentWidth\n * @param {Number} props.contentHeight\n * @param {Number} props.containerWidth\n * @param {Number} props.containerHeight\n * @param {Number} props.majorValue // Major value\n * @param {Number} props.trendValue // Trend value\n * @param {Number} props.majorFontSize\n * @param {Number} props.trendFontSize\n * @param {String} props.trendDisplay\n * @param {String} props.unit // Unit for the value\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @param {Object} props.toRemoveList\n * @param {Bool} props.smallViz\n * @returns {Object} results\n * @returns {String} results.majorText\n * @returns {String} results.trendText\n * @returns {Number} results.majorTextFontSize\n * @returns {Number} results.trendTextFontSize\n * @returns {String} results.majorValueTitle\n * @returns {Object} results.smallVizProps\n */\nexport const computeSingleValueRadialContent = ({\n contentWidth,\n contentHeight,\n containerWidth,\n containerHeight,\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n trendDisplay,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n smallViz,\n}) => {\n let { majorText, trendText, majorTextFontSize, trendTextFontSize } = getMajorAndTrend({\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n trendDisplay,\n width: contentWidth,\n height: contentHeight,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n });\n\n const majorValueTitle = majorText;\n let smallVizProps = {};\n\n // custom logic for viz in small space\n // if not showing the radial graph (if `smallViz` is true), then compute truncated major value\n // and font sizes\n if (smallViz) {\n const truncateValue = minimallyTruncateStringToWidth({\n text: majorValue,\n fontWeight: 'bold',\n fontSize: 12,\n containerWidth,\n });\n\n ({ majorText, trendText, majorTextFontSize, trendTextFontSize } = getMajorAndTrend({\n majorValue: truncateValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n width: containerWidth,\n height: containerHeight,\n unit,\n trendDisplay,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n }));\n\n smallVizProps = {\n trendDisplay,\n unit,\n };\n }\n\n return {\n majorText,\n trendText,\n majorTextFontSize,\n trendTextFontSize,\n majorValueTitle,\n smallVizProps,\n };\n};\n\n/**\n * Get the colors for a graph\n *\n * @method getGraphColors\n * @param {Object} options\n * @param {Bool} options.backgroundEnabled // Flag to turn on color mode\n * @param {String} options.backgroundColor // The current background color, overrides trend background color\n * @param {Object} options.defaultColors // Default colors by severity\n * @param {Function} options.customColorFormatter // must return { background, stroke } given a color\n * @returns {Object} { background, stroke } colors\n * @private\n */\nexport const getGraphColors = ({\n backgroundEnabled,\n backgroundColor,\n defaultColors,\n customColorFormatter,\n}) => {\n // Only do custom colors in block mode\n if (backgroundEnabled) {\n // Check if the user defined colors to use\n if (backgroundColor && typeof customColorFormatter === 'function') {\n return customColorFormatter(backgroundColor);\n }\n }\n\n return defaultColors.none;\n};\n\n/**\n * Adjust rgb value if it equals to 0 or 255\n * @method adjustRGB\n * @param {Number} rgb [0 - 255]\n * @param {Number} delta\n * @returns {Number} adjusted rgb\n * @private\n */\nexport const adjustRGB = (rgb, delta) => {\n if (rgb === 255) {\n return rgb - delta;\n }\n\n if (rgb === 0) {\n return rgb + delta;\n }\n\n return rgb;\n};\n\n/**\n * Modifies colors by multiplying by a given ratio\n * @method changeColor\n * @param {String} color // Color to modify\n * @param {Number} ratio // Float to modify color\n * @returns {String} new color\n * @private\n */\nconst changeColor = (color, ratio) => {\n const hex = color.replace(/(0x|#)/, '');\n const r = parseInt(hex.substr(0, 2), 16);\n const g = parseInt(hex.substr(2, 2), 16);\n const b = parseInt(hex.substr(4, 2), 16);\n\n // Multiply by given ratio, make sure is between 0 and 255;\n let newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);\n let newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);\n let newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0);\n\n // If the color is not changed\n // case 1: the color is (0, 0 0)\n // lighten color (80, 80, 80)\n // darken color (40, 40, 40)\n // case 2: the color is (255, 255, 255)\n // lighten color (235, 235, 235)\n // darken color (175, 175, 175)\n // case 3: the color is e.g. (0, 255, 0)\n // new color (20, 235, 20)\n if (newR === r && newG === g && newB === b) {\n if (newR === 0 && newG === 0 && newB === 0) {\n if (ratio > 1) {\n newR = adjustRGB(newR, 80);\n newG = adjustRGB(newG, 80);\n newB = adjustRGB(newB, 80);\n } else {\n newR = adjustRGB(newR, 40);\n newG = adjustRGB(newG, 40);\n newB = adjustRGB(newB, 40);\n }\n } else if (newR === 255 && newG === 255 && newB === 255) {\n if (ratio > 1) {\n newR = adjustRGB(newR, 20);\n newG = adjustRGB(newG, 20);\n newB = adjustRGB(newB, 20);\n } else {\n newR = adjustRGB(newR, 80);\n newG = adjustRGB(newG, 80);\n newB = adjustRGB(newB, 80);\n }\n } else {\n newR = adjustRGB(newR, 20);\n newG = adjustRGB(newG, 20);\n newB = adjustRGB(newB, 20);\n }\n }\n\n return (\n `#${newR.toString(16).padStart(2, 0)}` +\n `${newG.toString(16).padStart(2, 0)}` +\n `${newB.toString(16).padStart(2, 0)}`\n );\n};\n\n/**\n * Lighten a given color\n * @method lighten\n * @param {String} color\n * @returns {String}\n * @private\n */\nexport const lighten = color => changeColor(color, 1.3);\n\n/**\n * Darkens a given color\n * @method darken\n * @param {String} color\n * @returns {String}\n * @private\n */\nexport const darken = color => changeColor(color, 0.5);\n\n/** consistent token structure: handle callback to add value and name in event payload\n * @method handleValueClickCallback\n * @param {Object} ev\n * @param {String | Number} majorValue\n * @param {String} majorValueField\n * @param {Number} trendValue\n * @param {Function} onValueClick\n */\nexport const handleValueClickCallback = (\n ev,\n majorValue,\n majorValueField,\n trendValue,\n onValueClick,\n trellisEnabled = false,\n trellisSplityBy = '',\n trellisKey = ''\n) => {\n let payload = {\n trendValue,\n value: majorValue,\n name: majorValueField,\n };\n if (trellisEnabled) {\n payload = { ...payload, 'trellis.name': trellisSplityBy, 'trellis.value': trellisKey };\n }\n return onValueClick({ ...ev, payload });\n};\n","module.exports = require(\"@splunk/visualizations-shared/propUtils\");","module.exports = require(\"@splunk/visualizations-shared/colorConstants\");"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"lodash\"","webpack:///external \"@splunk/visualizations-shared/numberUtils\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@splunk/visualizations-shared/domUtils\"","webpack:///./src/common/utils/singleValueUtils.js","webpack:///external \"@splunk/visualizations-shared/propUtils\"","webpack:///external \"@splunk/visualizations-shared/colorConstants\""],"names":["DEFAULT_FONT","DEFAULT_FONT_FAMILY","SVR_PADDING","top","bottom","left","right","getAligment","alignMap","center","shouldShowTrend","trendDisplay","isLoadingOrNoColumns","data","get","noColumns","loading","getFormattedColor","formatColor","hasBackground","backgroundColor","isIdenticalColor","colorA","colorB","getDefaultColorWithBg","defaultFontColor","defaultBlockFontColor","getMajorColor","majorColor","getTrendColor","trendColor","trendValue","majorValue","customizedBgColor","defaultColors","Number","defaultBackgroundColor","isInvalidTrend","parseFloat","computeColors","props","backgroundEnabled","underLabelColor","computeText","value","numberPrecision","shouldUseThousandSeparators","shouldAbbreviateValue","text","formatNumber","useThousandSeparators","useTrendUnits","getMajorText","shouldAbbreviateMajorValue","getTrendText","shouldAbbreviateTrendValue","compute","isNumerial","showPercent","diff","Math","val","computeFontSize","width","height","fontFamily","fontWeight","widthInDefaultFont","computeTextSize","fontSize","parseInt","getMajorFontSize","unit","majorText","spaceRatio","majorTextCalc","getTrendFontSize","trendText","trendFontSize","getUnderLabelHeight","getUnderLabel","underLabel","getMajorAndTrend","majorFontSize","majorTextSpaceRatio","textContentWidth","textContentHeight","majorTextFontSize","trendTextFontSize","updateVizInSmallSpace","toRemoveList","removeIndex","newProps","newMajorAndTrend","newTextSize","toRemove","truncateValue","updatedProps","computeSingleValueContent","contentWidth","contentHeight","containerWidth","containerHeight","majorValueTitle","smallVizProps","minimallyTruncateStringToWidth","textWidth","modifiedText","ellipsesLength","computeSingleValueRadialContent","smallViz","getGraphColors","customColorFormatter","adjustRGB","rgb","changeColor","hex","color","r","g","b","newR","newG","newB","ratio","lighten","darken","handleValueClickCallback","trellisEnabled","trellisSplityBy","trellisKey","payload","name","majorValueField","onValueClick"],"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;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;;AACO,IAAMW,MAAM,GAAG,SAATA,MAAS,QAAK;AAAA,SAAIX,WAAW,QAAf,GAAe,CAAf;AAApB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,IAAMY,wBAAwB,GAAG,SAA3BA,wBAA2B,4DASnC;AAAA,MAHDC,cAGC,uEAHgB,KAGhB;AAAA,MAFDC,eAEC,uEAFiB,EAEjB;AAAA,MADDC,UACC,uEADY,EACZ;AACD,MAAIC,OAAO,GAAG;AACVpG,cAAU,EADA;AAEVa,SAAK,EAFK;AAGVwF,QAAI,EAAEC;AAHI,GAAd;;AAKA,sBAAoB;AAChBF,WAAO;AAAiB,sBAAjB;AAAkD,uBAAiBD;AAAnE,MAAPC;AACH;;AACD,SAAOG,YAAY;AAAUH,WAAO,EAAPA;AAAV,KAAnB;AAlBG,E;;;;;;;ACr4BP,oE;;;;;;;ACAA,yE","file":"singleValueUtils.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 = 54);\n","module.exports = require(\"lodash\");","module.exports = require(\"@splunk/visualizations-shared/numberUtils\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@splunk/visualizations-shared/domUtils\");","import { get } from 'lodash';\nimport { isNumerial, formatNumber } from '@splunk/visualizations-shared/numberUtils';\nimport { computeTextSize } from '@splunk/visualizations-shared/domUtils';\nimport { formatColor } from '@splunk/visualizations-shared/propUtils';\nimport { DELTA_GREEN, DELTA_RED } from '@splunk/visualizations-shared/colorConstants';\n\nexport const DEFAULT_FONT = 12;\nexport const DEFAULT_FONT_FAMILY =\n '\"Splunk Platform Sans\", \"Proxima Nova\", \"Helvetica Neue\", Helvetica, Arial, sans-serif';\n\nexport const SVR_PADDING = { top: 12, bottom: 12, left: 16, right: 16 };\n\nexport const getAligment = align => {\n const alignMap = {\n left: 'start',\n center: 'center',\n right: 'end',\n };\n return alignMap[align] || 'center';\n};\n\n/**\n * @method shouldShowTrend\n * @param {String} trendDisplay\n * @returns {Bool}\n */\nexport const shouldShowTrend = trendDisplay => trendDisplay === 'absolute' || trendDisplay === 'percent';\n\n/**\n * @method isLoadingOrNoColumns\n * @param {Object} dataSources\n * @param {Boolean} loading\n * @returns {Boolean} return true if loading or without columns in dataSources\n */\nexport const isLoadingOrNoColumns = (dataSources, loading) => {\n const data = get(dataSources, 'primary.data.columns[0]', undefined);\n const noColumns = data === undefined;\n return loading || noColumns;\n};\n\n/**\n * Retrieve the valid formatted color\n * @method getFormattedColor\n * @param {String} color\n * @param {String} defaultColor\n * @returns {String} the formatted color\n */\nexport const getFormattedColor = (color, defaultColor) => formatColor(color) || formatColor(defaultColor);\n\n/**\n * Determines if there is a background color\n * @method hasBackground\n * @param {String} backgroundColor\n * @returns true for non-transparent background color\n */\nexport const hasBackground = backgroundColor => !!backgroundColor && backgroundColor !== 'transparent';\n\n/**\n * @method isIdenticalColor\n * @param {String} colorA\n * @param {String} colorB\n * @returns {Boolean}\n */\nexport const isIdenticalColor = (colorA, colorB) =>\n !!colorA && !!colorB && formatColor(colorA.toLowerCase()) === formatColor(colorB.toLowerCase());\n\n/*\n * @method getDefaultColorWithBg\n * @param {Object} props\n * @param {String} props.backgroundColor\n * @param {String} props.defaultFontColor\n * @param {String} props.defaultBlockFontColor\n * @returns {String} defaultColor\n */\nexport const getDefaultColorWithBg = ({ backgroundColor, defaultFontColor, defaultBlockFontColor }) =>\n isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;\n\n/*\n * @method getMajorColor\n * return formatted majorColor.\n * @param {Object} props\n * @param {String} props.majorColor\n * @param {String} props.backgroundColor\n * @param {String} props.defaultFontColor\n * @param {String} props.defaultBlockFontColor\n * @returns {String} majorColor\n */\nexport const getMajorColor = ({ majorColor, backgroundColor, defaultFontColor, defaultBlockFontColor }) => {\n // If backgroundColor is set, but no majorColor,\n // the default majorColor will turn to be defaultBlockFontColor.\n // eg: major color will turn to be white in enterprise mode.\n // however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.\n if (hasBackground(backgroundColor) && !majorColor) {\n return getDefaultColorWithBg({\n backgroundColor,\n defaultFontColor,\n defaultBlockFontColor,\n });\n }\n\n return getFormattedColor(majorColor, defaultFontColor);\n};\n\n/**\n * Get the color for the trend components\n * @method getTrendColor\n * @param {Object} props\n * @param {String} props.trendColor The trendColor value determined from encoding\n * @param {Number} props.trendValue\n * @param {Number} props.majorValue\n * @param {String} props.customizedBgColor\n * @param {String} props.trendDisplay absolute || percent || off\n * @param {Object} defaultColors\n * @returns {String} trendColor\n */\nexport const getTrendColor = ({\n trendColor,\n trendValue,\n majorValue,\n customizedBgColor,\n trendDisplay,\n defaultColors,\n}) => {\n if (trendColor) {\n return trendColor;\n }\n\n if (Number.isNaN(Number(trendValue))) {\n return undefined;\n }\n\n const { defaultFontColor, defaultBlockFontColor, defaultBackgroundColor } = defaultColors;\n\n // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor\n if (\n hasBackground(customizedBgColor) &&\n !isIdenticalColor(customizedBgColor, defaultBackgroundColor) &&\n !isIdenticalColor(customizedBgColor, defaultBlockFontColor)\n ) {\n return defaultBlockFontColor;\n }\n\n // if trendDisplay is percent, and trendValue === value\n // the trend percent = trendValue / (value - trendValue) will return Infinity\n const isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);\n\n if (trendValue === 0 || isInvalidTrend) {\n return defaultFontColor;\n }\n\n return trendValue > 0 ? DELTA_GREEN : DELTA_RED;\n};\n\n/**\n * Computes visualization properties for display component\n * @method computeColors\n * @param {Object} props all viz props\n * @param {Object} defaultColors defaultColors from theme\n * @returns {Object} result\n * @returns {Boolean} backgroundEnabled\n * @returns {String} backgroundColor\n * @returns {String} majorColor\n * @returns {String} trendColor\n * @returns {String} underLabelColor\n */\nexport const computeColors = (props, defaultColors) => {\n const backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);\n const backgroundEnabled = hasBackground(backgroundColor);\n const majorColor = getMajorColor({\n majorColor: props.majorColor,\n backgroundColor,\n defaultFontColor: defaultColors.defaultFontColor,\n defaultBlockFontColor: defaultColors.defaultBlockFontColor,\n });\n const trendColor = getTrendColor({\n trendColor: props.trendColor,\n trendValue: props.trendValue,\n majorValue: props.majorValue,\n customizedBgColor: props.backgroundColor,\n trendDisplay: props.trendDisplay,\n defaultColors,\n });\n // todo: need change it to not depend on majorColor\n const underLabelColor = majorColor;\n\n return {\n backgroundColor,\n backgroundEnabled,\n majorColor,\n trendColor,\n underLabelColor,\n };\n};\n\n/**\n * Format and return the value (major/trend)\n * @method computeText\n * @param {Object} props\n * @param {Number} props.value // The major/trend value\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateValue\n * @returns {Number} major or trend text\n */\nexport const computeText = ({\n value,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateValue,\n}) => {\n let text = isNumerial(value)\n ? formatNumber(value, numberPrecision, {\n useThousandSeparators: shouldUseThousandSeparators, // todo: need update formatNumber\n useTrendUnits: shouldAbbreviateValue,\n })\n : value;\n // When text is undefined, return empty string\n text = text || '';\n return text;\n};\n\n/*\n * @method getMajorText\n * @param {Object} props\n * @param {Number} props.majorValue\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateMajorValue\n * @returns {String} majorText\n */\nexport const getMajorText = ({\n majorValue,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateMajorValue,\n}) =>\n computeText({\n value: majorValue === null ? 'N/A' : majorValue, // if majorValue is null, use `N/A`.\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateValue: shouldAbbreviateMajorValue,\n });\n\n/*\n * @method getTrendText\n * @param {Object} props\n * @param {Number} props.majorValue\n * @param {Number} props.trendValue\n * @param {String} props.trendDisplay\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @returns {String} trendText\n */\nexport const getTrendText = ({\n majorValue,\n trendValue,\n trendDisplay,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n}) => {\n const compute = value =>\n computeText({\n value,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateValue: shouldAbbreviateTrendValue,\n });\n\n if (trendValue === '' || !isNumerial(trendValue)) {\n return '';\n }\n const showPercent = trendDisplay === 'percent';\n if (!showPercent) {\n return compute(trendValue);\n }\n\n const diff = Math.abs(trendValue - majorValue);\n let val = Math.round((trendValue / diff) * 100);\n if (trendValue === 0 && diff === 0) {\n val = 0;\n }\n\n if (!Number.isFinite(val)) {\n return 'N/A';\n }\n const text = compute(val);\n\n return `${text}%`;\n};\n\n/**\n * Helper to determine the font size for an element\n * @method computeFontSize\n * @param {String} text The string to find a size for\n * @param {Object} dimensions\n * @param {Number} dimensions.width The width of the container\n * @param {Number} dimensions.height The height of the container\n * @param {String} [fontFamily='\"Splunk Platform Sans\" ...'] The font being used\n * @param {String} [fontWeight='normal'] Boldness of font\n * @returns {Number} The size to use for fontSize styles\n */\nexport const computeFontSize = (\n text,\n { width, height },\n fontFamily = DEFAULT_FONT_FAMILY,\n fontWeight = 'normal'\n) => {\n const widthInDefaultFont = computeTextSize(text, `${fontWeight} ${DEFAULT_FONT}px ${fontFamily}`);\n const fontSize = Math.min(\n (width / widthInDefaultFont) * DEFAULT_FONT,\n (height / DEFAULT_FONT) * DEFAULT_FONT\n );\n return parseInt(fontSize, 10);\n};\n\n/*\n * @method getMajorFontSize\n * @param {Object} props\n * @param {Number} props.width\n * @param {Number} props.height\n * @param {String} props.unit\n * @param {String} props.majorText\n * @param {Number} props.spaceRatio\n * @returns {Number} majorFontSize\n */\nexport const getMajorFontSize = ({ width, height, unit, majorText, spaceRatio = 1 }) => {\n const majorTextCalc = unit ? `${unit}${majorText}` : majorText;\n return computeFontSize(majorTextCalc, {\n width: width * spaceRatio,\n height,\n });\n};\n\n/*\n * @method getTrendFontSize\n * @param {Object} props\n * @param {Number} props.width\n * @param {Number} props.height\n * @param {String} props.trendText\n * @param {Number} props.spaceRatio\n * @returns {Number} trendFontSize\n */\nexport const getTrendFontSize = ({ width, height, trendText, spaceRatio = 1 }) => {\n let trendFontSize = 12;\n if (spaceRatio > 0) {\n trendFontSize = computeFontSize(trendText, {\n width: width * spaceRatio,\n height,\n });\n trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;\n }\n return trendFontSize;\n};\n\n/*\n * The height of underLabel should no more than 12px\n * @param {Number} height\n * @return {Number} height || DEFAULT_FONT\n */\nexport const getUnderLabelHeight = height => (height > DEFAULT_FONT ? DEFAULT_FONT : height);\n\n/*\n * @param {Object} config\n * @param {String} underLabel\n * @param {Number} width width of underLabel\n * @param {Number} height height of underLabel\n * @param {Number} fond size of underLabel\n */\nexport const getUnderLabel = ({ underLabel, width, height }) =>\n // todo: may need truncate underLabel later\n computeFontSize(underLabel, {\n width,\n height,\n });\n\n/**\n * Compute value and font size for major and trend\n * @method getMajorAndTrend\n * @param {Object} props\n * @param {Number} props.width // Width of the text container\n * @param {Number} props.height // Height of the text container\n * @param {Number} props.majorValue // Major value\n * @param {Number} props.trendValue // Trend value\n * @param {Number} props.majorFontSize\n * @param {Number} props.trendFontSize\n * @param {String} props.trendDisplay\n * @param {String} props.unit // Unit for the value\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @param {Bool} props.shouldAbbreviateMajorValue\n * @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size\n */\nexport const getMajorAndTrend = ({\n width,\n height,\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n trendDisplay,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n shouldAbbreviateMajorValue,\n}) => {\n const majorTextSpaceRatio = isNumerial(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;\n const textContentWidth = width * 0.9;\n const textContentHeight = height * 0.9;\n const majorText = getMajorText({\n majorValue,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateMajorValue,\n });\n const majorTextFontSize =\n majorFontSize ||\n getMajorFontSize({\n width: textContentWidth,\n height: textContentHeight,\n unit,\n majorText,\n spaceRatio: majorTextSpaceRatio,\n });\n const trendText = getTrendText({\n majorValue,\n trendValue,\n trendDisplay,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n });\n\n const trendTextFontSize =\n trendFontSize ||\n getTrendFontSize({\n width: textContentWidth,\n height: textContentHeight,\n trendText,\n spaceRatio: 1 - majorTextSpaceRatio,\n });\n\n return {\n majorText,\n majorTextFontSize,\n trendText,\n trendTextFontSize,\n };\n};\n\n/*\n * @method updateVizInSmallSpace\n * @param {Object} props\n * @param {Number} props.width // Width of the text container\n * @param {Number} props.height // Height of the text container\n * @param {Object} props.toRemoveList\n * @param {Number} props.majorValue // Major value\n * @param {Number} props.trendValue // Trend value\n * @param {Number} props.majorFontSize\n * @param {Number} props.trendFontSize\n * @param {Number} props.majorTextFontSize\n * @param {String} props.unit // Unit for the value\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @returns {Object} results\n * @returns {Object} results.newMajorAndTrend\n * @returns {Object} results.updatedProps\n */\nexport const updateVizInSmallSpace = ({\n width,\n height,\n toRemoveList,\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n majorTextFontSize,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n}) => {\n let removeIndex = 0;\n let newProps = {}; // options need to be updated\n let newMajorAndTrend = {};\n let newTextSize = majorTextFontSize;\n\n // remove info on viz to make textFontSize >= 12px;\n while (newTextSize < 12 && removeIndex < toRemoveList.length) {\n const toRemove = toRemoveList[removeIndex];\n newProps = {\n ...newProps,\n ...{\n [toRemove.key]: toRemove.value,\n },\n };\n\n newMajorAndTrend = getMajorAndTrend({\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n width,\n height,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n ...newProps,\n });\n\n newTextSize = newMajorAndTrend.majorTextFontSize;\n removeIndex += 1;\n }\n\n // truncate text if textFontSize is still less than 12\n if (newTextSize < 12) {\n const truncateValue = `${majorValue.toString().slice(0, 3)}...`;\n newMajorAndTrend = getMajorAndTrend({\n majorValue: truncateValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n width,\n height,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n ...newProps,\n });\n }\n\n return { newMajorAndTrend, updatedProps: newProps };\n};\n\n/*\n * @method computeSingleValueContent\n * @param {Object} props\n * @param {Number} props.contentWidth\n * @param {Number} props.contentHeight\n * @param {Number} props.containerWidth\n * @param {Number} props.containerHeight\n * @param {Number} props.majorValue // Major value\n * @param {Number} props.trendValue // Trend value\n * @param {Number} props.majorFontSize\n * @param {Number} props.trendFontSize\n * @param {String} props.trendDisplay\n * @param {String} props.unit // Unit for the value\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @param {Bool} props.shouldAbbreviateMajorValue\n * @param {Object} props.toRemoveList\n * @returns {Object} results\n * @returns {String} results.majorText\n * @returns {String} results.trendText\n * @returns {Number} results.majorTextFontSize\n * @returns {Number} results.trendTextFontSize\n * @returns {String} results.majorValueTitle\n * @returns {Object} results.smallVizProps\n */\nexport const computeSingleValueContent = ({\n contentWidth,\n contentHeight,\n containerWidth,\n containerHeight,\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n trendDisplay,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n shouldAbbreviateMajorValue,\n toRemoveList,\n}) => {\n let { majorText, trendText, majorTextFontSize, trendTextFontSize } = getMajorAndTrend({\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n trendDisplay,\n width: contentWidth,\n height: contentHeight,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n shouldAbbreviateMajorValue,\n });\n const majorValueTitle = majorText;\n let smallVizProps = {};\n\n // update viz in small space\n // if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit\n // or truncate major value to make the major font size >= 12\n if (majorTextFontSize < 12) {\n const { newMajorAndTrend, updatedProps } = updateVizInSmallSpace({\n width: containerWidth,\n height: containerHeight,\n toRemoveList,\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n majorTextFontSize,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n });\n\n ({ majorText, trendText, majorTextFontSize, trendTextFontSize } = newMajorAndTrend);\n smallVizProps = updatedProps;\n }\n return {\n majorText,\n trendText,\n majorTextFontSize,\n trendTextFontSize,\n majorValueTitle,\n smallVizProps,\n };\n};\n\nexport const minimallyTruncateStringToWidth = ({\n text,\n fontSize = DEFAULT_FONT,\n fontFamily = DEFAULT_FONT_FAMILY,\n fontWeight = 'normal',\n containerWidth,\n}) => {\n let textWidth = computeTextSize(text, `${fontWeight} ${fontSize}px ${fontFamily}`);\n let modifiedText = text;\n\n const ellipsesLength = computeTextSize('...', `${fontWeight} ${fontSize}px ${fontFamily}`);\n // `containerWidth - ellipsesLength > 0` condition ensures space even exists for text.\n if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {\n // Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.\n // `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.\n // `text.length > 1` condition included to keep at least the first number.\n while (textWidth + ellipsesLength > containerWidth && modifiedText.length > 1) {\n modifiedText = modifiedText.substring(0, modifiedText.length - 1);\n textWidth = computeTextSize(modifiedText, `normal ${fontSize}px ${fontFamily}`);\n }\n\n modifiedText = `${modifiedText}...`;\n }\n\n return modifiedText;\n};\n\n/*\n * @method computeSingleValueRadialContent\n * @param {Object} props\n * @param {Number} props.contentWidth\n * @param {Number} props.contentHeight\n * @param {Number} props.containerWidth\n * @param {Number} props.containerHeight\n * @param {Number} props.majorValue // Major value\n * @param {Number} props.trendValue // Trend value\n * @param {Number} props.majorFontSize\n * @param {Number} props.trendFontSize\n * @param {String} props.trendDisplay\n * @param {String} props.unit // Unit for the value\n * @param {Number} props.numberPrecision\n * @param {Bool} props.shouldUseThousandSeparators\n * @param {Bool} props.shouldAbbreviateTrendValue\n * @param {Bool} props.shouldAbbreviateMajorValue,\n * @param {Object} props.toRemoveList\n * @param {Bool} props.smallViz\n * @returns {Object} results\n * @returns {String} results.majorText\n * @returns {String} results.trendText\n * @returns {Number} results.majorTextFontSize\n * @returns {Number} results.trendTextFontSize\n * @returns {String} results.majorValueTitle\n * @returns {Object} results.smallVizProps\n */\nexport const computeSingleValueRadialContent = ({\n contentWidth,\n contentHeight,\n containerWidth,\n containerHeight,\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n trendDisplay,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n shouldAbbreviateMajorValue,\n smallViz,\n}) => {\n let { majorText, trendText, majorTextFontSize, trendTextFontSize } = getMajorAndTrend({\n majorValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n trendDisplay,\n width: contentWidth,\n height: contentHeight,\n unit,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n shouldAbbreviateMajorValue,\n });\n\n const majorValueTitle = majorText;\n let smallVizProps = {};\n\n // custom logic for viz in small space\n // if not showing the radial graph (if `smallViz` is true), then compute truncated major value\n // and font sizes\n if (smallViz) {\n const truncateValue = minimallyTruncateStringToWidth({\n text: majorValue,\n fontWeight: 'bold',\n fontSize: 12,\n containerWidth,\n });\n\n ({ majorText, trendText, majorTextFontSize, trendTextFontSize } = getMajorAndTrend({\n majorValue: truncateValue,\n trendValue,\n majorFontSize,\n trendFontSize,\n width: containerWidth,\n height: containerHeight,\n unit,\n trendDisplay,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateTrendValue,\n shouldAbbreviateMajorValue,\n }));\n\n smallVizProps = {\n trendDisplay,\n unit,\n };\n }\n\n return {\n majorText,\n trendText,\n majorTextFontSize,\n trendTextFontSize,\n majorValueTitle,\n smallVizProps,\n };\n};\n\n/**\n * Get the colors for a graph\n *\n * @method getGraphColors\n * @param {Object} options\n * @param {Bool} options.backgroundEnabled // Flag to turn on color mode\n * @param {String} options.backgroundColor // The current background color, overrides trend background color\n * @param {Object} options.defaultColors // Default colors by severity\n * @param {Function} options.customColorFormatter // must return { background, stroke } given a color\n * @returns {Object} { background, stroke } colors\n * @private\n */\nexport const getGraphColors = ({\n backgroundEnabled,\n backgroundColor,\n defaultColors,\n customColorFormatter,\n}) => {\n // Only do custom colors in block mode\n if (backgroundEnabled) {\n // Check if the user defined colors to use\n if (backgroundColor && typeof customColorFormatter === 'function') {\n return customColorFormatter(backgroundColor);\n }\n }\n\n return defaultColors.none;\n};\n\n/**\n * Adjust rgb value if it equals to 0 or 255\n * @method adjustRGB\n * @param {Number} rgb [0 - 255]\n * @param {Number} delta\n * @returns {Number} adjusted rgb\n * @private\n */\nexport const adjustRGB = (rgb, delta) => {\n if (rgb === 255) {\n return rgb - delta;\n }\n\n if (rgb === 0) {\n return rgb + delta;\n }\n\n return rgb;\n};\n\n/**\n * Modifies colors by multiplying by a given ratio\n * @method changeColor\n * @param {String} color // Color to modify\n * @param {Number} ratio // Float to modify color\n * @returns {String} new color\n * @private\n */\nconst changeColor = (color, ratio) => {\n const hex = color.replace(/(0x|#)/, '');\n const r = parseInt(hex.substr(0, 2), 16);\n const g = parseInt(hex.substr(2, 2), 16);\n const b = parseInt(hex.substr(4, 2), 16);\n\n // Multiply by given ratio, make sure is between 0 and 255;\n let newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);\n let newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);\n let newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0);\n\n // If the color is not changed\n // case 1: the color is (0, 0 0)\n // lighten color (80, 80, 80)\n // darken color (40, 40, 40)\n // case 2: the color is (255, 255, 255)\n // lighten color (235, 235, 235)\n // darken color (175, 175, 175)\n // case 3: the color is e.g. (0, 255, 0)\n // new color (20, 235, 20)\n if (newR === r && newG === g && newB === b) {\n if (newR === 0 && newG === 0 && newB === 0) {\n if (ratio > 1) {\n newR = adjustRGB(newR, 80);\n newG = adjustRGB(newG, 80);\n newB = adjustRGB(newB, 80);\n } else {\n newR = adjustRGB(newR, 40);\n newG = adjustRGB(newG, 40);\n newB = adjustRGB(newB, 40);\n }\n } else if (newR === 255 && newG === 255 && newB === 255) {\n if (ratio > 1) {\n newR = adjustRGB(newR, 20);\n newG = adjustRGB(newG, 20);\n newB = adjustRGB(newB, 20);\n } else {\n newR = adjustRGB(newR, 80);\n newG = adjustRGB(newG, 80);\n newB = adjustRGB(newB, 80);\n }\n } else {\n newR = adjustRGB(newR, 20);\n newG = adjustRGB(newG, 20);\n newB = adjustRGB(newB, 20);\n }\n }\n\n return (\n `#${newR.toString(16).padStart(2, 0)}` +\n `${newG.toString(16).padStart(2, 0)}` +\n `${newB.toString(16).padStart(2, 0)}`\n );\n};\n\n/**\n * Lighten a given color\n * @method lighten\n * @param {String} color\n * @returns {String}\n * @private\n */\nexport const lighten = color => changeColor(color, 1.3);\n\n/**\n * Darkens a given color\n * @method darken\n * @param {String} color\n * @returns {String}\n * @private\n */\nexport const darken = color => changeColor(color, 0.5);\n\n/** consistent token structure: handle callback to add value and name in event payload\n * @method handleValueClickCallback\n * @param {Object} ev\n * @param {String | Number} majorValue\n * @param {String} majorValueField\n * @param {Number} trendValue\n * @param {Function} onValueClick\n */\nexport const handleValueClickCallback = (\n ev,\n majorValue,\n majorValueField,\n trendValue,\n onValueClick,\n trellisEnabled = false,\n trellisSplityBy = '',\n trellisKey = ''\n) => {\n let payload = {\n trendValue,\n value: majorValue,\n name: majorValueField,\n };\n if (trellisEnabled) {\n payload = { ...payload, 'trellis.name': trellisSplityBy, 'trellis.value': trellisKey };\n }\n return onValueClick({ ...ev, payload });\n};\n","module.exports = require(\"@splunk/visualizations-shared/propUtils\");","module.exports = require(\"@splunk/visualizations-shared/colorConstants\");"],"sourceRoot":""}
|