@splunk/visualizations 28.3.0 → 28.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/Area/Area.d.ts.map +1 -1
  2. package/Area.config.js +0 -1
  3. package/Area.config.js.map +2 -2
  4. package/Area.js +495 -99
  5. package/Area.js.map +3 -3
  6. package/Bar/Bar.d.ts.map +1 -1
  7. package/Bar.config.js +0 -1
  8. package/Bar.config.js.map +2 -2
  9. package/Bar.js +505 -99
  10. package/Bar.js.map +3 -3
  11. package/Bubble.config.js +0 -1
  12. package/Bubble.config.js.map +2 -2
  13. package/Bubble.js +494 -86
  14. package/Bubble.js.map +3 -3
  15. package/CHANGELOG.external.md +76 -0
  16. package/ChoroplethSvg/ChoroplethSvg.d.ts +4 -3
  17. package/ChoroplethSvg/ChoroplethSvg.d.ts.map +1 -1
  18. package/ChoroplethSvg.config.js +1 -3
  19. package/ChoroplethSvg.config.js.map +2 -2
  20. package/ChoroplethSvg.js +539 -103
  21. package/ChoroplethSvg.js.map +4 -4
  22. package/Column/Column.d.ts.map +1 -1
  23. package/Column.config.js +0 -1
  24. package/Column.config.js.map +2 -2
  25. package/Column.js +495 -99
  26. package/Column.js.map +3 -3
  27. package/Ellipse.js +528 -104
  28. package/Ellipse.js.map +4 -4
  29. package/Events/PureEvents/PureEvents.d.ts.map +1 -1
  30. package/Events.js +612 -149
  31. package/Events.js.map +4 -4
  32. package/FillerGauge/FillerGauge.d.ts.map +1 -1
  33. package/FillerGauge/PureFillerGauge/FillerGauge.d.ts.map +1 -1
  34. package/FillerGauge.js +535 -140
  35. package/FillerGauge.js.map +4 -4
  36. package/Image/Image.d.ts.map +1 -1
  37. package/Image.js +564 -108
  38. package/Image.js.map +4 -4
  39. package/Line/Line.d.ts.map +1 -1
  40. package/Line/lineUtils.d.ts.map +1 -1
  41. package/Line/mockdata/LineData.d.ts +59 -0
  42. package/Line/mockdata/LineData.d.ts.map +1 -1
  43. package/Line.config.js +0 -1
  44. package/Line.config.js.map +2 -2
  45. package/Line.js +601 -100
  46. package/Line.js.map +3 -3
  47. package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts +5 -0
  48. package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts.map +1 -1
  49. package/LinkGraph/PureLinkGraph/PureLinkGraphUtils.d.ts.map +1 -1
  50. package/LinkGraph/PureLinkGraph/components/Graph.d.ts +9 -1
  51. package/LinkGraph/PureLinkGraph/components/Graph.d.ts.map +1 -1
  52. package/LinkGraph/PureLinkGraph/components/GraphStyles.d.ts.map +1 -1
  53. package/LinkGraph/PureLinkGraph/components/Node.d.ts +1 -0
  54. package/LinkGraph/PureLinkGraph/components/Node.d.ts.map +1 -1
  55. package/LinkGraph/PureLinkGraph/components/Nodes.d.ts +1 -0
  56. package/LinkGraph/PureLinkGraph/components/Nodes.d.ts.map +1 -1
  57. package/LinkGraph/PureLinkGraph/measurementUtils.d.ts +16 -0
  58. package/LinkGraph/PureLinkGraph/measurementUtils.d.ts.map +1 -0
  59. package/LinkGraph/PureLinkGraph/utils/iconLoader.d.ts.map +1 -1
  60. package/LinkGraph/config.d.ts.map +1 -1
  61. package/LinkGraph.config.js +15 -1
  62. package/LinkGraph.config.js.map +2 -2
  63. package/LinkGraph.js +1355 -654
  64. package/LinkGraph.js.map +4 -4
  65. package/Map/Map.d.ts +2 -2
  66. package/Map/Map.d.ts.map +1 -1
  67. package/Map/PureMap/BubbleLayer.d.ts +5 -0
  68. package/Map/PureMap/BubbleLayer.d.ts.map +1 -1
  69. package/Map/PureMap/LocalChoroplethLayer.d.ts.map +1 -1
  70. package/Map/PureMap/PureMap.d.ts.map +1 -1
  71. package/Map/PureMap/PureMapContainer.d.ts.map +1 -1
  72. package/Map/PureMap/Tooltip.d.ts.map +1 -1
  73. package/Map/config.d.ts.map +1 -1
  74. package/Map.config.js +0 -1
  75. package/Map.config.js.map +2 -2
  76. package/Map.js +738 -228
  77. package/Map.js.map +4 -4
  78. package/Markdown/Markdown.d.ts.map +1 -1
  79. package/Markdown.js +548 -95
  80. package/Markdown.js.map +4 -4
  81. package/MarkerGauge/MarkerGauge.d.ts +5 -1
  82. package/MarkerGauge/MarkerGauge.d.ts.map +1 -1
  83. package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts +4 -0
  84. package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts.map +1 -1
  85. package/MarkerGauge/config.d.ts.map +1 -1
  86. package/MarkerGauge.config.js +121 -3
  87. package/MarkerGauge.config.js.map +3 -3
  88. package/MarkerGauge.js +1318 -142
  89. package/MarkerGauge.js.map +4 -4
  90. package/NetworkGraph/NetworkGraph.d.ts +22 -0
  91. package/NetworkGraph/NetworkGraph.d.ts.map +1 -0
  92. package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts +60 -0
  93. package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts.map +1 -0
  94. package/NetworkGraph/PureNetworkGraph/components/Link.d.ts +19 -0
  95. package/NetworkGraph/PureNetworkGraph/components/Link.d.ts.map +1 -0
  96. package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts +29 -0
  97. package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts.map +1 -0
  98. package/NetworkGraph/PureNetworkGraph/components/Node.d.ts +27 -0
  99. package/NetworkGraph/PureNetworkGraph/components/Node.d.ts.map +1 -0
  100. package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts +12 -0
  101. package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts.map +1 -0
  102. package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts +13 -0
  103. package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts.map +1 -0
  104. package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts +140 -0
  105. package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts.map +1 -0
  106. package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts +89 -0
  107. package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts.map +1 -0
  108. package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts +47 -0
  109. package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts.map +1 -0
  110. package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts +78 -0
  111. package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts.map +1 -0
  112. package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts +111 -0
  113. package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts.map +1 -0
  114. package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts +123 -0
  115. package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts.map +1 -0
  116. package/NetworkGraph/config.d.ts +4 -0
  117. package/NetworkGraph/config.d.ts.map +1 -0
  118. package/NetworkGraph/index.d.ts +3 -0
  119. package/NetworkGraph/index.d.ts.map +1 -0
  120. package/NetworkGraph.config.js +938 -0
  121. package/NetworkGraph.config.js.map +7 -0
  122. package/NetworkGraph.js +6793 -0
  123. package/NetworkGraph.js.map +7 -0
  124. package/ParallelCoordinates.js +532 -93
  125. package/ParallelCoordinates.js.map +4 -4
  126. package/Pie/Pie.d.ts.map +1 -1
  127. package/Pie/pieUtils.d.ts.map +1 -1
  128. package/Pie.js +510 -101
  129. package/Pie.js.map +3 -3
  130. package/Punchcard.js +523 -84
  131. package/Punchcard.js.map +4 -4
  132. package/Rectangle.js +537 -113
  133. package/Rectangle.js.map +4 -4
  134. package/Sankey/PureSankey/SankeyTooltip.d.ts.map +1 -1
  135. package/Sankey.js +562 -111
  136. package/Sankey.js.map +4 -4
  137. package/Scatter/Scatter.d.ts.map +1 -1
  138. package/Scatter.config.js +0 -1
  139. package/Scatter.config.js.map +2 -2
  140. package/Scatter.js +505 -99
  141. package/Scatter.js.map +3 -3
  142. package/SingleValue/SingleValue.d.ts.map +1 -1
  143. package/SingleValue/config.d.ts.map +1 -1
  144. package/SingleValue.config.js +15 -2
  145. package/SingleValue.config.js.map +2 -2
  146. package/SingleValue.js +656 -173
  147. package/SingleValue.js.map +3 -3
  148. package/SingleValueBasic.js.map +1 -1
  149. package/SingleValueIcon/SingleValueIcon.d.ts.map +1 -1
  150. package/SingleValueIcon/config.d.ts.map +1 -1
  151. package/SingleValueIcon.config.js +0 -1
  152. package/SingleValueIcon.config.js.map +2 -2
  153. package/SingleValueIcon.js +512 -124
  154. package/SingleValueIcon.js.map +3 -3
  155. package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts +0 -8
  156. package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts.map +1 -1
  157. package/SingleValueRadial/SingleValueRadial.d.ts.map +1 -1
  158. package/SingleValueRadial.config.js +0 -1
  159. package/SingleValueRadial.config.js.map +2 -2
  160. package/SingleValueRadial.js +517 -124
  161. package/SingleValueRadial.js.map +4 -4
  162. package/SparkLine.js +46 -8
  163. package/SparkLine.js.map +2 -2
  164. package/Table/PureTable.d.ts +10 -0
  165. package/Table/PureTable.d.ts.map +1 -1
  166. package/Table/cells/SparklineCell.d.ts.map +1 -1
  167. package/Table/config.d.ts.map +1 -1
  168. package/Table/hooks.d.ts +4 -0
  169. package/Table/hooks.d.ts.map +1 -1
  170. package/Table.config.js +1 -1
  171. package/Table.config.js.map +2 -2
  172. package/Table.js +760 -223
  173. package/Table.js.map +4 -4
  174. package/Timeline/PureTimeline/src/CursorPlugin.d.ts.map +1 -1
  175. package/Timeline/PureTimeline/src/TimelineLegend.d.ts.map +1 -1
  176. package/Timeline/config.d.ts.map +1 -1
  177. package/Timeline.config.js +31 -12
  178. package/Timeline.config.js.map +4 -4
  179. package/Timeline.js +649 -211
  180. package/Timeline.js.map +4 -4
  181. package/common/Charting.d.ts +5 -0
  182. package/common/Charting.d.ts.map +1 -1
  183. package/common/Charting.js +12 -0
  184. package/common/Charting.js.map +2 -2
  185. package/common/OptionsDoc.js.map +1 -1
  186. package/common/ThemesDoc.js +0 -1
  187. package/common/ThemesDoc.js.map +2 -2
  188. package/common/TimeSeriesChartWrapper.d.ts +24 -11
  189. package/common/TimeSeriesChartWrapper.d.ts.map +1 -1
  190. package/common/TimeSeriesChartWrapper.js +561 -83
  191. package/common/TimeSeriesChartWrapper.js.map +4 -4
  192. package/common/chartingUtils.d.ts +45 -5
  193. package/common/chartingUtils.d.ts.map +1 -1
  194. package/common/chartingUtils.js +102 -8
  195. package/common/chartingUtils.js.map +3 -3
  196. package/common/editorConfig/AxesChartDataConfig.d.ts.map +1 -1
  197. package/common/hocs/withTrellis.d.ts.map +1 -1
  198. package/common/interfaces/DashboardVizProps.d.ts +0 -3
  199. package/common/interfaces/DashboardVizProps.d.ts.map +1 -1
  200. package/common/interfaces/DataSource.d.ts +1 -1
  201. package/common/interfaces/DataSource.d.ts.map +1 -1
  202. package/common/shapeUtils.js +5 -20
  203. package/common/shapeUtils.js.map +2 -2
  204. package/common/utils/dataUtils.d.ts.map +1 -1
  205. package/common/utils/dataUtils.js +5 -4
  206. package/common/utils/dataUtils.js.map +2 -2
  207. package/common/utils/mapUtils.js +16 -9
  208. package/common/utils/mapUtils.js.map +2 -2
  209. package/common/utils/singleValueUtils.js +17 -18
  210. package/common/utils/singleValueUtils.js.map +2 -2
  211. package/common/utils/textUtils.d.ts +20 -0
  212. package/common/utils/textUtils.d.ts.map +1 -0
  213. package/common/utils/textUtils.js +76 -0
  214. package/common/utils/textUtils.js.map +7 -0
  215. package/common/utils/trellisUtils.d.ts.map +1 -1
  216. package/common/utils/trellisUtils.js +12 -14
  217. package/common/utils/trellisUtils.js.map +2 -2
  218. package/common/withDashboardViz.d.ts.map +1 -1
  219. package/common/withDashboardViz.js +544 -84
  220. package/common/withDashboardViz.js.map +4 -4
  221. package/package.json +33 -26
  222. package/common/utils/styleUtils.d.ts +0 -2
  223. package/common/utils/styleUtils.d.ts.map +0 -1
  224. package/common/utils/styleUtils.js +0 -30
  225. package/common/utils/styleUtils.js.map +0 -7
package/Scatter.js CHANGED
@@ -248,6 +248,7 @@ var DefaultVizActionHandler = class {
248
248
  };
249
249
 
250
250
  // src/common/utils/dataUtils.ts
251
+ var getFieldName = (field) => typeof field === "string" ? field : field.name;
251
252
  var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
252
253
  const dataLength = data.length;
253
254
  const downsampledIndices = [];
@@ -421,9 +422,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
421
422
  let xColumn = [];
422
423
  const yColumns = [];
423
424
  const canDownsample = !ds.data.fields.some((field, index) => {
424
- var _a, _b;
425
- const fieldName = (_a = field.name) != null ? _a : field;
426
- const fieldType = (_b = fieldTypes[index]) != null ? _b : "unknown";
425
+ var _a;
426
+ const fieldName = getFieldName(field);
427
+ const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
427
428
  const column = ds.data.columns[index];
428
429
  let hasDisplayedColumnThatCantBeDownsampled = false;
429
430
  if (fieldName === xField) {
@@ -627,6 +628,7 @@ var Charting = (props) => {
627
628
  const timezone = (0, react_exports.useContext)(TimezoneContext_default);
628
629
  const selectChartEvent = (0, react_exports.useRef)(null);
629
630
  const trellisEnabled = useTrellisEnabled(props.splitByLayout);
631
+ const isResizing = (0, react_exports.useRef)(false);
630
632
  const drawChartRef = (0, react_exports.useRef)(() => {
631
633
  });
632
634
  const debouncedDrawChart = (0, react_exports.useMemo)(
@@ -725,6 +727,9 @@ var Charting = (props) => {
725
727
  recalculateDownsamplingThreshold();
726
728
  }, [recalculateDownsamplingThreshold]);
727
729
  const handleSelect = useEventCallback_default((chartEvent) => {
730
+ if (isResizing.current) {
731
+ return;
732
+ }
728
733
  selectChartEvent.current = chartEvent;
729
734
  recalculateDownsamplingThreshold();
730
735
  const payload = appendTrellisToPayload(
@@ -859,6 +864,14 @@ var Charting = (props) => {
859
864
  }
860
865
  if (chart.current) {
861
866
  if (Math.round(chart.current.height) !== Math.round(computedHeight) || Math.round(chart.current.width) !== Math.round(computedWidth)) {
867
+ isResizing.current = true;
868
+ queueMicrotask(() => {
869
+ try {
870
+ isResizing.current = false;
871
+ } catch (e) {
872
+ (0, lodash_exports.noop)(e);
873
+ }
874
+ });
862
875
  chart.current.resize(computedWidth, computedHeight);
863
876
  }
864
877
  }
@@ -1413,7 +1426,6 @@ var AcceleratedRenderEditorLayout = [
1413
1426
  "Render visualizations faster for large datasets. Some functionalities might not be available in this mode."
1414
1427
  ),
1415
1428
  helpFormat: "under"
1416
- // TODO: uncomment and replace link with real link (SCP-75907)
1417
1429
  // helpTextLink: {
1418
1430
  // href: 'https://splunkui.splunk.com/Packages/visualizations/Overview',
1419
1431
  // label: 'Learn More.',
@@ -2488,7 +2500,7 @@ var Cover = styled_components_default.div`
2488
2500
  bottom: 0;
2489
2501
  `;
2490
2502
  var Blocker = styled_components_default.div.attrs({
2491
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b"
2503
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f"
2492
2504
  })`
2493
2505
  position: relative;
2494
2506
  width: 100%;
@@ -2569,7 +2581,7 @@ var withFixedSizeContainer = (Viz) => {
2569
2581
  FixSizeItem,
2570
2582
  {
2571
2583
  "data-test": "fix-size-item",
2572
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b",
2584
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f",
2573
2585
  width,
2574
2586
  height,
2575
2587
  backgroundColor
@@ -2845,7 +2857,7 @@ var trellisUtils_default = "default" in defaultImport34 ? defaultImport34.defaul
2845
2857
  var AGGREGATIONS = "aggregations";
2846
2858
  var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
2847
2859
  var _a, _b, _c, _d;
2848
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2860
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2849
2861
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2850
2862
  let splitDataSources = null;
2851
2863
  let errorCode = null;
@@ -2866,7 +2878,7 @@ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
2866
2878
  }
2867
2879
  return { splitDataSources, errorCode };
2868
2880
  };
2869
- var toFieldEntries = (fields) => {
2881
+ var toFieldEntries = (fields = []) => {
2870
2882
  return fields.map((field) => {
2871
2883
  if (typeof field === "string") {
2872
2884
  return { name: field };
@@ -2881,7 +2893,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
2881
2893
  let splitDataSources = null;
2882
2894
  let splitByFields = [];
2883
2895
  let errorCode = null;
2884
- if (typeof fields[0] !== "string") {
2896
+ if (fields.length > 0) {
2885
2897
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2886
2898
  }
2887
2899
  if (splitByFields && splitByFields.length > 0) {
@@ -2919,12 +2931,12 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
2919
2931
  };
2920
2932
  var dataSourcesSplitByAggregationsStats = (dataSource) => {
2921
2933
  var _a, _b, _c, _d;
2922
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2934
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2923
2935
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2924
2936
  let splitDataSources = null;
2925
2937
  let splitByFields = [];
2926
2938
  let errorCode = null;
2927
- if (typeof fields[0] !== "string") {
2939
+ if (fields.length > 0) {
2928
2940
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
2929
2941
  }
2930
2942
  if (splitByFields && splitByFields.length > 0) {
@@ -2948,12 +2960,12 @@ var dataSourcesSplitByAggregationsStats = (dataSource) => {
2948
2960
  };
2949
2961
  var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
2950
2962
  var _a, _b, _c, _d, _e;
2951
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2963
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2952
2964
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2953
2965
  let splitDataSources = null;
2954
2966
  let splitByFields = [];
2955
2967
  let errorCode = null;
2956
- if (typeof fields[0] !== "string") {
2968
+ if (fields.length > 0) {
2957
2969
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
2958
2970
  }
2959
2971
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -2991,12 +3003,12 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
2991
3003
  };
2992
3004
  var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
2993
3005
  var _a, _b, _c, _d;
2994
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3006
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2995
3007
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2996
3008
  let splitDataSources = null;
2997
3009
  let splitByFields = [];
2998
3010
  let errorCode = null;
2999
- if (typeof fields[0] !== "string") {
3011
+ if (fields.length > 0) {
3000
3012
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3001
3013
  }
3002
3014
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -3084,17 +3096,15 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
3084
3096
  };
3085
3097
  var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
3086
3098
  var _a, _b, _c, _d, _e, _f;
3087
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3099
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3088
3100
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3089
3101
  let splitDataSources = null;
3090
3102
  let splitByFields = [];
3091
3103
  let errorCode = null;
3092
- if (typeof fields[0] !== "string") {
3104
+ if (fields.length > 0) {
3093
3105
  splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
3094
3106
  }
3095
- const splitByIndex = fields == null ? void 0 : fields.findIndex(
3096
- (field) => field === splitBy || field.name === splitBy
3097
- );
3107
+ const splitByIndex = fields.findIndex((field) => field.name === splitBy);
3098
3108
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
3099
3109
  const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
3100
3110
  splitDataSources = {};
@@ -3270,6 +3280,16 @@ var mapToValues = (optionValuesSCMapping) => (options) => {
3270
3280
  });
3271
3281
  return convertedOptions;
3272
3282
  };
3283
+ var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
3284
+ const rangeSelectEventHandler = eventHandlers.find(
3285
+ (eventHandler) => {
3286
+ var _a;
3287
+ return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
3288
+ }
3289
+ );
3290
+ const xAxisIsTime = xField === "_time";
3291
+ return !!rangeSelectEventHandler && xAxisIsTime;
3292
+ };
3273
3293
  var canvasSupportedTimeSeriesCharts = ["splunk.line"];
3274
3294
  var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
3275
3295
  return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
@@ -3290,16 +3310,31 @@ var filterChartDataFromInternalFields = (chartData) => {
3290
3310
  var convert2DArrayToNumbers = (arr) => {
3291
3311
  return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
3292
3312
  };
3313
+ var parseAxisValue = (val) => {
3314
+ if (val === void 0 || val === null || val === "auto" || val === "") {
3315
+ return void 0;
3316
+ }
3317
+ const num = typeof val === "number" ? val : Number.parseFloat(val);
3318
+ return Number.isNaN(num) ? void 0 : num;
3319
+ };
3293
3320
  var SideLegendWidth = 75;
3294
- var commonLegendProps = { center: true, fontSize: 12, largerTiles: true, hideSeriesValue: true };
3321
+ var SeriesCompareLegendWidth = 200;
3295
3322
  var getLegend = (props) => {
3296
3323
  const legendPlacement = props == null ? void 0 : props.legendDisplay;
3324
+ const { isSeriesCompare } = props;
3325
+ const commonLegendProps = {
3326
+ center: true,
3327
+ fontSize: 12,
3328
+ largerTiles: true,
3329
+ hideSeriesValue: !isSeriesCompare
3330
+ // Show values if in seriesCompare mode
3331
+ };
3297
3332
  switch (legendPlacement) {
3298
3333
  case "off":
3299
3334
  return false;
3300
3335
  case "left":
3301
3336
  return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
3302
- width: SideLegendWidth
3337
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
3303
3338
  }, commonLegendProps));
3304
3339
  case "bottom":
3305
3340
  return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
@@ -3311,7 +3346,7 @@ var getLegend = (props) => {
3311
3346
  }, commonLegendProps));
3312
3347
  default:
3313
3348
  return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
3314
- width: SideLegendWidth
3349
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
3315
3350
  }, commonLegendProps));
3316
3351
  }
3317
3352
  };
@@ -3347,22 +3382,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
3347
3382
  const end = axisTitle.slice(-halfChars);
3348
3383
  return `${start}...${end}`;
3349
3384
  };
3350
- var getFieldName = (field) => {
3385
+ var getFieldName2 = (field) => {
3351
3386
  const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
3352
3387
  return fieldName;
3353
3388
  };
3354
3389
  var getFieldNames = (fields) => {
3355
- return fields.map((field) => getFieldName(field));
3390
+ return fields.map((field) => getFieldName2(field));
3356
3391
  };
3357
- var getXScaleConfig = (label, xAxisLabelVisibility) => {
3392
+ var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
3358
3393
  const xConfig = { x: {} };
3359
3394
  xConfig.x.label = label;
3360
3395
  if (xAxisLabelVisibility === "hide") {
3361
3396
  xConfig.x.hideLabels = true;
3362
3397
  }
3398
+ if (xAxisLabelRotation !== void 0) {
3399
+ xConfig.x.labelRotation = xAxisLabelRotation;
3400
+ }
3363
3401
  return xConfig;
3364
3402
  };
3365
- var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
3403
+ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
3366
3404
  const scaleType = yAxisScale != null ? yAxisScale : "linear";
3367
3405
  const yConfig = { y: {} };
3368
3406
  yConfig.y.label = label;
@@ -3378,14 +3416,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
3378
3416
  if (yAxisLabelVisibility === "hide") {
3379
3417
  yConfig.y.hideLabels = true;
3380
3418
  }
3419
+ if (yAxisMin !== void 0 || yAxisMax !== void 0) {
3420
+ yConfig.y.range = (u, dataMin, dataMax) => {
3421
+ const min = yAxisMin != null ? yAxisMin : dataMin;
3422
+ const max = yAxisMax != null ? yAxisMax : dataMax;
3423
+ return [min, max];
3424
+ };
3425
+ }
3381
3426
  return yConfig;
3382
3427
  };
3383
- var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
3428
+ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
3384
3429
  const y2Config = { y2: {} };
3385
3430
  const scaleType = axisScale != null ? axisScale : "linear";
3386
3431
  y2Config.y2.label = label;
3387
3432
  y2Config.y2.side = "right";
3388
- y2Config.y2.showGrid = false;
3389
3433
  y2Config.y2.type = scaleType;
3390
3434
  if (axisAbbreviation !== "none") {
3391
3435
  y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
@@ -3395,9 +3439,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
3395
3439
  if (y2AxisLabelVisibility === "hide") {
3396
3440
  y2Config.y2.hideLabels = true;
3397
3441
  }
3442
+ if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
3443
+ y2Config.y2.range = (u, dataMin, dataMax) => {
3444
+ const min = y2AxisMin != null ? y2AxisMin : dataMin;
3445
+ const max = y2AxisMax != null ? y2AxisMax : dataMax;
3446
+ return [min, max];
3447
+ };
3448
+ }
3398
3449
  return y2Config;
3399
3450
  };
3400
- var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
3451
+ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
3401
3452
  const seriesConfig = {};
3402
3453
  let spanGaps;
3403
3454
  let replaceNullsWithZero;
@@ -3432,12 +3483,45 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
3432
3483
  if (markerDisplay !== void 0) {
3433
3484
  seriesConfig[field].markerDisplay = markerDisplay;
3434
3485
  }
3486
+ const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
3487
+ if (fieldDashStyle) {
3488
+ seriesConfig[field].lineDashStyle = fieldDashStyle;
3489
+ }
3435
3490
  if (replaceNullsWithZero !== void 0) {
3436
3491
  seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
3437
3492
  }
3438
3493
  });
3439
3494
  return seriesConfig;
3440
3495
  };
3496
+ var findRangeIndices = (xData, startValue, endValue) => {
3497
+ let startXIndex = -1;
3498
+ let endXIndex = -1;
3499
+ const xDataEpoch = xData.map((val) => {
3500
+ if (typeof val === "string") {
3501
+ return new Date(val).getTime() / 1e3;
3502
+ }
3503
+ return val;
3504
+ });
3505
+ for (let i = 0; i < xDataEpoch.length; i += 1) {
3506
+ if (xDataEpoch[i] >= startValue) {
3507
+ startXIndex = i;
3508
+ break;
3509
+ }
3510
+ }
3511
+ if (startXIndex === -1 && xDataEpoch.length > 0) {
3512
+ startXIndex = xDataEpoch.length - 1;
3513
+ }
3514
+ for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
3515
+ if (xDataEpoch[i] <= endValue) {
3516
+ endXIndex = i;
3517
+ break;
3518
+ }
3519
+ }
3520
+ if (endXIndex === -1 && xDataEpoch.length > 0) {
3521
+ endXIndex = 0;
3522
+ }
3523
+ return { startXIndex, endXIndex };
3524
+ };
3441
3525
 
3442
3526
  // src/common/TimeSeriesChartWrapper.tsx
3443
3527
  var TimeSeriesChartContainer = styled_components_default.div`
@@ -3448,38 +3532,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
3448
3532
  position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
3449
3533
  }
3450
3534
  `;
3451
- var handleClick = (chartEvent, onClick) => {
3535
+ var appendTrellisToPayload2 = (payload, trellisKey, trellisSplitBy) => {
3536
+ const result = __spreadValues({}, payload);
3537
+ if (trellisSplitBy) {
3538
+ result["trellis.name"] = trellisSplitBy;
3539
+ }
3540
+ if (trellisKey) {
3541
+ result["trellis.value"] = trellisKey;
3542
+ }
3543
+ return result;
3544
+ };
3545
+ var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
3546
+ if (!previousPayload) {
3547
+ return true;
3548
+ }
3549
+ if (currentPayload.index !== previousPayload.index) {
3550
+ return true;
3551
+ }
3552
+ if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
3553
+ return true;
3554
+ }
3555
+ if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
3556
+ return true;
3557
+ }
3558
+ if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
3559
+ return true;
3560
+ }
3561
+ return false;
3562
+ };
3563
+ var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
3452
3564
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
3453
3565
  name: chartEvent.seriesKey
3454
3566
  });
3455
3567
  delete payload.seriesKey;
3456
3568
  if (chartEvent.rowContext) {
3457
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
3458
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3459
- });
3569
+ Object.assign(
3570
+ payload,
3571
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
3572
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3573
+ return acc;
3574
+ }, {})
3575
+ );
3460
3576
  }
3577
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3461
3578
  if (onClick) {
3462
3579
  onClick({
3463
3580
  type: "point.click",
3464
3581
  originalEvent: chartEvent,
3465
- payload
3582
+ payload: updatedPayload
3466
3583
  });
3467
3584
  }
3468
3585
  };
3469
- var handleLegendClick = (chartEvent, onClick) => {
3586
+ var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
3470
3587
  const payload = {
3471
3588
  name: chartEvent
3472
3589
  };
3590
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3473
3591
  if (onClick) {
3474
3592
  onClick({
3475
3593
  type: "legend.click",
3476
3594
  originalEvent: chartEvent,
3477
- payload
3595
+ payload: updatedPayload
3478
3596
  });
3479
3597
  }
3480
3598
  };
3599
+ var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3600
+ var _a;
3601
+ if (!rangeEvent) {
3602
+ return;
3603
+ }
3604
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3605
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3606
+ const payload = {
3607
+ startXIndex,
3608
+ startXValue: rangeEvent.start,
3609
+ endXIndex,
3610
+ endXValue: rangeEvent.end
3611
+ };
3612
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3613
+ if (onSelect) {
3614
+ onSelect({
3615
+ type: "range.selectBeforeZoom",
3616
+ originalEvent: rangeEvent,
3617
+ payload: updatedPayload
3618
+ });
3619
+ }
3620
+ };
3621
+ var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3622
+ var _a;
3623
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3624
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3625
+ const payload = {
3626
+ startXIndex,
3627
+ startXValue: rangeEvent.start,
3628
+ endXIndex,
3629
+ endXValue: rangeEvent.end
3630
+ };
3631
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3632
+ if (onSelect) {
3633
+ onSelect({
3634
+ type: "range.select",
3635
+ originalEvent: rangeEvent,
3636
+ payload: updatedPayload
3637
+ });
3638
+ }
3639
+ };
3640
+ var parseArrayOption = (value) => {
3641
+ if (Array.isArray(value)) {
3642
+ return value;
3643
+ }
3644
+ if (value) {
3645
+ return JSON.parse(value);
3646
+ }
3647
+ return void 0;
3648
+ };
3481
3649
  var TimeSeriesChartWrapper = (props) => {
3482
- const {
3650
+ var _b, _c, _d;
3651
+ const _a = props, {
3483
3652
  width,
3484
3653
  height,
3485
3654
  chartData,
@@ -3492,12 +3661,49 @@ var TimeSeriesChartWrapper = (props) => {
3492
3661
  markerDisplay,
3493
3662
  onClick,
3494
3663
  onPointMouseOver,
3495
- onPointMouseOut
3496
- } = props;
3497
- const {
3664
+ onPointMouseOut,
3665
+ onSelect,
3666
+ splitByLayout,
3667
+ trellisKey,
3668
+ trellisSplitBy,
3498
3669
  backgroundColor,
3670
+ defaultFontColor,
3671
+ additionalTooltipValues,
3672
+ showYAxisWithZero: showYAxisWithZeroFromProps,
3673
+ showY2AxisWithZero: showY2AxisWithZeroFromProps
3674
+ } = _a, otherOptions = __objRest(_a, [
3675
+ "width",
3676
+ "height",
3677
+ "chartData",
3678
+ "options",
3679
+ "userLocale",
3680
+ "annotationX",
3681
+ "annotationLabel",
3682
+ "annotationColor",
3683
+ "legendDisplay",
3684
+ "markerDisplay",
3685
+ "onClick",
3686
+ "onPointMouseOver",
3687
+ "onPointMouseOut",
3688
+ "onSelect",
3689
+ "splitByLayout",
3690
+ "trellisKey",
3691
+ "trellisSplitBy",
3692
+ "backgroundColor",
3693
+ "defaultFontColor",
3694
+ "additionalTooltipValues",
3695
+ // Extract showYAxisWithZero directly from props for accelerated render mode
3696
+ "showYAxisWithZero",
3697
+ "showY2AxisWithZero"
3698
+ ]);
3699
+ const { eventHandlers, xField: xFieldFromProps } = otherOptions;
3700
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
3701
+ const {
3702
+ backgroundColor: bgColorFromOptions,
3499
3703
  seriesColors: seriesColorsStr,
3500
3704
  fieldColors,
3705
+ legendLabels: legendLabelsStr,
3706
+ legendMode,
3501
3707
  "axisTitleX.text": xAxisTitleText,
3502
3708
  "axisTitleY.text": yAxisTitleText,
3503
3709
  "axisTitleY2.text": y2AxisTitleText,
@@ -3505,8 +3711,11 @@ var TimeSeriesChartWrapper = (props) => {
3505
3711
  "axisTitleY.visibility": yAxisTitleVisibility,
3506
3712
  "axisTitleY2.visibility": y2AxisTitleVisibility,
3507
3713
  "axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
3714
+ "axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
3508
3715
  "axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
3716
+ "axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
3509
3717
  "axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
3718
+ "axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
3510
3719
  "axisY.abbreviation": yAxisAbbreviation,
3511
3720
  "axisY.scale": yAxisScale,
3512
3721
  "axisY2.abbreviation": y2AxisAbbreviation,
@@ -3516,10 +3725,63 @@ var TimeSeriesChartWrapper = (props) => {
3516
3725
  "axisLabelsY2.integerUnits": y2IntegerUnits,
3517
3726
  "chart.overlayFields": overlayFieldsStr,
3518
3727
  "chart.nullValueMode": nullValueMode,
3519
- lineWidth
3728
+ "chart.showDataLabels": showDataLabels,
3729
+ lineWidth,
3730
+ lineDashStyle,
3731
+ fieldDashStyles: lineDashStylesByFieldStr,
3732
+ yAxisMin: yAxisMinRaw,
3733
+ yAxisMax: yAxisMaxRaw,
3734
+ y2AxisMin: y2AxisMinRaw,
3735
+ y2AxisMax: y2AxisMaxRaw,
3736
+ showXMajorGridLines,
3737
+ showYMajorGridLines,
3738
+ showY2MajorGridLines,
3739
+ showYMinorGridLines,
3740
+ showY2MinorGridLines,
3741
+ showLineSmoothing,
3742
+ yAxisMajorTickVisibility,
3743
+ y2AxisMajorTickVisibility,
3744
+ yAxisMajorTickSize,
3745
+ y2AxisMajorTickSize,
3746
+ yAxisMajorTickInterval,
3747
+ y2AxisMajorTickInterval,
3748
+ yAxisMinorTickVisibility,
3749
+ y2AxisMinorTickVisibility,
3750
+ yAxisMinorTickSize,
3751
+ y2AxisMinorTickSize,
3752
+ showYAxisWithZero: showYAxisWithZeroFromOptions,
3753
+ showY2AxisWithZero: showY2AxisWithZeroFromOptions
3520
3754
  } = options;
3755
+ const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
3756
+ const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
3757
+ const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
3758
+ const showYMajorTicks = yAxisMajorTickVisibility === "show";
3759
+ const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
3760
+ const showYMinorTicks = yAxisMinorTickVisibility === "show";
3761
+ const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
3762
+ const yAxisMin = parseAxisValue(yAxisMinRaw);
3763
+ const yAxisMax = parseAxisValue(yAxisMaxRaw);
3764
+ const y2AxisMin = parseAxisValue(y2AxisMinRaw);
3765
+ const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
3766
+ const parseTickInterval = (simpleXMLValue, canvasValue) => {
3767
+ if (simpleXMLValue) return Number(simpleXMLValue);
3768
+ if (canvasValue) return Number(canvasValue);
3769
+ return void 0;
3770
+ };
3771
+ const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
3772
+ const y2AxisMajorTickIntervalNum = parseTickInterval(
3773
+ y2AxisMajorUnitFromSimpleXML,
3774
+ y2AxisMajorTickInterval
3775
+ );
3776
+ const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
3777
+ const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
3778
+ const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
3779
+ const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
3521
3780
  const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
3522
3781
  const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
3782
+ const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
3783
+ const legendLabels = parseArrayOption(legendLabelsStr);
3784
+ const bgColor = backgroundColor || bgColorFromOptions;
3523
3785
  const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
3524
3786
  const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
3525
3787
  const cachedHandleResize = react_exports.useCallback((w, h) => {
@@ -3530,31 +3792,64 @@ var TimeSeriesChartWrapper = (props) => {
3530
3792
  fields: chartData.fields,
3531
3793
  columns: chartData.seriesList
3532
3794
  });
3533
- const xField = getFieldName(filteredChartData.fields[0]);
3795
+ const xField = getFieldName2(filteredChartData.fields[0]);
3534
3796
  const yFields = getFieldNames(
3535
3797
  filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
3536
3798
  );
3537
- const y2Fields = y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [];
3538
- const overlayFields = overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [];
3799
+ const y2Fields = (0, react_exports.useMemo)(
3800
+ () => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
3801
+ [y2FieldsStr]
3802
+ );
3803
+ const overlayFields = (0, react_exports.useMemo)(
3804
+ () => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
3805
+ [overlayFieldsStr]
3806
+ );
3539
3807
  let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
3540
3808
  xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
3541
- let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFields, yAxisTitleVisibility);
3809
+ const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
3810
+ let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
3542
3811
  yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
3543
3812
  const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
3544
3813
  let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
3545
3814
  y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
3546
- const xScaleConfig = getXScaleConfig(xAxisTitle, xAxisLabelVisibility);
3547
- const yScaleConfig = getYScaleConfig(yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility);
3548
- let y2ScaleConfig = {};
3549
- if (y2Enabled) {
3550
- y2ScaleConfig = getY2ScaleConfig(
3551
- y2AxisTitle,
3552
- y2AxisAbbreviation,
3553
- y2AxisScale,
3554
- y2IntegerUnits,
3555
- y2AxisLabelVisibility
3556
- );
3557
- }
3815
+ const xScaleConfig = (0, react_exports.useMemo)(
3816
+ () => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
3817
+ [xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
3818
+ );
3819
+ const yScaleConfig = (0, react_exports.useMemo)(
3820
+ () => getYScaleConfig(
3821
+ yAxisTitle,
3822
+ yAxisAbbreviation,
3823
+ yAxisScale,
3824
+ yAxisLabelVisibility,
3825
+ yAxisMin,
3826
+ yAxisMax
3827
+ ),
3828
+ [yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
3829
+ );
3830
+ const y2ScaleConfig = (0, react_exports.useMemo)(() => {
3831
+ if (y2Enabled) {
3832
+ return getY2ScaleConfig(
3833
+ y2AxisTitle,
3834
+ y2AxisAbbreviation,
3835
+ y2AxisScale,
3836
+ y2IntegerUnits,
3837
+ y2AxisLabelVisibility,
3838
+ y2AxisMin,
3839
+ y2AxisMax
3840
+ );
3841
+ }
3842
+ return {};
3843
+ }, [
3844
+ y2Enabled,
3845
+ y2AxisTitle,
3846
+ y2AxisAbbreviation,
3847
+ y2AxisScale,
3848
+ y2IntegerUnits,
3849
+ y2AxisLabelVisibility,
3850
+ y2AxisMin,
3851
+ y2AxisMax
3852
+ ]);
3558
3853
  const uplotContainerElement = (0, react_exports.useRef)(null);
3559
3854
  const seriesDataFormatted = [
3560
3855
  filteredChartData.columns[0],
@@ -3570,9 +3865,21 @@ var TimeSeriesChartWrapper = (props) => {
3570
3865
  overlayFields,
3571
3866
  y2Enabled,
3572
3867
  nullValueMode,
3573
- markerDisplay
3868
+ markerDisplay,
3869
+ lineDashStyle,
3870
+ lineDashStylesByField
3574
3871
  ),
3575
- [yFields, y2Fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay]
3872
+ [
3873
+ yFields,
3874
+ y2Fields,
3875
+ lineWidth,
3876
+ overlayFields,
3877
+ y2Enabled,
3878
+ nullValueMode,
3879
+ markerDisplay,
3880
+ lineDashStyle,
3881
+ lineDashStylesByField
3882
+ ]
3576
3883
  );
3577
3884
  const chartingEventAnnotations = (0, react_exports.useMemo)(
3578
3885
  () => getAnnotationsForCanvas({
@@ -3586,25 +3893,54 @@ var TimeSeriesChartWrapper = (props) => {
3586
3893
  () => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
3587
3894
  [xScaleConfig, yScaleConfig, y2ScaleConfig]
3588
3895
  );
3589
- const legend = (0, react_exports.useMemo)(() => getLegend({ legendDisplay }), [legendDisplay]);
3896
+ const legend = (0, react_exports.useMemo)(
3897
+ () => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
3898
+ [legendDisplay, legendMode]
3899
+ );
3590
3900
  const handleChartClick = react_exports.useCallback(
3591
3901
  (event) => {
3592
3902
  if (onClick) {
3593
- handleClick(event, onClick);
3903
+ handleClick(event, onClick, trellisKey, trellisSplitBy);
3594
3904
  }
3595
3905
  },
3596
- [onClick]
3906
+ [onClick, trellisKey, trellisSplitBy]
3597
3907
  );
3598
3908
  const handleChartLegendClick = react_exports.useCallback(
3599
3909
  (event) => {
3600
3910
  if (onClick) {
3601
- handleLegendClick(event, onClick);
3911
+ handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
3602
3912
  }
3603
3913
  },
3604
- [onClick]
3914
+ [onClick, trellisKey, trellisSplitBy]
3915
+ );
3916
+ const handleChartRangeSelection = react_exports.useCallback(
3917
+ (range2) => {
3918
+ if (onSelect) {
3919
+ handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
3920
+ }
3921
+ },
3922
+ [onSelect, chartData, trellisKey, trellisSplitBy]
3923
+ );
3924
+ const handleChartRangeZoom = react_exports.useCallback(
3925
+ (range2) => {
3926
+ if (onSelect) {
3927
+ handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
3928
+ }
3929
+ },
3930
+ [onSelect, chartData, trellisKey, trellisSplitBy]
3931
+ );
3932
+ const xFieldToUse = xFieldFromProps || xField;
3933
+ const enableSearchZoom = react_exports.useMemo(
3934
+ () => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
3935
+ [eventHandlers, xFieldToUse]
3605
3936
  );
3606
3937
  const lastPayloadRef = react_exports.useRef(null);
3607
3938
  const lastOriginalEventRef = react_exports.useRef(null);
3939
+ const previousMouseoverPayloadRef = react_exports.useRef(null);
3940
+ const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
3941
+ react_exports.useEffect(() => {
3942
+ additionalTooltipValuesRef.current = additionalTooltipValues;
3943
+ }, [additionalTooltipValues]);
3608
3944
  const handleChartCrosshairChange = react_exports.useCallback(
3609
3945
  (event) => {
3610
3946
  if (onPointMouseOver || onPointMouseOut) {
@@ -3616,6 +3952,7 @@ var TimeSeriesChartWrapper = (props) => {
3616
3952
  payload: lastPayloadRef.current
3617
3953
  });
3618
3954
  }
3955
+ previousMouseoverPayloadRef.current = null;
3619
3956
  return;
3620
3957
  }
3621
3958
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
@@ -3623,25 +3960,36 @@ var TimeSeriesChartWrapper = (props) => {
3623
3960
  });
3624
3961
  delete payload.seriesKey;
3625
3962
  if (event.rowContext) {
3626
- Object.keys(event.rowContext).forEach((fieldName) => {
3627
- payload[`row.${fieldName}.value`] = event.rowContext[fieldName];
3628
- });
3963
+ Object.assign(
3964
+ payload,
3965
+ Object.keys(event.rowContext).reduce((acc, fieldName) => {
3966
+ acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
3967
+ return acc;
3968
+ }, {})
3969
+ );
3629
3970
  }
3630
- lastPayloadRef.current = payload;
3971
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3972
+ if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
3973
+ return;
3974
+ }
3975
+ lastPayloadRef.current = updatedPayload;
3631
3976
  lastOriginalEventRef.current = event;
3977
+ previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
3632
3978
  if (onPointMouseOver) {
3633
3979
  onPointMouseOver({
3634
3980
  type: "point.mouseover",
3635
3981
  originalEvent: event,
3636
- payload
3982
+ payload: updatedPayload
3637
3983
  });
3638
3984
  }
3639
3985
  }
3640
3986
  },
3641
- [onPointMouseOver, onPointMouseOut]
3987
+ [onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
3642
3988
  );
3643
- const memoizedChart = (0, react_exports.useMemo)(
3644
- () => /* @__PURE__ */ react_exports.createElement(
3989
+ 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}`;
3990
+ const memoizedChart = (0, react_exports.useMemo)(() => {
3991
+ const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
3992
+ return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
3645
3993
  visualization_canvas_exports.TimeSeriesChart,
3646
3994
  {
3647
3995
  data: chartData,
@@ -3651,49 +3999,107 @@ var TimeSeriesChartWrapper = (props) => {
3651
3999
  seriesColorsByField,
3652
4000
  seriesConfig: seriesOverrides,
3653
4001
  legend,
4002
+ legendLabels,
4003
+ isSeriesCompare: legendMode === "seriesCompare",
4004
+ maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
3654
4005
  scaleConfig,
3655
4006
  timestampFormat: "expanded",
3656
4007
  onCrosshairClick: onClick ? handleChartClick : void 0,
3657
4008
  onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
3658
4009
  onSeriesClick: onClick ? handleChartLegendClick : void 0,
4010
+ onRangeSelection: handleChartRangeSelection,
4011
+ onRangeZoom: computedOnRangeZoom,
4012
+ serverSideZoom: enableSearchZoom,
3659
4013
  userLocale,
3660
4014
  events: chartingEventAnnotations,
3661
- eventsConfig: { renderer: triangleEventAnnotationRenderer }
4015
+ eventsConfig: { renderer: triangleEventAnnotationRenderer },
4016
+ additionalTooltipValuesRef,
4017
+ showXMajorGridLines,
4018
+ showYMajorGridLines,
4019
+ showY2MajorGridLines,
4020
+ showYMinorGridLines,
4021
+ showY2MinorGridLines,
4022
+ showLineSmoothing,
4023
+ dataValuesDisplay,
4024
+ showYMajorTicks,
4025
+ showY2MajorTicks,
4026
+ yAxisMajorTickSize: yAxisMajorTickSizeNum,
4027
+ y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
4028
+ yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
4029
+ y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
4030
+ showYMinorTicks,
4031
+ showY2MinorTicks,
4032
+ yAxisMinorTickSize: yAxisMinorTickSizeNum,
4033
+ y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
4034
+ showYAxisWithZero,
4035
+ showY2AxisWithZero
3662
4036
  }
3663
- ),
3664
- [
3665
- chartData,
3666
- containerWidth,
3667
- containerHeight,
3668
- seriesColors,
3669
- seriesColorsByField,
3670
- seriesOverrides,
3671
- legend,
3672
- scaleConfig,
3673
- userLocale,
3674
- chartingEventAnnotations,
3675
- onClick,
3676
- handleChartClick,
3677
- onPointMouseOver,
3678
- onPointMouseOut,
3679
- handleChartCrosshairChange,
3680
- handleChartLegendClick
3681
- ]
3682
- );
4037
+ ));
4038
+ }, [
4039
+ onSelect,
4040
+ handleChartRangeZoom,
4041
+ dataKey,
4042
+ chartData,
4043
+ containerWidth,
4044
+ containerHeight,
4045
+ seriesColors,
4046
+ seriesColorsByField,
4047
+ seriesOverrides,
4048
+ legend,
4049
+ legendLabels,
4050
+ scaleConfig,
4051
+ onClick,
4052
+ handleChartClick,
4053
+ onPointMouseOver,
4054
+ onPointMouseOut,
4055
+ handleChartCrosshairChange,
4056
+ handleChartLegendClick,
4057
+ handleChartRangeSelection,
4058
+ enableSearchZoom,
4059
+ userLocale,
4060
+ chartingEventAnnotations,
4061
+ showXMajorGridLines,
4062
+ showYMajorGridLines,
4063
+ showY2MajorGridLines,
4064
+ showYMinorGridLines,
4065
+ showY2MinorGridLines,
4066
+ showLineSmoothing,
4067
+ dataValuesDisplay,
4068
+ showYMajorTicks,
4069
+ showY2MajorTicks,
4070
+ yAxisMajorTickSizeNum,
4071
+ y2AxisMajorTickSizeNum,
4072
+ yAxisMajorTickIntervalNum,
4073
+ y2AxisMajorTickIntervalNum,
4074
+ showYMinorTicks,
4075
+ showY2MinorTicks,
4076
+ yAxisMinorTickSizeNum,
4077
+ y2AxisMinorTickSizeNum,
4078
+ showYAxisWithZero,
4079
+ showY2AxisWithZero,
4080
+ legendMode
4081
+ ]);
3683
4082
  const memoizedVisualization = (0, react_exports.useMemo)(() => {
3684
- return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
3685
- }, [backgroundColor, memoizedChart]);
3686
- return /* @__PURE__ */ react_exports.createElement(
4083
+ return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
4084
+ }, [bgColor, memoizedChart]);
4085
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
4086
+ TrellisTitle,
4087
+ {
4088
+ trellisKey,
4089
+ backgroundColor: bgColor,
4090
+ fontColor: defaultFontColor
4091
+ }
4092
+ ), /* @__PURE__ */ react_exports.createElement(
3687
4093
  TimeSeriesChartContainer,
3688
4094
  {
3689
- height,
4095
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
3690
4096
  width,
3691
4097
  ref: uplotContainerElement,
3692
4098
  "data-test": "timeseries-chart-wrapper"
3693
4099
  },
3694
4100
  /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
3695
4101
  memoizedVisualization
3696
- );
4102
+ ));
3697
4103
  };
3698
4104
  var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
3699
4105