@splunk/visualizations 28.3.0 → 28.5.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 (285) hide show
  1. package/Area/Area.d.ts.map +1 -1
  2. package/Area.config.js +28 -8
  3. package/Area.config.js.map +2 -2
  4. package/Area.js +583 -120
  5. package/Area.js.map +3 -3
  6. package/Bar/Bar.d.ts.map +1 -1
  7. package/Bar.config.js +28 -8
  8. package/Bar.config.js.map +2 -2
  9. package/Bar.js +593 -120
  10. package/Bar.js.map +3 -3
  11. package/Bubble.config.js +4 -5
  12. package/Bubble.config.js.map +2 -2
  13. package/Bubble.js +554 -98
  14. package/Bubble.js.map +3 -3
  15. package/CHANGELOG.external.md +165 -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 +595 -111
  21. package/ChoroplethSvg.js.map +4 -4
  22. package/Column/Column.d.ts.map +1 -1
  23. package/Column.config.js +28 -8
  24. package/Column.config.js.map +2 -2
  25. package/Column.js +583 -120
  26. package/Column.js.map +3 -3
  27. package/Ellipse/config.d.ts.map +1 -1
  28. package/Ellipse.config.js +14 -5
  29. package/Ellipse.config.js.map +4 -4
  30. package/Ellipse.js +640 -159
  31. package/Ellipse.js.map +4 -4
  32. package/Events/PureEvents/PureEvents.d.ts.map +1 -1
  33. package/Events.js +668 -157
  34. package/Events.js.map +4 -4
  35. package/FillerGauge/FillerGauge.d.ts.map +1 -1
  36. package/FillerGauge/PureFillerGauge/FillerGauge.d.ts.map +1 -1
  37. package/FillerGauge.js +751 -169
  38. package/FillerGauge.js.map +4 -4
  39. package/Image/Image.d.ts.map +1 -1
  40. package/Image.js +620 -116
  41. package/Image.js.map +4 -4
  42. package/Line/Line.d.ts.map +1 -1
  43. package/Line/lineUtils.d.ts.map +1 -1
  44. package/Line/mockdata/LineData.d.ts +154 -0
  45. package/Line/mockdata/LineData.d.ts.map +1 -1
  46. package/Line.config.js +28 -8
  47. package/Line.config.js.map +2 -2
  48. package/Line.js +704 -122
  49. package/Line.js.map +3 -3
  50. package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts +5 -0
  51. package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts.map +1 -1
  52. package/LinkGraph/PureLinkGraph/PureLinkGraphUtils.d.ts.map +1 -1
  53. package/LinkGraph/PureLinkGraph/components/Graph.d.ts +9 -1
  54. package/LinkGraph/PureLinkGraph/components/Graph.d.ts.map +1 -1
  55. package/LinkGraph/PureLinkGraph/components/GraphStyles.d.ts.map +1 -1
  56. package/LinkGraph/PureLinkGraph/components/Node.d.ts +1 -0
  57. package/LinkGraph/PureLinkGraph/components/Node.d.ts.map +1 -1
  58. package/LinkGraph/PureLinkGraph/components/Nodes.d.ts +1 -0
  59. package/LinkGraph/PureLinkGraph/components/Nodes.d.ts.map +1 -1
  60. package/LinkGraph/PureLinkGraph/measurementUtils.d.ts +16 -0
  61. package/LinkGraph/PureLinkGraph/measurementUtils.d.ts.map +1 -0
  62. package/LinkGraph/PureLinkGraph/utils/iconLoader.d.ts.map +1 -1
  63. package/LinkGraph/config.d.ts.map +1 -1
  64. package/LinkGraph.config.js +15 -1
  65. package/LinkGraph.config.js.map +2 -2
  66. package/LinkGraph.js +1411 -662
  67. package/LinkGraph.js.map +4 -4
  68. package/Map/Map.d.ts +2 -2
  69. package/Map/Map.d.ts.map +1 -1
  70. package/Map/PureMap/BubbleLayer.d.ts +5 -0
  71. package/Map/PureMap/BubbleLayer.d.ts.map +1 -1
  72. package/Map/PureMap/ClusterLayer.d.ts.map +1 -1
  73. package/Map/PureMap/LocalChoroplethLayer.d.ts.map +1 -1
  74. package/Map/PureMap/MapUtils.d.ts +2 -2
  75. package/Map/PureMap/MapUtils.d.ts.map +1 -1
  76. package/Map/PureMap/PureMap.d.ts.map +1 -1
  77. package/Map/PureMap/PureMapContainer.d.ts.map +1 -1
  78. package/Map/PureMap/Tooltip.d.ts.map +1 -1
  79. package/Map/config.d.ts.map +1 -1
  80. package/Map.config.js +0 -1
  81. package/Map.config.js.map +2 -2
  82. package/Map.js +831 -247
  83. package/Map.js.map +4 -4
  84. package/Markdown/Markdown.d.ts.map +1 -1
  85. package/Markdown/config.d.ts.map +1 -1
  86. package/Markdown.config.js +14 -5
  87. package/Markdown.config.js.map +4 -4
  88. package/Markdown.js +619 -109
  89. package/Markdown.js.map +4 -4
  90. package/MarkerGauge/MarkerGauge.d.ts +5 -1
  91. package/MarkerGauge/MarkerGauge.d.ts.map +1 -1
  92. package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts +4 -0
  93. package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts.map +1 -1
  94. package/MarkerGauge/config.d.ts.map +1 -1
  95. package/MarkerGauge.config.js +121 -3
  96. package/MarkerGauge.config.js.map +3 -3
  97. package/MarkerGauge.js +1535 -172
  98. package/MarkerGauge.js.map +4 -4
  99. package/NetworkGraph/NetworkGraph.d.ts +22 -0
  100. package/NetworkGraph/NetworkGraph.d.ts.map +1 -0
  101. package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts +60 -0
  102. package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts.map +1 -0
  103. package/NetworkGraph/PureNetworkGraph/components/Link.d.ts +19 -0
  104. package/NetworkGraph/PureNetworkGraph/components/Link.d.ts.map +1 -0
  105. package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts +29 -0
  106. package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts.map +1 -0
  107. package/NetworkGraph/PureNetworkGraph/components/Node.d.ts +27 -0
  108. package/NetworkGraph/PureNetworkGraph/components/Node.d.ts.map +1 -0
  109. package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts +12 -0
  110. package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts.map +1 -0
  111. package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts +13 -0
  112. package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts.map +1 -0
  113. package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts +140 -0
  114. package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts.map +1 -0
  115. package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts +89 -0
  116. package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts.map +1 -0
  117. package/NetworkGraph/PureNetworkGraph/utils/dragUtils.d.ts +78 -0
  118. package/NetworkGraph/PureNetworkGraph/utils/dragUtils.d.ts.map +1 -0
  119. package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts +47 -0
  120. package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts.map +1 -0
  121. package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts +78 -0
  122. package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts.map +1 -0
  123. package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts +111 -0
  124. package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts.map +1 -0
  125. package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts +122 -0
  126. package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts.map +1 -0
  127. package/NetworkGraph/config.d.ts +4 -0
  128. package/NetworkGraph/config.d.ts.map +1 -0
  129. package/NetworkGraph/index.d.ts +3 -0
  130. package/NetworkGraph/index.d.ts.map +1 -0
  131. package/NetworkGraph.config.js +938 -0
  132. package/NetworkGraph.config.js.map +7 -0
  133. package/NetworkGraph.js +7053 -0
  134. package/NetworkGraph.js.map +7 -0
  135. package/PERFORMANCE.md +23 -0
  136. package/ParallelCoordinates/ParallelCoordinates.d.ts +1 -46
  137. package/ParallelCoordinates/ParallelCoordinates.d.ts.map +1 -1
  138. package/ParallelCoordinates/PureParallelCoordinates/PureParallelCoordinates.d.ts +12 -58
  139. package/ParallelCoordinates/PureParallelCoordinates/PureParallelCoordinates.d.ts.map +1 -1
  140. package/ParallelCoordinates/PureParallelCoordinates/src/ParallelCoordinatesChart.d.ts +1 -0
  141. package/ParallelCoordinates/PureParallelCoordinates/src/ParallelCoordinatesChart.d.ts.map +1 -1
  142. package/ParallelCoordinates.js +664 -228
  143. package/ParallelCoordinates.js.map +4 -4
  144. package/Pie/Pie.d.ts.map +1 -1
  145. package/Pie/config.d.ts.map +1 -1
  146. package/Pie/pieUtils.d.ts +4 -0
  147. package/Pie/pieUtils.d.ts.map +1 -1
  148. package/Pie.config.js +16 -0
  149. package/Pie.config.js.map +2 -2
  150. package/Pie.js +610 -118
  151. package/Pie.js.map +3 -3
  152. package/Punchcard.js +579 -92
  153. package/Punchcard.js.map +4 -4
  154. package/Rectangle/config.d.ts.map +1 -1
  155. package/Rectangle.config.js +14 -5
  156. package/Rectangle.config.js.map +4 -4
  157. package/Rectangle.js +611 -130
  158. package/Rectangle.js.map +4 -4
  159. package/Sankey/PureSankey/PureSankey.d.ts +26 -72
  160. package/Sankey/PureSankey/PureSankey.d.ts.map +1 -1
  161. package/Sankey/PureSankey/SankeyLink.d.ts +3 -19
  162. package/Sankey/PureSankey/SankeyLink.d.ts.map +1 -1
  163. package/Sankey/PureSankey/SankeyNode.d.ts +3 -20
  164. package/Sankey/PureSankey/SankeyNode.d.ts.map +1 -1
  165. package/Sankey/PureSankey/SankeyTooltip.d.ts +3 -24
  166. package/Sankey/PureSankey/SankeyTooltip.d.ts.map +1 -1
  167. package/Sankey.js +814 -429
  168. package/Sankey.js.map +4 -4
  169. package/Scatter/Scatter.d.ts.map +1 -1
  170. package/Scatter.config.js +168 -148
  171. package/Scatter.config.js.map +4 -4
  172. package/Scatter.js +733 -260
  173. package/Scatter.js.map +4 -4
  174. package/SingleValue/SingleValue.d.ts.map +1 -1
  175. package/SingleValue/config.d.ts.map +1 -1
  176. package/SingleValue.config.js +15 -2
  177. package/SingleValue.config.js.map +2 -2
  178. package/SingleValue.js +733 -229
  179. package/SingleValue.js.map +3 -3
  180. package/SingleValueBasic.js.map +1 -1
  181. package/SingleValueIcon/SingleValueIcon.d.ts.map +1 -1
  182. package/SingleValueIcon/config.d.ts.map +1 -1
  183. package/SingleValueIcon.config.js +14 -6
  184. package/SingleValueIcon.config.js.map +4 -4
  185. package/SingleValueIcon.js +612 -182
  186. package/SingleValueIcon.js.map +4 -4
  187. package/SingleValueRadial/PureSingleValueRadial/GaugeGraph.d.ts.map +1 -1
  188. package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts +0 -8
  189. package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts.map +1 -1
  190. package/SingleValueRadial/SingleValueRadial.d.ts.map +1 -1
  191. package/SingleValueRadial.config.js +0 -1
  192. package/SingleValueRadial.config.js.map +2 -2
  193. package/SingleValueRadial.js +594 -182
  194. package/SingleValueRadial.js.map +4 -4
  195. package/SparkLine.js +46 -8
  196. package/SparkLine.js.map +2 -2
  197. package/Table/PureTable.d.ts +10 -0
  198. package/Table/PureTable.d.ts.map +1 -1
  199. package/Table/Table.d.ts.map +1 -1
  200. package/Table/cells/SparklineCell.d.ts.map +1 -1
  201. package/Table/config.d.ts.map +1 -1
  202. package/Table/hooks.d.ts +6 -0
  203. package/Table/hooks.d.ts.map +1 -1
  204. package/Table.config.js +1 -1
  205. package/Table.config.js.map +2 -2
  206. package/Table.js +836 -253
  207. package/Table.js.map +4 -4
  208. package/Timeline/PureTimeline/PureTimeline.d.ts.map +1 -1
  209. package/Timeline/PureTimeline/src/CursorPlugin.d.ts.map +1 -1
  210. package/Timeline/PureTimeline/src/TimelineLegend.d.ts.map +1 -1
  211. package/Timeline/PureTimeline/src/TimelinePlugin.d.ts.map +1 -1
  212. package/Timeline/PureTimeline/src/TimelineYAxis.d.ts.map +1 -1
  213. package/Timeline/PureTimeline/src/utils/timelineUtils.d.ts +2 -1
  214. package/Timeline/PureTimeline/src/utils/timelineUtils.d.ts.map +1 -1
  215. package/Timeline/config.d.ts.map +1 -1
  216. package/Timeline.config.js +31 -12
  217. package/Timeline.config.js.map +4 -4
  218. package/Timeline.js +785 -247
  219. package/Timeline.js.map +4 -4
  220. package/common/Charting.d.ts +5 -0
  221. package/common/Charting.d.ts.map +1 -1
  222. package/common/Charting.js +12 -0
  223. package/common/Charting.js.map +2 -2
  224. package/common/GaugeMajorTicks.js +150 -13
  225. package/common/GaugeMajorTicks.js.map +4 -4
  226. package/common/GaugeValueMarker.js +84 -17
  227. package/common/GaugeValueMarker.js.map +4 -4
  228. package/common/OptionsDoc.js.map +1 -1
  229. package/common/OverviewDoc.d.ts.map +1 -1
  230. package/common/OverviewDoc.js +2 -2
  231. package/common/OverviewDoc.js.map +2 -2
  232. package/common/ThemesDoc.js +0 -1
  233. package/common/ThemesDoc.js.map +2 -2
  234. package/common/TimeSeriesChartWrapper.d.ts +24 -11
  235. package/common/TimeSeriesChartWrapper.d.ts.map +1 -1
  236. package/common/TimeSeriesChartWrapper.js +617 -91
  237. package/common/TimeSeriesChartWrapper.js.map +4 -4
  238. package/common/chartingUtils.d.ts +52 -6
  239. package/common/chartingUtils.d.ts.map +1 -1
  240. package/common/chartingUtils.js +116 -17
  241. package/common/chartingUtils.js.map +3 -3
  242. package/common/editorConfig/AxesChartDataConfig.d.ts +3 -3
  243. package/common/editorConfig/AxesChartDataConfig.d.ts.map +1 -1
  244. package/common/editorConfig/AxesChartDataDisplay.d.ts +4 -0
  245. package/common/editorConfig/AxesChartDataDisplay.d.ts.map +1 -1
  246. package/common/editorConfig/AxesChartLegend.d.ts.map +1 -1
  247. package/common/gaugeUtils.d.ts +37 -0
  248. package/common/gaugeUtils.d.ts.map +1 -1
  249. package/common/gaugeUtils.js +152 -2
  250. package/common/gaugeUtils.js.map +4 -4
  251. package/common/hocs/mockdata/trellisData.d.ts +119 -0
  252. package/common/hocs/mockdata/trellisData.d.ts.map +1 -1
  253. package/common/hocs/withTrellis.d.ts.map +1 -1
  254. package/common/interfaces/DashboardVizProps.d.ts +0 -3
  255. package/common/interfaces/DashboardVizProps.d.ts.map +1 -1
  256. package/common/interfaces/DataSource.d.ts +1 -1
  257. package/common/interfaces/DataSource.d.ts.map +1 -1
  258. package/common/interfaces/Overview.d.ts +1 -0
  259. package/common/interfaces/Overview.d.ts.map +1 -1
  260. package/common/interfaces/VizConfig.d.ts +2 -1
  261. package/common/interfaces/VizConfig.d.ts.map +1 -1
  262. package/common/shapeUtils.js +5 -20
  263. package/common/shapeUtils.js.map +2 -2
  264. package/common/utils/dataUtils.d.ts.map +1 -1
  265. package/common/utils/dataUtils.js +5 -4
  266. package/common/utils/dataUtils.js.map +2 -2
  267. package/common/utils/mapUtils.js +16 -9
  268. package/common/utils/mapUtils.js.map +2 -2
  269. package/common/utils/singleValueUtils.js +17 -18
  270. package/common/utils/singleValueUtils.js.map +2 -2
  271. package/common/utils/textUtils.d.ts +20 -0
  272. package/common/utils/textUtils.d.ts.map +1 -0
  273. package/common/utils/textUtils.js +76 -0
  274. package/common/utils/textUtils.js.map +7 -0
  275. package/common/utils/trellisUtils.d.ts.map +1 -1
  276. package/common/utils/trellisUtils.js +16 -20
  277. package/common/utils/trellisUtils.js.map +2 -2
  278. package/common/withDashboardViz.d.ts.map +1 -1
  279. package/common/withDashboardViz.js +600 -92
  280. package/common/withDashboardViz.js.map +4 -4
  281. package/package.json +46 -39
  282. package/common/utils/styleUtils.d.ts +0 -2
  283. package/common/utils/styleUtils.d.ts.map +0 -1
  284. package/common/utils/styleUtils.js +0 -30
  285. package/common/utils/styleUtils.js.map +0 -7
package/MarkerGauge.js CHANGED
@@ -151,20 +151,42 @@ var defaultImport9 = __toESM(require("@splunk/ui-utils/id"));
151
151
  __reExport(id_exports, require("@splunk/ui-utils/id"));
152
152
  var id_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
153
153
 
154
+ // esm-externals:@splunk/visualization-schemas
155
+ var visualization_schemas_exports = {};
156
+ __export(visualization_schemas_exports, {
157
+ default: () => visualization_schemas_default
158
+ });
159
+ var defaultImport10 = __toESM(require("@splunk/visualization-schemas"));
160
+ __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
161
+ var visualization_schemas_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
162
+
154
163
  // esm-externals:@splunk/visualizations-shared/colorConstants
155
164
  var colorConstants_exports = {};
156
165
  __export(colorConstants_exports, {
157
166
  default: () => colorConstants_default
158
167
  });
159
- var defaultImport10 = __toESM(require("@splunk/visualizations-shared/colorConstants"));
168
+ var defaultImport11 = __toESM(require("@splunk/visualizations-shared/colorConstants"));
160
169
  __reExport(colorConstants_exports, require("@splunk/visualizations-shared/colorConstants"));
161
- var colorConstants_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
170
+ var colorConstants_default = "default" in defaultImport11 ? defaultImport11.default : defaultImport11;
171
+
172
+ // esm-externals:@splunk/visualizations-shared/numberUtils
173
+ var numberUtils_exports = {};
174
+ __export(numberUtils_exports, {
175
+ default: () => numberUtils_default
176
+ });
177
+ var defaultImport12 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
178
+ __reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUtils"));
179
+ var numberUtils_default = "default" in defaultImport12 ? defaultImport12.default : defaultImport12;
162
180
 
163
181
  // src/common/gaugeUtils.ts
164
182
  var GAUGE_THICKNESS = 50;
165
183
  var FILL_THICKNESS = 38;
166
184
  var GRADIENT_STOP_OFFSET_MIN = 0;
167
185
  var GRADIENT_STOP_OFFSET_MAX = 100;
186
+ var DEFAULT_NUM_OF_TICKS = 5;
187
+ var MAX_TICK_LABEL_DECIMAL_PLACES = 5;
188
+ var MAX_VALUE_LABEL_DIGITS_WITHOUT_PERCENT = 6;
189
+ var MAX_VALUE_LABEL_DIGITS_WITH_PERCENT = 5;
168
190
  var getGaugeWidth = ({ containerWidth, orientation }) => orientation === "vertical" ? GAUGE_THICKNESS : containerWidth * 0.8;
169
191
  var getGaugeHeight = ({ containerHeight, orientation }) => orientation === "vertical" ? containerHeight * 0.8 : GAUGE_THICKNESS;
170
192
  var getGaugeLength = ({ containerWidth, containerHeight, orientation }) => orientation === "vertical" ? getGaugeHeight({ containerHeight, orientation }) : getGaugeWidth({ containerWidth, orientation });
@@ -343,6 +365,137 @@ var getGradientDimensions = (orientation) => {
343
365
  const y2 = orientation === "horizontal" ? "0%" : "100%";
344
366
  return { x1, y1, x2, y2 };
345
367
  };
368
+ var getDecimalPlaces = (value) => {
369
+ const numericValue = Number(value);
370
+ if (!Number.isFinite(numericValue)) {
371
+ return 0;
372
+ }
373
+ const fractionPart = numericValue.toString().split(".")[1];
374
+ return fractionPart ? fractionPart.length : 0;
375
+ };
376
+ var getUniqueDecimalPlaces = ({
377
+ values,
378
+ minimumDecimalPlaces
379
+ }) => {
380
+ if (values.length <= 1) {
381
+ return minimumDecimalPlaces;
382
+ }
383
+ for (let decimalPlaces = minimumDecimalPlaces; decimalPlaces <= MAX_TICK_LABEL_DECIMAL_PLACES; decimalPlaces += 1) {
384
+ const roundedValues = values.map((value) => Number(value.toFixed(decimalPlaces)));
385
+ if (new Set(roundedValues).size === roundedValues.length) {
386
+ return decimalPlaces;
387
+ }
388
+ }
389
+ return MAX_TICK_LABEL_DECIMAL_PLACES;
390
+ };
391
+ var getPercentageFromRange = ({ value, min, range: range2 }) => {
392
+ if (range2 === 0) {
393
+ return 0;
394
+ }
395
+ return (value - min) / range2 * 100;
396
+ };
397
+ var getNumOfTicks = ({
398
+ min,
399
+ max,
400
+ majorUnit,
401
+ usePercentageRange
402
+ }) => {
403
+ const range2 = max - min;
404
+ const majorUnitNumber = Number(majorUnit);
405
+ const isAutoMajorUnit = majorUnit === "auto" || Number.isNaN(majorUnitNumber) || majorUnitNumber <= 0;
406
+ let numOfTicks = DEFAULT_NUM_OF_TICKS;
407
+ if (!isAutoMajorUnit) {
408
+ numOfTicks = usePercentageRange ? 100 / majorUnitNumber : range2 / majorUnitNumber;
409
+ }
410
+ return { numOfTicks, isAutoMajorUnit, majorUnitNumber };
411
+ };
412
+ var getTickLabelFormatter = ({
413
+ min,
414
+ max,
415
+ majorUnit,
416
+ usePercentageRange
417
+ }) => {
418
+ const range2 = max - min;
419
+ const { numOfTicks, isAutoMajorUnit, majorUnitNumber } = getNumOfTicks({
420
+ min,
421
+ max,
422
+ majorUnit,
423
+ usePercentageRange
424
+ });
425
+ const numericStep = range2 / numOfTicks;
426
+ const tickValues = [];
427
+ for (let i = 0; i <= numOfTicks; i += 1) {
428
+ tickValues.push(min + numericStep * i);
429
+ }
430
+ if (!Number.isInteger(numOfTicks)) {
431
+ tickValues.push(max);
432
+ }
433
+ const minimumNumericDecimalPlaces = Math.min(
434
+ MAX_TICK_LABEL_DECIMAL_PLACES,
435
+ Math.max(
436
+ getDecimalPlaces(min),
437
+ getDecimalPlaces(max),
438
+ isAutoMajorUnit ? 0 : getDecimalPlaces(majorUnitNumber)
439
+ )
440
+ );
441
+ const numericLabelDecimalPlaces = getUniqueDecimalPlaces({
442
+ values: tickValues,
443
+ minimumDecimalPlaces: minimumNumericDecimalPlaces
444
+ });
445
+ const percentageLabelDecimalPlaces = getUniqueDecimalPlaces({
446
+ values: tickValues.map((value) => getPercentageFromRange({ value, min, range: range2 })),
447
+ minimumDecimalPlaces: 0
448
+ });
449
+ const formatTickLabel = (value) => {
450
+ if (usePercentageRange) {
451
+ const percentageValue = getPercentageFromRange({ value, min, range: range2 });
452
+ return `${percentageValue.toFixed(percentageLabelDecimalPlaces)}%`;
453
+ }
454
+ const numericLabel = value.toFixed(numericLabelDecimalPlaces);
455
+ if (numericLabel.includes(".")) {
456
+ return numericLabel;
457
+ }
458
+ return (0, numberUtils_exports.formatNumber)(Number(numericLabel), 0, {
459
+ useThousandSeparators: true,
460
+ useTrendUnits: true
461
+ }).replace(/k$/, "K");
462
+ };
463
+ return { numOfTicks, numericStep, formatTickLabel };
464
+ };
465
+ var getDigitsBeforeDecimal = (numericValue) => Math.abs(Math.trunc(Number(numericValue))).toString().length;
466
+ var getCappedDecimalPlaces = (numericValue, rawDecimalPlaces, maxDigits) => {
467
+ const digitsBeforeDecimal = getDigitsBeforeDecimal(numericValue);
468
+ const maxDecimalPlaces = Math.max(0, maxDigits - digitsBeforeDecimal);
469
+ return Math.min(rawDecimalPlaces, maxDecimalPlaces);
470
+ };
471
+ var formatGaugeValueLabel = ({
472
+ value,
473
+ min,
474
+ max,
475
+ usePercentageValue
476
+ }) => {
477
+ const numericValue = Number(value);
478
+ const range2 = max - min || 1;
479
+ const percentageValue = getPercentageFromRange({ value: numericValue, min, range: range2 });
480
+ const trendFormatOptions = {
481
+ useThousandSeparators: true,
482
+ useTrendUnits: true
483
+ };
484
+ if (usePercentageValue) {
485
+ const percentageDecimalPlaces = getCappedDecimalPlaces(
486
+ percentageValue,
487
+ 2,
488
+ MAX_VALUE_LABEL_DIGITS_WITH_PERCENT
489
+ );
490
+ return `${(0, numberUtils_exports.formatNumber)(percentageValue, percentageDecimalPlaces, trendFormatOptions)}%`;
491
+ }
492
+ const valueDecimalPlaces = getCappedDecimalPlaces(
493
+ numericValue,
494
+ getDecimalPlaces(numericValue),
495
+ MAX_VALUE_LABEL_DIGITS_WITHOUT_PERCENT
496
+ );
497
+ return (0, numberUtils_exports.formatNumber)(numericValue, valueDecimalPlaces, trendFormatOptions);
498
+ };
346
499
  var gaugeOptionsMapping = {
347
500
  majorTickInterval: "majorUnit",
348
501
  gaugeRanges: "ranges"
@@ -370,19 +523,10 @@ var mapValueLabelDisplay = (labelOrValue, options) => {
370
523
  };
371
524
  var convertToGaugeProperties = (originalOptions) => (0, lodash_exports.chain)(mapToOldKey(originalOptions)).thru((options) => mapValueLabelDisplay("label", options)).thru((options) => mapValueLabelDisplay("value", options)).value();
372
525
 
373
- // esm-externals:@splunk/visualizations-shared/numberUtils
374
- var numberUtils_exports = {};
375
- __export(numberUtils_exports, {
376
- default: () => numberUtils_default
377
- });
378
- var defaultImport11 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
379
- __reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUtils"));
380
- var numberUtils_default = "default" in defaultImport11 ? defaultImport11.default : defaultImport11;
381
-
382
526
  // src/common/GaugeMajorTicks.jsx
383
- var DEFAULT_NUM_OF_TICKS = 5;
384
527
  var TICK_LENGTH_DELTA = 5;
385
528
  var TICK_LABEL_PADDING_FACTOR = 3.2;
529
+ var VERTICAL_START_ANCHOR_OFFSET = 8;
386
530
  var MajorTickLine = styled_components_default.line`
387
531
  stroke: ${(props) => props.majorTickStrokeColor};
388
532
  stroke-width: 2px;
@@ -395,7 +539,7 @@ var MajorTickLabel = styled_components_default.text`
395
539
  sans-serif;
396
540
  line-height: 19px;
397
541
  fill: ${(props) => props.majorTickFillColor};
398
- text-anchor: middle;
542
+ text-anchor: ${(props) => props.textAnchor};
399
543
  text-align: center;
400
544
  `;
401
545
  var MajorTick = ({
@@ -408,6 +552,7 @@ var MajorTick = ({
408
552
  label,
409
553
  labelX,
410
554
  labelY,
555
+ textAnchor = "middle",
411
556
  majorTickStrokeColor,
412
557
  majorTickFillColor
413
558
  }) => /* @__PURE__ */ react_default.createElement("g", null, /* @__PURE__ */ react_default.createElement(
@@ -426,13 +571,11 @@ var MajorTick = ({
426
571
  {
427
572
  x: labelX,
428
573
  y: labelY,
574
+ textAnchor,
429
575
  majorTickFillColor,
430
576
  "data-test": "major-tick-label"
431
577
  },
432
- (0, numberUtils_exports.isNumerial)(label) ? (0, numberUtils_exports.formatNumber)(label, 0, {
433
- useThousandSeparators: true,
434
- useTrendUnits: true
435
- }) : label
578
+ label
436
579
  ));
437
580
  MajorTick.propTypes = {
438
581
  index: prop_types_default.number,
@@ -444,6 +587,7 @@ MajorTick.propTypes = {
444
587
  label: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
445
588
  labelX: prop_types_default.number,
446
589
  labelY: prop_types_default.number,
590
+ textAnchor: prop_types_default.string,
447
591
  majorTickStrokeColor: prop_types_default.string,
448
592
  majorTickFillColor: prop_types_default.string
449
593
  };
@@ -460,7 +604,7 @@ var positionMajorTick = ({ width, height, startX, startY, orientation, numOfTick
460
604
  y1 = y;
461
605
  x2 += width + TICK_LENGTH_DELTA;
462
606
  y2 = y;
463
- labelX += width + TICK_LENGTH_DELTA * TICK_LABEL_PADDING_FACTOR;
607
+ labelX += width + TICK_LENGTH_DELTA * TICK_LABEL_PADDING_FACTOR - VERTICAL_START_ANCHOR_OFFSET;
464
608
  labelY = y;
465
609
  } else {
466
610
  const x = width / numOfTicks * i + startX;
@@ -489,10 +633,17 @@ var MajorTicks = (_a) => {
489
633
  majorTickFillColor,
490
634
  majorTickStrokeColor
491
635
  } = props;
492
- const range2 = max - min;
493
- const numOfTicks = majorUnit === "auto" || Number.isNaN(Number(majorUnit)) || majorUnit <= 0 ? DEFAULT_NUM_OF_TICKS : range2 / majorUnit;
636
+ const isVertical = orientation === "vertical";
637
+ const textAnchor = isVertical ? "start" : "middle";
638
+ const { numOfTicks, numericStep, formatTickLabel } = getTickLabelFormatter({
639
+ min,
640
+ max,
641
+ majorUnit,
642
+ usePercentageRange
643
+ });
494
644
  const majorTicks = [];
495
645
  for (let i = 0; i <= numOfTicks; i += 1) {
646
+ const tickValue = min + numericStep * i;
496
647
  const { x1, y1, x2, y2, labelX, labelY } = positionMajorTick({
497
648
  width,
498
649
  height,
@@ -502,7 +653,7 @@ var MajorTicks = (_a) => {
502
653
  numOfTicks,
503
654
  i
504
655
  });
505
- const label = usePercentageRange ? `${parseInt((i / numOfTicks - min / range2) * 100, 10)}%` : parseInt(min + range2 / numOfTicks * i, 10);
656
+ const label = formatTickLabel(tickValue);
506
657
  majorTicks.push(
507
658
  /* @__PURE__ */ react_default.createElement(
508
659
  MajorTick,
@@ -517,6 +668,7 @@ var MajorTicks = (_a) => {
517
668
  label,
518
669
  labelX,
519
670
  labelY,
671
+ textAnchor,
520
672
  majorTickFillColor,
521
673
  majorTickStrokeColor
522
674
  }
@@ -545,9 +697,10 @@ var MajorTicks = (_a) => {
545
697
  x2,
546
698
  y2,
547
699
  showLabels,
548
- label: usePercentageRange ? "100%" : max,
700
+ label: formatTickLabel(max),
549
701
  labelX,
550
702
  labelY,
703
+ textAnchor,
551
704
  majorTickFillColor,
552
705
  majorTickStrokeColor
553
706
  }
@@ -577,9 +730,9 @@ var format_exports = {};
577
730
  __export(format_exports, {
578
731
  default: () => format_default
579
732
  });
580
- var defaultImport12 = __toESM(require("@splunk/ui-utils/format"));
733
+ var defaultImport13 = __toESM(require("@splunk/ui-utils/format"));
581
734
  __reExport(format_exports, require("@splunk/ui-utils/format"));
582
- var format_default = "default" in defaultImport12 ? defaultImport12.default : defaultImport12;
735
+ var format_default = "default" in defaultImport13 ? defaultImport13.default : defaultImport13;
583
736
 
584
737
  // src/common/GaugeValueMarker.jsx
585
738
  var MARKER_THICKNESS = 15;
@@ -702,10 +855,7 @@ var ValueMarker = (_a) => {
702
855
  valueMarkerLabelFillColor,
703
856
  "aria-label": (0, format_exports.sprintf)((0, i18n_exports._)("Marker gauge value: %s"), value)
704
857
  },
705
- usePercentageValue ? `${(value / (max - min) * 100).toFixed(2)}%` : (0, numberUtils_exports.formatNumber)(value, 0, {
706
- useThousandSeparators: true,
707
- useTrendUnits: true
708
- })
858
+ formatGaugeValueLabel({ value, min, max, usePercentageValue })
709
859
  )));
710
860
  };
711
861
  ValueMarker.propTypes = {
@@ -724,6 +874,57 @@ ValueMarker.propTypes = {
724
874
  };
725
875
  var GaugeValueMarker_default = ValueMarker;
726
876
 
877
+ // esm-externals:@splunk/visualization-context/FeatureFlagContext
878
+ var FeatureFlagContext_exports = {};
879
+ __export(FeatureFlagContext_exports, {
880
+ default: () => FeatureFlagContext_default
881
+ });
882
+ var defaultImport14 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
883
+ __reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
884
+ var FeatureFlagContext_default = "default" in defaultImport14 ? defaultImport14.default : defaultImport14;
885
+
886
+ // src/common/hooks/useTrellisEnabled.ts
887
+ var useTrellisFeatureFlagOn = () => {
888
+ const context = (0, react_exports.useContext)(FeatureFlagContext_default);
889
+ return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
890
+ };
891
+ var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
892
+ const trellisFeatureEnabled = useTrellisFeatureFlagOn();
893
+ return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
894
+ };
895
+
896
+ // src/common/components/TrellisTitle.tsx
897
+ var TRELLIS_TITLE_HEIGHT = 28;
898
+ var TrellisTitleText = styled_components_default.div`
899
+ margin-left: 10px;
900
+ margin-right: 10px;
901
+ padding-top: 8px;
902
+ text-overflow: ellipsis;
903
+ white-space: nowrap;
904
+ overflow: hidden;
905
+ `;
906
+ var TrellisTitleDiv = styled_components_default.div`
907
+ height: ${TRELLIS_TITLE_HEIGHT}px;
908
+ font-size: 14px;
909
+ font-weight: 700;
910
+ color: ${(props) => props.fontColor};
911
+ background-color: ${(props) => props.backgroundColor};
912
+ box-shadow: 0 1px ${(props) => props.backgroundColor}; // this is added to avoid a 1px gap between title and viz divs that showed up intermittently because of pixel rounding error in chrome.
913
+ `;
914
+ var TrellisTitle = (props) => {
915
+ const titleText = String(props.trellisKey).toString();
916
+ return /* @__PURE__ */ react_exports.createElement(
917
+ TrellisTitleDiv,
918
+ {
919
+ fontColor: props.fontColor,
920
+ backgroundColor: props.backgroundColor,
921
+ "data-test": "trellis-title",
922
+ title: titleText
923
+ },
924
+ /* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
925
+ );
926
+ };
927
+
727
928
  // src/MarkerGauge/PureMarkerGauge/MarkerGauge.tsx
728
929
  var MAX_VERTICAL_CONTAINER_WIDTH = 200;
729
930
  var MIN_VERTICAL_CONTAINER_HEIGHT = 200;
@@ -774,8 +975,12 @@ var MarkerGauge = (_a) => {
774
975
  majorTickFillColor,
775
976
  majorTickStrokeColor,
776
977
  valueMarkerFillColor,
777
- valueMarkerLabelFillColor
978
+ valueMarkerLabelFillColor,
979
+ splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off,
980
+ defaultFontColor = "#000",
981
+ trellisKey = ""
778
982
  } = props;
983
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
779
984
  const cachedHandleResize = react_exports.useCallback((w, h) => {
780
985
  setContainerWidth(w);
781
986
  setContainerHeight(h);
@@ -930,6 +1135,26 @@ var MarkerGauge = (_a) => {
930
1135
  errorMessage,
931
1136
  errorId
932
1137
  ]);
1138
+ if (trellisEnabled) {
1139
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, /* @__PURE__ */ react_exports.createElement(
1140
+ TrellisTitle,
1141
+ {
1142
+ fontColor: defaultFontColor,
1143
+ backgroundColor,
1144
+ trellisKey
1145
+ }
1146
+ ), /* @__PURE__ */ react_exports.createElement(
1147
+ Container,
1148
+ {
1149
+ "data-test": "marker-gauge-container",
1150
+ width,
1151
+ height: Number(height) - TRELLIS_TITLE_HEIGHT,
1152
+ backgroundColor
1153
+ },
1154
+ /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
1155
+ renderVisualization()
1156
+ ));
1157
+ }
933
1158
  return /* @__PURE__ */ react_exports.createElement(
934
1159
  Container,
935
1160
  {
@@ -946,7 +1171,6 @@ MarkerGauge.propTypes = {
946
1171
  width: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
947
1172
  height: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
948
1173
  value: prop_types_exports.number,
949
- // valueFieldName: T.string, // todo: need add it back when displaying name later
950
1174
  orientation: prop_types_exports.oneOf(["horizontal", "vertical"]),
951
1175
  majorUnit: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
952
1176
  showLabels: prop_types_exports.bool,
@@ -1009,45 +1233,36 @@ var visualization_icons_exports = {};
1009
1233
  __export(visualization_icons_exports, {
1010
1234
  default: () => visualization_icons_default
1011
1235
  });
1012
- var defaultImport13 = __toESM(require("@splunk/visualization-icons"));
1236
+ var defaultImport15 = __toESM(require("@splunk/visualization-icons"));
1013
1237
  __reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
1014
- var visualization_icons_default = "default" in defaultImport13 ? defaultImport13.default : defaultImport13;
1238
+ var visualization_icons_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
1015
1239
 
1016
1240
  // esm-externals:@splunk/visualization-icons/placeholders
1017
1241
  var placeholders_exports = {};
1018
1242
  __export(placeholders_exports, {
1019
1243
  default: () => placeholders_default
1020
1244
  });
1021
- var defaultImport14 = __toESM(require("@splunk/visualization-icons/placeholders"));
1245
+ var defaultImport16 = __toESM(require("@splunk/visualization-icons/placeholders"));
1022
1246
  __reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
1023
- var placeholders_default = "default" in defaultImport14 ? defaultImport14.default : defaultImport14;
1024
-
1025
- // esm-externals:@splunk/visualization-schemas
1026
- var visualization_schemas_exports = {};
1027
- __export(visualization_schemas_exports, {
1028
- default: () => visualization_schemas_default
1029
- });
1030
- var defaultImport15 = __toESM(require("@splunk/visualization-schemas"));
1031
- __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
1032
- var visualization_schemas_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
1247
+ var placeholders_default = "default" in defaultImport16 ? defaultImport16.default : defaultImport16;
1033
1248
 
1034
1249
  // esm-externals:@splunk/themes/variables
1035
1250
  var variables_exports = {};
1036
1251
  __export(variables_exports, {
1037
1252
  default: () => variables_default
1038
1253
  });
1039
- var defaultImport16 = __toESM(require("@splunk/themes/variables"));
1254
+ var defaultImport17 = __toESM(require("@splunk/themes/variables"));
1040
1255
  __reExport(variables_exports, require("@splunk/themes/variables"));
1041
- var variables_default = "default" in defaultImport16 ? defaultImport16.default : defaultImport16;
1256
+ var variables_default = "default" in defaultImport17 ? defaultImport17.default : defaultImport17;
1042
1257
 
1043
1258
  // esm-externals:@splunk/themes/pick
1044
1259
  var pick_exports = {};
1045
1260
  __export(pick_exports, {
1046
1261
  default: () => pick_default
1047
1262
  });
1048
- var defaultImport17 = __toESM(require("@splunk/themes/pick"));
1263
+ var defaultImport18 = __toESM(require("@splunk/themes/pick"));
1049
1264
  __reExport(pick_exports, require("@splunk/themes/pick"));
1050
- var pick_default = "default" in defaultImport17 ? defaultImport17.default : defaultImport17;
1265
+ var pick_default = "default" in defaultImport18 ? defaultImport18.default : defaultImport18;
1051
1266
 
1052
1267
  // src/common/editorConfig/Gauge.ts
1053
1268
  var gauge = {
@@ -1103,9 +1318,9 @@ var configUtils_exports = {};
1103
1318
  __export(configUtils_exports, {
1104
1319
  default: () => configUtils_default
1105
1320
  });
1106
- var defaultImport18 = __toESM(require("@splunk/visualizations-shared/configUtils"));
1321
+ var defaultImport19 = __toESM(require("@splunk/visualizations-shared/configUtils"));
1107
1322
  __reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
1108
- var configUtils_default = "default" in defaultImport18 ? defaultImport18.default : defaultImport18;
1323
+ var configUtils_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
1109
1324
 
1110
1325
  // src/common/utils/configUtils.ts
1111
1326
  function enhanceConfig(vizConfig) {
@@ -1143,6 +1358,110 @@ var defaultBackgroundColor = (props) => pick_default({
1143
1358
  prisma: variables_default.backgroundColorSection(props)
1144
1359
  })(props);
1145
1360
 
1361
+ // src/common/editorConfig/TrellisEditors.ts
1362
+ var isTrellisFeatureFlagOn = ({ featureFlags }) => {
1363
+ return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
1364
+ };
1365
+ var isTrellisEnabled = ({ options, featureFlags }) => {
1366
+ const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
1367
+ return isTrellisFeatureFlagOn({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
1368
+ };
1369
+ var TrellisEditorConfig = [
1370
+ [
1371
+ {
1372
+ label: (0, i18n_exports._)("Trellis layout"),
1373
+ option: "splitByLayout",
1374
+ editor: "editor.toggle",
1375
+ showEditor: isTrellisFeatureFlagOn
1376
+ }
1377
+ ],
1378
+ [
1379
+ {
1380
+ label: (0, i18n_exports._)("Split by"),
1381
+ option: "trellisSplitBy",
1382
+ editor: "editor.trellisSplitBy",
1383
+ editorProps: {
1384
+ dataSourceKey: "primary"
1385
+ },
1386
+ showEditor: isTrellisEnabled
1387
+ }
1388
+ ],
1389
+ [
1390
+ {
1391
+ label: (0, i18n_exports._)("Number of columns"),
1392
+ option: "trellisColumns",
1393
+ editor: "editor.number",
1394
+ editorProps: {
1395
+ min: 1
1396
+ },
1397
+ showEditor: isTrellisEnabled
1398
+ }
1399
+ ],
1400
+ [
1401
+ {
1402
+ label: (0, i18n_exports._)("Min column width"),
1403
+ option: "trellisMinColumnWidth",
1404
+ editor: "editor.number",
1405
+ editorProps: {
1406
+ min: 1
1407
+ },
1408
+ showEditor: isTrellisEnabled
1409
+ },
1410
+ {
1411
+ label: (0, i18n_exports._)("Row height"),
1412
+ option: "trellisRowHeight",
1413
+ editor: "editor.number",
1414
+ editorProps: {
1415
+ min: 1
1416
+ },
1417
+ showEditor: isTrellisEnabled
1418
+ }
1419
+ ],
1420
+ [
1421
+ {
1422
+ label: (0, i18n_exports._)("Max number of components per page"),
1423
+ option: "trellisPageCount",
1424
+ editor: "editor.number",
1425
+ editorProps: {
1426
+ min: 1
1427
+ },
1428
+ showEditor: isTrellisEnabled
1429
+ }
1430
+ ]
1431
+ ];
1432
+ var TimechartTrellisEditorConfig = [
1433
+ [
1434
+ {
1435
+ label: (0, i18n_exports._)("Trellis layout"),
1436
+ option: "splitByLayout",
1437
+ editor: "editor.toggle",
1438
+ showEditor: isTrellisFeatureFlagOn,
1439
+ // add help text for timecharts
1440
+ editorProps: {
1441
+ help: (0, i18n_exports._)(
1442
+ "Y2-axis and overlay field configurations are not supported when trellis is enabled."
1443
+ ),
1444
+ helpFormat: "under"
1445
+ }
1446
+ }
1447
+ ],
1448
+ ...TrellisEditorConfig.slice(1),
1449
+ [
1450
+ {
1451
+ label: (0, i18n_exports._)("Shared y-axis scale"),
1452
+ option: "trellisSharedScale",
1453
+ editor: "editor.checkbox",
1454
+ showEditor: isTrellisEnabled
1455
+ }
1456
+ ]
1457
+ ];
1458
+ var TrellisBackgroundColorEditor = {
1459
+ label: (0, i18n_exports._)("Trellis background"),
1460
+ option: "trellisBackgroundColor",
1461
+ editor: "editor.color",
1462
+ showEditor: isTrellisEnabled
1463
+ };
1464
+
1146
1465
  // src/MarkerGauge/config.ts
1147
1466
  var dataContract = {
1148
1467
  requiredDataSources: [
@@ -1185,6 +1504,10 @@ var themes = {
1185
1504
  valueMarkerLabelFillColor: (props) => pick_default({
1186
1505
  light: variables_default.gray96(props),
1187
1506
  dark: variables_default.black(props)
1507
+ })(props),
1508
+ defaultFontColor: (props) => pick_default({
1509
+ enterprise: variables_default.textColor(props),
1510
+ prisma: variables_default.contentColorDefault(props)
1188
1511
  })(props)
1189
1512
  };
1190
1513
  var editorConfig = [
@@ -1215,7 +1538,10 @@ var editorConfig = [
1215
1538
  ]
1216
1539
  ]
1217
1540
  },
1218
- Gauge_default,
1541
+ {
1542
+ label: Gauge_default.label,
1543
+ layout: [...Gauge_default.layout, ...TrellisEditorConfig]
1544
+ },
1219
1545
  {
1220
1546
  label: (0, i18n_exports._)("Color and style"),
1221
1547
  layout: [
@@ -1232,7 +1558,14 @@ var editorConfig = [
1232
1558
  }
1233
1559
  }
1234
1560
  ],
1235
- BackgroundColor_default({ themes, labelPosition: "top" })
1561
+ BackgroundColor_default({ themes, labelPosition: "top" }),
1562
+ [
1563
+ __spreadProps(__spreadValues({}, TrellisBackgroundColorEditor), {
1564
+ editorProps: {
1565
+ themes
1566
+ }
1567
+ })
1568
+ ]
1236
1569
  ]
1237
1570
  }
1238
1571
  ];
@@ -1256,7 +1589,7 @@ var config = {
1256
1589
  defaultContext,
1257
1590
  optionsSchema: visualization_schemas_exports.markerGaugeOptionsSchema,
1258
1591
  editorConfig,
1259
- supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */],
1592
+ supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */, "trellis" /* TRELLIS */],
1260
1593
  themes
1261
1594
  };
1262
1595
  var config_default = enhanceConfig(config);
@@ -1266,54 +1599,45 @@ var getSettingsFromThemedProps_exports = {};
1266
1599
  __export(getSettingsFromThemedProps_exports, {
1267
1600
  default: () => getSettingsFromThemedProps_default
1268
1601
  });
1269
- var defaultImport19 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
1602
+ var defaultImport20 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
1270
1603
  __reExport(getSettingsFromThemedProps_exports, require("@splunk/themes/getSettingsFromThemedProps"));
1271
- var getSettingsFromThemedProps_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
1604
+ var getSettingsFromThemedProps_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
1272
1605
 
1273
1606
  // esm-externals:@splunk/visualization-encoding/Options
1274
1607
  var Options_exports = {};
1275
1608
  __export(Options_exports, {
1276
1609
  default: () => Options_default
1277
1610
  });
1278
- var defaultImport20 = __toESM(require("@splunk/visualization-encoding/Options"));
1611
+ var defaultImport21 = __toESM(require("@splunk/visualization-encoding/Options"));
1279
1612
  __reExport(Options_exports, require("@splunk/visualization-encoding/Options"));
1280
- var Options_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
1613
+ var Options_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
1281
1614
 
1282
1615
  // esm-externals:@splunk/visualizations-shared/SanitizeProps
1283
1616
  var SanitizeProps_exports = {};
1284
1617
  __export(SanitizeProps_exports, {
1285
1618
  default: () => SanitizeProps_default
1286
1619
  });
1287
- var defaultImport21 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
1620
+ var defaultImport22 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
1288
1621
  __reExport(SanitizeProps_exports, require("@splunk/visualizations-shared/SanitizeProps"));
1289
- var SanitizeProps_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
1622
+ var SanitizeProps_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
1290
1623
 
1291
1624
  // esm-externals:@splunk/visualization-context/TimezoneContext
1292
1625
  var TimezoneContext_exports = {};
1293
1626
  __export(TimezoneContext_exports, {
1294
1627
  default: () => TimezoneContext_default
1295
1628
  });
1296
- var defaultImport22 = __toESM(require("@splunk/visualization-context/TimezoneContext"));
1629
+ var defaultImport23 = __toESM(require("@splunk/visualization-context/TimezoneContext"));
1297
1630
  __reExport(TimezoneContext_exports, require("@splunk/visualization-context/TimezoneContext"));
1298
- var TimezoneContext_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
1631
+ var TimezoneContext_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
1299
1632
 
1300
1633
  // esm-externals:@splunk/moment
1301
1634
  var moment_exports = {};
1302
1635
  __export(moment_exports, {
1303
1636
  default: () => moment_default
1304
1637
  });
1305
- var defaultImport23 = __toESM(require("@splunk/moment"));
1638
+ var defaultImport24 = __toESM(require("@splunk/moment"));
1306
1639
  __reExport(moment_exports, require("@splunk/moment"));
1307
- var moment_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
1308
-
1309
- // esm-externals:@splunk/visualization-context/FeatureFlagContext
1310
- var FeatureFlagContext_exports = {};
1311
- __export(FeatureFlagContext_exports, {
1312
- default: () => FeatureFlagContext_default
1313
- });
1314
- var defaultImport24 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
1315
- __reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
1316
- var FeatureFlagContext_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
1640
+ var moment_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
1317
1641
 
1318
1642
  // esm-externals:@splunk/visualizations-shared/hocUtils
1319
1643
  var hocUtils_exports = {};
@@ -1596,7 +1920,7 @@ var Cover = styled_components_default.div`
1596
1920
  bottom: 0;
1597
1921
  `;
1598
1922
  var Blocker = styled_components_default.div.attrs({
1599
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b"
1923
+ "data-splunk-visualization-version": "28.5.0 - b192418b7"
1600
1924
  })`
1601
1925
  position: relative;
1602
1926
  width: 100%;
@@ -1677,7 +2001,7 @@ var withFixedSizeContainer = (Viz) => {
1677
2001
  FixSizeItem,
1678
2002
  {
1679
2003
  "data-test": "fix-size-item",
1680
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b",
2004
+ "data-splunk-visualization-version": "28.5.0 - b192418b7",
1681
2005
  width,
1682
2006
  height,
1683
2007
  backgroundColor
@@ -1764,6 +2088,7 @@ var withPlaceholder = (Visualization, useIconPlaceholder = shouldShowIconPlaceho
1764
2088
  var withPlaceholder_default = withPlaceholder;
1765
2089
 
1766
2090
  // src/common/utils/dataUtils.ts
2091
+ var getFieldName = (field) => typeof field === "string" ? field : field.name;
1767
2092
  var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
1768
2093
  const dataLength = data.length;
1769
2094
  const downsampledIndices = [];
@@ -1880,9 +2205,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
1880
2205
  let xColumn = [];
1881
2206
  const yColumns = [];
1882
2207
  const canDownsample = !ds.data.fields.some((field, index) => {
1883
- var _a, _b;
1884
- const fieldName = (_a = field.name) != null ? _a : field;
1885
- const fieldType = (_b = fieldTypes[index]) != null ? _b : "unknown";
2208
+ var _a;
2209
+ const fieldName = getFieldName(field);
2210
+ const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
1886
2211
  const column = ds.data.columns[index];
1887
2212
  let hasDisplayedColumnThatCantBeDownsampled = false;
1888
2213
  if (fieldName === xField) {
@@ -2166,6 +2491,305 @@ __reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisU
2166
2491
  var trellisUtils_default = "default" in defaultImport30 ? defaultImport30.default : defaultImport30;
2167
2492
 
2168
2493
  // src/common/utils/trellisUtils.ts
2494
+ var AGGREGATIONS = "aggregations";
2495
+ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
2496
+ var _a, _b, _c, _d;
2497
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2498
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2499
+ let splitDataSources = null;
2500
+ let errorCode = null;
2501
+ if (fields && fields.length) {
2502
+ splitDataSources = {};
2503
+ for (let i = 0; i < fields.length; i += 1) {
2504
+ const fieldName = fields[i].name;
2505
+ if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
2506
+ splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
2507
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2508
+ );
2509
+ splitDataSources[fieldName].primary.data.fields = [fields[i]];
2510
+ splitDataSources[fieldName].primary.data.columns = [columns[i]];
2511
+ }
2512
+ }
2513
+ } else {
2514
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2515
+ }
2516
+ return { splitDataSources, errorCode };
2517
+ };
2518
+ var toFieldEntries = (fields = []) => {
2519
+ return fields.map((field) => {
2520
+ if (typeof field === "string") {
2521
+ return { name: field };
2522
+ }
2523
+ return field;
2524
+ });
2525
+ };
2526
+ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
2527
+ var _a, _b, _c, _d;
2528
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2529
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2530
+ let splitDataSources = null;
2531
+ let splitByFields = [];
2532
+ let errorCode = null;
2533
+ if (fields.length > 0) {
2534
+ splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2535
+ }
2536
+ if (splitByFields && splitByFields.length > 0) {
2537
+ splitDataSources = {};
2538
+ splitByFields.forEach((splitByField) => {
2539
+ splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
2540
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2541
+ );
2542
+ splitDataSources[splitByField].primary.data.fields = [fields[0]];
2543
+ splitDataSources[splitByField].primary.data.columns = [columns[0]];
2544
+ fields.forEach((field, idx) => {
2545
+ const fieldName = field == null ? void 0 : field.name;
2546
+ if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
2547
+ splitDataSources[splitByField].primary.data.fields.push(field);
2548
+ splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
2549
+ }
2550
+ });
2551
+ });
2552
+ } else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
2553
+ splitDataSources = {};
2554
+ for (let i = 1; i < fields.length; i += 1) {
2555
+ const fieldName = fields[i].name;
2556
+ if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
2557
+ splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
2558
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2559
+ );
2560
+ splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
2561
+ splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
2562
+ }
2563
+ }
2564
+ } else {
2565
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2566
+ }
2567
+ return { splitDataSources, errorCode };
2568
+ };
2569
+ var dataSourcesSplitByAggregationsStats = (dataSource) => {
2570
+ var _a, _b, _c, _d;
2571
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2572
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2573
+ let splitDataSources = null;
2574
+ let splitByFields = [];
2575
+ let errorCode = null;
2576
+ if (fields.length > 0) {
2577
+ splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
2578
+ }
2579
+ if (splitByFields && splitByFields.length > 0) {
2580
+ splitDataSources = {};
2581
+ splitByFields.forEach((splitByField) => {
2582
+ splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
2583
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2584
+ );
2585
+ splitDataSources[splitByField].primary.data.fields = [fields[0]];
2586
+ splitDataSources[splitByField].primary.data.columns = [columns[0]];
2587
+ const idx = fields.findIndex((field) => field.name === splitByField);
2588
+ if (idx > 0) {
2589
+ splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
2590
+ splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
2591
+ }
2592
+ });
2593
+ } else {
2594
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2595
+ }
2596
+ return { splitDataSources, errorCode };
2597
+ };
2598
+ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
2599
+ var _a, _b, _c, _d, _e;
2600
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2601
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2602
+ let splitDataSources = null;
2603
+ let splitByFields = [];
2604
+ let errorCode = null;
2605
+ if (fields.length > 0) {
2606
+ splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
2607
+ }
2608
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
2609
+ splitDataSources = {};
2610
+ const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2611
+ const valueKeys = [];
2612
+ for (let i = 1; i < fields.length; i += 1) {
2613
+ if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
2614
+ valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
2615
+ }
2616
+ }
2617
+ valueKeys.forEach((val) => {
2618
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2619
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2620
+ );
2621
+ splitDataSources[val].primary.data.fields = [{ name: fields[0].name }];
2622
+ splitDataSources[val].primary.data.columns = [[...columns[0]]];
2623
+ dataSourceKeys.forEach((dsKey) => {
2624
+ fields.forEach((field, idx) => {
2625
+ if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
2626
+ splitDataSources[val].primary.data.fields.push({
2627
+ name: dsKey
2628
+ });
2629
+ splitDataSources[val].primary.data.columns.push([...columns[idx]]);
2630
+ }
2631
+ });
2632
+ });
2633
+ });
2634
+ } else {
2635
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2636
+ }
2637
+ return { splitDataSources, errorCode };
2638
+ };
2639
+ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
2640
+ var _a, _b, _c, _d;
2641
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2642
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2643
+ let splitDataSources = null;
2644
+ let splitByFields = [];
2645
+ let errorCode = null;
2646
+ if (fields.length > 0) {
2647
+ splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
2648
+ }
2649
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
2650
+ splitDataSources = {};
2651
+ const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
2652
+ const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
2653
+ const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2654
+ const nonDataSourceAggregations = [];
2655
+ if (!dataSourceKeys.length && fields[0].groupby_rank === "0" && fields.length && !fields[1].groupby_rank) {
2656
+ for (let i = 1; i < fields.length; i += 1) {
2657
+ nonDataSourceAggregations.push(fields[i].name);
2658
+ }
2659
+ }
2660
+ if (splitByFieldIdx === 0) {
2661
+ const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
2662
+ valueKeys.forEach((val, idx) => {
2663
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2664
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2665
+ );
2666
+ splitDataSources[val].primary.data.fields = [];
2667
+ if (otherSplitBy.length) {
2668
+ splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
2669
+ }
2670
+ if (dataSourceKeys.length) {
2671
+ const columnValues = [[]];
2672
+ splitDataSources[val].primary.data.fields = [
2673
+ ...splitDataSources[val].primary.data.fields,
2674
+ ...dataSourceKeys.map((k) => ({
2675
+ name: k
2676
+ }))
2677
+ ];
2678
+ dataSourceKeys.forEach(() => {
2679
+ columnValues.push([]);
2680
+ });
2681
+ for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
2682
+ columnValues[0].push(
2683
+ fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
2684
+ );
2685
+ dataSourceKeys.forEach((dskey, dsIndx) => {
2686
+ const mul = (fields.length - 1) / dataSourceKeys.length;
2687
+ columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
2688
+ });
2689
+ }
2690
+ splitDataSources[val].primary.data.columns = columnValues;
2691
+ } else if (nonDataSourceAggregations.length) {
2692
+ const columnValues = [];
2693
+ fields.forEach((aggregationField, fieldIdx) => {
2694
+ if (fieldIdx > 0) {
2695
+ splitDataSources[val].primary.data.fields.push(aggregationField);
2696
+ columnValues.push([columns[fieldIdx][idx]]);
2697
+ }
2698
+ });
2699
+ splitDataSources[val].primary.data.columns = columnValues;
2700
+ }
2701
+ });
2702
+ } else {
2703
+ const valueKeys = [];
2704
+ for (let i = 1; i < fields.length; i += 1) {
2705
+ valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
2706
+ }
2707
+ valueKeys.forEach((val) => {
2708
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2709
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2710
+ );
2711
+ splitDataSources[val].primary.data.fields = [
2712
+ { name: otherSplitBy[0] },
2713
+ ...dataSourceKeys.map((k) => ({
2714
+ name: k
2715
+ }))
2716
+ ];
2717
+ splitDataSources[val].primary.data.columns = [[...columns[0]]];
2718
+ dataSourceKeys.forEach((dsKey) => {
2719
+ fields.forEach((field, idx) => {
2720
+ if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
2721
+ splitDataSources[val].primary.data.columns.push([...columns[idx]]);
2722
+ }
2723
+ });
2724
+ });
2725
+ });
2726
+ }
2727
+ } else {
2728
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2729
+ }
2730
+ return { splitDataSources, errorCode };
2731
+ };
2732
+ var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
2733
+ var _a, _b, _c, _d, _e, _f;
2734
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2735
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2736
+ let splitDataSources = null;
2737
+ let splitByFields = [];
2738
+ let errorCode = null;
2739
+ if (fields.length > 0) {
2740
+ splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
2741
+ }
2742
+ const splitByIndex = fields.findIndex((field) => field.name === splitBy);
2743
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
2744
+ const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
2745
+ splitDataSources = {};
2746
+ splitByColumn.forEach((val, idx) => {
2747
+ if (!splitDataSources[val]) {
2748
+ splitDataSources[val] = [idx];
2749
+ } else {
2750
+ splitDataSources[val].push(idx);
2751
+ }
2752
+ });
2753
+ const cloneFields = (0, lodash_exports.cloneDeep)(fields);
2754
+ cloneFields.splice(splitByIndex, 1);
2755
+ const valueKeys = Object.keys(splitDataSources);
2756
+ valueKeys.forEach((val) => {
2757
+ const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
2758
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2759
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2760
+ );
2761
+ splitDataSources[val].primary.data.fields = cloneFields;
2762
+ splitDataSources[val].primary.data.columns = [];
2763
+ columns.forEach((col, idx) => {
2764
+ if (idx !== splitByIndex) {
2765
+ const newCol = valIndices.map((valIdx) => col[valIdx]);
2766
+ splitDataSources[val].primary.data.columns.push(newCol);
2767
+ }
2768
+ });
2769
+ });
2770
+ } else {
2771
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2772
+ }
2773
+ return { splitDataSources, errorCode };
2774
+ };
2775
+ var getTrellisDataSourcesBySplitMode = (splitMode, dataSources, trellisSplitBy) => {
2776
+ let result = null;
2777
+ try {
2778
+ if (splitMode === trellisUtils_exports.TIMECHART) {
2779
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeTimechart(dataSources, trellisSplitBy);
2780
+ } else if (splitMode === trellisUtils_exports.STATS) {
2781
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsStats(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.STATS);
2782
+ } else if (splitMode === trellisUtils_exports.CHART) {
2783
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeChart(dataSources, trellisSplitBy);
2784
+ } else if (splitMode === trellisUtils_exports.UNKNOWN) {
2785
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsUnknown(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.UNKNOWN);
2786
+ }
2787
+ } catch (ex) {
2788
+ console.error("getTrellisDataSourcesBySplitMode ", ex);
2789
+ result = { splitDataSources: null, errorCode: "UNKNOWN" };
2790
+ }
2791
+ return result;
2792
+ };
2169
2793
  var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
2170
2794
  if (isTrellisOn && !options.legendDisplay) {
2171
2795
  return {
@@ -2174,6 +2798,36 @@ var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
2174
2798
  }
2175
2799
  return {};
2176
2800
  };
2801
+ var calculateSharedMinMax = (splitData) => {
2802
+ let max = -Infinity;
2803
+ let min = Infinity;
2804
+ Object.keys(splitData).forEach((splitByKey) => {
2805
+ const datasources = splitData[splitByKey];
2806
+ Object.keys(datasources).forEach((datasourceName) => {
2807
+ const dataColumns = datasources[datasourceName].data.columns;
2808
+ dataColumns.forEach((column) => {
2809
+ column.forEach((point) => {
2810
+ const pointNumber = Number(point);
2811
+ if (pointNumber > max) {
2812
+ max = pointNumber;
2813
+ }
2814
+ if (pointNumber < min) {
2815
+ min = pointNumber;
2816
+ }
2817
+ });
2818
+ });
2819
+ });
2820
+ });
2821
+ return [min, max];
2822
+ };
2823
+ var determineMinMax = (splitData, trellisSharedScale, yAxisMin, yAxisMax, stackMode) => {
2824
+ if (!trellisSharedScale || stackMode === "stacked100" || yAxisMin !== "auto" && yAxisMax !== "auto")
2825
+ return [yAxisMin, yAxisMax];
2826
+ const [sharedMin, sharedMax] = calculateSharedMinMax(splitData);
2827
+ const shouldUseSharedMax = sharedMax !== -Infinity && yAxisMax === "auto";
2828
+ const shouldUseSharedMin = sharedMin !== Infinity && yAxisMin === "auto";
2829
+ return [shouldUseSharedMin ? sharedMin : yAxisMin, shouldUseSharedMax ? sharedMax : yAxisMax];
2830
+ };
2177
2831
 
2178
2832
  // esm-externals:@splunk/visualization-canvas
2179
2833
  var visualization_canvas_exports = {};
@@ -2235,6 +2889,16 @@ var triangleEventAnnotationRenderer = ({
2235
2889
  eventColor: eventWithColor.color
2236
2890
  });
2237
2891
  };
2892
+ var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
2893
+ const rangeSelectEventHandler = eventHandlers.find(
2894
+ (eventHandler) => {
2895
+ var _a;
2896
+ return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
2897
+ }
2898
+ );
2899
+ const xAxisIsTime = xField === "_time";
2900
+ return !!rangeSelectEventHandler && xAxisIsTime;
2901
+ };
2238
2902
  var canvasSupportedTimeSeriesCharts = ["splunk.line"];
2239
2903
  var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
2240
2904
  return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
@@ -2255,17 +2919,34 @@ var filterChartDataFromInternalFields = (chartData) => {
2255
2919
  var convert2DArrayToNumbers = (arr) => {
2256
2920
  return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
2257
2921
  };
2258
- var SideLegendWidth = 75;
2259
- var commonLegendProps = { center: true, fontSize: 12, largerTiles: true, hideSeriesValue: true };
2922
+ var parseAxisValue = (val) => {
2923
+ if (val === void 0 || val === null || val === "auto" || val === "") {
2924
+ return void 0;
2925
+ }
2926
+ const num = typeof val === "number" ? val : Number.parseFloat(val);
2927
+ return Number.isNaN(num) ? void 0 : num;
2928
+ };
2929
+ var parseXAxisLineVisibility = (visibility) => {
2930
+ if (visibility === "hide") return false;
2931
+ if (visibility === "show") return true;
2932
+ return void 0;
2933
+ };
2260
2934
  var getLegend = (props) => {
2261
2935
  const legendPlacement = props == null ? void 0 : props.legendDisplay;
2936
+ const { isSeriesCompare, legendTruncation } = props;
2937
+ const commonLegendProps = {
2938
+ center: true,
2939
+ fontSize: 12,
2940
+ largerTiles: true,
2941
+ hideSeriesValue: !isSeriesCompare,
2942
+ // Show values if in seriesCompare mode
2943
+ legendTruncation
2944
+ };
2262
2945
  switch (legendPlacement) {
2263
2946
  case "off":
2264
2947
  return false;
2265
2948
  case "left":
2266
- return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
2267
- width: SideLegendWidth
2268
- }, commonLegendProps));
2949
+ return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({}, commonLegendProps));
2269
2950
  case "bottom":
2270
2951
  return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
2271
2952
  wrap: true
@@ -2275,9 +2956,7 @@ var getLegend = (props) => {
2275
2956
  wrap: true
2276
2957
  }, commonLegendProps));
2277
2958
  default:
2278
- return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
2279
- width: SideLegendWidth
2280
- }, commonLegendProps));
2959
+ return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({}, commonLegendProps));
2281
2960
  }
2282
2961
  };
2283
2962
  var getComputedAxisTitles = (inputAxisTitle, fields, axisTitleVisibility) => {
@@ -2312,22 +2991,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
2312
2991
  const end = axisTitle.slice(-halfChars);
2313
2992
  return `${start}...${end}`;
2314
2993
  };
2315
- var getFieldName = (field) => {
2994
+ var getFieldName2 = (field) => {
2316
2995
  const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
2317
2996
  return fieldName;
2318
2997
  };
2319
2998
  var getFieldNames = (fields) => {
2320
- return fields.map((field) => getFieldName(field));
2999
+ return fields.map((field) => getFieldName2(field));
2321
3000
  };
2322
- var getXScaleConfig = (label, xAxisLabelVisibility) => {
3001
+ var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
2323
3002
  const xConfig = { x: {} };
2324
3003
  xConfig.x.label = label;
2325
3004
  if (xAxisLabelVisibility === "hide") {
2326
3005
  xConfig.x.hideLabels = true;
2327
3006
  }
3007
+ if (xAxisLabelRotation !== void 0) {
3008
+ xConfig.x.labelRotation = xAxisLabelRotation;
3009
+ }
2328
3010
  return xConfig;
2329
3011
  };
2330
- var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
3012
+ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
2331
3013
  const scaleType = yAxisScale != null ? yAxisScale : "linear";
2332
3014
  const yConfig = { y: {} };
2333
3015
  yConfig.y.label = label;
@@ -2335,34 +3017,46 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
2335
3017
  if (yAxisAbbreviation !== "none") {
2336
3018
  yConfig.y.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1);
2337
3019
  }
2338
- if (yAxisAbbreviation === "none") {
2339
- yConfig.y.width = 55;
2340
- } else {
3020
+ if (yAxisAbbreviation !== "none") {
2341
3021
  yConfig.y.width = label && label.length > 0 ? 30 : 10;
2342
3022
  }
2343
3023
  if (yAxisLabelVisibility === "hide") {
2344
3024
  yConfig.y.hideLabels = true;
2345
3025
  }
3026
+ if (yAxisMin !== void 0 || yAxisMax !== void 0) {
3027
+ yConfig.y.range = (u, dataMin, dataMax) => {
3028
+ const min = yAxisMin != null ? yAxisMin : dataMin;
3029
+ const max = yAxisMax != null ? yAxisMax : dataMax;
3030
+ return [min, max];
3031
+ };
3032
+ }
2346
3033
  return yConfig;
2347
3034
  };
2348
- var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
3035
+ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
2349
3036
  const y2Config = { y2: {} };
2350
3037
  const scaleType = axisScale != null ? axisScale : "linear";
2351
3038
  y2Config.y2.label = label;
2352
3039
  y2Config.y2.side = "right";
2353
- y2Config.y2.showGrid = false;
2354
3040
  y2Config.y2.type = scaleType;
2355
3041
  if (axisAbbreviation !== "none") {
2356
3042
  y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
3043
+ y2Config.y2.width = label && label.length > 0 ? 50 : 10;
2357
3044
  } else if (roundAxisLabelsToInteger) {
2358
3045
  y2Config.y2.tickFmt = (v) => roundAxisLabelsToInteger ? Math.round(v).toString() : v.toString();
2359
3046
  }
2360
3047
  if (y2AxisLabelVisibility === "hide") {
2361
3048
  y2Config.y2.hideLabels = true;
2362
3049
  }
3050
+ if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
3051
+ y2Config.y2.range = (u, dataMin, dataMax) => {
3052
+ const min = y2AxisMin != null ? y2AxisMin : dataMin;
3053
+ const max = y2AxisMax != null ? y2AxisMax : dataMax;
3054
+ return [min, max];
3055
+ };
3056
+ }
2363
3057
  return y2Config;
2364
3058
  };
2365
- var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
3059
+ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField, stepPosition, stepPositionsByField) => {
2366
3060
  const seriesConfig = {};
2367
3061
  let spanGaps;
2368
3062
  let replaceNullsWithZero;
@@ -2389,6 +3083,8 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
2389
3083
  );
2390
3084
  if (shouldAssignToY2) {
2391
3085
  seriesConfig[field].overrides.scale = "y2";
3086
+ } else {
3087
+ seriesConfig[field].overrides.scale = "y";
2392
3088
  }
2393
3089
  }
2394
3090
  if (overlayFields == null ? void 0 : overlayFields.includes(field)) {
@@ -2397,12 +3093,50 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
2397
3093
  if (markerDisplay !== void 0) {
2398
3094
  seriesConfig[field].markerDisplay = markerDisplay;
2399
3095
  }
3096
+ const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
3097
+ if (fieldDashStyle) {
3098
+ seriesConfig[field].lineDashStyle = fieldDashStyle;
3099
+ }
3100
+ const hasFieldStepPosition = Object.hasOwn(stepPositionsByField || {}, field);
3101
+ const fieldStepPosition = hasFieldStepPosition ? stepPositionsByField == null ? void 0 : stepPositionsByField[field] : stepPosition;
3102
+ if (fieldStepPosition && fieldStepPosition !== "off") {
3103
+ seriesConfig[field].stepPosition = fieldStepPosition;
3104
+ }
2400
3105
  if (replaceNullsWithZero !== void 0) {
2401
3106
  seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
2402
3107
  }
2403
3108
  });
2404
3109
  return seriesConfig;
2405
3110
  };
3111
+ var findRangeIndices = (xData, startValue, endValue) => {
3112
+ let startXIndex = -1;
3113
+ let endXIndex = -1;
3114
+ const xDataEpoch = xData.map((val) => {
3115
+ if (typeof val === "string") {
3116
+ return new Date(val).getTime() / 1e3;
3117
+ }
3118
+ return val;
3119
+ });
3120
+ for (let i = 0; i < xDataEpoch.length; i += 1) {
3121
+ if (xDataEpoch[i] >= startValue) {
3122
+ startXIndex = i;
3123
+ break;
3124
+ }
3125
+ }
3126
+ if (startXIndex === -1 && xDataEpoch.length > 0) {
3127
+ startXIndex = xDataEpoch.length - 1;
3128
+ }
3129
+ for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
3130
+ if (xDataEpoch[i] <= endValue) {
3131
+ endXIndex = i;
3132
+ break;
3133
+ }
3134
+ }
3135
+ if (endXIndex === -1 && xDataEpoch.length > 0) {
3136
+ endXIndex = 0;
3137
+ }
3138
+ return { startXIndex, endXIndex };
3139
+ };
2406
3140
 
2407
3141
  // src/common/TimeSeriesChartWrapper.tsx
2408
3142
  var TimeSeriesChartContainer = styled_components_default.div`
@@ -2413,38 +3147,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
2413
3147
  position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
2414
3148
  }
2415
3149
  `;
2416
- var handleClick = (chartEvent, onClick) => {
3150
+ var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
3151
+ const result = __spreadValues({}, payload);
3152
+ if (trellisSplitBy) {
3153
+ result["trellis.name"] = trellisSplitBy;
3154
+ }
3155
+ if (trellisKey) {
3156
+ result["trellis.value"] = trellisKey;
3157
+ }
3158
+ return result;
3159
+ };
3160
+ var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
3161
+ if (!previousPayload) {
3162
+ return true;
3163
+ }
3164
+ if (currentPayload.index !== previousPayload.index) {
3165
+ return true;
3166
+ }
3167
+ if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
3168
+ return true;
3169
+ }
3170
+ if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
3171
+ return true;
3172
+ }
3173
+ if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
3174
+ return true;
3175
+ }
3176
+ return false;
3177
+ };
3178
+ var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
2417
3179
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
2418
3180
  name: chartEvent.seriesKey
2419
3181
  });
2420
3182
  delete payload.seriesKey;
2421
3183
  if (chartEvent.rowContext) {
2422
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
2423
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
2424
- });
3184
+ Object.assign(
3185
+ payload,
3186
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
3187
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3188
+ return acc;
3189
+ }, {})
3190
+ );
2425
3191
  }
3192
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2426
3193
  if (onClick) {
2427
3194
  onClick({
2428
3195
  type: "point.click",
2429
3196
  originalEvent: chartEvent,
2430
- payload
3197
+ payload: updatedPayload
2431
3198
  });
2432
3199
  }
2433
3200
  };
2434
- var handleLegendClick = (chartEvent, onClick) => {
3201
+ var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
2435
3202
  const payload = {
2436
3203
  name: chartEvent
2437
3204
  };
3205
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2438
3206
  if (onClick) {
2439
3207
  onClick({
2440
3208
  type: "legend.click",
2441
3209
  originalEvent: chartEvent,
2442
- payload
3210
+ payload: updatedPayload
3211
+ });
3212
+ }
3213
+ };
3214
+ var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3215
+ var _a;
3216
+ if (!rangeEvent) {
3217
+ return;
3218
+ }
3219
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3220
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3221
+ const payload = {
3222
+ startXIndex,
3223
+ startXValue: rangeEvent.start,
3224
+ endXIndex,
3225
+ endXValue: rangeEvent.end
3226
+ };
3227
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3228
+ if (onSelect) {
3229
+ onSelect({
3230
+ type: "range.selectBeforeZoom",
3231
+ originalEvent: rangeEvent,
3232
+ payload: updatedPayload
2443
3233
  });
2444
3234
  }
2445
3235
  };
3236
+ var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3237
+ var _a;
3238
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3239
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3240
+ const payload = {
3241
+ startXIndex,
3242
+ startXValue: rangeEvent.start,
3243
+ endXIndex,
3244
+ endXValue: rangeEvent.end
3245
+ };
3246
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3247
+ if (onSelect) {
3248
+ onSelect({
3249
+ type: "range.select",
3250
+ originalEvent: rangeEvent,
3251
+ payload: updatedPayload
3252
+ });
3253
+ }
3254
+ };
3255
+ var parseArrayOption = (value) => {
3256
+ if (Array.isArray(value)) {
3257
+ return value;
3258
+ }
3259
+ if (value) {
3260
+ return JSON.parse(value);
3261
+ }
3262
+ return void 0;
3263
+ };
2446
3264
  var TimeSeriesChartWrapper = (props) => {
2447
- const {
3265
+ var _b, _c, _d;
3266
+ const _a = props, {
2448
3267
  width,
2449
3268
  height,
2450
3269
  chartData,
@@ -2457,12 +3276,57 @@ var TimeSeriesChartWrapper = (props) => {
2457
3276
  markerDisplay,
2458
3277
  onClick,
2459
3278
  onPointMouseOver,
2460
- onPointMouseOut
2461
- } = props;
2462
- const {
3279
+ onPointMouseOut,
3280
+ onSelect,
3281
+ splitByLayout,
3282
+ trellisKey,
3283
+ trellisSplitBy,
2463
3284
  backgroundColor,
3285
+ defaultFontColor,
3286
+ additionalTooltipValues,
3287
+ xAxisLineVisibility: xAxisLineVisibility,
3288
+ yAxisLineVisibility,
3289
+ y2AxisLineVisibility,
3290
+ showYAxisWithZero: showYAxisWithZeroFromProps,
3291
+ showY2AxisWithZero: showY2AxisWithZeroFromProps
3292
+ } = _a, otherOptions = __objRest(_a, [
3293
+ "width",
3294
+ "height",
3295
+ "chartData",
3296
+ "options",
3297
+ "userLocale",
3298
+ "annotationX",
3299
+ "annotationLabel",
3300
+ "annotationColor",
3301
+ "legendDisplay",
3302
+ "markerDisplay",
3303
+ "onClick",
3304
+ "onPointMouseOver",
3305
+ "onPointMouseOut",
3306
+ "onSelect",
3307
+ "splitByLayout",
3308
+ "trellisKey",
3309
+ "trellisSplitBy",
3310
+ "backgroundColor",
3311
+ "defaultFontColor",
3312
+ "additionalTooltipValues",
3313
+ // Extract axis line visibility options from props
3314
+ "xAxisLineVisibility",
3315
+ "yAxisLineVisibility",
3316
+ "y2AxisLineVisibility",
3317
+ // Extract showYAxisWithZero directly from props for accelerated render mode
3318
+ "showYAxisWithZero",
3319
+ "showY2AxisWithZero"
3320
+ ]);
3321
+ const { eventHandlers, xField: xFieldFromProps } = otherOptions;
3322
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
3323
+ const {
3324
+ backgroundColor: bgColorFromOptions,
2464
3325
  seriesColors: seriesColorsStr,
2465
3326
  fieldColors,
3327
+ legendLabels: legendLabelsStr,
3328
+ legendMode,
3329
+ legendTruncation,
2466
3330
  "axisTitleX.text": xAxisTitleText,
2467
3331
  "axisTitleY.text": yAxisTitleText,
2468
3332
  "axisTitleY2.text": y2AxisTitleText,
@@ -2470,8 +3334,12 @@ var TimeSeriesChartWrapper = (props) => {
2470
3334
  "axisTitleY.visibility": yAxisTitleVisibility,
2471
3335
  "axisTitleY2.visibility": y2AxisTitleVisibility,
2472
3336
  "axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
3337
+ "axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
3338
+ "axisLabelsX.maxLabelParts": xAxisMaxLabelParts,
2473
3339
  "axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
3340
+ "axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
2474
3341
  "axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
3342
+ "axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
2475
3343
  "axisY.abbreviation": yAxisAbbreviation,
2476
3344
  "axisY.scale": yAxisScale,
2477
3345
  "axisY2.abbreviation": y2AxisAbbreviation,
@@ -2481,10 +3349,73 @@ var TimeSeriesChartWrapper = (props) => {
2481
3349
  "axisLabelsY2.integerUnits": y2IntegerUnits,
2482
3350
  "chart.overlayFields": overlayFieldsStr,
2483
3351
  "chart.nullValueMode": nullValueMode,
2484
- lineWidth
3352
+ "chart.showDataLabels": showDataLabels,
3353
+ lineWidth,
3354
+ lineDashStyle,
3355
+ fieldDashStyles: lineDashStylesByFieldStr,
3356
+ stepPosition,
3357
+ fieldStepPositions: stepPositionsByFieldStr,
3358
+ yAxisMin: yAxisMinRaw,
3359
+ yAxisMax: yAxisMaxRaw,
3360
+ y2AxisMin: y2AxisMinRaw,
3361
+ y2AxisMax: y2AxisMaxRaw,
3362
+ showXMajorGridLines,
3363
+ showYMajorGridLines,
3364
+ showY2MajorGridLines,
3365
+ showYMinorGridLines,
3366
+ showY2MinorGridLines,
3367
+ showLineSmoothing,
3368
+ xAxisMajorTickVisibility,
3369
+ xAxisMajorTickSize,
3370
+ yAxisMajorTickVisibility,
3371
+ y2AxisMajorTickVisibility,
3372
+ yAxisMajorTickSize,
3373
+ y2AxisMajorTickSize,
3374
+ yAxisMajorTickInterval,
3375
+ y2AxisMajorTickInterval,
3376
+ yAxisMinorTickVisibility,
3377
+ y2AxisMinorTickVisibility,
3378
+ yAxisMinorTickSize,
3379
+ y2AxisMinorTickSize,
3380
+ showYAxisWithZero: showYAxisWithZeroFromOptions,
3381
+ showY2AxisWithZero: showY2AxisWithZeroFromOptions
2485
3382
  } = options;
3383
+ const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
3384
+ const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
3385
+ const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
3386
+ const showXMajorTicks = xAxisMajorTickVisibility !== "hide";
3387
+ const showYMajorTicks = yAxisMajorTickVisibility === "show";
3388
+ const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
3389
+ const showYMinorTicks = yAxisMinorTickVisibility === "show";
3390
+ const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
3391
+ const showXAxisLine = parseXAxisLineVisibility(xAxisLineVisibility);
3392
+ const showYAxisLine = yAxisLineVisibility === "show";
3393
+ const showY2AxisLine = y2AxisLineVisibility === "show";
3394
+ const yAxisMin = parseAxisValue(yAxisMinRaw);
3395
+ const yAxisMax = parseAxisValue(yAxisMaxRaw);
3396
+ const y2AxisMin = parseAxisValue(y2AxisMinRaw);
3397
+ const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
3398
+ const parseTickInterval = (simpleXMLValue, canvasValue) => {
3399
+ if (simpleXMLValue) return Number(simpleXMLValue);
3400
+ if (canvasValue) return Number(canvasValue);
3401
+ return void 0;
3402
+ };
3403
+ const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
3404
+ const y2AxisMajorTickIntervalNum = parseTickInterval(
3405
+ y2AxisMajorUnitFromSimpleXML,
3406
+ y2AxisMajorTickInterval
3407
+ );
3408
+ const xAxisMajorTickSizeNum = xAxisMajorTickSize != null ? Number(xAxisMajorTickSize) : void 0;
3409
+ const yAxisMajorTickSizeNum = yAxisMajorTickSize != null ? Number(yAxisMajorTickSize) : void 0;
3410
+ const y2AxisMajorTickSizeNum = y2AxisMajorTickSize != null ? Number(y2AxisMajorTickSize) : void 0;
3411
+ const yAxisMinorTickSizeNum = yAxisMinorTickSize != null ? Number(yAxisMinorTickSize) : void 0;
3412
+ const y2AxisMinorTickSizeNum = y2AxisMinorTickSize != null ? Number(y2AxisMinorTickSize) : void 0;
2486
3413
  const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
2487
3414
  const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
3415
+ const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
3416
+ const stepPositionsByField = stepPositionsByFieldStr ? JSON.parse(stepPositionsByFieldStr) : void 0;
3417
+ const legendLabels = parseArrayOption(legendLabelsStr);
3418
+ const bgColor = backgroundColor || bgColorFromOptions;
2488
3419
  const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
2489
3420
  const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
2490
3421
  const cachedHandleResize = react_exports.useCallback((w, h) => {
@@ -2495,31 +3426,64 @@ var TimeSeriesChartWrapper = (props) => {
2495
3426
  fields: chartData.fields,
2496
3427
  columns: chartData.seriesList
2497
3428
  });
2498
- const xField = getFieldName(filteredChartData.fields[0]);
3429
+ const xField = getFieldName2(filteredChartData.fields[0]);
2499
3430
  const yFields = getFieldNames(
2500
3431
  filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
2501
3432
  );
2502
- const y2Fields = y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [];
2503
- const overlayFields = overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [];
3433
+ const y2Fields = (0, react_exports.useMemo)(
3434
+ () => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
3435
+ [y2FieldsStr]
3436
+ );
3437
+ const overlayFields = (0, react_exports.useMemo)(
3438
+ () => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
3439
+ [overlayFieldsStr]
3440
+ );
2504
3441
  let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
2505
3442
  xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
2506
- let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFields, yAxisTitleVisibility);
3443
+ const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
3444
+ let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
2507
3445
  yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
2508
3446
  const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
2509
3447
  let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
2510
3448
  y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
2511
- const xScaleConfig = getXScaleConfig(xAxisTitle, xAxisLabelVisibility);
2512
- const yScaleConfig = getYScaleConfig(yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility);
2513
- let y2ScaleConfig = {};
2514
- if (y2Enabled) {
2515
- y2ScaleConfig = getY2ScaleConfig(
2516
- y2AxisTitle,
2517
- y2AxisAbbreviation,
2518
- y2AxisScale,
2519
- y2IntegerUnits,
2520
- y2AxisLabelVisibility
2521
- );
2522
- }
3449
+ const xScaleConfig = (0, react_exports.useMemo)(
3450
+ () => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
3451
+ [xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
3452
+ );
3453
+ const yScaleConfig = (0, react_exports.useMemo)(
3454
+ () => getYScaleConfig(
3455
+ yAxisTitle,
3456
+ yAxisAbbreviation,
3457
+ yAxisScale,
3458
+ yAxisLabelVisibility,
3459
+ yAxisMin,
3460
+ yAxisMax
3461
+ ),
3462
+ [yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
3463
+ );
3464
+ const y2ScaleConfig = (0, react_exports.useMemo)(() => {
3465
+ if (y2Enabled) {
3466
+ return getY2ScaleConfig(
3467
+ y2AxisTitle,
3468
+ y2AxisAbbreviation,
3469
+ y2AxisScale,
3470
+ y2IntegerUnits,
3471
+ y2AxisLabelVisibility,
3472
+ y2AxisMin,
3473
+ y2AxisMax
3474
+ );
3475
+ }
3476
+ return {};
3477
+ }, [
3478
+ y2Enabled,
3479
+ y2AxisTitle,
3480
+ y2AxisAbbreviation,
3481
+ y2AxisScale,
3482
+ y2IntegerUnits,
3483
+ y2AxisLabelVisibility,
3484
+ y2AxisMin,
3485
+ y2AxisMax
3486
+ ]);
2523
3487
  const uplotContainerElement = (0, react_exports.useRef)(null);
2524
3488
  const seriesDataFormatted = [
2525
3489
  filteredChartData.columns[0],
@@ -2535,9 +3499,25 @@ var TimeSeriesChartWrapper = (props) => {
2535
3499
  overlayFields,
2536
3500
  y2Enabled,
2537
3501
  nullValueMode,
2538
- markerDisplay
3502
+ markerDisplay,
3503
+ lineDashStyle,
3504
+ lineDashStylesByField,
3505
+ stepPosition,
3506
+ stepPositionsByField
2539
3507
  ),
2540
- [yFields, y2Fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay]
3508
+ [
3509
+ yFields,
3510
+ y2Fields,
3511
+ lineWidth,
3512
+ overlayFields,
3513
+ y2Enabled,
3514
+ nullValueMode,
3515
+ markerDisplay,
3516
+ lineDashStyle,
3517
+ lineDashStylesByField,
3518
+ stepPosition,
3519
+ stepPositionsByField
3520
+ ]
2541
3521
  );
2542
3522
  const chartingEventAnnotations = (0, react_exports.useMemo)(
2543
3523
  () => getAnnotationsForCanvas({
@@ -2551,25 +3531,59 @@ var TimeSeriesChartWrapper = (props) => {
2551
3531
  () => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
2552
3532
  [xScaleConfig, yScaleConfig, y2ScaleConfig]
2553
3533
  );
2554
- const legend = (0, react_exports.useMemo)(() => getLegend({ legendDisplay }), [legendDisplay]);
3534
+ const isSeriesCompare = legendMode === "seriesCompare";
3535
+ const legend = (0, react_exports.useMemo)(
3536
+ () => getLegend({
3537
+ legendDisplay: isSeriesCompare && legendDisplay !== "off" ? "right" : legendDisplay,
3538
+ isSeriesCompare,
3539
+ legendTruncation
3540
+ }),
3541
+ [legendDisplay, isSeriesCompare, legendTruncation]
3542
+ );
2555
3543
  const handleChartClick = react_exports.useCallback(
2556
3544
  (event) => {
2557
3545
  if (onClick) {
2558
- handleClick(event, onClick);
3546
+ handleClick(event, onClick, trellisKey, trellisSplitBy);
2559
3547
  }
2560
3548
  },
2561
- [onClick]
3549
+ [onClick, trellisKey, trellisSplitBy]
2562
3550
  );
2563
3551
  const handleChartLegendClick = react_exports.useCallback(
2564
3552
  (event) => {
2565
3553
  if (onClick) {
2566
- handleLegendClick(event, onClick);
3554
+ handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
2567
3555
  }
2568
3556
  },
2569
- [onClick]
3557
+ [onClick, trellisKey, trellisSplitBy]
3558
+ );
3559
+ const handleChartRangeSelection = react_exports.useCallback(
3560
+ (range2) => {
3561
+ if (onSelect) {
3562
+ handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
3563
+ }
3564
+ },
3565
+ [onSelect, chartData, trellisKey, trellisSplitBy]
3566
+ );
3567
+ const handleChartRangeZoom = react_exports.useCallback(
3568
+ (range2) => {
3569
+ if (onSelect) {
3570
+ handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
3571
+ }
3572
+ },
3573
+ [onSelect, chartData, trellisKey, trellisSplitBy]
3574
+ );
3575
+ const xFieldToUse = xFieldFromProps || xField;
3576
+ const enableSearchZoom = react_exports.useMemo(
3577
+ () => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
3578
+ [eventHandlers, xFieldToUse]
2570
3579
  );
2571
3580
  const lastPayloadRef = react_exports.useRef(null);
2572
3581
  const lastOriginalEventRef = react_exports.useRef(null);
3582
+ const previousMouseoverPayloadRef = react_exports.useRef(null);
3583
+ const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
3584
+ react_exports.useEffect(() => {
3585
+ additionalTooltipValuesRef.current = additionalTooltipValues;
3586
+ }, [additionalTooltipValues]);
2573
3587
  const handleChartCrosshairChange = react_exports.useCallback(
2574
3588
  (event) => {
2575
3589
  if (onPointMouseOver || onPointMouseOut) {
@@ -2581,6 +3595,7 @@ var TimeSeriesChartWrapper = (props) => {
2581
3595
  payload: lastPayloadRef.current
2582
3596
  });
2583
3597
  }
3598
+ previousMouseoverPayloadRef.current = null;
2584
3599
  return;
2585
3600
  }
2586
3601
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
@@ -2588,25 +3603,36 @@ var TimeSeriesChartWrapper = (props) => {
2588
3603
  });
2589
3604
  delete payload.seriesKey;
2590
3605
  if (event.rowContext) {
2591
- Object.keys(event.rowContext).forEach((fieldName) => {
2592
- payload[`row.${fieldName}.value`] = event.rowContext[fieldName];
2593
- });
3606
+ Object.assign(
3607
+ payload,
3608
+ Object.keys(event.rowContext).reduce((acc, fieldName) => {
3609
+ acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
3610
+ return acc;
3611
+ }, {})
3612
+ );
2594
3613
  }
2595
- lastPayloadRef.current = payload;
3614
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3615
+ if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
3616
+ return;
3617
+ }
3618
+ lastPayloadRef.current = updatedPayload;
2596
3619
  lastOriginalEventRef.current = event;
3620
+ previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
2597
3621
  if (onPointMouseOver) {
2598
3622
  onPointMouseOver({
2599
3623
  type: "point.mouseover",
2600
3624
  originalEvent: event,
2601
- payload
3625
+ payload: updatedPayload
2602
3626
  });
2603
3627
  }
2604
3628
  }
2605
3629
  },
2606
- [onPointMouseOver, onPointMouseOut]
3630
+ [onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
2607
3631
  );
2608
- const memoizedChart = (0, react_exports.useMemo)(
2609
- () => /* @__PURE__ */ react_exports.createElement(
3632
+ const dataKey = `${(_b = chartData.columns[0]) == null ? void 0 : _b[0]}-${(_c = chartData.columns[0]) == null ? void 0 : _c[chartData.columns[0].length - 1]}-${(_d = chartData.columns[0]) == null ? void 0 : _d.length}`;
3633
+ const memoizedChart = (0, react_exports.useMemo)(() => {
3634
+ const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
3635
+ return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
2610
3636
  visualization_canvas_exports.TimeSeriesChart,
2611
3637
  {
2612
3638
  data: chartData,
@@ -2616,49 +3642,121 @@ var TimeSeriesChartWrapper = (props) => {
2616
3642
  seriesColorsByField,
2617
3643
  seriesConfig: seriesOverrides,
2618
3644
  legend,
3645
+ legendLabels,
3646
+ legendTruncation,
3647
+ isSeriesCompare: legendMode === "seriesCompare",
3648
+ maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
2619
3649
  scaleConfig,
2620
3650
  timestampFormat: "expanded",
2621
3651
  onCrosshairClick: onClick ? handleChartClick : void 0,
2622
3652
  onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
2623
3653
  onSeriesClick: onClick ? handleChartLegendClick : void 0,
3654
+ onRangeSelection: handleChartRangeSelection,
3655
+ onRangeZoom: computedOnRangeZoom,
3656
+ serverSideZoom: enableSearchZoom,
2624
3657
  userLocale,
2625
3658
  events: chartingEventAnnotations,
2626
- eventsConfig: { renderer: triangleEventAnnotationRenderer }
3659
+ eventsConfig: { renderer: triangleEventAnnotationRenderer },
3660
+ additionalTooltipValuesRef,
3661
+ showXMajorGridLines,
3662
+ showYMajorGridLines,
3663
+ showY2MajorGridLines,
3664
+ showYMinorGridLines,
3665
+ showY2MinorGridLines,
3666
+ showLineSmoothing,
3667
+ dataValuesDisplay,
3668
+ showXMajorTicks,
3669
+ xAxisMajorTickSize: xAxisMajorTickSizeNum,
3670
+ showYMajorTicks,
3671
+ showY2MajorTicks,
3672
+ yAxisMajorTickSize: yAxisMajorTickSizeNum,
3673
+ y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
3674
+ yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
3675
+ y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
3676
+ showYMinorTicks,
3677
+ showY2MinorTicks,
3678
+ yAxisMinorTickSize: yAxisMinorTickSizeNum,
3679
+ y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
3680
+ showYAxisWithZero,
3681
+ showY2AxisWithZero,
3682
+ showXAxisLine,
3683
+ showYAxisLine,
3684
+ showY2AxisLine,
3685
+ xAxisMaxLabelParts
2627
3686
  }
2628
- ),
2629
- [
2630
- chartData,
2631
- containerWidth,
2632
- containerHeight,
2633
- seriesColors,
2634
- seriesColorsByField,
2635
- seriesOverrides,
2636
- legend,
2637
- scaleConfig,
2638
- userLocale,
2639
- chartingEventAnnotations,
2640
- onClick,
2641
- handleChartClick,
2642
- onPointMouseOver,
2643
- onPointMouseOut,
2644
- handleChartCrosshairChange,
2645
- handleChartLegendClick
2646
- ]
2647
- );
3687
+ ));
3688
+ }, [
3689
+ onSelect,
3690
+ handleChartRangeZoom,
3691
+ dataKey,
3692
+ chartData,
3693
+ containerWidth,
3694
+ containerHeight,
3695
+ seriesColors,
3696
+ seriesColorsByField,
3697
+ seriesOverrides,
3698
+ legend,
3699
+ legendLabels,
3700
+ legendTruncation,
3701
+ scaleConfig,
3702
+ onClick,
3703
+ handleChartClick,
3704
+ onPointMouseOver,
3705
+ onPointMouseOut,
3706
+ handleChartCrosshairChange,
3707
+ handleChartLegendClick,
3708
+ handleChartRangeSelection,
3709
+ enableSearchZoom,
3710
+ userLocale,
3711
+ chartingEventAnnotations,
3712
+ showXMajorGridLines,
3713
+ showYMajorGridLines,
3714
+ showY2MajorGridLines,
3715
+ showYMinorGridLines,
3716
+ showY2MinorGridLines,
3717
+ showLineSmoothing,
3718
+ dataValuesDisplay,
3719
+ showXMajorTicks,
3720
+ xAxisMajorTickSizeNum,
3721
+ showYMajorTicks,
3722
+ showY2MajorTicks,
3723
+ yAxisMajorTickSizeNum,
3724
+ y2AxisMajorTickSizeNum,
3725
+ yAxisMajorTickIntervalNum,
3726
+ y2AxisMajorTickIntervalNum,
3727
+ showYMinorTicks,
3728
+ showY2MinorTicks,
3729
+ yAxisMinorTickSizeNum,
3730
+ y2AxisMinorTickSizeNum,
3731
+ showYAxisWithZero,
3732
+ showY2AxisWithZero,
3733
+ showXAxisLine,
3734
+ showYAxisLine,
3735
+ showY2AxisLine,
3736
+ legendMode,
3737
+ xAxisMaxLabelParts
3738
+ ]);
2648
3739
  const memoizedVisualization = (0, react_exports.useMemo)(() => {
2649
- return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
2650
- }, [backgroundColor, memoizedChart]);
2651
- return /* @__PURE__ */ react_exports.createElement(
3740
+ return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
3741
+ }, [bgColor, memoizedChart]);
3742
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
3743
+ TrellisTitle,
3744
+ {
3745
+ trellisKey,
3746
+ backgroundColor: bgColor,
3747
+ fontColor: defaultFontColor
3748
+ }
3749
+ ), /* @__PURE__ */ react_exports.createElement(
2652
3750
  TimeSeriesChartContainer,
2653
3751
  {
2654
- height,
3752
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
2655
3753
  width,
2656
3754
  ref: uplotContainerElement,
2657
3755
  "data-test": "timeseries-chart-wrapper"
2658
3756
  },
2659
3757
  /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
2660
3758
  memoizedVisualization
2661
- );
3759
+ ));
2662
3760
  };
2663
3761
  var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
2664
3762
 
@@ -2721,10 +3819,10 @@ var withDashboardViz = (opts) => {
2721
3819
  const isDownsamplingEnabledByFeatureFlag = Boolean(
2722
3820
  featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
2723
3821
  );
2724
- const isTrellisFeatureFlagOn = Boolean(
3822
+ const isTrellisFeatureFlagOn2 = Boolean(
2725
3823
  featureFlagContext && featureFlagContext.visualizations_enableTrellis
2726
3824
  );
2727
- const isTrellisOn = isTrellisFeatureFlagOn && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
3825
+ const isTrellisOn = isTrellisFeatureFlagOn2 && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
2728
3826
  const isAcceleratedRenderFeatureFlagOn = Boolean(
2729
3827
  featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableAcceleratedRender
2730
3828
  );
@@ -2948,6 +4046,268 @@ var withDashboardViz = (opts) => {
2948
4046
  };
2949
4047
  var withDashboardViz_default = withDashboardViz;
2950
4048
 
4049
+ // esm-externals:@splunk/react-ui/Paginator
4050
+ var Paginator_exports = {};
4051
+ __export(Paginator_exports, {
4052
+ default: () => Paginator_default
4053
+ });
4054
+ var defaultImport33 = __toESM(require("@splunk/react-ui/Paginator"));
4055
+ __reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
4056
+ var Paginator_default = "default" in defaultImport33 ? defaultImport33.default : defaultImport33;
4057
+
4058
+ // esm-externals:@splunk/themes
4059
+ var themes_exports = {};
4060
+ __export(themes_exports, {
4061
+ default: () => themes_default
4062
+ });
4063
+ var defaultImport34 = __toESM(require("@splunk/themes"));
4064
+ __reExport(themes_exports, require("@splunk/themes"));
4065
+ var themes_default = "default" in defaultImport34 ? defaultImport34.default : defaultImport34;
4066
+
4067
+ // esm-externals:@splunk/themes/useSplunkTheme
4068
+ var useSplunkTheme_exports = {};
4069
+ __export(useSplunkTheme_exports, {
4070
+ default: () => useSplunkTheme_default
4071
+ });
4072
+ var defaultImport35 = __toESM(require("@splunk/themes/useSplunkTheme"));
4073
+ __reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
4074
+ var useSplunkTheme_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
4075
+
4076
+ // src/common/hocs/withTrellis.tsx
4077
+ var TrellisContainer = styled_components_default.div`
4078
+ overflow: hidden;
4079
+ display: flex;
4080
+ flex-direction: column;
4081
+ background-color: ${(props) => props.backgroundColor};
4082
+ ${(props) => (0, style_exports.toDimension)((0, lodash_exports.pick)(props, ["width", "height"]))};
4083
+ > [data-test='paginator'] {
4084
+ align-self: flex-end;
4085
+ margin-bottom: 10px;
4086
+ }
4087
+ `;
4088
+ var TrellisContainerGrid = styled_components_default.div`
4089
+ display: grid;
4090
+ height: ${(props) => {
4091
+ return `${props.height}px`;
4092
+ }};
4093
+ gap: 10px 10px;
4094
+ grid-template-columns: ${(props) => {
4095
+ return props.colCount ? `repeat(${props.colCount}, minmax(${props.colMinWidth}px, 1fr))` : `repeat(auto-fit, minmax(${props.colMinWidth}px, 1fr))`;
4096
+ }};
4097
+ overflow: auto;
4098
+ justify-items: stretch;
4099
+ grid-auto-rows: ${(props) => `${props.rowHeight}px`};
4100
+ .child {
4101
+ height: ${(props) => `${props.rowHeight}px`};
4102
+ }
4103
+ `;
4104
+ var showErrorMessage = (errorCode, width, height) => {
4105
+ if (errorCode === "INVALID_SPLIT_BY_FIELD") {
4106
+ return /* @__PURE__ */ react_exports.createElement(
4107
+ Message_default,
4108
+ {
4109
+ width,
4110
+ height,
4111
+ message: (0, i18n_exports._)("Select a valid trellis split by field"),
4112
+ level: "info"
4113
+ }
4114
+ );
4115
+ }
4116
+ if (errorCode === "UNKNOWN_DATA_SPLIT_MODE") {
4117
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Unknown data split mode"), level: "info" });
4118
+ }
4119
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Error render in trellis"), level: "info" });
4120
+ };
4121
+ var withTrellis = (Viz) => {
4122
+ const VizWithTrellis = (opts) => {
4123
+ const cachedHandleResize = react_exports.useCallback((w, h) => {
4124
+ setContainerWidth(w);
4125
+ setContainerHeight(h);
4126
+ }, []);
4127
+ const [containerWidth, setContainerWidth] = react_exports.useState(Number(opts.width));
4128
+ const [containerHeight, setContainerHeight] = react_exports.useState(Number(opts.height));
4129
+ const _a = opts, { options = {}, height, width } = _a, otherProps = __objRest(_a, ["options", "height", "width"]);
4130
+ const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(Viz.config.optionsSchema, "default");
4131
+ const mergedOptions = (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
4132
+ const {
4133
+ trellisColumns,
4134
+ trellisPageCount,
4135
+ trellisMinColumnWidth,
4136
+ trellisRowHeight,
4137
+ splitByLayout,
4138
+ trellisSplitBy,
4139
+ trellisSharedScale,
4140
+ stackMode,
4141
+ yAxisMin,
4142
+ yAxisMax
4143
+ } = mergedOptions;
4144
+ const colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
4145
+ const pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
4146
+ const colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
4147
+ const rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
4148
+ const [pageNum, setPageNum] = (0, react_exports.useState)(1);
4149
+ const [pagedData, setPagedData] = (0, react_exports.useState)(null);
4150
+ let splitByKeys = [];
4151
+ let totalPages = 0;
4152
+ let showPaginator = false;
4153
+ const { dataSources } = otherProps;
4154
+ const theme = {
4155
+ splunkThemeV1: useSplunkTheme_default()
4156
+ };
4157
+ const {
4158
+ family: currentThemeFamily,
4159
+ colorScheme: currentThemeColorScheme,
4160
+ density: currentThemeDensity
4161
+ } = (0, themes_exports.getSettingsFromThemedProps)({ theme });
4162
+ const trellisBackgroundColor = (0, react_exports.useMemo)(() => {
4163
+ const themeFunc = (themeVar) => {
4164
+ var _a2, _b;
4165
+ return (_b = (_a2 = Viz.config.themes)[themeVar]) == null ? void 0 : _b.call(_a2, {
4166
+ trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
4167
+ theme
4168
+ });
4169
+ };
4170
+ const evaluated = Options_exports.Options.evaluate(
4171
+ {
4172
+ context: Viz.config.context,
4173
+ options: {
4174
+ trellisBackgroundColor: mergedOptions.trellisBackgroundColor
4175
+ }
4176
+ },
4177
+ {},
4178
+ themeFunc
4179
+ );
4180
+ return evaluated.trellisBackgroundColor;
4181
+ }, [
4182
+ mergedOptions.trellisBackgroundColor,
4183
+ currentThemeFamily,
4184
+ currentThemeColorScheme,
4185
+ currentThemeDensity
4186
+ ]);
4187
+ const columns = (0, lodash_exports.get)(dataSources, "primary.data.columns", void 0);
4188
+ const fields = (0, lodash_exports.get)(dataSources, "primary.data.fields", void 0);
4189
+ const noColumns = columns === void 0;
4190
+ const noFields = fields === void 0;
4191
+ const updateDataDisplay = (currPage) => {
4192
+ if (!showPaginator) {
4193
+ setPagedData(splitByKeys);
4194
+ setPageNum(1);
4195
+ } else {
4196
+ const startIdx = pageCount * (currPage - 1);
4197
+ const paged = splitByKeys.slice(startIdx, startIdx + pageCount);
4198
+ setPagedData(paged);
4199
+ }
4200
+ };
4201
+ (0, react_exports.useEffect)(() => {
4202
+ setPageNum(1);
4203
+ updateDataDisplay(1);
4204
+ }, [pageCount, trellisSplitBy]);
4205
+ (0, react_exports.useEffect)(() => {
4206
+ updateDataDisplay(pageNum);
4207
+ }, [columns, fields, trellisSplitBy, pageNum, splitByLayout]);
4208
+ const handlePageChange = (0, react_exports.useCallback)(
4209
+ (event, { page }) => {
4210
+ setPageNum(page);
4211
+ },
4212
+ [pageNum, pagedData]
4213
+ );
4214
+ const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
4215
+ const isTrellisFeatureFlagOn2 = Boolean(
4216
+ featureFlagContext && featureFlagContext.visualizations_enableTrellis
4217
+ );
4218
+ if (!isTrellisFeatureFlagOn2 || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
4219
+ return /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, opts));
4220
+ }
4221
+ if (splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
4222
+ if (noColumns || noFields) {
4223
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Loading"), level: "info" });
4224
+ }
4225
+ let currTrellisSplitBy = trellisSplitBy;
4226
+ if (!trellisSplitBy || trellisSplitBy.length === 0) {
4227
+ const splitByPossibleFields = (0, trellisUtils_exports.getAllPossibleSplitByFields)(fields);
4228
+ currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : AGGREGATIONS;
4229
+ }
4230
+ const splitMode = (0, trellisUtils_exports.getTrellisDataSplitterMode)(fields);
4231
+ const dataSplitResult = getTrellisDataSourcesBySplitMode(
4232
+ splitMode,
4233
+ dataSources,
4234
+ currTrellisSplitBy
4235
+ );
4236
+ const modifiedDataSourceBySplitBy = dataSplitResult == null ? void 0 : dataSplitResult.splitDataSources;
4237
+ const dataSplitErrorCode = dataSplitResult == null ? void 0 : dataSplitResult.errorCode;
4238
+ if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
4239
+ return showErrorMessage(dataSplitErrorCode, width, height);
4240
+ }
4241
+ const splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
4242
+ if (splitByKeysModified) {
4243
+ showPaginator = splitByKeysModified.length > pageCount;
4244
+ splitByKeys = splitByKeysModified;
4245
+ totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
4246
+ }
4247
+ const [calculatedMin, calculatedMax] = determineMinMax(
4248
+ modifiedDataSourceBySplitBy,
4249
+ trellisSharedScale,
4250
+ yAxisMin,
4251
+ yAxisMax,
4252
+ stackMode
4253
+ );
4254
+ return /* @__PURE__ */ react_exports.createElement(TrellisContainer, { height, width, backgroundColor: trellisBackgroundColor }, /* @__PURE__ */ react_exports.createElement(
4255
+ TrellisContainerGrid,
4256
+ {
4257
+ height,
4258
+ colCount,
4259
+ colMinWidth,
4260
+ rowHeight
4261
+ },
4262
+ pagedData == null ? void 0 : pagedData.map((splitByKey, idx) => /* @__PURE__ */ react_exports.createElement(
4263
+ "div",
4264
+ {
4265
+ className: "child",
4266
+ "data-test": "trellis-child",
4267
+ key: `div-child-${idx.toString()}`
4268
+ },
4269
+ /* @__PURE__ */ react_exports.createElement(
4270
+ SizeAwareWrapper_default,
4271
+ {
4272
+ width,
4273
+ height,
4274
+ onResize: cachedHandleResize
4275
+ }
4276
+ ),
4277
+ /* @__PURE__ */ react_exports.createElement(
4278
+ Viz,
4279
+ __spreadProps(__spreadValues({}, otherProps), {
4280
+ trellisKey: splitByKey,
4281
+ trellisSplitBy: currTrellisSplitBy,
4282
+ dataSources: modifiedDataSourceBySplitBy[splitByKey],
4283
+ options: __spreadProps(__spreadValues({}, options), {
4284
+ yAxisMin: calculatedMin,
4285
+ yAxisMax: calculatedMax
4286
+ }),
4287
+ key: `viz-${idx.toString()}`,
4288
+ height: containerHeight,
4289
+ width: containerWidth
4290
+ })
4291
+ )
4292
+ ))
4293
+ ), showPaginator && totalPages >= pageNum && /* @__PURE__ */ react_exports.createElement(
4294
+ Paginator_default,
4295
+ {
4296
+ onChange: handlePageChange,
4297
+ current: pageNum,
4298
+ alwaysShowLastPageLink: true,
4299
+ totalPages
4300
+ }
4301
+ ));
4302
+ }
4303
+ return null;
4304
+ };
4305
+ VizWithTrellis.propTypes = Viz.proptypes;
4306
+ VizWithTrellis.config = Viz.config;
4307
+ return VizWithTrellis;
4308
+ };
4309
+ var withTrellis_default = withTrellis;
4310
+
2951
4311
  // src/MarkerGauge/MarkerGauge.tsx
2952
4312
  var PureMarkerGauge = MarkerGauge_default;
2953
4313
  var validOptions = Object.keys(config_default.optionsSchema);
@@ -2959,14 +4319,17 @@ var computeVizProps = (_a) => {
2959
4319
  majorTickFillColor: config_default.themes.majorTickFillColor(props),
2960
4320
  majorTickStrokeColor: config_default.themes.majorTickStrokeColor(props),
2961
4321
  valueMarkerFillColor: config_default.themes.valueMarkerFillColor(props),
2962
- valueMarkerLabelFillColor: config_default.themes.valueMarkerLabelFillColor(props)
4322
+ valueMarkerLabelFillColor: config_default.themes.valueMarkerLabelFillColor(props),
4323
+ defaultFontColor: props.themeFunc("defaultFontColor")
2963
4324
  };
2964
- return __spreadValues(__spreadValues({}, options), defaultColors);
4325
+ return __spreadProps(__spreadValues(__spreadValues({}, options), defaultColors), { trellisKey: props.trellisKey });
2965
4326
  };
2966
- var viz = withDashboardViz_default({
2967
- ReactViz: MarkerGauge_default,
2968
- computeVizProps,
2969
- vizConfig: config_default
2970
- });
4327
+ var viz = withTrellis_default(
4328
+ withDashboardViz_default({
4329
+ ReactViz: MarkerGauge_default,
4330
+ computeVizProps,
4331
+ vizConfig: config_default
4332
+ })
4333
+ );
2971
4334
  var MarkerGauge_default2 = viz;
2972
4335
  //# sourceMappingURL=MarkerGauge.js.map