@splunk/visualizations 28.3.0 → 28.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/Area/Area.d.ts.map +1 -1
  2. package/Area.config.js +0 -1
  3. package/Area.config.js.map +2 -2
  4. package/Area.js +495 -99
  5. package/Area.js.map +3 -3
  6. package/Bar/Bar.d.ts.map +1 -1
  7. package/Bar.config.js +0 -1
  8. package/Bar.config.js.map +2 -2
  9. package/Bar.js +505 -99
  10. package/Bar.js.map +3 -3
  11. package/Bubble.config.js +0 -1
  12. package/Bubble.config.js.map +2 -2
  13. package/Bubble.js +494 -86
  14. package/Bubble.js.map +3 -3
  15. package/CHANGELOG.external.md +76 -0
  16. package/ChoroplethSvg/ChoroplethSvg.d.ts +4 -3
  17. package/ChoroplethSvg/ChoroplethSvg.d.ts.map +1 -1
  18. package/ChoroplethSvg.config.js +1 -3
  19. package/ChoroplethSvg.config.js.map +2 -2
  20. package/ChoroplethSvg.js +539 -103
  21. package/ChoroplethSvg.js.map +4 -4
  22. package/Column/Column.d.ts.map +1 -1
  23. package/Column.config.js +0 -1
  24. package/Column.config.js.map +2 -2
  25. package/Column.js +495 -99
  26. package/Column.js.map +3 -3
  27. package/Ellipse.js +528 -104
  28. package/Ellipse.js.map +4 -4
  29. package/Events/PureEvents/PureEvents.d.ts.map +1 -1
  30. package/Events.js +612 -149
  31. package/Events.js.map +4 -4
  32. package/FillerGauge/FillerGauge.d.ts.map +1 -1
  33. package/FillerGauge/PureFillerGauge/FillerGauge.d.ts.map +1 -1
  34. package/FillerGauge.js +535 -140
  35. package/FillerGauge.js.map +4 -4
  36. package/Image/Image.d.ts.map +1 -1
  37. package/Image.js +564 -108
  38. package/Image.js.map +4 -4
  39. package/Line/Line.d.ts.map +1 -1
  40. package/Line/lineUtils.d.ts.map +1 -1
  41. package/Line/mockdata/LineData.d.ts +59 -0
  42. package/Line/mockdata/LineData.d.ts.map +1 -1
  43. package/Line.config.js +0 -1
  44. package/Line.config.js.map +2 -2
  45. package/Line.js +601 -100
  46. package/Line.js.map +3 -3
  47. package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts +5 -0
  48. package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts.map +1 -1
  49. package/LinkGraph/PureLinkGraph/PureLinkGraphUtils.d.ts.map +1 -1
  50. package/LinkGraph/PureLinkGraph/components/Graph.d.ts +9 -1
  51. package/LinkGraph/PureLinkGraph/components/Graph.d.ts.map +1 -1
  52. package/LinkGraph/PureLinkGraph/components/GraphStyles.d.ts.map +1 -1
  53. package/LinkGraph/PureLinkGraph/components/Node.d.ts +1 -0
  54. package/LinkGraph/PureLinkGraph/components/Node.d.ts.map +1 -1
  55. package/LinkGraph/PureLinkGraph/components/Nodes.d.ts +1 -0
  56. package/LinkGraph/PureLinkGraph/components/Nodes.d.ts.map +1 -1
  57. package/LinkGraph/PureLinkGraph/measurementUtils.d.ts +16 -0
  58. package/LinkGraph/PureLinkGraph/measurementUtils.d.ts.map +1 -0
  59. package/LinkGraph/PureLinkGraph/utils/iconLoader.d.ts.map +1 -1
  60. package/LinkGraph/config.d.ts.map +1 -1
  61. package/LinkGraph.config.js +15 -1
  62. package/LinkGraph.config.js.map +2 -2
  63. package/LinkGraph.js +1355 -654
  64. package/LinkGraph.js.map +4 -4
  65. package/Map/Map.d.ts +2 -2
  66. package/Map/Map.d.ts.map +1 -1
  67. package/Map/PureMap/BubbleLayer.d.ts +5 -0
  68. package/Map/PureMap/BubbleLayer.d.ts.map +1 -1
  69. package/Map/PureMap/LocalChoroplethLayer.d.ts.map +1 -1
  70. package/Map/PureMap/PureMap.d.ts.map +1 -1
  71. package/Map/PureMap/PureMapContainer.d.ts.map +1 -1
  72. package/Map/PureMap/Tooltip.d.ts.map +1 -1
  73. package/Map/config.d.ts.map +1 -1
  74. package/Map.config.js +0 -1
  75. package/Map.config.js.map +2 -2
  76. package/Map.js +738 -228
  77. package/Map.js.map +4 -4
  78. package/Markdown/Markdown.d.ts.map +1 -1
  79. package/Markdown.js +548 -95
  80. package/Markdown.js.map +4 -4
  81. package/MarkerGauge/MarkerGauge.d.ts +5 -1
  82. package/MarkerGauge/MarkerGauge.d.ts.map +1 -1
  83. package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts +4 -0
  84. package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts.map +1 -1
  85. package/MarkerGauge/config.d.ts.map +1 -1
  86. package/MarkerGauge.config.js +121 -3
  87. package/MarkerGauge.config.js.map +3 -3
  88. package/MarkerGauge.js +1318 -142
  89. package/MarkerGauge.js.map +4 -4
  90. package/NetworkGraph/NetworkGraph.d.ts +22 -0
  91. package/NetworkGraph/NetworkGraph.d.ts.map +1 -0
  92. package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts +60 -0
  93. package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts.map +1 -0
  94. package/NetworkGraph/PureNetworkGraph/components/Link.d.ts +19 -0
  95. package/NetworkGraph/PureNetworkGraph/components/Link.d.ts.map +1 -0
  96. package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts +29 -0
  97. package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts.map +1 -0
  98. package/NetworkGraph/PureNetworkGraph/components/Node.d.ts +27 -0
  99. package/NetworkGraph/PureNetworkGraph/components/Node.d.ts.map +1 -0
  100. package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts +12 -0
  101. package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts.map +1 -0
  102. package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts +13 -0
  103. package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts.map +1 -0
  104. package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts +140 -0
  105. package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts.map +1 -0
  106. package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts +89 -0
  107. package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts.map +1 -0
  108. package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts +47 -0
  109. package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts.map +1 -0
  110. package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts +78 -0
  111. package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts.map +1 -0
  112. package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts +111 -0
  113. package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts.map +1 -0
  114. package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts +123 -0
  115. package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts.map +1 -0
  116. package/NetworkGraph/config.d.ts +4 -0
  117. package/NetworkGraph/config.d.ts.map +1 -0
  118. package/NetworkGraph/index.d.ts +3 -0
  119. package/NetworkGraph/index.d.ts.map +1 -0
  120. package/NetworkGraph.config.js +938 -0
  121. package/NetworkGraph.config.js.map +7 -0
  122. package/NetworkGraph.js +6793 -0
  123. package/NetworkGraph.js.map +7 -0
  124. package/ParallelCoordinates.js +532 -93
  125. package/ParallelCoordinates.js.map +4 -4
  126. package/Pie/Pie.d.ts.map +1 -1
  127. package/Pie/pieUtils.d.ts.map +1 -1
  128. package/Pie.js +510 -101
  129. package/Pie.js.map +3 -3
  130. package/Punchcard.js +523 -84
  131. package/Punchcard.js.map +4 -4
  132. package/Rectangle.js +537 -113
  133. package/Rectangle.js.map +4 -4
  134. package/Sankey/PureSankey/SankeyTooltip.d.ts.map +1 -1
  135. package/Sankey.js +562 -111
  136. package/Sankey.js.map +4 -4
  137. package/Scatter/Scatter.d.ts.map +1 -1
  138. package/Scatter.config.js +0 -1
  139. package/Scatter.config.js.map +2 -2
  140. package/Scatter.js +505 -99
  141. package/Scatter.js.map +3 -3
  142. package/SingleValue/SingleValue.d.ts.map +1 -1
  143. package/SingleValue/config.d.ts.map +1 -1
  144. package/SingleValue.config.js +15 -2
  145. package/SingleValue.config.js.map +2 -2
  146. package/SingleValue.js +656 -173
  147. package/SingleValue.js.map +3 -3
  148. package/SingleValueBasic.js.map +1 -1
  149. package/SingleValueIcon/SingleValueIcon.d.ts.map +1 -1
  150. package/SingleValueIcon/config.d.ts.map +1 -1
  151. package/SingleValueIcon.config.js +0 -1
  152. package/SingleValueIcon.config.js.map +2 -2
  153. package/SingleValueIcon.js +512 -124
  154. package/SingleValueIcon.js.map +3 -3
  155. package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts +0 -8
  156. package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts.map +1 -1
  157. package/SingleValueRadial/SingleValueRadial.d.ts.map +1 -1
  158. package/SingleValueRadial.config.js +0 -1
  159. package/SingleValueRadial.config.js.map +2 -2
  160. package/SingleValueRadial.js +517 -124
  161. package/SingleValueRadial.js.map +4 -4
  162. package/SparkLine.js +46 -8
  163. package/SparkLine.js.map +2 -2
  164. package/Table/PureTable.d.ts +10 -0
  165. package/Table/PureTable.d.ts.map +1 -1
  166. package/Table/cells/SparklineCell.d.ts.map +1 -1
  167. package/Table/config.d.ts.map +1 -1
  168. package/Table/hooks.d.ts +4 -0
  169. package/Table/hooks.d.ts.map +1 -1
  170. package/Table.config.js +1 -1
  171. package/Table.config.js.map +2 -2
  172. package/Table.js +760 -223
  173. package/Table.js.map +4 -4
  174. package/Timeline/PureTimeline/src/CursorPlugin.d.ts.map +1 -1
  175. package/Timeline/PureTimeline/src/TimelineLegend.d.ts.map +1 -1
  176. package/Timeline/config.d.ts.map +1 -1
  177. package/Timeline.config.js +31 -12
  178. package/Timeline.config.js.map +4 -4
  179. package/Timeline.js +649 -211
  180. package/Timeline.js.map +4 -4
  181. package/common/Charting.d.ts +5 -0
  182. package/common/Charting.d.ts.map +1 -1
  183. package/common/Charting.js +12 -0
  184. package/common/Charting.js.map +2 -2
  185. package/common/OptionsDoc.js.map +1 -1
  186. package/common/ThemesDoc.js +0 -1
  187. package/common/ThemesDoc.js.map +2 -2
  188. package/common/TimeSeriesChartWrapper.d.ts +24 -11
  189. package/common/TimeSeriesChartWrapper.d.ts.map +1 -1
  190. package/common/TimeSeriesChartWrapper.js +561 -83
  191. package/common/TimeSeriesChartWrapper.js.map +4 -4
  192. package/common/chartingUtils.d.ts +45 -5
  193. package/common/chartingUtils.d.ts.map +1 -1
  194. package/common/chartingUtils.js +102 -8
  195. package/common/chartingUtils.js.map +3 -3
  196. package/common/editorConfig/AxesChartDataConfig.d.ts.map +1 -1
  197. package/common/hocs/withTrellis.d.ts.map +1 -1
  198. package/common/interfaces/DashboardVizProps.d.ts +0 -3
  199. package/common/interfaces/DashboardVizProps.d.ts.map +1 -1
  200. package/common/interfaces/DataSource.d.ts +1 -1
  201. package/common/interfaces/DataSource.d.ts.map +1 -1
  202. package/common/shapeUtils.js +5 -20
  203. package/common/shapeUtils.js.map +2 -2
  204. package/common/utils/dataUtils.d.ts.map +1 -1
  205. package/common/utils/dataUtils.js +5 -4
  206. package/common/utils/dataUtils.js.map +2 -2
  207. package/common/utils/mapUtils.js +16 -9
  208. package/common/utils/mapUtils.js.map +2 -2
  209. package/common/utils/singleValueUtils.js +17 -18
  210. package/common/utils/singleValueUtils.js.map +2 -2
  211. package/common/utils/textUtils.d.ts +20 -0
  212. package/common/utils/textUtils.d.ts.map +1 -0
  213. package/common/utils/textUtils.js +76 -0
  214. package/common/utils/textUtils.js.map +7 -0
  215. package/common/utils/trellisUtils.d.ts.map +1 -1
  216. package/common/utils/trellisUtils.js +12 -14
  217. package/common/utils/trellisUtils.js.map +2 -2
  218. package/common/withDashboardViz.d.ts.map +1 -1
  219. package/common/withDashboardViz.js +544 -84
  220. package/common/withDashboardViz.js.map +4 -4
  221. package/package.json +33 -26
  222. package/common/utils/styleUtils.d.ts +0 -2
  223. package/common/utils/styleUtils.d.ts.map +0 -1
  224. package/common/utils/styleUtils.js +0 -30
  225. package/common/utils/styleUtils.js.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/common/utils/singleValueUtils.js", "esm-externals:lodash", "esm-externals:@splunk/visualizations-shared/numberUtils", "esm-externals:@splunk/visualizations-shared/domUtils", "esm-externals:@splunk/visualizations-shared/propUtils", "esm-externals:@splunk/visualizations-shared/colorConstants"],
4
- "sourcesContent": ["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 majorValueDisplay,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateMajorValue,\n}) =>\n computeText({\n value: majorValueDisplay === null ? 'N/A' : majorValueDisplay, // if majorValueDisplay 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 = (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.majorValueDisplay // Major value display\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 majorValueDisplay,\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\n // use majorValueDisplay here for display only\n const majorText = getMajorText({\n majorValueDisplay,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateMajorValue,\n });\n\n const majorTextFontSize =\n majorFontSize ||\n getMajorFontSize({\n width: textContentWidth,\n height: textContentHeight,\n unit,\n majorText,\n spaceRatio: majorTextSpaceRatio,\n });\n\n // use majorValue here for calculations\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 majorValueDisplay,\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 majorValueDisplay,\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 = `${(majorValueDisplay || majorValue).toString().slice(0, 3)}...`;\n newMajorAndTrend = getMajorAndTrend({\n majorValue,\n majorValueDisplay: 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.majorValueDisplay // Major value display\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 majorValueDisplay,\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 majorValueDisplay: majorValueDisplay || 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 majorValueDisplay: majorValueDisplay || 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 majorValueDisplay,\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 majorValueDisplay: majorValueDisplay || 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: majorValueDisplay || majorValue,\n fontWeight: 'bold',\n fontSize: 12,\n containerWidth,\n });\n\n ({ majorText, trendText, majorTextFontSize, trendTextFontSize } = getMajorAndTrend({\n majorValueDisplay: truncateValue,\n majorValue,\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 * @param {Boolean} trellisEnabled\n * @param {String} trellisSplitBy\n * @param {String} trellisKey\n */\nexport const handleValueClickCallback = (\n ev,\n majorValue,\n majorValueField,\n trendValue,\n onValueClick,\n trellisEnabled = false,\n trellisSplitBy = '',\n trellisKey = ''\n) =>\n onValueClick({\n ...ev,\n payload: {\n trendValue,\n value: majorValue,\n name: majorValueField,\n ...(trellisEnabled && {\n 'trellis.name': trellisSplitBy,\n 'trellis.value': trellisKey,\n }),\n },\n });\n\n/** handle trend color when trend display is percent\n * @method getTrendColorWithPercent\n * @param {Object} options\n * @returns {Object}\n */\nexport const getTrendColorWithPercent = options => {\n const shouldUsePercentTrendColor =\n options.trendColor === '> trendValue | rangeValue(trendColorEditorConfig)' &&\n options.trendDisplay === 'percent';\n\n return shouldUsePercentTrendColor\n ? {\n trendColor: '> trendValuePercent | rangeValue(trendColorEditorConfig)',\n }\n : {};\n};\n", "\nimport * as defaultImport from \"lodash\";\nexport * from \"lodash\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualizations-shared/numberUtils\";\nexport * from \"@splunk/visualizations-shared/numberUtils\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualizations-shared/domUtils\";\nexport * from \"@splunk/visualizations-shared/domUtils\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualizations-shared/propUtils\";\nexport * from \"@splunk/visualizations-shared/propUtils\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualizations-shared/colorConstants\";\nexport * from \"@splunk/visualizations-shared/colorConstants\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,2BAAc;AACd,IAAO,iBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,gCAAc;A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,iBAAiB;AAE7B,SAAO,6BACD;AAAA,IACI,YAAY;AAAA,EAChB,IACA,CAAC;AACX;",
4
+ "sourcesContent": ["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 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,\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 majorValueDisplay,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateMajorValue,\n}) =>\n computeText({\n value: majorValueDisplay === null ? 'N/A' : majorValueDisplay, // if majorValueDisplay 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 = (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 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.majorValueDisplay // Major value display\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 majorValueDisplay,\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\n // use majorValueDisplay here for display only\n const majorText = getMajorText({\n majorValueDisplay,\n numberPrecision,\n shouldUseThousandSeparators,\n shouldAbbreviateMajorValue,\n });\n\n const majorTextFontSize =\n majorFontSize ||\n getMajorFontSize({\n width: textContentWidth,\n height: textContentHeight,\n unit,\n majorText,\n spaceRatio: majorTextSpaceRatio,\n });\n\n // use majorValue here for calculations\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 majorValueDisplay,\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 majorValueDisplay,\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 = `${(majorValueDisplay || majorValue).toString().slice(0, 3)}...`;\n newMajorAndTrend = getMajorAndTrend({\n majorValue,\n majorValueDisplay: 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.majorValueDisplay // Major value display\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 majorValueDisplay,\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 majorValueDisplay: majorValueDisplay || 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 majorValueDisplay: majorValueDisplay || 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 majorValueDisplay,\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 majorValueDisplay: majorValueDisplay || 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: majorValueDisplay || majorValue,\n fontWeight: 'bold',\n fontSize: 12,\n containerWidth,\n });\n\n ({ majorText, trendText, majorTextFontSize, trendTextFontSize } = getMajorAndTrend({\n majorValueDisplay: truncateValue,\n majorValue,\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 * @param {Object} trellisContext\n * @param {Boolean} trellisContext.trellisEnabled\n * @param {String} trellisContext.trellisSplitBy\n * @param {String} trellisContext.trellisKey\n */\nexport const handleValueClickCallback = (\n ev,\n majorValue,\n majorValueField,\n trendValue,\n onValueClick,\n trellisContext = {}\n) => {\n const { trellisEnabled = false, trellisSplitBy = '', trellisKey = '' } = trellisContext;\n\n return onValueClick({\n ...ev,\n payload: {\n trendValue,\n value: majorValue,\n name: majorValueField,\n ...(trellisEnabled && {\n 'trellis.name': trellisSplitBy,\n 'trellis.value': trellisKey,\n }),\n },\n });\n};\n\n/** handle trend color when trend display is percent\n * @method getTrendColorWithPercent\n * @param {Object} options\n * @returns {Object}\n */\nexport const getTrendColorWithPercent = options => {\n const shouldUsePercentTrendColor =\n options.trendColor === '> trendValue | rangeValue(trendColorEditorConfig)' &&\n options.trendDisplay === 'percent';\n\n return shouldUsePercentTrendColor\n ? {\n trendColor: '> trendValuePercent | rangeValue(trendColorEditorConfig)',\n }\n : {};\n};\n", "\nimport * as defaultImport from \"lodash\";\nexport * from \"lodash\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualizations-shared/numberUtils\";\nexport * from \"@splunk/visualizations-shared/numberUtils\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualizations-shared/domUtils\";\nexport * from \"@splunk/visualizations-shared/domUtils\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualizations-shared/propUtils\";\nexport * from \"@splunk/visualizations-shared/propUtils\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualizations-shared/colorConstants\";\nexport * from \"@splunk/visualizations-shared/colorConstants\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,2BAAc;AACd,IAAO,iBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,gCAAc;AACd,IAAO,sBAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,6BAAc;AACd,IAAO,mBAAS,aAAaA,iB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port", "defaultImport", "defaultImport", "defaultImport"]
7
7
  }
@@ -0,0 +1,20 @@
1
+ export declare const VIZ_FONT_FAMILY = "'Splunk Platform Sans', 'Splunk Data Sans', Roboto, Droid, 'Helvetica Neue', Helvetica, Arial, sans-serif";
2
+ /**
3
+ * Return text width
4
+ * @method computeTextWidth
5
+ * @param {String} text
6
+ * @param {String} font
7
+ * @returns {Number} width of text with font
8
+ */
9
+ export declare const computeTextWidth: (text: string, font: string) => number;
10
+ /**
11
+ * Return truncated text
12
+ * @method truncateText
13
+ * @param {String} text
14
+ * @param {Number} maxWidth
15
+ * @param {String} truncationType
16
+ * @param {String} font
17
+ * @returns {String} truncated text
18
+ */
19
+ export declare const truncateText: (text: string, maxWidth: number, truncationType: "ellipsisEnd" | "ellipsisMiddle" | "ellipsisStart", font?: string) => string;
20
+ //# sourceMappingURL=textUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textUtils.d.ts","sourceRoot":"","sources":["../../src/common/utils/textUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,8GACmF,CAAC;AAEhH;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,MAM7D,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GACrB,MAAM,MAAM,EACZ,UAAU,MAAM,EAChB,gBAAgB,aAAa,GAAG,gBAAgB,GAAG,eAAe,EAClE,aAAgC,KACjC,MA4CF,CAAC"}
@@ -0,0 +1,76 @@
1
+ /* Copyright © 2020 Splunk Inc.
2
+ SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
3
+ in part without a valid written license from Splunk Inc. is PROHIBITED. */
4
+ "use strict";
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+
23
+ // src/common/utils/textUtils.ts
24
+ var textUtils_exports = {};
25
+ __export(textUtils_exports, {
26
+ VIZ_FONT_FAMILY: () => VIZ_FONT_FAMILY,
27
+ computeTextWidth: () => computeTextWidth,
28
+ truncateText: () => truncateText
29
+ });
30
+ module.exports = __toCommonJS(textUtils_exports);
31
+ var VIZ_FONT_FAMILY = "'Splunk Platform Sans', 'Splunk Data Sans', Roboto, Droid, 'Helvetica Neue', Helvetica, Arial, sans-serif";
32
+ var computeTextWidth = (text, font) => {
33
+ const canvas = document.createElement("canvas");
34
+ const context = canvas.getContext("2d");
35
+ context.font = font;
36
+ const measure = context.measureText(text);
37
+ return measure.width;
38
+ };
39
+ var truncateText = (text, maxWidth, truncationType, font = `10px ${VIZ_FONT_FAMILY}`) => {
40
+ const canvas = document.createElement("canvas");
41
+ const context = canvas.getContext("2d");
42
+ if (!context) return text;
43
+ context.font = font;
44
+ const ellipsis = "...";
45
+ const ellipsisWidth = context.measureText(ellipsis).width;
46
+ const fullTextWidth = context.measureText(text).width;
47
+ if (fullTextWidth <= maxWidth) {
48
+ return text;
49
+ }
50
+ if (truncationType === "ellipsisEnd") {
51
+ for (let i = text.length - 1; i > 0; i -= 1) {
52
+ const truncatedText = text.slice(0, i) + ellipsis;
53
+ if (context.measureText(truncatedText).width <= maxWidth) {
54
+ return truncatedText;
55
+ }
56
+ }
57
+ } else if (truncationType === "ellipsisStart") {
58
+ for (let i = 0; i < text.length; i += 1) {
59
+ const truncatedText = ellipsis + text.slice(i);
60
+ if (context.measureText(truncatedText).width <= maxWidth) {
61
+ return truncatedText;
62
+ }
63
+ }
64
+ } else if (truncationType === "ellipsisMiddle") {
65
+ for (let i = 0; i < text.length / 2; i += 1) {
66
+ const left = text.slice(0, Math.floor(text.length / 2) - i);
67
+ const right = text.slice(Math.ceil(text.length / 2) + i);
68
+ const truncatedText = left + ellipsis + right;
69
+ if (context.measureText(left).width + ellipsisWidth + context.measureText(right).width <= maxWidth) {
70
+ return truncatedText;
71
+ }
72
+ }
73
+ }
74
+ return ellipsis;
75
+ };
76
+ //# sourceMappingURL=textUtils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/common/utils/textUtils.ts"],
4
+ "sourcesContent": ["export const VIZ_FONT_FAMILY =\n \"'Splunk Platform Sans', 'Splunk Data Sans', Roboto, Droid, 'Helvetica Neue', Helvetica, Arial, sans-serif\";\n\n/**\n * Return text width\n * @method computeTextWidth\n * @param {String} text\n * @param {String} font\n * @returns {Number} width of text with font\n */\nexport const computeTextWidth = (text: string, font: string): number => {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n context.font = font;\n const measure = context.measureText(text);\n return measure.width;\n};\n\n/**\n * Return truncated text\n * @method truncateText\n * @param {String} text\n * @param {Number} maxWidth\n * @param {String} truncationType\n * @param {String} font\n * @returns {String} truncated text\n */\nexport const truncateText = (\n text: string,\n maxWidth: number,\n truncationType: 'ellipsisEnd' | 'ellipsisMiddle' | 'ellipsisStart',\n font = `10px ${VIZ_FONT_FAMILY}`\n): string => {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!context) return text;\n\n context.font = font;\n\n const ellipsis = '...';\n const ellipsisWidth = context.measureText(ellipsis).width;\n const fullTextWidth = context.measureText(text).width;\n\n if (fullTextWidth <= maxWidth) {\n return text;\n }\n\n if (truncationType === 'ellipsisEnd') {\n for (let i = text.length - 1; i > 0; i -= 1) {\n const truncatedText = text.slice(0, i) + ellipsis;\n if (context.measureText(truncatedText).width <= maxWidth) {\n return truncatedText;\n }\n }\n } else if (truncationType === 'ellipsisStart') {\n for (let i = 0; i < text.length; i += 1) {\n const truncatedText = ellipsis + text.slice(i);\n if (context.measureText(truncatedText).width <= maxWidth) {\n return truncatedText;\n }\n }\n } else if (truncationType === 'ellipsisMiddle') {\n for (let i = 0; i < text.length / 2; i += 1) {\n const left = text.slice(0, Math.floor(text.length / 2) - i);\n const right = text.slice(Math.ceil(text.length / 2) + i);\n const truncatedText = left + ellipsis + right;\n if (\n context.measureText(left).width + ellipsisWidth + context.measureText(right).width <=\n maxWidth\n ) {\n return truncatedText;\n }\n }\n }\n\n return ellipsis;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,kBACT;AASG,IAAM,mBAAmB,CAAC,MAAc,SAAyB;AACpE,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,QAAM,UAAU,OAAO,WAAW,IAAI;AACtC,UAAQ,OAAO;AACf,QAAM,UAAU,QAAQ,YAAY,IAAI;AACxC,SAAO,QAAQ;AACnB;AAWO,IAAM,eAAe,CACxB,MACA,UACA,gBACA,OAAO,QAAQ,eAAe,OACrB;AACT,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,QAAM,UAAU,OAAO,WAAW,IAAI;AACtC,MAAI,CAAC,QAAS,QAAO;AAErB,UAAQ,OAAO;AAEf,QAAM,WAAW;AACjB,QAAM,gBAAgB,QAAQ,YAAY,QAAQ,EAAE;AACpD,QAAM,gBAAgB,QAAQ,YAAY,IAAI,EAAE;AAEhD,MAAI,iBAAiB,UAAU;AAC3B,WAAO;AAAA,EACX;AAEA,MAAI,mBAAmB,eAAe;AAClC,aAAS,IAAI,KAAK,SAAS,GAAG,IAAI,GAAG,KAAK,GAAG;AACzC,YAAM,gBAAgB,KAAK,MAAM,GAAG,CAAC,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YAAY;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,EAC1C,SAAS,MAAM,EACf,YAAY,aAAa,KAC1B,eA4CF,CAAC;AAEF,eAAO,MAAM,gCAAgC,GACzC,WAAW,aAAa,EACxB,aAAa;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,EAC3C,gBAAgB,MAAM,KACvB,eA8BF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mCAAmC,GAC5C,aAAa,OAAO,EACpB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC7B,MAAM,CAAC,MAAM,EAAE,MAAM,CAOvB,CAAC;AAiCF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GACxB,WAAW,eAAe,EAC1B,oBAAoB,OAAO,EAC3B,UAAU,MAAM,GAAG,MAAM,EACzB,UAAU,MAAM,GAAG,MAAM,EACzB,YAAY,MAAM,wBAWrB,CAAC"}
@@ -69,7 +69,7 @@ var trellisUtils_default = "default" in defaultImport2 ? defaultImport2.default
69
69
  var AGGREGATIONS = "aggregations";
70
70
  var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
71
71
  var _a, _b, _c, _d;
72
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
72
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
73
73
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
74
74
  let splitDataSources = null;
75
75
  let errorCode = null;
@@ -90,7 +90,7 @@ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
90
90
  }
91
91
  return { splitDataSources, errorCode };
92
92
  };
93
- var toFieldEntries = (fields) => {
93
+ var toFieldEntries = (fields = []) => {
94
94
  return fields.map((field) => {
95
95
  if (typeof field === "string") {
96
96
  return { name: field };
@@ -105,7 +105,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
105
105
  let splitDataSources = null;
106
106
  let splitByFields = [];
107
107
  let errorCode = null;
108
- if (typeof fields[0] !== "string") {
108
+ if (fields.length > 0) {
109
109
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
110
110
  }
111
111
  if (splitByFields && splitByFields.length > 0) {
@@ -143,12 +143,12 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
143
143
  };
144
144
  var dataSourcesSplitByAggregationsStats = (dataSource) => {
145
145
  var _a, _b, _c, _d;
146
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
146
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
147
147
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
148
148
  let splitDataSources = null;
149
149
  let splitByFields = [];
150
150
  let errorCode = null;
151
- if (typeof fields[0] !== "string") {
151
+ if (fields.length > 0) {
152
152
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
153
153
  }
154
154
  if (splitByFields && splitByFields.length > 0) {
@@ -172,12 +172,12 @@ var dataSourcesSplitByAggregationsStats = (dataSource) => {
172
172
  };
173
173
  var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
174
174
  var _a, _b, _c, _d, _e;
175
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
175
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
176
176
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
177
177
  let splitDataSources = null;
178
178
  let splitByFields = [];
179
179
  let errorCode = null;
180
- if (typeof fields[0] !== "string") {
180
+ if (fields.length > 0) {
181
181
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
182
182
  }
183
183
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -215,12 +215,12 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
215
215
  };
216
216
  var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
217
217
  var _a, _b, _c, _d;
218
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
218
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
219
219
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
220
220
  let splitDataSources = null;
221
221
  let splitByFields = [];
222
222
  let errorCode = null;
223
- if (typeof fields[0] !== "string") {
223
+ if (fields.length > 0) {
224
224
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
225
225
  }
226
226
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -308,17 +308,15 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
308
308
  };
309
309
  var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
310
310
  var _a, _b, _c, _d, _e, _f;
311
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
311
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
312
312
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
313
313
  let splitDataSources = null;
314
314
  let splitByFields = [];
315
315
  let errorCode = null;
316
- if (typeof fields[0] !== "string") {
316
+ if (fields.length > 0) {
317
317
  splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
318
318
  }
319
- const splitByIndex = fields == null ? void 0 : fields.findIndex(
320
- (field) => field === splitBy || field.name === splitBy
321
- );
319
+ const splitByIndex = fields.findIndex((field) => field.name === splitBy);
322
320
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
323
321
  const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
324
322
  splitDataSources = {};