@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
@@ -25,6 +25,18 @@ var __spreadValues = (a, b) => {
25
25
  return a;
26
26
  };
27
27
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
+ var __objRest = (source, exclude) => {
29
+ var target = {};
30
+ for (var prop in source)
31
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
32
+ target[prop] = source[prop];
33
+ if (source != null && __getOwnPropSymbols)
34
+ for (var prop of __getOwnPropSymbols(source)) {
35
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
36
+ target[prop] = source[prop];
37
+ }
38
+ return target;
39
+ };
28
40
  var __export = (target, all) => {
29
41
  for (var name in all)
30
42
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -51,10 +63,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
51
63
  // src/common/TimeSeriesChartWrapper.tsx
52
64
  var TimeSeriesChartWrapper_exports = {};
53
65
  __export(TimeSeriesChartWrapper_exports, {
66
+ appendTrellisToPayload: () => appendTrellisToPayload,
54
67
  default: () => TimeSeriesChartWrapper_default,
55
68
  handleClick: () => handleClick,
56
69
  handleCrosshairChange: () => handleCrosshairChange,
57
- handleLegendClick: () => handleLegendClick
70
+ handleLegendClick: () => handleLegendClick,
71
+ handleRangeSelection: () => handleRangeSelection,
72
+ handleRangeZoom: () => handleRangeZoom,
73
+ hasMouseoverPayloadChanged: () => hasMouseoverPayloadChanged,
74
+ parseArrayOption: () => parseArrayOption
58
75
  });
59
76
  module.exports = __toCommonJS(TimeSeriesChartWrapper_exports);
60
77
 
@@ -172,6 +189,16 @@ var triangleEventAnnotationRenderer = ({
172
189
  eventColor: eventWithColor.color
173
190
  });
174
191
  };
192
+ var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
193
+ const rangeSelectEventHandler = eventHandlers.find(
194
+ (eventHandler) => {
195
+ var _a;
196
+ return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
197
+ }
198
+ );
199
+ const xAxisIsTime = xField === "_time";
200
+ return !!rangeSelectEventHandler && xAxisIsTime;
201
+ };
175
202
  var filterChartDataFromInternalFields = (chartData) => {
176
203
  const { fields, columns } = chartData;
177
204
  const keepIndexes = fields.reduce((acc, field, index) => {
@@ -188,17 +215,34 @@ var filterChartDataFromInternalFields = (chartData) => {
188
215
  var convert2DArrayToNumbers = (arr) => {
189
216
  return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
190
217
  };
191
- var SideLegendWidth = 75;
192
- var commonLegendProps = { center: true, fontSize: 12, largerTiles: true, hideSeriesValue: true };
218
+ var parseAxisValue = (val) => {
219
+ if (val === void 0 || val === null || val === "auto" || val === "") {
220
+ return void 0;
221
+ }
222
+ const num = typeof val === "number" ? val : Number.parseFloat(val);
223
+ return Number.isNaN(num) ? void 0 : num;
224
+ };
225
+ var parseXAxisLineVisibility = (visibility) => {
226
+ if (visibility === "hide") return false;
227
+ if (visibility === "show") return true;
228
+ return void 0;
229
+ };
193
230
  var getLegend = (props) => {
194
231
  const legendPlacement = props == null ? void 0 : props.legendDisplay;
232
+ const { isSeriesCompare, legendTruncation } = props;
233
+ const commonLegendProps = {
234
+ center: true,
235
+ fontSize: 12,
236
+ largerTiles: true,
237
+ hideSeriesValue: !isSeriesCompare,
238
+ // Show values if in seriesCompare mode
239
+ legendTruncation
240
+ };
195
241
  switch (legendPlacement) {
196
242
  case "off":
197
243
  return false;
198
244
  case "left":
199
- return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
200
- width: SideLegendWidth
201
- }, commonLegendProps));
245
+ return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({}, commonLegendProps));
202
246
  case "bottom":
203
247
  return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
204
248
  wrap: true
@@ -208,9 +252,7 @@ var getLegend = (props) => {
208
252
  wrap: true
209
253
  }, commonLegendProps));
210
254
  default:
211
- return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
212
- width: SideLegendWidth
213
- }, commonLegendProps));
255
+ return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({}, commonLegendProps));
214
256
  }
215
257
  };
216
258
  var getComputedAxisTitles = (inputAxisTitle, fields, axisTitleVisibility) => {
@@ -252,15 +294,18 @@ var getFieldName = (field) => {
252
294
  var getFieldNames = (fields) => {
253
295
  return fields.map((field) => getFieldName(field));
254
296
  };
255
- var getXScaleConfig = (label, xAxisLabelVisibility) => {
297
+ var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
256
298
  const xConfig = { x: {} };
257
299
  xConfig.x.label = label;
258
300
  if (xAxisLabelVisibility === "hide") {
259
301
  xConfig.x.hideLabels = true;
260
302
  }
303
+ if (xAxisLabelRotation !== void 0) {
304
+ xConfig.x.labelRotation = xAxisLabelRotation;
305
+ }
261
306
  return xConfig;
262
307
  };
263
- var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
308
+ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
264
309
  const scaleType = yAxisScale != null ? yAxisScale : "linear";
265
310
  const yConfig = { y: {} };
266
311
  yConfig.y.label = label;
@@ -268,34 +313,46 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
268
313
  if (yAxisAbbreviation !== "none") {
269
314
  yConfig.y.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1);
270
315
  }
271
- if (yAxisAbbreviation === "none") {
272
- yConfig.y.width = 55;
273
- } else {
316
+ if (yAxisAbbreviation !== "none") {
274
317
  yConfig.y.width = label && label.length > 0 ? 30 : 10;
275
318
  }
276
319
  if (yAxisLabelVisibility === "hide") {
277
320
  yConfig.y.hideLabels = true;
278
321
  }
322
+ if (yAxisMin !== void 0 || yAxisMax !== void 0) {
323
+ yConfig.y.range = (u, dataMin, dataMax) => {
324
+ const min = yAxisMin != null ? yAxisMin : dataMin;
325
+ const max = yAxisMax != null ? yAxisMax : dataMax;
326
+ return [min, max];
327
+ };
328
+ }
279
329
  return yConfig;
280
330
  };
281
- var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
331
+ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
282
332
  const y2Config = { y2: {} };
283
333
  const scaleType = axisScale != null ? axisScale : "linear";
284
334
  y2Config.y2.label = label;
285
335
  y2Config.y2.side = "right";
286
- y2Config.y2.showGrid = false;
287
336
  y2Config.y2.type = scaleType;
288
337
  if (axisAbbreviation !== "none") {
289
338
  y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
339
+ y2Config.y2.width = label && label.length > 0 ? 50 : 10;
290
340
  } else if (roundAxisLabelsToInteger) {
291
341
  y2Config.y2.tickFmt = (v) => roundAxisLabelsToInteger ? Math.round(v).toString() : v.toString();
292
342
  }
293
343
  if (y2AxisLabelVisibility === "hide") {
294
344
  y2Config.y2.hideLabels = true;
295
345
  }
346
+ if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
347
+ y2Config.y2.range = (u, dataMin, dataMax) => {
348
+ const min = y2AxisMin != null ? y2AxisMin : dataMin;
349
+ const max = y2AxisMax != null ? y2AxisMax : dataMax;
350
+ return [min, max];
351
+ };
352
+ }
296
353
  return y2Config;
297
354
  };
298
- var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
355
+ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField, stepPosition, stepPositionsByField) => {
299
356
  const seriesConfig = {};
300
357
  let spanGaps;
301
358
  let replaceNullsWithZero;
@@ -322,6 +379,8 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
322
379
  );
323
380
  if (shouldAssignToY2) {
324
381
  seriesConfig[field].overrides.scale = "y2";
382
+ } else {
383
+ seriesConfig[field].overrides.scale = "y";
325
384
  }
326
385
  }
327
386
  if (overlayFields == null ? void 0 : overlayFields.includes(field)) {
@@ -330,12 +389,110 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
330
389
  if (markerDisplay !== void 0) {
331
390
  seriesConfig[field].markerDisplay = markerDisplay;
332
391
  }
392
+ const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
393
+ if (fieldDashStyle) {
394
+ seriesConfig[field].lineDashStyle = fieldDashStyle;
395
+ }
396
+ const hasFieldStepPosition = Object.hasOwn(stepPositionsByField || {}, field);
397
+ const fieldStepPosition = hasFieldStepPosition ? stepPositionsByField == null ? void 0 : stepPositionsByField[field] : stepPosition;
398
+ if (fieldStepPosition && fieldStepPosition !== "off") {
399
+ seriesConfig[field].stepPosition = fieldStepPosition;
400
+ }
333
401
  if (replaceNullsWithZero !== void 0) {
334
402
  seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
335
403
  }
336
404
  });
337
405
  return seriesConfig;
338
406
  };
407
+ var findRangeIndices = (xData, startValue, endValue) => {
408
+ let startXIndex = -1;
409
+ let endXIndex = -1;
410
+ const xDataEpoch = xData.map((val) => {
411
+ if (typeof val === "string") {
412
+ return new Date(val).getTime() / 1e3;
413
+ }
414
+ return val;
415
+ });
416
+ for (let i = 0; i < xDataEpoch.length; i += 1) {
417
+ if (xDataEpoch[i] >= startValue) {
418
+ startXIndex = i;
419
+ break;
420
+ }
421
+ }
422
+ if (startXIndex === -1 && xDataEpoch.length > 0) {
423
+ startXIndex = xDataEpoch.length - 1;
424
+ }
425
+ for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
426
+ if (xDataEpoch[i] <= endValue) {
427
+ endXIndex = i;
428
+ break;
429
+ }
430
+ }
431
+ if (endXIndex === -1 && xDataEpoch.length > 0) {
432
+ endXIndex = 0;
433
+ }
434
+ return { startXIndex, endXIndex };
435
+ };
436
+
437
+ // esm-externals:@splunk/visualization-context/FeatureFlagContext
438
+ var FeatureFlagContext_exports = {};
439
+ __export(FeatureFlagContext_exports, {
440
+ default: () => FeatureFlagContext_default
441
+ });
442
+ var defaultImport9 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
443
+ __reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
444
+ var FeatureFlagContext_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
445
+
446
+ // esm-externals:@splunk/visualization-schemas
447
+ var visualization_schemas_exports = {};
448
+ __export(visualization_schemas_exports, {
449
+ default: () => visualization_schemas_default
450
+ });
451
+ var defaultImport10 = __toESM(require("@splunk/visualization-schemas"));
452
+ __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
453
+ var visualization_schemas_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
454
+
455
+ // src/common/hooks/useTrellisEnabled.ts
456
+ var useTrellisFeatureFlagOn = () => {
457
+ const context = (0, react_exports.useContext)(FeatureFlagContext_default);
458
+ return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
459
+ };
460
+ var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
461
+ const trellisFeatureEnabled = useTrellisFeatureFlagOn();
462
+ return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
463
+ };
464
+
465
+ // src/common/components/TrellisTitle.tsx
466
+ var TRELLIS_TITLE_HEIGHT = 28;
467
+ var TrellisTitleText = styled_components_default.div`
468
+ margin-left: 10px;
469
+ margin-right: 10px;
470
+ padding-top: 8px;
471
+ text-overflow: ellipsis;
472
+ white-space: nowrap;
473
+ overflow: hidden;
474
+ `;
475
+ var TrellisTitleDiv = styled_components_default.div`
476
+ height: ${TRELLIS_TITLE_HEIGHT}px;
477
+ font-size: 14px;
478
+ font-weight: 700;
479
+ color: ${(props) => props.fontColor};
480
+ background-color: ${(props) => props.backgroundColor};
481
+ 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.
482
+ `;
483
+ var TrellisTitle = (props) => {
484
+ const titleText = String(props.trellisKey).toString();
485
+ return /* @__PURE__ */ react_exports.createElement(
486
+ TrellisTitleDiv,
487
+ {
488
+ fontColor: props.fontColor,
489
+ backgroundColor: props.backgroundColor,
490
+ "data-test": "trellis-title",
491
+ title: titleText
492
+ },
493
+ /* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
494
+ );
495
+ };
339
496
 
340
497
  // src/common/TimeSeriesChartWrapper.tsx
341
498
  var TimeSeriesChartContainer = styled_components_default.div`
@@ -346,37 +503,112 @@ var TimeSeriesChartContainer = styled_components_default.div`
346
503
  position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
347
504
  }
348
505
  `;
349
- var handleClick = (chartEvent, onClick) => {
506
+ var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
507
+ const result = __spreadValues({}, payload);
508
+ if (trellisSplitBy) {
509
+ result["trellis.name"] = trellisSplitBy;
510
+ }
511
+ if (trellisKey) {
512
+ result["trellis.value"] = trellisKey;
513
+ }
514
+ return result;
515
+ };
516
+ var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
517
+ if (!previousPayload) {
518
+ return true;
519
+ }
520
+ if (currentPayload.index !== previousPayload.index) {
521
+ return true;
522
+ }
523
+ if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
524
+ return true;
525
+ }
526
+ if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
527
+ return true;
528
+ }
529
+ if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
530
+ return true;
531
+ }
532
+ return false;
533
+ };
534
+ var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
350
535
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
351
536
  name: chartEvent.seriesKey
352
537
  });
353
538
  delete payload.seriesKey;
354
539
  if (chartEvent.rowContext) {
355
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
356
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
357
- });
540
+ Object.assign(
541
+ payload,
542
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
543
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
544
+ return acc;
545
+ }, {})
546
+ );
358
547
  }
548
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
359
549
  if (onClick) {
360
550
  onClick({
361
551
  type: "point.click",
362
552
  originalEvent: chartEvent,
363
- payload
553
+ payload: updatedPayload
364
554
  });
365
555
  }
366
556
  };
367
- var handleLegendClick = (chartEvent, onClick) => {
557
+ var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
368
558
  const payload = {
369
559
  name: chartEvent
370
560
  };
561
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
371
562
  if (onClick) {
372
563
  onClick({
373
564
  type: "legend.click",
374
565
  originalEvent: chartEvent,
375
- payload
566
+ payload: updatedPayload
376
567
  });
377
568
  }
378
569
  };
379
- var handleCrosshairChange = (chartEvent, onPointMouseOver, onPointMouseOut, lastPayload = null, lastOriginalEvent = null) => {
570
+ var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
571
+ var _a;
572
+ if (!rangeEvent) {
573
+ return;
574
+ }
575
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
576
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
577
+ const payload = {
578
+ startXIndex,
579
+ startXValue: rangeEvent.start,
580
+ endXIndex,
581
+ endXValue: rangeEvent.end
582
+ };
583
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
584
+ if (onSelect) {
585
+ onSelect({
586
+ type: "range.selectBeforeZoom",
587
+ originalEvent: rangeEvent,
588
+ payload: updatedPayload
589
+ });
590
+ }
591
+ };
592
+ var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
593
+ var _a;
594
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
595
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
596
+ const payload = {
597
+ startXIndex,
598
+ startXValue: rangeEvent.start,
599
+ endXIndex,
600
+ endXValue: rangeEvent.end
601
+ };
602
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
603
+ if (onSelect) {
604
+ onSelect({
605
+ type: "range.select",
606
+ originalEvent: rangeEvent,
607
+ payload: updatedPayload
608
+ });
609
+ }
610
+ };
611
+ var handleCrosshairChange = (chartEvent, onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy, lastPayload = null, lastOriginalEvent = null) => {
380
612
  if (!chartEvent) {
381
613
  if (onPointMouseOut && lastPayload) {
382
614
  onPointMouseOut({
@@ -392,21 +624,36 @@ var handleCrosshairChange = (chartEvent, onPointMouseOver, onPointMouseOut, last
392
624
  });
393
625
  delete payload.seriesKey;
394
626
  if (chartEvent.rowContext) {
395
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
396
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
397
- });
627
+ Object.assign(
628
+ payload,
629
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
630
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
631
+ return acc;
632
+ }, {})
633
+ );
398
634
  }
635
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
399
636
  if (onPointMouseOver) {
400
637
  onPointMouseOver({
401
638
  type: "point.mouseover",
402
639
  originalEvent: chartEvent,
403
- payload
640
+ payload: updatedPayload
404
641
  });
405
642
  }
406
- return { payload, originalEvent: chartEvent };
643
+ return { payload: updatedPayload, originalEvent: chartEvent };
644
+ };
645
+ var parseArrayOption = (value) => {
646
+ if (Array.isArray(value)) {
647
+ return value;
648
+ }
649
+ if (value) {
650
+ return JSON.parse(value);
651
+ }
652
+ return void 0;
407
653
  };
408
654
  var TimeSeriesChartWrapper = (props) => {
409
- const {
655
+ var _b, _c, _d;
656
+ const _a = props, {
410
657
  width,
411
658
  height,
412
659
  chartData,
@@ -419,12 +666,57 @@ var TimeSeriesChartWrapper = (props) => {
419
666
  markerDisplay,
420
667
  onClick,
421
668
  onPointMouseOver,
422
- onPointMouseOut
423
- } = props;
424
- const {
669
+ onPointMouseOut,
670
+ onSelect,
671
+ splitByLayout,
672
+ trellisKey,
673
+ trellisSplitBy,
425
674
  backgroundColor,
675
+ defaultFontColor,
676
+ additionalTooltipValues,
677
+ xAxisLineVisibility: xAxisLineVisibility,
678
+ yAxisLineVisibility,
679
+ y2AxisLineVisibility,
680
+ showYAxisWithZero: showYAxisWithZeroFromProps,
681
+ showY2AxisWithZero: showY2AxisWithZeroFromProps
682
+ } = _a, otherOptions = __objRest(_a, [
683
+ "width",
684
+ "height",
685
+ "chartData",
686
+ "options",
687
+ "userLocale",
688
+ "annotationX",
689
+ "annotationLabel",
690
+ "annotationColor",
691
+ "legendDisplay",
692
+ "markerDisplay",
693
+ "onClick",
694
+ "onPointMouseOver",
695
+ "onPointMouseOut",
696
+ "onSelect",
697
+ "splitByLayout",
698
+ "trellisKey",
699
+ "trellisSplitBy",
700
+ "backgroundColor",
701
+ "defaultFontColor",
702
+ "additionalTooltipValues",
703
+ // Extract axis line visibility options from props
704
+ "xAxisLineVisibility",
705
+ "yAxisLineVisibility",
706
+ "y2AxisLineVisibility",
707
+ // Extract showYAxisWithZero directly from props for accelerated render mode
708
+ "showYAxisWithZero",
709
+ "showY2AxisWithZero"
710
+ ]);
711
+ const { eventHandlers, xField: xFieldFromProps } = otherOptions;
712
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
713
+ const {
714
+ backgroundColor: bgColorFromOptions,
426
715
  seriesColors: seriesColorsStr,
427
716
  fieldColors,
717
+ legendLabels: legendLabelsStr,
718
+ legendMode,
719
+ legendTruncation,
428
720
  "axisTitleX.text": xAxisTitleText,
429
721
  "axisTitleY.text": yAxisTitleText,
430
722
  "axisTitleY2.text": y2AxisTitleText,
@@ -432,8 +724,12 @@ var TimeSeriesChartWrapper = (props) => {
432
724
  "axisTitleY.visibility": yAxisTitleVisibility,
433
725
  "axisTitleY2.visibility": y2AxisTitleVisibility,
434
726
  "axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
727
+ "axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
728
+ "axisLabelsX.maxLabelParts": xAxisMaxLabelParts,
435
729
  "axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
730
+ "axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
436
731
  "axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
732
+ "axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
437
733
  "axisY.abbreviation": yAxisAbbreviation,
438
734
  "axisY.scale": yAxisScale,
439
735
  "axisY2.abbreviation": y2AxisAbbreviation,
@@ -443,10 +739,73 @@ var TimeSeriesChartWrapper = (props) => {
443
739
  "axisLabelsY2.integerUnits": y2IntegerUnits,
444
740
  "chart.overlayFields": overlayFieldsStr,
445
741
  "chart.nullValueMode": nullValueMode,
446
- lineWidth
742
+ "chart.showDataLabels": showDataLabels,
743
+ lineWidth,
744
+ lineDashStyle,
745
+ fieldDashStyles: lineDashStylesByFieldStr,
746
+ stepPosition,
747
+ fieldStepPositions: stepPositionsByFieldStr,
748
+ yAxisMin: yAxisMinRaw,
749
+ yAxisMax: yAxisMaxRaw,
750
+ y2AxisMin: y2AxisMinRaw,
751
+ y2AxisMax: y2AxisMaxRaw,
752
+ showXMajorGridLines,
753
+ showYMajorGridLines,
754
+ showY2MajorGridLines,
755
+ showYMinorGridLines,
756
+ showY2MinorGridLines,
757
+ showLineSmoothing,
758
+ xAxisMajorTickVisibility,
759
+ xAxisMajorTickSize,
760
+ yAxisMajorTickVisibility,
761
+ y2AxisMajorTickVisibility,
762
+ yAxisMajorTickSize,
763
+ y2AxisMajorTickSize,
764
+ yAxisMajorTickInterval,
765
+ y2AxisMajorTickInterval,
766
+ yAxisMinorTickVisibility,
767
+ y2AxisMinorTickVisibility,
768
+ yAxisMinorTickSize,
769
+ y2AxisMinorTickSize,
770
+ showYAxisWithZero: showYAxisWithZeroFromOptions,
771
+ showY2AxisWithZero: showY2AxisWithZeroFromOptions
447
772
  } = options;
773
+ const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
774
+ const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
775
+ const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
776
+ const showXMajorTicks = xAxisMajorTickVisibility !== "hide";
777
+ const showYMajorTicks = yAxisMajorTickVisibility === "show";
778
+ const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
779
+ const showYMinorTicks = yAxisMinorTickVisibility === "show";
780
+ const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
781
+ const showXAxisLine = parseXAxisLineVisibility(xAxisLineVisibility);
782
+ const showYAxisLine = yAxisLineVisibility === "show";
783
+ const showY2AxisLine = y2AxisLineVisibility === "show";
784
+ const yAxisMin = parseAxisValue(yAxisMinRaw);
785
+ const yAxisMax = parseAxisValue(yAxisMaxRaw);
786
+ const y2AxisMin = parseAxisValue(y2AxisMinRaw);
787
+ const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
788
+ const parseTickInterval = (simpleXMLValue, canvasValue) => {
789
+ if (simpleXMLValue) return Number(simpleXMLValue);
790
+ if (canvasValue) return Number(canvasValue);
791
+ return void 0;
792
+ };
793
+ const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
794
+ const y2AxisMajorTickIntervalNum = parseTickInterval(
795
+ y2AxisMajorUnitFromSimpleXML,
796
+ y2AxisMajorTickInterval
797
+ );
798
+ const xAxisMajorTickSizeNum = xAxisMajorTickSize != null ? Number(xAxisMajorTickSize) : void 0;
799
+ const yAxisMajorTickSizeNum = yAxisMajorTickSize != null ? Number(yAxisMajorTickSize) : void 0;
800
+ const y2AxisMajorTickSizeNum = y2AxisMajorTickSize != null ? Number(y2AxisMajorTickSize) : void 0;
801
+ const yAxisMinorTickSizeNum = yAxisMinorTickSize != null ? Number(yAxisMinorTickSize) : void 0;
802
+ const y2AxisMinorTickSizeNum = y2AxisMinorTickSize != null ? Number(y2AxisMinorTickSize) : void 0;
448
803
  const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
449
804
  const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
805
+ const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
806
+ const stepPositionsByField = stepPositionsByFieldStr ? JSON.parse(stepPositionsByFieldStr) : void 0;
807
+ const legendLabels = parseArrayOption(legendLabelsStr);
808
+ const bgColor = backgroundColor || bgColorFromOptions;
450
809
  const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
451
810
  const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
452
811
  const cachedHandleResize = react_exports.useCallback((w, h) => {
@@ -461,27 +820,60 @@ var TimeSeriesChartWrapper = (props) => {
461
820
  const yFields = getFieldNames(
462
821
  filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
463
822
  );
464
- const y2Fields = y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [];
465
- const overlayFields = overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [];
823
+ const y2Fields = (0, react_exports.useMemo)(
824
+ () => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
825
+ [y2FieldsStr]
826
+ );
827
+ const overlayFields = (0, react_exports.useMemo)(
828
+ () => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
829
+ [overlayFieldsStr]
830
+ );
466
831
  let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
467
832
  xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
468
- let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFields, yAxisTitleVisibility);
833
+ const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
834
+ let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
469
835
  yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
470
836
  const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
471
837
  let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
472
838
  y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
473
- const xScaleConfig = getXScaleConfig(xAxisTitle, xAxisLabelVisibility);
474
- const yScaleConfig = getYScaleConfig(yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility);
475
- let y2ScaleConfig = {};
476
- if (y2Enabled) {
477
- y2ScaleConfig = getY2ScaleConfig(
478
- y2AxisTitle,
479
- y2AxisAbbreviation,
480
- y2AxisScale,
481
- y2IntegerUnits,
482
- y2AxisLabelVisibility
483
- );
484
- }
839
+ const xScaleConfig = (0, react_exports.useMemo)(
840
+ () => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
841
+ [xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
842
+ );
843
+ const yScaleConfig = (0, react_exports.useMemo)(
844
+ () => getYScaleConfig(
845
+ yAxisTitle,
846
+ yAxisAbbreviation,
847
+ yAxisScale,
848
+ yAxisLabelVisibility,
849
+ yAxisMin,
850
+ yAxisMax
851
+ ),
852
+ [yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
853
+ );
854
+ const y2ScaleConfig = (0, react_exports.useMemo)(() => {
855
+ if (y2Enabled) {
856
+ return getY2ScaleConfig(
857
+ y2AxisTitle,
858
+ y2AxisAbbreviation,
859
+ y2AxisScale,
860
+ y2IntegerUnits,
861
+ y2AxisLabelVisibility,
862
+ y2AxisMin,
863
+ y2AxisMax
864
+ );
865
+ }
866
+ return {};
867
+ }, [
868
+ y2Enabled,
869
+ y2AxisTitle,
870
+ y2AxisAbbreviation,
871
+ y2AxisScale,
872
+ y2IntegerUnits,
873
+ y2AxisLabelVisibility,
874
+ y2AxisMin,
875
+ y2AxisMax
876
+ ]);
485
877
  const uplotContainerElement = (0, react_exports.useRef)(null);
486
878
  const seriesDataFormatted = [
487
879
  filteredChartData.columns[0],
@@ -497,9 +889,25 @@ var TimeSeriesChartWrapper = (props) => {
497
889
  overlayFields,
498
890
  y2Enabled,
499
891
  nullValueMode,
500
- markerDisplay
892
+ markerDisplay,
893
+ lineDashStyle,
894
+ lineDashStylesByField,
895
+ stepPosition,
896
+ stepPositionsByField
501
897
  ),
502
- [yFields, y2Fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay]
898
+ [
899
+ yFields,
900
+ y2Fields,
901
+ lineWidth,
902
+ overlayFields,
903
+ y2Enabled,
904
+ nullValueMode,
905
+ markerDisplay,
906
+ lineDashStyle,
907
+ lineDashStylesByField,
908
+ stepPosition,
909
+ stepPositionsByField
910
+ ]
503
911
  );
504
912
  const chartingEventAnnotations = (0, react_exports.useMemo)(
505
913
  () => getAnnotationsForCanvas({
@@ -513,25 +921,59 @@ var TimeSeriesChartWrapper = (props) => {
513
921
  () => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
514
922
  [xScaleConfig, yScaleConfig, y2ScaleConfig]
515
923
  );
516
- const legend = (0, react_exports.useMemo)(() => getLegend({ legendDisplay }), [legendDisplay]);
924
+ const isSeriesCompare = legendMode === "seriesCompare";
925
+ const legend = (0, react_exports.useMemo)(
926
+ () => getLegend({
927
+ legendDisplay: isSeriesCompare && legendDisplay !== "off" ? "right" : legendDisplay,
928
+ isSeriesCompare,
929
+ legendTruncation
930
+ }),
931
+ [legendDisplay, isSeriesCompare, legendTruncation]
932
+ );
517
933
  const handleChartClick = react_exports.useCallback(
518
934
  (event) => {
519
935
  if (onClick) {
520
- handleClick(event, onClick);
936
+ handleClick(event, onClick, trellisKey, trellisSplitBy);
521
937
  }
522
938
  },
523
- [onClick]
939
+ [onClick, trellisKey, trellisSplitBy]
524
940
  );
525
941
  const handleChartLegendClick = react_exports.useCallback(
526
942
  (event) => {
527
943
  if (onClick) {
528
- handleLegendClick(event, onClick);
944
+ handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
529
945
  }
530
946
  },
531
- [onClick]
947
+ [onClick, trellisKey, trellisSplitBy]
948
+ );
949
+ const handleChartRangeSelection = react_exports.useCallback(
950
+ (range) => {
951
+ if (onSelect) {
952
+ handleRangeSelection(range, onSelect, chartData, trellisKey, trellisSplitBy);
953
+ }
954
+ },
955
+ [onSelect, chartData, trellisKey, trellisSplitBy]
956
+ );
957
+ const handleChartRangeZoom = react_exports.useCallback(
958
+ (range) => {
959
+ if (onSelect) {
960
+ handleRangeZoom(range, onSelect, chartData, trellisKey, trellisSplitBy);
961
+ }
962
+ },
963
+ [onSelect, chartData, trellisKey, trellisSplitBy]
964
+ );
965
+ const xFieldToUse = xFieldFromProps || xField;
966
+ const enableSearchZoom = react_exports.useMemo(
967
+ () => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
968
+ [eventHandlers, xFieldToUse]
532
969
  );
533
970
  const lastPayloadRef = react_exports.useRef(null);
534
971
  const lastOriginalEventRef = react_exports.useRef(null);
972
+ const previousMouseoverPayloadRef = react_exports.useRef(null);
973
+ const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
974
+ react_exports.useEffect(() => {
975
+ additionalTooltipValuesRef.current = additionalTooltipValues;
976
+ }, [additionalTooltipValues]);
535
977
  const handleChartCrosshairChange = react_exports.useCallback(
536
978
  (event) => {
537
979
  if (onPointMouseOver || onPointMouseOut) {
@@ -543,6 +985,7 @@ var TimeSeriesChartWrapper = (props) => {
543
985
  payload: lastPayloadRef.current
544
986
  });
545
987
  }
988
+ previousMouseoverPayloadRef.current = null;
546
989
  return;
547
990
  }
548
991
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
@@ -550,25 +993,36 @@ var TimeSeriesChartWrapper = (props) => {
550
993
  });
551
994
  delete payload.seriesKey;
552
995
  if (event.rowContext) {
553
- Object.keys(event.rowContext).forEach((fieldName) => {
554
- payload[`row.${fieldName}.value`] = event.rowContext[fieldName];
555
- });
996
+ Object.assign(
997
+ payload,
998
+ Object.keys(event.rowContext).reduce((acc, fieldName) => {
999
+ acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
1000
+ return acc;
1001
+ }, {})
1002
+ );
556
1003
  }
557
- lastPayloadRef.current = payload;
1004
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
1005
+ if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
1006
+ return;
1007
+ }
1008
+ lastPayloadRef.current = updatedPayload;
558
1009
  lastOriginalEventRef.current = event;
1010
+ previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
559
1011
  if (onPointMouseOver) {
560
1012
  onPointMouseOver({
561
1013
  type: "point.mouseover",
562
1014
  originalEvent: event,
563
- payload
1015
+ payload: updatedPayload
564
1016
  });
565
1017
  }
566
1018
  }
567
1019
  },
568
- [onPointMouseOver, onPointMouseOut]
1020
+ [onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
569
1021
  );
570
- const memoizedChart = (0, react_exports.useMemo)(
571
- () => /* @__PURE__ */ react_exports.createElement(
1022
+ 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}`;
1023
+ const memoizedChart = (0, react_exports.useMemo)(() => {
1024
+ const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
1025
+ return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
572
1026
  visualization_canvas_exports.TimeSeriesChart,
573
1027
  {
574
1028
  data: chartData,
@@ -578,49 +1032,121 @@ var TimeSeriesChartWrapper = (props) => {
578
1032
  seriesColorsByField,
579
1033
  seriesConfig: seriesOverrides,
580
1034
  legend,
1035
+ legendLabels,
1036
+ legendTruncation,
1037
+ isSeriesCompare: legendMode === "seriesCompare",
1038
+ maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
581
1039
  scaleConfig,
582
1040
  timestampFormat: "expanded",
583
1041
  onCrosshairClick: onClick ? handleChartClick : void 0,
584
1042
  onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
585
1043
  onSeriesClick: onClick ? handleChartLegendClick : void 0,
1044
+ onRangeSelection: handleChartRangeSelection,
1045
+ onRangeZoom: computedOnRangeZoom,
1046
+ serverSideZoom: enableSearchZoom,
586
1047
  userLocale,
587
1048
  events: chartingEventAnnotations,
588
- eventsConfig: { renderer: triangleEventAnnotationRenderer }
1049
+ eventsConfig: { renderer: triangleEventAnnotationRenderer },
1050
+ additionalTooltipValuesRef,
1051
+ showXMajorGridLines,
1052
+ showYMajorGridLines,
1053
+ showY2MajorGridLines,
1054
+ showYMinorGridLines,
1055
+ showY2MinorGridLines,
1056
+ showLineSmoothing,
1057
+ dataValuesDisplay,
1058
+ showXMajorTicks,
1059
+ xAxisMajorTickSize: xAxisMajorTickSizeNum,
1060
+ showYMajorTicks,
1061
+ showY2MajorTicks,
1062
+ yAxisMajorTickSize: yAxisMajorTickSizeNum,
1063
+ y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
1064
+ yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
1065
+ y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
1066
+ showYMinorTicks,
1067
+ showY2MinorTicks,
1068
+ yAxisMinorTickSize: yAxisMinorTickSizeNum,
1069
+ y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
1070
+ showYAxisWithZero,
1071
+ showY2AxisWithZero,
1072
+ showXAxisLine,
1073
+ showYAxisLine,
1074
+ showY2AxisLine,
1075
+ xAxisMaxLabelParts
589
1076
  }
590
- ),
591
- [
592
- chartData,
593
- containerWidth,
594
- containerHeight,
595
- seriesColors,
596
- seriesColorsByField,
597
- seriesOverrides,
598
- legend,
599
- scaleConfig,
600
- userLocale,
601
- chartingEventAnnotations,
602
- onClick,
603
- handleChartClick,
604
- onPointMouseOver,
605
- onPointMouseOut,
606
- handleChartCrosshairChange,
607
- handleChartLegendClick
608
- ]
609
- );
1077
+ ));
1078
+ }, [
1079
+ onSelect,
1080
+ handleChartRangeZoom,
1081
+ dataKey,
1082
+ chartData,
1083
+ containerWidth,
1084
+ containerHeight,
1085
+ seriesColors,
1086
+ seriesColorsByField,
1087
+ seriesOverrides,
1088
+ legend,
1089
+ legendLabels,
1090
+ legendTruncation,
1091
+ scaleConfig,
1092
+ onClick,
1093
+ handleChartClick,
1094
+ onPointMouseOver,
1095
+ onPointMouseOut,
1096
+ handleChartCrosshairChange,
1097
+ handleChartLegendClick,
1098
+ handleChartRangeSelection,
1099
+ enableSearchZoom,
1100
+ userLocale,
1101
+ chartingEventAnnotations,
1102
+ showXMajorGridLines,
1103
+ showYMajorGridLines,
1104
+ showY2MajorGridLines,
1105
+ showYMinorGridLines,
1106
+ showY2MinorGridLines,
1107
+ showLineSmoothing,
1108
+ dataValuesDisplay,
1109
+ showXMajorTicks,
1110
+ xAxisMajorTickSizeNum,
1111
+ showYMajorTicks,
1112
+ showY2MajorTicks,
1113
+ yAxisMajorTickSizeNum,
1114
+ y2AxisMajorTickSizeNum,
1115
+ yAxisMajorTickIntervalNum,
1116
+ y2AxisMajorTickIntervalNum,
1117
+ showYMinorTicks,
1118
+ showY2MinorTicks,
1119
+ yAxisMinorTickSizeNum,
1120
+ y2AxisMinorTickSizeNum,
1121
+ showYAxisWithZero,
1122
+ showY2AxisWithZero,
1123
+ showXAxisLine,
1124
+ showYAxisLine,
1125
+ showY2AxisLine,
1126
+ legendMode,
1127
+ xAxisMaxLabelParts
1128
+ ]);
610
1129
  const memoizedVisualization = (0, react_exports.useMemo)(() => {
611
- return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
612
- }, [backgroundColor, memoizedChart]);
613
- return /* @__PURE__ */ react_exports.createElement(
1130
+ return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
1131
+ }, [bgColor, memoizedChart]);
1132
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
1133
+ TrellisTitle,
1134
+ {
1135
+ trellisKey,
1136
+ backgroundColor: bgColor,
1137
+ fontColor: defaultFontColor
1138
+ }
1139
+ ), /* @__PURE__ */ react_exports.createElement(
614
1140
  TimeSeriesChartContainer,
615
1141
  {
616
- height,
1142
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
617
1143
  width,
618
1144
  ref: uplotContainerElement,
619
1145
  "data-test": "timeseries-chart-wrapper"
620
1146
  },
621
1147
  /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
622
1148
  memoizedVisualization
623
- );
1149
+ ));
624
1150
  };
625
1151
  var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
626
1152
  //# sourceMappingURL=TimeSeriesChartWrapper.js.map