@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/FillerGauge.js CHANGED
@@ -985,7 +985,7 @@ var Cover = styled_components_default.div`
985
985
  bottom: 0;
986
986
  `;
987
987
  var Blocker = styled_components_default.div.attrs({
988
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b"
988
+ "data-splunk-visualization-version": "28.5.0 - b192418b7"
989
989
  })`
990
990
  position: relative;
991
991
  width: 100%;
@@ -1075,7 +1075,7 @@ var withFixedSizeContainer = (Viz) => {
1075
1075
  FixSizeItem,
1076
1076
  {
1077
1077
  "data-test": "fix-size-item",
1078
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b",
1078
+ "data-splunk-visualization-version": "28.5.0 - b192418b7",
1079
1079
  width,
1080
1080
  height,
1081
1081
  backgroundColor
@@ -1171,6 +1171,7 @@ __reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUti
1171
1171
  var numberUtils_default = "default" in defaultImport28 ? defaultImport28.default : defaultImport28;
1172
1172
 
1173
1173
  // src/common/utils/dataUtils.ts
1174
+ var getFieldName = (field) => typeof field === "string" ? field : field.name;
1174
1175
  var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
1175
1176
  const dataLength = data.length;
1176
1177
  const downsampledIndices = [];
@@ -1287,9 +1288,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
1287
1288
  let xColumn = [];
1288
1289
  const yColumns = [];
1289
1290
  const canDownsample = !ds.data.fields.some((field, index) => {
1290
- var _a, _b;
1291
- const fieldName = (_a = field.name) != null ? _a : field;
1292
- const fieldType = (_b = fieldTypes[index]) != null ? _b : "unknown";
1291
+ var _a;
1292
+ const fieldName = getFieldName(field);
1293
+ const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
1293
1294
  const column = ds.data.columns[index];
1294
1295
  let hasDisplayedColumnThatCantBeDownsampled = false;
1295
1296
  if (fieldName === xField) {
@@ -1576,7 +1577,7 @@ var trellisUtils_default = "default" in defaultImport30 ? defaultImport30.defaul
1576
1577
  var AGGREGATIONS = "aggregations";
1577
1578
  var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
1578
1579
  var _a, _b, _c, _d;
1579
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
1580
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
1580
1581
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1581
1582
  let splitDataSources = null;
1582
1583
  let errorCode = null;
@@ -1597,7 +1598,7 @@ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
1597
1598
  }
1598
1599
  return { splitDataSources, errorCode };
1599
1600
  };
1600
- var toFieldEntries = (fields) => {
1601
+ var toFieldEntries = (fields = []) => {
1601
1602
  return fields.map((field) => {
1602
1603
  if (typeof field === "string") {
1603
1604
  return { name: field };
@@ -1612,7 +1613,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
1612
1613
  let splitDataSources = null;
1613
1614
  let splitByFields = [];
1614
1615
  let errorCode = null;
1615
- if (typeof fields[0] !== "string") {
1616
+ if (fields.length > 0) {
1616
1617
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
1617
1618
  }
1618
1619
  if (splitByFields && splitByFields.length > 0) {
@@ -1650,12 +1651,12 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
1650
1651
  };
1651
1652
  var dataSourcesSplitByAggregationsStats = (dataSource) => {
1652
1653
  var _a, _b, _c, _d;
1653
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
1654
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
1654
1655
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1655
1656
  let splitDataSources = null;
1656
1657
  let splitByFields = [];
1657
1658
  let errorCode = null;
1658
- if (typeof fields[0] !== "string") {
1659
+ if (fields.length > 0) {
1659
1660
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
1660
1661
  }
1661
1662
  if (splitByFields && splitByFields.length > 0) {
@@ -1679,12 +1680,12 @@ var dataSourcesSplitByAggregationsStats = (dataSource) => {
1679
1680
  };
1680
1681
  var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
1681
1682
  var _a, _b, _c, _d, _e;
1682
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
1683
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
1683
1684
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1684
1685
  let splitDataSources = null;
1685
1686
  let splitByFields = [];
1686
1687
  let errorCode = null;
1687
- if (typeof fields[0] !== "string") {
1688
+ if (fields.length > 0) {
1688
1689
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
1689
1690
  }
1690
1691
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -1700,16 +1701,14 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
1700
1701
  splitDataSources[val] = (0, lodash_exports.cloneDeep)(
1701
1702
  (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
1702
1703
  );
1703
- splitDataSources[val].primary.data.fields = [
1704
- { name: fields[0].name },
1705
- ...dataSourceKeys.map((k) => ({
1706
- name: k
1707
- }))
1708
- ];
1704
+ splitDataSources[val].primary.data.fields = [{ name: fields[0].name }];
1709
1705
  splitDataSources[val].primary.data.columns = [[...columns[0]]];
1710
1706
  dataSourceKeys.forEach((dsKey) => {
1711
1707
  fields.forEach((field, idx) => {
1712
1708
  if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
1709
+ splitDataSources[val].primary.data.fields.push({
1710
+ name: dsKey
1711
+ });
1713
1712
  splitDataSources[val].primary.data.columns.push([...columns[idx]]);
1714
1713
  }
1715
1714
  });
@@ -1722,12 +1721,12 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
1722
1721
  };
1723
1722
  var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
1724
1723
  var _a, _b, _c, _d;
1725
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
1724
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
1726
1725
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1727
1726
  let splitDataSources = null;
1728
1727
  let splitByFields = [];
1729
1728
  let errorCode = null;
1730
- if (typeof fields[0] !== "string") {
1729
+ if (fields.length > 0) {
1731
1730
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
1732
1731
  }
1733
1732
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -1815,17 +1814,15 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
1815
1814
  };
1816
1815
  var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
1817
1816
  var _a, _b, _c, _d, _e, _f;
1818
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
1817
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
1819
1818
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
1820
1819
  let splitDataSources = null;
1821
1820
  let splitByFields = [];
1822
1821
  let errorCode = null;
1823
- if (typeof fields[0] !== "string") {
1822
+ if (fields.length > 0) {
1824
1823
  splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
1825
1824
  }
1826
- const splitByIndex = fields == null ? void 0 : fields.findIndex(
1827
- (field) => field === splitBy || field.name === splitBy
1828
- );
1825
+ const splitByIndex = fields.findIndex((field) => field.name === splitBy);
1829
1826
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
1830
1827
  const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
1831
1828
  splitDataSources = {};
@@ -1975,6 +1972,16 @@ var triangleEventAnnotationRenderer = ({
1975
1972
  eventColor: eventWithColor.color
1976
1973
  });
1977
1974
  };
1975
+ var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
1976
+ const rangeSelectEventHandler = eventHandlers.find(
1977
+ (eventHandler) => {
1978
+ var _a;
1979
+ return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
1980
+ }
1981
+ );
1982
+ const xAxisIsTime = xField === "_time";
1983
+ return !!rangeSelectEventHandler && xAxisIsTime;
1984
+ };
1978
1985
  var canvasSupportedTimeSeriesCharts = ["splunk.line"];
1979
1986
  var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
1980
1987
  return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
@@ -1995,17 +2002,34 @@ var filterChartDataFromInternalFields = (chartData) => {
1995
2002
  var convert2DArrayToNumbers = (arr) => {
1996
2003
  return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
1997
2004
  };
1998
- var SideLegendWidth = 75;
1999
- var commonLegendProps = { center: true, fontSize: 12, largerTiles: true, hideSeriesValue: true };
2005
+ var parseAxisValue = (val) => {
2006
+ if (val === void 0 || val === null || val === "auto" || val === "") {
2007
+ return void 0;
2008
+ }
2009
+ const num = typeof val === "number" ? val : Number.parseFloat(val);
2010
+ return Number.isNaN(num) ? void 0 : num;
2011
+ };
2012
+ var parseXAxisLineVisibility = (visibility) => {
2013
+ if (visibility === "hide") return false;
2014
+ if (visibility === "show") return true;
2015
+ return void 0;
2016
+ };
2000
2017
  var getLegend = (props) => {
2001
2018
  const legendPlacement = props == null ? void 0 : props.legendDisplay;
2019
+ const { isSeriesCompare, legendTruncation } = props;
2020
+ const commonLegendProps = {
2021
+ center: true,
2022
+ fontSize: 12,
2023
+ largerTiles: true,
2024
+ hideSeriesValue: !isSeriesCompare,
2025
+ // Show values if in seriesCompare mode
2026
+ legendTruncation
2027
+ };
2002
2028
  switch (legendPlacement) {
2003
2029
  case "off":
2004
2030
  return false;
2005
2031
  case "left":
2006
- return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
2007
- width: SideLegendWidth
2008
- }, commonLegendProps));
2032
+ return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({}, commonLegendProps));
2009
2033
  case "bottom":
2010
2034
  return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
2011
2035
  wrap: true
@@ -2015,9 +2039,7 @@ var getLegend = (props) => {
2015
2039
  wrap: true
2016
2040
  }, commonLegendProps));
2017
2041
  default:
2018
- return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
2019
- width: SideLegendWidth
2020
- }, commonLegendProps));
2042
+ return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({}, commonLegendProps));
2021
2043
  }
2022
2044
  };
2023
2045
  var getComputedAxisTitles = (inputAxisTitle, fields, axisTitleVisibility) => {
@@ -2052,22 +2074,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
2052
2074
  const end = axisTitle.slice(-halfChars);
2053
2075
  return `${start}...${end}`;
2054
2076
  };
2055
- var getFieldName = (field) => {
2077
+ var getFieldName2 = (field) => {
2056
2078
  const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
2057
2079
  return fieldName;
2058
2080
  };
2059
2081
  var getFieldNames = (fields) => {
2060
- return fields.map((field) => getFieldName(field));
2082
+ return fields.map((field) => getFieldName2(field));
2061
2083
  };
2062
- var getXScaleConfig = (label, xAxisLabelVisibility) => {
2084
+ var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
2063
2085
  const xConfig = { x: {} };
2064
2086
  xConfig.x.label = label;
2065
2087
  if (xAxisLabelVisibility === "hide") {
2066
2088
  xConfig.x.hideLabels = true;
2067
2089
  }
2090
+ if (xAxisLabelRotation !== void 0) {
2091
+ xConfig.x.labelRotation = xAxisLabelRotation;
2092
+ }
2068
2093
  return xConfig;
2069
2094
  };
2070
- var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
2095
+ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
2071
2096
  const scaleType = yAxisScale != null ? yAxisScale : "linear";
2072
2097
  const yConfig = { y: {} };
2073
2098
  yConfig.y.label = label;
@@ -2075,34 +2100,46 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
2075
2100
  if (yAxisAbbreviation !== "none") {
2076
2101
  yConfig.y.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1);
2077
2102
  }
2078
- if (yAxisAbbreviation === "none") {
2079
- yConfig.y.width = 55;
2080
- } else {
2103
+ if (yAxisAbbreviation !== "none") {
2081
2104
  yConfig.y.width = label && label.length > 0 ? 30 : 10;
2082
2105
  }
2083
2106
  if (yAxisLabelVisibility === "hide") {
2084
2107
  yConfig.y.hideLabels = true;
2085
2108
  }
2109
+ if (yAxisMin !== void 0 || yAxisMax !== void 0) {
2110
+ yConfig.y.range = (u, dataMin, dataMax) => {
2111
+ const min = yAxisMin != null ? yAxisMin : dataMin;
2112
+ const max = yAxisMax != null ? yAxisMax : dataMax;
2113
+ return [min, max];
2114
+ };
2115
+ }
2086
2116
  return yConfig;
2087
2117
  };
2088
- var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
2118
+ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
2089
2119
  const y2Config = { y2: {} };
2090
2120
  const scaleType = axisScale != null ? axisScale : "linear";
2091
2121
  y2Config.y2.label = label;
2092
2122
  y2Config.y2.side = "right";
2093
- y2Config.y2.showGrid = false;
2094
2123
  y2Config.y2.type = scaleType;
2095
2124
  if (axisAbbreviation !== "none") {
2096
2125
  y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
2126
+ y2Config.y2.width = label && label.length > 0 ? 50 : 10;
2097
2127
  } else if (roundAxisLabelsToInteger) {
2098
2128
  y2Config.y2.tickFmt = (v) => roundAxisLabelsToInteger ? Math.round(v).toString() : v.toString();
2099
2129
  }
2100
2130
  if (y2AxisLabelVisibility === "hide") {
2101
2131
  y2Config.y2.hideLabels = true;
2102
2132
  }
2133
+ if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
2134
+ y2Config.y2.range = (u, dataMin, dataMax) => {
2135
+ const min = y2AxisMin != null ? y2AxisMin : dataMin;
2136
+ const max = y2AxisMax != null ? y2AxisMax : dataMax;
2137
+ return [min, max];
2138
+ };
2139
+ }
2103
2140
  return y2Config;
2104
2141
  };
2105
- var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
2142
+ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField, stepPosition, stepPositionsByField) => {
2106
2143
  const seriesConfig = {};
2107
2144
  let spanGaps;
2108
2145
  let replaceNullsWithZero;
@@ -2129,6 +2166,8 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
2129
2166
  );
2130
2167
  if (shouldAssignToY2) {
2131
2168
  seriesConfig[field].overrides.scale = "y2";
2169
+ } else {
2170
+ seriesConfig[field].overrides.scale = "y";
2132
2171
  }
2133
2172
  }
2134
2173
  if (overlayFields == null ? void 0 : overlayFields.includes(field)) {
@@ -2137,12 +2176,92 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
2137
2176
  if (markerDisplay !== void 0) {
2138
2177
  seriesConfig[field].markerDisplay = markerDisplay;
2139
2178
  }
2179
+ const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
2180
+ if (fieldDashStyle) {
2181
+ seriesConfig[field].lineDashStyle = fieldDashStyle;
2182
+ }
2183
+ const hasFieldStepPosition = Object.hasOwn(stepPositionsByField || {}, field);
2184
+ const fieldStepPosition = hasFieldStepPosition ? stepPositionsByField == null ? void 0 : stepPositionsByField[field] : stepPosition;
2185
+ if (fieldStepPosition && fieldStepPosition !== "off") {
2186
+ seriesConfig[field].stepPosition = fieldStepPosition;
2187
+ }
2140
2188
  if (replaceNullsWithZero !== void 0) {
2141
2189
  seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
2142
2190
  }
2143
2191
  });
2144
2192
  return seriesConfig;
2145
2193
  };
2194
+ var findRangeIndices = (xData, startValue, endValue) => {
2195
+ let startXIndex = -1;
2196
+ let endXIndex = -1;
2197
+ const xDataEpoch = xData.map((val) => {
2198
+ if (typeof val === "string") {
2199
+ return new Date(val).getTime() / 1e3;
2200
+ }
2201
+ return val;
2202
+ });
2203
+ for (let i = 0; i < xDataEpoch.length; i += 1) {
2204
+ if (xDataEpoch[i] >= startValue) {
2205
+ startXIndex = i;
2206
+ break;
2207
+ }
2208
+ }
2209
+ if (startXIndex === -1 && xDataEpoch.length > 0) {
2210
+ startXIndex = xDataEpoch.length - 1;
2211
+ }
2212
+ for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
2213
+ if (xDataEpoch[i] <= endValue) {
2214
+ endXIndex = i;
2215
+ break;
2216
+ }
2217
+ }
2218
+ if (endXIndex === -1 && xDataEpoch.length > 0) {
2219
+ endXIndex = 0;
2220
+ }
2221
+ return { startXIndex, endXIndex };
2222
+ };
2223
+
2224
+ // src/common/hooks/useTrellisEnabled.ts
2225
+ var useTrellisFeatureFlagOn = () => {
2226
+ const context = (0, react_exports.useContext)(FeatureFlagContext_default);
2227
+ return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
2228
+ };
2229
+ var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
2230
+ const trellisFeatureEnabled = useTrellisFeatureFlagOn();
2231
+ return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
2232
+ };
2233
+
2234
+ // src/common/components/TrellisTitle.tsx
2235
+ var TRELLIS_TITLE_HEIGHT = 28;
2236
+ var TrellisTitleText = styled_components_default.div`
2237
+ margin-left: 10px;
2238
+ margin-right: 10px;
2239
+ padding-top: 8px;
2240
+ text-overflow: ellipsis;
2241
+ white-space: nowrap;
2242
+ overflow: hidden;
2243
+ `;
2244
+ var TrellisTitleDiv = styled_components_default.div`
2245
+ height: ${TRELLIS_TITLE_HEIGHT}px;
2246
+ font-size: 14px;
2247
+ font-weight: 700;
2248
+ color: ${(props) => props.fontColor};
2249
+ background-color: ${(props) => props.backgroundColor};
2250
+ 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.
2251
+ `;
2252
+ var TrellisTitle = (props) => {
2253
+ const titleText = String(props.trellisKey).toString();
2254
+ return /* @__PURE__ */ react_exports.createElement(
2255
+ TrellisTitleDiv,
2256
+ {
2257
+ fontColor: props.fontColor,
2258
+ backgroundColor: props.backgroundColor,
2259
+ "data-test": "trellis-title",
2260
+ title: titleText
2261
+ },
2262
+ /* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
2263
+ );
2264
+ };
2146
2265
 
2147
2266
  // src/common/TimeSeriesChartWrapper.tsx
2148
2267
  var TimeSeriesChartContainer = styled_components_default.div`
@@ -2153,38 +2272,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
2153
2272
  position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
2154
2273
  }
2155
2274
  `;
2156
- var handleClick = (chartEvent, onClick) => {
2275
+ var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
2276
+ const result = __spreadValues({}, payload);
2277
+ if (trellisSplitBy) {
2278
+ result["trellis.name"] = trellisSplitBy;
2279
+ }
2280
+ if (trellisKey) {
2281
+ result["trellis.value"] = trellisKey;
2282
+ }
2283
+ return result;
2284
+ };
2285
+ var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
2286
+ if (!previousPayload) {
2287
+ return true;
2288
+ }
2289
+ if (currentPayload.index !== previousPayload.index) {
2290
+ return true;
2291
+ }
2292
+ if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
2293
+ return true;
2294
+ }
2295
+ if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
2296
+ return true;
2297
+ }
2298
+ if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
2299
+ return true;
2300
+ }
2301
+ return false;
2302
+ };
2303
+ var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
2157
2304
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
2158
2305
  name: chartEvent.seriesKey
2159
2306
  });
2160
2307
  delete payload.seriesKey;
2161
2308
  if (chartEvent.rowContext) {
2162
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
2163
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
2164
- });
2309
+ Object.assign(
2310
+ payload,
2311
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
2312
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
2313
+ return acc;
2314
+ }, {})
2315
+ );
2165
2316
  }
2317
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2166
2318
  if (onClick) {
2167
2319
  onClick({
2168
2320
  type: "point.click",
2169
2321
  originalEvent: chartEvent,
2170
- payload
2322
+ payload: updatedPayload
2171
2323
  });
2172
2324
  }
2173
2325
  };
2174
- var handleLegendClick = (chartEvent, onClick) => {
2326
+ var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
2175
2327
  const payload = {
2176
2328
  name: chartEvent
2177
2329
  };
2330
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2178
2331
  if (onClick) {
2179
2332
  onClick({
2180
2333
  type: "legend.click",
2181
2334
  originalEvent: chartEvent,
2182
- payload
2335
+ payload: updatedPayload
2336
+ });
2337
+ }
2338
+ };
2339
+ var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
2340
+ var _a;
2341
+ if (!rangeEvent) {
2342
+ return;
2343
+ }
2344
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
2345
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
2346
+ const payload = {
2347
+ startXIndex,
2348
+ startXValue: rangeEvent.start,
2349
+ endXIndex,
2350
+ endXValue: rangeEvent.end
2351
+ };
2352
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2353
+ if (onSelect) {
2354
+ onSelect({
2355
+ type: "range.selectBeforeZoom",
2356
+ originalEvent: rangeEvent,
2357
+ payload: updatedPayload
2358
+ });
2359
+ }
2360
+ };
2361
+ var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
2362
+ var _a;
2363
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
2364
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
2365
+ const payload = {
2366
+ startXIndex,
2367
+ startXValue: rangeEvent.start,
2368
+ endXIndex,
2369
+ endXValue: rangeEvent.end
2370
+ };
2371
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2372
+ if (onSelect) {
2373
+ onSelect({
2374
+ type: "range.select",
2375
+ originalEvent: rangeEvent,
2376
+ payload: updatedPayload
2183
2377
  });
2184
2378
  }
2185
2379
  };
2380
+ var parseArrayOption = (value) => {
2381
+ if (Array.isArray(value)) {
2382
+ return value;
2383
+ }
2384
+ if (value) {
2385
+ return JSON.parse(value);
2386
+ }
2387
+ return void 0;
2388
+ };
2186
2389
  var TimeSeriesChartWrapper = (props) => {
2187
- const {
2390
+ var _b, _c, _d;
2391
+ const _a = props, {
2188
2392
  width,
2189
2393
  height,
2190
2394
  chartData,
@@ -2197,12 +2401,57 @@ var TimeSeriesChartWrapper = (props) => {
2197
2401
  markerDisplay,
2198
2402
  onClick,
2199
2403
  onPointMouseOver,
2200
- onPointMouseOut
2201
- } = props;
2202
- const {
2404
+ onPointMouseOut,
2405
+ onSelect,
2406
+ splitByLayout,
2407
+ trellisKey,
2408
+ trellisSplitBy,
2203
2409
  backgroundColor,
2410
+ defaultFontColor,
2411
+ additionalTooltipValues,
2412
+ xAxisLineVisibility: xAxisLineVisibility,
2413
+ yAxisLineVisibility,
2414
+ y2AxisLineVisibility,
2415
+ showYAxisWithZero: showYAxisWithZeroFromProps,
2416
+ showY2AxisWithZero: showY2AxisWithZeroFromProps
2417
+ } = _a, otherOptions = __objRest(_a, [
2418
+ "width",
2419
+ "height",
2420
+ "chartData",
2421
+ "options",
2422
+ "userLocale",
2423
+ "annotationX",
2424
+ "annotationLabel",
2425
+ "annotationColor",
2426
+ "legendDisplay",
2427
+ "markerDisplay",
2428
+ "onClick",
2429
+ "onPointMouseOver",
2430
+ "onPointMouseOut",
2431
+ "onSelect",
2432
+ "splitByLayout",
2433
+ "trellisKey",
2434
+ "trellisSplitBy",
2435
+ "backgroundColor",
2436
+ "defaultFontColor",
2437
+ "additionalTooltipValues",
2438
+ // Extract axis line visibility options from props
2439
+ "xAxisLineVisibility",
2440
+ "yAxisLineVisibility",
2441
+ "y2AxisLineVisibility",
2442
+ // Extract showYAxisWithZero directly from props for accelerated render mode
2443
+ "showYAxisWithZero",
2444
+ "showY2AxisWithZero"
2445
+ ]);
2446
+ const { eventHandlers, xField: xFieldFromProps } = otherOptions;
2447
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
2448
+ const {
2449
+ backgroundColor: bgColorFromOptions,
2204
2450
  seriesColors: seriesColorsStr,
2205
2451
  fieldColors,
2452
+ legendLabels: legendLabelsStr,
2453
+ legendMode,
2454
+ legendTruncation,
2206
2455
  "axisTitleX.text": xAxisTitleText,
2207
2456
  "axisTitleY.text": yAxisTitleText,
2208
2457
  "axisTitleY2.text": y2AxisTitleText,
@@ -2210,8 +2459,12 @@ var TimeSeriesChartWrapper = (props) => {
2210
2459
  "axisTitleY.visibility": yAxisTitleVisibility,
2211
2460
  "axisTitleY2.visibility": y2AxisTitleVisibility,
2212
2461
  "axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
2462
+ "axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
2463
+ "axisLabelsX.maxLabelParts": xAxisMaxLabelParts,
2213
2464
  "axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
2465
+ "axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
2214
2466
  "axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
2467
+ "axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
2215
2468
  "axisY.abbreviation": yAxisAbbreviation,
2216
2469
  "axisY.scale": yAxisScale,
2217
2470
  "axisY2.abbreviation": y2AxisAbbreviation,
@@ -2221,10 +2474,73 @@ var TimeSeriesChartWrapper = (props) => {
2221
2474
  "axisLabelsY2.integerUnits": y2IntegerUnits,
2222
2475
  "chart.overlayFields": overlayFieldsStr,
2223
2476
  "chart.nullValueMode": nullValueMode,
2224
- lineWidth
2477
+ "chart.showDataLabels": showDataLabels,
2478
+ lineWidth,
2479
+ lineDashStyle,
2480
+ fieldDashStyles: lineDashStylesByFieldStr,
2481
+ stepPosition,
2482
+ fieldStepPositions: stepPositionsByFieldStr,
2483
+ yAxisMin: yAxisMinRaw,
2484
+ yAxisMax: yAxisMaxRaw,
2485
+ y2AxisMin: y2AxisMinRaw,
2486
+ y2AxisMax: y2AxisMaxRaw,
2487
+ showXMajorGridLines,
2488
+ showYMajorGridLines,
2489
+ showY2MajorGridLines,
2490
+ showYMinorGridLines,
2491
+ showY2MinorGridLines,
2492
+ showLineSmoothing,
2493
+ xAxisMajorTickVisibility,
2494
+ xAxisMajorTickSize,
2495
+ yAxisMajorTickVisibility,
2496
+ y2AxisMajorTickVisibility,
2497
+ yAxisMajorTickSize,
2498
+ y2AxisMajorTickSize,
2499
+ yAxisMajorTickInterval,
2500
+ y2AxisMajorTickInterval,
2501
+ yAxisMinorTickVisibility,
2502
+ y2AxisMinorTickVisibility,
2503
+ yAxisMinorTickSize,
2504
+ y2AxisMinorTickSize,
2505
+ showYAxisWithZero: showYAxisWithZeroFromOptions,
2506
+ showY2AxisWithZero: showY2AxisWithZeroFromOptions
2225
2507
  } = options;
2508
+ const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
2509
+ const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
2510
+ const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
2511
+ const showXMajorTicks = xAxisMajorTickVisibility !== "hide";
2512
+ const showYMajorTicks = yAxisMajorTickVisibility === "show";
2513
+ const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
2514
+ const showYMinorTicks = yAxisMinorTickVisibility === "show";
2515
+ const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
2516
+ const showXAxisLine = parseXAxisLineVisibility(xAxisLineVisibility);
2517
+ const showYAxisLine = yAxisLineVisibility === "show";
2518
+ const showY2AxisLine = y2AxisLineVisibility === "show";
2519
+ const yAxisMin = parseAxisValue(yAxisMinRaw);
2520
+ const yAxisMax = parseAxisValue(yAxisMaxRaw);
2521
+ const y2AxisMin = parseAxisValue(y2AxisMinRaw);
2522
+ const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
2523
+ const parseTickInterval = (simpleXMLValue, canvasValue) => {
2524
+ if (simpleXMLValue) return Number(simpleXMLValue);
2525
+ if (canvasValue) return Number(canvasValue);
2526
+ return void 0;
2527
+ };
2528
+ const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
2529
+ const y2AxisMajorTickIntervalNum = parseTickInterval(
2530
+ y2AxisMajorUnitFromSimpleXML,
2531
+ y2AxisMajorTickInterval
2532
+ );
2533
+ const xAxisMajorTickSizeNum = xAxisMajorTickSize != null ? Number(xAxisMajorTickSize) : void 0;
2534
+ const yAxisMajorTickSizeNum = yAxisMajorTickSize != null ? Number(yAxisMajorTickSize) : void 0;
2535
+ const y2AxisMajorTickSizeNum = y2AxisMajorTickSize != null ? Number(y2AxisMajorTickSize) : void 0;
2536
+ const yAxisMinorTickSizeNum = yAxisMinorTickSize != null ? Number(yAxisMinorTickSize) : void 0;
2537
+ const y2AxisMinorTickSizeNum = y2AxisMinorTickSize != null ? Number(y2AxisMinorTickSize) : void 0;
2226
2538
  const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
2227
2539
  const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
2540
+ const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
2541
+ const stepPositionsByField = stepPositionsByFieldStr ? JSON.parse(stepPositionsByFieldStr) : void 0;
2542
+ const legendLabels = parseArrayOption(legendLabelsStr);
2543
+ const bgColor = backgroundColor || bgColorFromOptions;
2228
2544
  const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
2229
2545
  const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
2230
2546
  const cachedHandleResize = react_exports.useCallback((w, h) => {
@@ -2235,31 +2551,64 @@ var TimeSeriesChartWrapper = (props) => {
2235
2551
  fields: chartData.fields,
2236
2552
  columns: chartData.seriesList
2237
2553
  });
2238
- const xField = getFieldName(filteredChartData.fields[0]);
2554
+ const xField = getFieldName2(filteredChartData.fields[0]);
2239
2555
  const yFields = getFieldNames(
2240
2556
  filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
2241
2557
  );
2242
- const y2Fields = y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [];
2243
- const overlayFields = overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [];
2558
+ const y2Fields = (0, react_exports.useMemo)(
2559
+ () => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
2560
+ [y2FieldsStr]
2561
+ );
2562
+ const overlayFields = (0, react_exports.useMemo)(
2563
+ () => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
2564
+ [overlayFieldsStr]
2565
+ );
2244
2566
  let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
2245
2567
  xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
2246
- let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFields, yAxisTitleVisibility);
2568
+ const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
2569
+ let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
2247
2570
  yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
2248
2571
  const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
2249
2572
  let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
2250
2573
  y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
2251
- const xScaleConfig = getXScaleConfig(xAxisTitle, xAxisLabelVisibility);
2252
- const yScaleConfig = getYScaleConfig(yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility);
2253
- let y2ScaleConfig = {};
2254
- if (y2Enabled) {
2255
- y2ScaleConfig = getY2ScaleConfig(
2256
- y2AxisTitle,
2257
- y2AxisAbbreviation,
2258
- y2AxisScale,
2259
- y2IntegerUnits,
2260
- y2AxisLabelVisibility
2261
- );
2262
- }
2574
+ const xScaleConfig = (0, react_exports.useMemo)(
2575
+ () => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
2576
+ [xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
2577
+ );
2578
+ const yScaleConfig = (0, react_exports.useMemo)(
2579
+ () => getYScaleConfig(
2580
+ yAxisTitle,
2581
+ yAxisAbbreviation,
2582
+ yAxisScale,
2583
+ yAxisLabelVisibility,
2584
+ yAxisMin,
2585
+ yAxisMax
2586
+ ),
2587
+ [yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
2588
+ );
2589
+ const y2ScaleConfig = (0, react_exports.useMemo)(() => {
2590
+ if (y2Enabled) {
2591
+ return getY2ScaleConfig(
2592
+ y2AxisTitle,
2593
+ y2AxisAbbreviation,
2594
+ y2AxisScale,
2595
+ y2IntegerUnits,
2596
+ y2AxisLabelVisibility,
2597
+ y2AxisMin,
2598
+ y2AxisMax
2599
+ );
2600
+ }
2601
+ return {};
2602
+ }, [
2603
+ y2Enabled,
2604
+ y2AxisTitle,
2605
+ y2AxisAbbreviation,
2606
+ y2AxisScale,
2607
+ y2IntegerUnits,
2608
+ y2AxisLabelVisibility,
2609
+ y2AxisMin,
2610
+ y2AxisMax
2611
+ ]);
2263
2612
  const uplotContainerElement = (0, react_exports.useRef)(null);
2264
2613
  const seriesDataFormatted = [
2265
2614
  filteredChartData.columns[0],
@@ -2275,9 +2624,25 @@ var TimeSeriesChartWrapper = (props) => {
2275
2624
  overlayFields,
2276
2625
  y2Enabled,
2277
2626
  nullValueMode,
2278
- markerDisplay
2627
+ markerDisplay,
2628
+ lineDashStyle,
2629
+ lineDashStylesByField,
2630
+ stepPosition,
2631
+ stepPositionsByField
2279
2632
  ),
2280
- [yFields, y2Fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay]
2633
+ [
2634
+ yFields,
2635
+ y2Fields,
2636
+ lineWidth,
2637
+ overlayFields,
2638
+ y2Enabled,
2639
+ nullValueMode,
2640
+ markerDisplay,
2641
+ lineDashStyle,
2642
+ lineDashStylesByField,
2643
+ stepPosition,
2644
+ stepPositionsByField
2645
+ ]
2281
2646
  );
2282
2647
  const chartingEventAnnotations = (0, react_exports.useMemo)(
2283
2648
  () => getAnnotationsForCanvas({
@@ -2291,25 +2656,59 @@ var TimeSeriesChartWrapper = (props) => {
2291
2656
  () => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
2292
2657
  [xScaleConfig, yScaleConfig, y2ScaleConfig]
2293
2658
  );
2294
- const legend = (0, react_exports.useMemo)(() => getLegend({ legendDisplay }), [legendDisplay]);
2659
+ const isSeriesCompare = legendMode === "seriesCompare";
2660
+ const legend = (0, react_exports.useMemo)(
2661
+ () => getLegend({
2662
+ legendDisplay: isSeriesCompare && legendDisplay !== "off" ? "right" : legendDisplay,
2663
+ isSeriesCompare,
2664
+ legendTruncation
2665
+ }),
2666
+ [legendDisplay, isSeriesCompare, legendTruncation]
2667
+ );
2295
2668
  const handleChartClick = react_exports.useCallback(
2296
2669
  (event) => {
2297
2670
  if (onClick) {
2298
- handleClick(event, onClick);
2671
+ handleClick(event, onClick, trellisKey, trellisSplitBy);
2299
2672
  }
2300
2673
  },
2301
- [onClick]
2674
+ [onClick, trellisKey, trellisSplitBy]
2302
2675
  );
2303
2676
  const handleChartLegendClick = react_exports.useCallback(
2304
2677
  (event) => {
2305
2678
  if (onClick) {
2306
- handleLegendClick(event, onClick);
2679
+ handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
2307
2680
  }
2308
2681
  },
2309
- [onClick]
2682
+ [onClick, trellisKey, trellisSplitBy]
2683
+ );
2684
+ const handleChartRangeSelection = react_exports.useCallback(
2685
+ (range2) => {
2686
+ if (onSelect) {
2687
+ handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
2688
+ }
2689
+ },
2690
+ [onSelect, chartData, trellisKey, trellisSplitBy]
2691
+ );
2692
+ const handleChartRangeZoom = react_exports.useCallback(
2693
+ (range2) => {
2694
+ if (onSelect) {
2695
+ handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
2696
+ }
2697
+ },
2698
+ [onSelect, chartData, trellisKey, trellisSplitBy]
2699
+ );
2700
+ const xFieldToUse = xFieldFromProps || xField;
2701
+ const enableSearchZoom = react_exports.useMemo(
2702
+ () => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
2703
+ [eventHandlers, xFieldToUse]
2310
2704
  );
2311
2705
  const lastPayloadRef = react_exports.useRef(null);
2312
2706
  const lastOriginalEventRef = react_exports.useRef(null);
2707
+ const previousMouseoverPayloadRef = react_exports.useRef(null);
2708
+ const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
2709
+ react_exports.useEffect(() => {
2710
+ additionalTooltipValuesRef.current = additionalTooltipValues;
2711
+ }, [additionalTooltipValues]);
2313
2712
  const handleChartCrosshairChange = react_exports.useCallback(
2314
2713
  (event) => {
2315
2714
  if (onPointMouseOver || onPointMouseOut) {
@@ -2321,6 +2720,7 @@ var TimeSeriesChartWrapper = (props) => {
2321
2720
  payload: lastPayloadRef.current
2322
2721
  });
2323
2722
  }
2723
+ previousMouseoverPayloadRef.current = null;
2324
2724
  return;
2325
2725
  }
2326
2726
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
@@ -2328,25 +2728,36 @@ var TimeSeriesChartWrapper = (props) => {
2328
2728
  });
2329
2729
  delete payload.seriesKey;
2330
2730
  if (event.rowContext) {
2331
- Object.keys(event.rowContext).forEach((fieldName) => {
2332
- payload[`row.${fieldName}.value`] = event.rowContext[fieldName];
2333
- });
2731
+ Object.assign(
2732
+ payload,
2733
+ Object.keys(event.rowContext).reduce((acc, fieldName) => {
2734
+ acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
2735
+ return acc;
2736
+ }, {})
2737
+ );
2738
+ }
2739
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2740
+ if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
2741
+ return;
2334
2742
  }
2335
- lastPayloadRef.current = payload;
2743
+ lastPayloadRef.current = updatedPayload;
2336
2744
  lastOriginalEventRef.current = event;
2745
+ previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
2337
2746
  if (onPointMouseOver) {
2338
2747
  onPointMouseOver({
2339
2748
  type: "point.mouseover",
2340
2749
  originalEvent: event,
2341
- payload
2750
+ payload: updatedPayload
2342
2751
  });
2343
2752
  }
2344
2753
  }
2345
2754
  },
2346
- [onPointMouseOver, onPointMouseOut]
2755
+ [onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
2347
2756
  );
2348
- const memoizedChart = (0, react_exports.useMemo)(
2349
- () => /* @__PURE__ */ react_exports.createElement(
2757
+ 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}`;
2758
+ const memoizedChart = (0, react_exports.useMemo)(() => {
2759
+ const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
2760
+ return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
2350
2761
  visualization_canvas_exports.TimeSeriesChart,
2351
2762
  {
2352
2763
  data: chartData,
@@ -2356,49 +2767,121 @@ var TimeSeriesChartWrapper = (props) => {
2356
2767
  seriesColorsByField,
2357
2768
  seriesConfig: seriesOverrides,
2358
2769
  legend,
2770
+ legendLabels,
2771
+ legendTruncation,
2772
+ isSeriesCompare: legendMode === "seriesCompare",
2773
+ maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
2359
2774
  scaleConfig,
2360
2775
  timestampFormat: "expanded",
2361
2776
  onCrosshairClick: onClick ? handleChartClick : void 0,
2362
2777
  onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
2363
2778
  onSeriesClick: onClick ? handleChartLegendClick : void 0,
2779
+ onRangeSelection: handleChartRangeSelection,
2780
+ onRangeZoom: computedOnRangeZoom,
2781
+ serverSideZoom: enableSearchZoom,
2364
2782
  userLocale,
2365
2783
  events: chartingEventAnnotations,
2366
- eventsConfig: { renderer: triangleEventAnnotationRenderer }
2784
+ eventsConfig: { renderer: triangleEventAnnotationRenderer },
2785
+ additionalTooltipValuesRef,
2786
+ showXMajorGridLines,
2787
+ showYMajorGridLines,
2788
+ showY2MajorGridLines,
2789
+ showYMinorGridLines,
2790
+ showY2MinorGridLines,
2791
+ showLineSmoothing,
2792
+ dataValuesDisplay,
2793
+ showXMajorTicks,
2794
+ xAxisMajorTickSize: xAxisMajorTickSizeNum,
2795
+ showYMajorTicks,
2796
+ showY2MajorTicks,
2797
+ yAxisMajorTickSize: yAxisMajorTickSizeNum,
2798
+ y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
2799
+ yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
2800
+ y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
2801
+ showYMinorTicks,
2802
+ showY2MinorTicks,
2803
+ yAxisMinorTickSize: yAxisMinorTickSizeNum,
2804
+ y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
2805
+ showYAxisWithZero,
2806
+ showY2AxisWithZero,
2807
+ showXAxisLine,
2808
+ showYAxisLine,
2809
+ showY2AxisLine,
2810
+ xAxisMaxLabelParts
2367
2811
  }
2368
- ),
2369
- [
2370
- chartData,
2371
- containerWidth,
2372
- containerHeight,
2373
- seriesColors,
2374
- seriesColorsByField,
2375
- seriesOverrides,
2376
- legend,
2377
- scaleConfig,
2378
- userLocale,
2379
- chartingEventAnnotations,
2380
- onClick,
2381
- handleChartClick,
2382
- onPointMouseOver,
2383
- onPointMouseOut,
2384
- handleChartCrosshairChange,
2385
- handleChartLegendClick
2386
- ]
2387
- );
2812
+ ));
2813
+ }, [
2814
+ onSelect,
2815
+ handleChartRangeZoom,
2816
+ dataKey,
2817
+ chartData,
2818
+ containerWidth,
2819
+ containerHeight,
2820
+ seriesColors,
2821
+ seriesColorsByField,
2822
+ seriesOverrides,
2823
+ legend,
2824
+ legendLabels,
2825
+ legendTruncation,
2826
+ scaleConfig,
2827
+ onClick,
2828
+ handleChartClick,
2829
+ onPointMouseOver,
2830
+ onPointMouseOut,
2831
+ handleChartCrosshairChange,
2832
+ handleChartLegendClick,
2833
+ handleChartRangeSelection,
2834
+ enableSearchZoom,
2835
+ userLocale,
2836
+ chartingEventAnnotations,
2837
+ showXMajorGridLines,
2838
+ showYMajorGridLines,
2839
+ showY2MajorGridLines,
2840
+ showYMinorGridLines,
2841
+ showY2MinorGridLines,
2842
+ showLineSmoothing,
2843
+ dataValuesDisplay,
2844
+ showXMajorTicks,
2845
+ xAxisMajorTickSizeNum,
2846
+ showYMajorTicks,
2847
+ showY2MajorTicks,
2848
+ yAxisMajorTickSizeNum,
2849
+ y2AxisMajorTickSizeNum,
2850
+ yAxisMajorTickIntervalNum,
2851
+ y2AxisMajorTickIntervalNum,
2852
+ showYMinorTicks,
2853
+ showY2MinorTicks,
2854
+ yAxisMinorTickSizeNum,
2855
+ y2AxisMinorTickSizeNum,
2856
+ showYAxisWithZero,
2857
+ showY2AxisWithZero,
2858
+ showXAxisLine,
2859
+ showYAxisLine,
2860
+ showY2AxisLine,
2861
+ legendMode,
2862
+ xAxisMaxLabelParts
2863
+ ]);
2388
2864
  const memoizedVisualization = (0, react_exports.useMemo)(() => {
2389
- return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
2390
- }, [backgroundColor, memoizedChart]);
2391
- return /* @__PURE__ */ react_exports.createElement(
2865
+ return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
2866
+ }, [bgColor, memoizedChart]);
2867
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
2868
+ TrellisTitle,
2869
+ {
2870
+ trellisKey,
2871
+ backgroundColor: bgColor,
2872
+ fontColor: defaultFontColor
2873
+ }
2874
+ ), /* @__PURE__ */ react_exports.createElement(
2392
2875
  TimeSeriesChartContainer,
2393
2876
  {
2394
- height,
2877
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
2395
2878
  width,
2396
2879
  ref: uplotContainerElement,
2397
2880
  "data-test": "timeseries-chart-wrapper"
2398
2881
  },
2399
2882
  /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
2400
2883
  memoizedVisualization
2401
- );
2884
+ ));
2402
2885
  };
2403
2886
  var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
2404
2887
 
@@ -2700,6 +3183,10 @@ var colorConstants_default = "default" in defaultImport33 ? defaultImport33.defa
2700
3183
  // src/common/gaugeUtils.ts
2701
3184
  var GAUGE_THICKNESS = 50;
2702
3185
  var FILL_THICKNESS = 38;
3186
+ var DEFAULT_NUM_OF_TICKS = 5;
3187
+ var MAX_TICK_LABEL_DECIMAL_PLACES = 5;
3188
+ var MAX_VALUE_LABEL_DIGITS_WITHOUT_PERCENT = 6;
3189
+ var MAX_VALUE_LABEL_DIGITS_WITH_PERCENT = 5;
2703
3190
  var getGaugeWidth = ({ containerWidth, orientation }) => orientation === "vertical" ? GAUGE_THICKNESS : containerWidth * 0.8;
2704
3191
  var getGaugeHeight = ({ containerHeight, orientation }) => orientation === "vertical" ? containerHeight * 0.8 : GAUGE_THICKNESS;
2705
3192
  var getGaugeLength = ({ containerWidth, containerHeight, orientation }) => orientation === "vertical" ? getGaugeHeight({ containerHeight, orientation }) : getGaugeWidth({ containerWidth, orientation });
@@ -2823,6 +3310,137 @@ var getFillerGaugeValueMarkerPositions = ({ fillBarX, fillBarY, fillBarLength, o
2823
3310
  valueMarkerY
2824
3311
  };
2825
3312
  };
3313
+ var getDecimalPlaces = (value) => {
3314
+ const numericValue = Number(value);
3315
+ if (!Number.isFinite(numericValue)) {
3316
+ return 0;
3317
+ }
3318
+ const fractionPart = numericValue.toString().split(".")[1];
3319
+ return fractionPart ? fractionPart.length : 0;
3320
+ };
3321
+ var getUniqueDecimalPlaces = ({
3322
+ values,
3323
+ minimumDecimalPlaces
3324
+ }) => {
3325
+ if (values.length <= 1) {
3326
+ return minimumDecimalPlaces;
3327
+ }
3328
+ for (let decimalPlaces = minimumDecimalPlaces; decimalPlaces <= MAX_TICK_LABEL_DECIMAL_PLACES; decimalPlaces += 1) {
3329
+ const roundedValues = values.map((value) => Number(value.toFixed(decimalPlaces)));
3330
+ if (new Set(roundedValues).size === roundedValues.length) {
3331
+ return decimalPlaces;
3332
+ }
3333
+ }
3334
+ return MAX_TICK_LABEL_DECIMAL_PLACES;
3335
+ };
3336
+ var getPercentageFromRange = ({ value, min, range: range2 }) => {
3337
+ if (range2 === 0) {
3338
+ return 0;
3339
+ }
3340
+ return (value - min) / range2 * 100;
3341
+ };
3342
+ var getNumOfTicks = ({
3343
+ min,
3344
+ max,
3345
+ majorUnit,
3346
+ usePercentageRange
3347
+ }) => {
3348
+ const range2 = max - min;
3349
+ const majorUnitNumber = Number(majorUnit);
3350
+ const isAutoMajorUnit = majorUnit === "auto" || Number.isNaN(majorUnitNumber) || majorUnitNumber <= 0;
3351
+ let numOfTicks = DEFAULT_NUM_OF_TICKS;
3352
+ if (!isAutoMajorUnit) {
3353
+ numOfTicks = usePercentageRange ? 100 / majorUnitNumber : range2 / majorUnitNumber;
3354
+ }
3355
+ return { numOfTicks, isAutoMajorUnit, majorUnitNumber };
3356
+ };
3357
+ var getTickLabelFormatter = ({
3358
+ min,
3359
+ max,
3360
+ majorUnit,
3361
+ usePercentageRange
3362
+ }) => {
3363
+ const range2 = max - min;
3364
+ const { numOfTicks, isAutoMajorUnit, majorUnitNumber } = getNumOfTicks({
3365
+ min,
3366
+ max,
3367
+ majorUnit,
3368
+ usePercentageRange
3369
+ });
3370
+ const numericStep = range2 / numOfTicks;
3371
+ const tickValues = [];
3372
+ for (let i = 0; i <= numOfTicks; i += 1) {
3373
+ tickValues.push(min + numericStep * i);
3374
+ }
3375
+ if (!Number.isInteger(numOfTicks)) {
3376
+ tickValues.push(max);
3377
+ }
3378
+ const minimumNumericDecimalPlaces = Math.min(
3379
+ MAX_TICK_LABEL_DECIMAL_PLACES,
3380
+ Math.max(
3381
+ getDecimalPlaces(min),
3382
+ getDecimalPlaces(max),
3383
+ isAutoMajorUnit ? 0 : getDecimalPlaces(majorUnitNumber)
3384
+ )
3385
+ );
3386
+ const numericLabelDecimalPlaces = getUniqueDecimalPlaces({
3387
+ values: tickValues,
3388
+ minimumDecimalPlaces: minimumNumericDecimalPlaces
3389
+ });
3390
+ const percentageLabelDecimalPlaces = getUniqueDecimalPlaces({
3391
+ values: tickValues.map((value) => getPercentageFromRange({ value, min, range: range2 })),
3392
+ minimumDecimalPlaces: 0
3393
+ });
3394
+ const formatTickLabel = (value) => {
3395
+ if (usePercentageRange) {
3396
+ const percentageValue = getPercentageFromRange({ value, min, range: range2 });
3397
+ return `${percentageValue.toFixed(percentageLabelDecimalPlaces)}%`;
3398
+ }
3399
+ const numericLabel = value.toFixed(numericLabelDecimalPlaces);
3400
+ if (numericLabel.includes(".")) {
3401
+ return numericLabel;
3402
+ }
3403
+ return (0, numberUtils_exports.formatNumber)(Number(numericLabel), 0, {
3404
+ useThousandSeparators: true,
3405
+ useTrendUnits: true
3406
+ }).replace(/k$/, "K");
3407
+ };
3408
+ return { numOfTicks, numericStep, formatTickLabel };
3409
+ };
3410
+ var getDigitsBeforeDecimal = (numericValue) => Math.abs(Math.trunc(Number(numericValue))).toString().length;
3411
+ var getCappedDecimalPlaces = (numericValue, rawDecimalPlaces, maxDigits) => {
3412
+ const digitsBeforeDecimal = getDigitsBeforeDecimal(numericValue);
3413
+ const maxDecimalPlaces = Math.max(0, maxDigits - digitsBeforeDecimal);
3414
+ return Math.min(rawDecimalPlaces, maxDecimalPlaces);
3415
+ };
3416
+ var formatGaugeValueLabel = ({
3417
+ value,
3418
+ min,
3419
+ max,
3420
+ usePercentageValue
3421
+ }) => {
3422
+ const numericValue = Number(value);
3423
+ const range2 = max - min || 1;
3424
+ const percentageValue = getPercentageFromRange({ value: numericValue, min, range: range2 });
3425
+ const trendFormatOptions = {
3426
+ useThousandSeparators: true,
3427
+ useTrendUnits: true
3428
+ };
3429
+ if (usePercentageValue) {
3430
+ const percentageDecimalPlaces = getCappedDecimalPlaces(
3431
+ percentageValue,
3432
+ 2,
3433
+ MAX_VALUE_LABEL_DIGITS_WITH_PERCENT
3434
+ );
3435
+ return `${(0, numberUtils_exports.formatNumber)(percentageValue, percentageDecimalPlaces, trendFormatOptions)}%`;
3436
+ }
3437
+ const valueDecimalPlaces = getCappedDecimalPlaces(
3438
+ numericValue,
3439
+ getDecimalPlaces(numericValue),
3440
+ MAX_VALUE_LABEL_DIGITS_WITHOUT_PERCENT
3441
+ );
3442
+ return (0, numberUtils_exports.formatNumber)(numericValue, valueDecimalPlaces, trendFormatOptions);
3443
+ };
2826
3444
  var gaugeOptionsMapping = {
2827
3445
  majorTickInterval: "majorUnit",
2828
3446
  gaugeRanges: "ranges"
@@ -2851,9 +3469,9 @@ var mapValueLabelDisplay = (labelOrValue, options) => {
2851
3469
  var convertToGaugeProperties = (originalOptions) => (0, lodash_exports.chain)(mapToOldKey(originalOptions)).thru((options) => mapValueLabelDisplay("label", options)).thru((options) => mapValueLabelDisplay("value", options)).value();
2852
3470
 
2853
3471
  // src/common/GaugeMajorTicks.jsx
2854
- var DEFAULT_NUM_OF_TICKS = 5;
2855
3472
  var TICK_LENGTH_DELTA = 5;
2856
3473
  var TICK_LABEL_PADDING_FACTOR = 3.2;
3474
+ var VERTICAL_START_ANCHOR_OFFSET = 8;
2857
3475
  var MajorTickLine = styled_components_default.line`
2858
3476
  stroke: ${(props) => props.majorTickStrokeColor};
2859
3477
  stroke-width: 2px;
@@ -2866,7 +3484,7 @@ var MajorTickLabel = styled_components_default.text`
2866
3484
  sans-serif;
2867
3485
  line-height: 19px;
2868
3486
  fill: ${(props) => props.majorTickFillColor};
2869
- text-anchor: middle;
3487
+ text-anchor: ${(props) => props.textAnchor};
2870
3488
  text-align: center;
2871
3489
  `;
2872
3490
  var MajorTick = ({
@@ -2879,6 +3497,7 @@ var MajorTick = ({
2879
3497
  label,
2880
3498
  labelX,
2881
3499
  labelY,
3500
+ textAnchor = "middle",
2882
3501
  majorTickStrokeColor,
2883
3502
  majorTickFillColor
2884
3503
  }) => /* @__PURE__ */ react_default.createElement("g", null, /* @__PURE__ */ react_default.createElement(
@@ -2897,13 +3516,11 @@ var MajorTick = ({
2897
3516
  {
2898
3517
  x: labelX,
2899
3518
  y: labelY,
3519
+ textAnchor,
2900
3520
  majorTickFillColor,
2901
3521
  "data-test": "major-tick-label"
2902
3522
  },
2903
- (0, numberUtils_exports.isNumerial)(label) ? (0, numberUtils_exports.formatNumber)(label, 0, {
2904
- useThousandSeparators: true,
2905
- useTrendUnits: true
2906
- }) : label
3523
+ label
2907
3524
  ));
2908
3525
  MajorTick.propTypes = {
2909
3526
  index: prop_types_default.number,
@@ -2915,6 +3532,7 @@ MajorTick.propTypes = {
2915
3532
  label: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
2916
3533
  labelX: prop_types_default.number,
2917
3534
  labelY: prop_types_default.number,
3535
+ textAnchor: prop_types_default.string,
2918
3536
  majorTickStrokeColor: prop_types_default.string,
2919
3537
  majorTickFillColor: prop_types_default.string
2920
3538
  };
@@ -2931,7 +3549,7 @@ var positionMajorTick = ({ width, height, startX, startY, orientation, numOfTick
2931
3549
  y1 = y;
2932
3550
  x2 += width + TICK_LENGTH_DELTA;
2933
3551
  y2 = y;
2934
- labelX += width + TICK_LENGTH_DELTA * TICK_LABEL_PADDING_FACTOR;
3552
+ labelX += width + TICK_LENGTH_DELTA * TICK_LABEL_PADDING_FACTOR - VERTICAL_START_ANCHOR_OFFSET;
2935
3553
  labelY = y;
2936
3554
  } else {
2937
3555
  const x = width / numOfTicks * i + startX;
@@ -2960,10 +3578,17 @@ var MajorTicks = (_a) => {
2960
3578
  majorTickFillColor,
2961
3579
  majorTickStrokeColor
2962
3580
  } = props;
2963
- const range2 = max - min;
2964
- const numOfTicks = majorUnit === "auto" || Number.isNaN(Number(majorUnit)) || majorUnit <= 0 ? DEFAULT_NUM_OF_TICKS : range2 / majorUnit;
3581
+ const isVertical = orientation === "vertical";
3582
+ const textAnchor = isVertical ? "start" : "middle";
3583
+ const { numOfTicks, numericStep, formatTickLabel } = getTickLabelFormatter({
3584
+ min,
3585
+ max,
3586
+ majorUnit,
3587
+ usePercentageRange
3588
+ });
2965
3589
  const majorTicks = [];
2966
3590
  for (let i = 0; i <= numOfTicks; i += 1) {
3591
+ const tickValue = min + numericStep * i;
2967
3592
  const { x1, y1, x2, y2, labelX, labelY } = positionMajorTick({
2968
3593
  width,
2969
3594
  height,
@@ -2973,7 +3598,7 @@ var MajorTicks = (_a) => {
2973
3598
  numOfTicks,
2974
3599
  i
2975
3600
  });
2976
- const label = usePercentageRange ? `${parseInt((i / numOfTicks - min / range2) * 100, 10)}%` : parseInt(min + range2 / numOfTicks * i, 10);
3601
+ const label = formatTickLabel(tickValue);
2977
3602
  majorTicks.push(
2978
3603
  /* @__PURE__ */ react_default.createElement(
2979
3604
  MajorTick,
@@ -2988,6 +3613,7 @@ var MajorTicks = (_a) => {
2988
3613
  label,
2989
3614
  labelX,
2990
3615
  labelY,
3616
+ textAnchor,
2991
3617
  majorTickFillColor,
2992
3618
  majorTickStrokeColor
2993
3619
  }
@@ -3016,9 +3642,10 @@ var MajorTicks = (_a) => {
3016
3642
  x2,
3017
3643
  y2,
3018
3644
  showLabels,
3019
- label: usePercentageRange ? "100%" : max,
3645
+ label: formatTickLabel(max),
3020
3646
  labelX,
3021
3647
  labelY,
3648
+ textAnchor,
3022
3649
  majorTickFillColor,
3023
3650
  majorTickStrokeColor
3024
3651
  }
@@ -3173,10 +3800,7 @@ var ValueMarker = (_a) => {
3173
3800
  valueMarkerLabelFillColor,
3174
3801
  "aria-label": (0, format_exports.sprintf)((0, i18n_exports._)("Marker gauge value: %s"), value)
3175
3802
  },
3176
- usePercentageValue ? `${(value / (max - min) * 100).toFixed(2)}%` : (0, numberUtils_exports.formatNumber)(value, 0, {
3177
- useThousandSeparators: true,
3178
- useTrendUnits: true
3179
- })
3803
+ formatGaugeValueLabel({ value, min, max, usePercentageValue })
3180
3804
  )));
3181
3805
  };
3182
3806
  ValueMarker.propTypes = {
@@ -3195,48 +3819,6 @@ ValueMarker.propTypes = {
3195
3819
  };
3196
3820
  var GaugeValueMarker_default = ValueMarker;
3197
3821
 
3198
- // src/common/hooks/useTrellisEnabled.ts
3199
- var useTrellisFeatureFlagOn = () => {
3200
- const context = (0, react_exports.useContext)(FeatureFlagContext_default);
3201
- return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
3202
- };
3203
- var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
3204
- const trellisFeatureEnabled = useTrellisFeatureFlagOn();
3205
- return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
3206
- };
3207
-
3208
- // src/common/components/TrellisTitle.tsx
3209
- var TRELLIS_TITLE_HEIGHT = 28;
3210
- var TrellisTitleText = styled_components_default.div`
3211
- margin-left: 10px;
3212
- margin-right: 10px;
3213
- padding-top: 8px;
3214
- text-overflow: ellipsis;
3215
- white-space: nowrap;
3216
- overflow: hidden;
3217
- `;
3218
- var TrellisTitleDiv = styled_components_default.div`
3219
- height: ${TRELLIS_TITLE_HEIGHT}px;
3220
- font-size: 14px;
3221
- font-weight: 700;
3222
- color: ${(props) => props.fontColor};
3223
- background-color: ${(props) => props.backgroundColor};
3224
- 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.
3225
- `;
3226
- var TrellisTitle = (props) => {
3227
- const titleText = String(props.trellisKey).toString();
3228
- return /* @__PURE__ */ react_exports.createElement(
3229
- TrellisTitleDiv,
3230
- {
3231
- fontColor: props.fontColor,
3232
- backgroundColor: props.backgroundColor,
3233
- "data-test": "trellis-title",
3234
- title: titleText
3235
- },
3236
- /* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
3237
- );
3238
- };
3239
-
3240
3822
  // src/FillerGauge/PureFillerGauge/FillerGauge.tsx
3241
3823
  var Container = styled_components_default.div`
3242
3824
  overflow: hidden;