@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/Bubble.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
  }
@@ -1150,7 +1163,6 @@ var AcceleratedRenderEditorLayout = [
1150
1163
  "Render visualizations faster for large datasets. Some functionalities might not be available in this mode."
1151
1164
  ),
1152
1165
  helpFormat: "under"
1153
- // TODO: uncomment and replace link with real link (SCP-75907)
1154
1166
  // helpTextLink: {
1155
1167
  // href: 'https://splunkui.splunk.com/Packages/visualizations/Overview',
1156
1168
  // label: 'Learn More.',
@@ -2312,7 +2324,7 @@ var Cover = styled_components_default.div`
2312
2324
  bottom: 0;
2313
2325
  `;
2314
2326
  var Blocker = styled_components_default.div.attrs({
2315
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b"
2327
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f"
2316
2328
  })`
2317
2329
  position: relative;
2318
2330
  width: 100%;
@@ -2393,7 +2405,7 @@ var withFixedSizeContainer = (Viz) => {
2393
2405
  FixSizeItem,
2394
2406
  {
2395
2407
  "data-test": "fix-size-item",
2396
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b",
2408
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f",
2397
2409
  width,
2398
2410
  height,
2399
2411
  backgroundColor
@@ -2761,6 +2773,16 @@ var mapToValues = (optionValuesSCMapping) => (options) => {
2761
2773
  });
2762
2774
  return convertedOptions;
2763
2775
  };
2776
+ var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
2777
+ const rangeSelectEventHandler = eventHandlers.find(
2778
+ (eventHandler) => {
2779
+ var _a;
2780
+ return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
2781
+ }
2782
+ );
2783
+ const xAxisIsTime = xField === "_time";
2784
+ return !!rangeSelectEventHandler && xAxisIsTime;
2785
+ };
2764
2786
  var canvasSupportedTimeSeriesCharts = ["splunk.line"];
2765
2787
  var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
2766
2788
  return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
@@ -2781,16 +2803,31 @@ var filterChartDataFromInternalFields = (chartData) => {
2781
2803
  var convert2DArrayToNumbers = (arr) => {
2782
2804
  return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
2783
2805
  };
2806
+ var parseAxisValue = (val) => {
2807
+ if (val === void 0 || val === null || val === "auto" || val === "") {
2808
+ return void 0;
2809
+ }
2810
+ const num = typeof val === "number" ? val : Number.parseFloat(val);
2811
+ return Number.isNaN(num) ? void 0 : num;
2812
+ };
2784
2813
  var SideLegendWidth = 75;
2785
- var commonLegendProps = { center: true, fontSize: 12, largerTiles: true, hideSeriesValue: true };
2814
+ var SeriesCompareLegendWidth = 200;
2786
2815
  var getLegend = (props) => {
2787
2816
  const legendPlacement = props == null ? void 0 : props.legendDisplay;
2817
+ const { isSeriesCompare } = props;
2818
+ const commonLegendProps = {
2819
+ center: true,
2820
+ fontSize: 12,
2821
+ largerTiles: true,
2822
+ hideSeriesValue: !isSeriesCompare
2823
+ // Show values if in seriesCompare mode
2824
+ };
2788
2825
  switch (legendPlacement) {
2789
2826
  case "off":
2790
2827
  return false;
2791
2828
  case "left":
2792
2829
  return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
2793
- width: SideLegendWidth
2830
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
2794
2831
  }, commonLegendProps));
2795
2832
  case "bottom":
2796
2833
  return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
@@ -2802,7 +2839,7 @@ var getLegend = (props) => {
2802
2839
  }, commonLegendProps));
2803
2840
  default:
2804
2841
  return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
2805
- width: SideLegendWidth
2842
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
2806
2843
  }, commonLegendProps));
2807
2844
  }
2808
2845
  };
@@ -2838,22 +2875,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
2838
2875
  const end = axisTitle.slice(-halfChars);
2839
2876
  return `${start}...${end}`;
2840
2877
  };
2841
- var getFieldName = (field) => {
2878
+ var getFieldName2 = (field) => {
2842
2879
  const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
2843
2880
  return fieldName;
2844
2881
  };
2845
2882
  var getFieldNames = (fields) => {
2846
- return fields.map((field) => getFieldName(field));
2883
+ return fields.map((field) => getFieldName2(field));
2847
2884
  };
2848
- var getXScaleConfig = (label, xAxisLabelVisibility) => {
2885
+ var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
2849
2886
  const xConfig = { x: {} };
2850
2887
  xConfig.x.label = label;
2851
2888
  if (xAxisLabelVisibility === "hide") {
2852
2889
  xConfig.x.hideLabels = true;
2853
2890
  }
2891
+ if (xAxisLabelRotation !== void 0) {
2892
+ xConfig.x.labelRotation = xAxisLabelRotation;
2893
+ }
2854
2894
  return xConfig;
2855
2895
  };
2856
- var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
2896
+ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
2857
2897
  const scaleType = yAxisScale != null ? yAxisScale : "linear";
2858
2898
  const yConfig = { y: {} };
2859
2899
  yConfig.y.label = label;
@@ -2869,14 +2909,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
2869
2909
  if (yAxisLabelVisibility === "hide") {
2870
2910
  yConfig.y.hideLabels = true;
2871
2911
  }
2912
+ if (yAxisMin !== void 0 || yAxisMax !== void 0) {
2913
+ yConfig.y.range = (u, dataMin, dataMax) => {
2914
+ const min = yAxisMin != null ? yAxisMin : dataMin;
2915
+ const max = yAxisMax != null ? yAxisMax : dataMax;
2916
+ return [min, max];
2917
+ };
2918
+ }
2872
2919
  return yConfig;
2873
2920
  };
2874
- var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
2921
+ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
2875
2922
  const y2Config = { y2: {} };
2876
2923
  const scaleType = axisScale != null ? axisScale : "linear";
2877
2924
  y2Config.y2.label = label;
2878
2925
  y2Config.y2.side = "right";
2879
- y2Config.y2.showGrid = false;
2880
2926
  y2Config.y2.type = scaleType;
2881
2927
  if (axisAbbreviation !== "none") {
2882
2928
  y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
@@ -2886,9 +2932,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
2886
2932
  if (y2AxisLabelVisibility === "hide") {
2887
2933
  y2Config.y2.hideLabels = true;
2888
2934
  }
2935
+ if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
2936
+ y2Config.y2.range = (u, dataMin, dataMax) => {
2937
+ const min = y2AxisMin != null ? y2AxisMin : dataMin;
2938
+ const max = y2AxisMax != null ? y2AxisMax : dataMax;
2939
+ return [min, max];
2940
+ };
2941
+ }
2889
2942
  return y2Config;
2890
2943
  };
2891
- var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
2944
+ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
2892
2945
  const seriesConfig = {};
2893
2946
  let spanGaps;
2894
2947
  let replaceNullsWithZero;
@@ -2923,12 +2976,45 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
2923
2976
  if (markerDisplay !== void 0) {
2924
2977
  seriesConfig[field].markerDisplay = markerDisplay;
2925
2978
  }
2979
+ const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
2980
+ if (fieldDashStyle) {
2981
+ seriesConfig[field].lineDashStyle = fieldDashStyle;
2982
+ }
2926
2983
  if (replaceNullsWithZero !== void 0) {
2927
2984
  seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
2928
2985
  }
2929
2986
  });
2930
2987
  return seriesConfig;
2931
2988
  };
2989
+ var findRangeIndices = (xData, startValue, endValue) => {
2990
+ let startXIndex = -1;
2991
+ let endXIndex = -1;
2992
+ const xDataEpoch = xData.map((val) => {
2993
+ if (typeof val === "string") {
2994
+ return new Date(val).getTime() / 1e3;
2995
+ }
2996
+ return val;
2997
+ });
2998
+ for (let i = 0; i < xDataEpoch.length; i += 1) {
2999
+ if (xDataEpoch[i] >= startValue) {
3000
+ startXIndex = i;
3001
+ break;
3002
+ }
3003
+ }
3004
+ if (startXIndex === -1 && xDataEpoch.length > 0) {
3005
+ startXIndex = xDataEpoch.length - 1;
3006
+ }
3007
+ for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
3008
+ if (xDataEpoch[i] <= endValue) {
3009
+ endXIndex = i;
3010
+ break;
3011
+ }
3012
+ }
3013
+ if (endXIndex === -1 && xDataEpoch.length > 0) {
3014
+ endXIndex = 0;
3015
+ }
3016
+ return { startXIndex, endXIndex };
3017
+ };
2932
3018
 
2933
3019
  // src/common/TimeSeriesChartWrapper.tsx
2934
3020
  var TimeSeriesChartContainer = styled_components_default.div`
@@ -2939,38 +3025,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
2939
3025
  position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
2940
3026
  }
2941
3027
  `;
2942
- var handleClick = (chartEvent, onClick) => {
3028
+ var appendTrellisToPayload2 = (payload, trellisKey, trellisSplitBy) => {
3029
+ const result = __spreadValues({}, payload);
3030
+ if (trellisSplitBy) {
3031
+ result["trellis.name"] = trellisSplitBy;
3032
+ }
3033
+ if (trellisKey) {
3034
+ result["trellis.value"] = trellisKey;
3035
+ }
3036
+ return result;
3037
+ };
3038
+ var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
3039
+ if (!previousPayload) {
3040
+ return true;
3041
+ }
3042
+ if (currentPayload.index !== previousPayload.index) {
3043
+ return true;
3044
+ }
3045
+ if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
3046
+ return true;
3047
+ }
3048
+ if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
3049
+ return true;
3050
+ }
3051
+ if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
3052
+ return true;
3053
+ }
3054
+ return false;
3055
+ };
3056
+ var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
2943
3057
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
2944
3058
  name: chartEvent.seriesKey
2945
3059
  });
2946
3060
  delete payload.seriesKey;
2947
3061
  if (chartEvent.rowContext) {
2948
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
2949
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
2950
- });
3062
+ Object.assign(
3063
+ payload,
3064
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
3065
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3066
+ return acc;
3067
+ }, {})
3068
+ );
2951
3069
  }
3070
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
2952
3071
  if (onClick) {
2953
3072
  onClick({
2954
3073
  type: "point.click",
2955
3074
  originalEvent: chartEvent,
2956
- payload
3075
+ payload: updatedPayload
2957
3076
  });
2958
3077
  }
2959
3078
  };
2960
- var handleLegendClick = (chartEvent, onClick) => {
3079
+ var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
2961
3080
  const payload = {
2962
3081
  name: chartEvent
2963
3082
  };
3083
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
2964
3084
  if (onClick) {
2965
3085
  onClick({
2966
3086
  type: "legend.click",
2967
3087
  originalEvent: chartEvent,
2968
- payload
3088
+ payload: updatedPayload
2969
3089
  });
2970
3090
  }
2971
3091
  };
3092
+ var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3093
+ var _a;
3094
+ if (!rangeEvent) {
3095
+ return;
3096
+ }
3097
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3098
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3099
+ const payload = {
3100
+ startXIndex,
3101
+ startXValue: rangeEvent.start,
3102
+ endXIndex,
3103
+ endXValue: rangeEvent.end
3104
+ };
3105
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3106
+ if (onSelect) {
3107
+ onSelect({
3108
+ type: "range.selectBeforeZoom",
3109
+ originalEvent: rangeEvent,
3110
+ payload: updatedPayload
3111
+ });
3112
+ }
3113
+ };
3114
+ var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3115
+ var _a;
3116
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3117
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3118
+ const payload = {
3119
+ startXIndex,
3120
+ startXValue: rangeEvent.start,
3121
+ endXIndex,
3122
+ endXValue: rangeEvent.end
3123
+ };
3124
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3125
+ if (onSelect) {
3126
+ onSelect({
3127
+ type: "range.select",
3128
+ originalEvent: rangeEvent,
3129
+ payload: updatedPayload
3130
+ });
3131
+ }
3132
+ };
3133
+ var parseArrayOption = (value) => {
3134
+ if (Array.isArray(value)) {
3135
+ return value;
3136
+ }
3137
+ if (value) {
3138
+ return JSON.parse(value);
3139
+ }
3140
+ return void 0;
3141
+ };
2972
3142
  var TimeSeriesChartWrapper = (props) => {
2973
- const {
3143
+ var _b, _c, _d;
3144
+ const _a = props, {
2974
3145
  width,
2975
3146
  height,
2976
3147
  chartData,
@@ -2983,12 +3154,49 @@ var TimeSeriesChartWrapper = (props) => {
2983
3154
  markerDisplay,
2984
3155
  onClick,
2985
3156
  onPointMouseOver,
2986
- onPointMouseOut
2987
- } = props;
2988
- const {
3157
+ onPointMouseOut,
3158
+ onSelect,
3159
+ splitByLayout,
3160
+ trellisKey,
3161
+ trellisSplitBy,
2989
3162
  backgroundColor,
3163
+ defaultFontColor,
3164
+ additionalTooltipValues,
3165
+ showYAxisWithZero: showYAxisWithZeroFromProps,
3166
+ showY2AxisWithZero: showY2AxisWithZeroFromProps
3167
+ } = _a, otherOptions = __objRest(_a, [
3168
+ "width",
3169
+ "height",
3170
+ "chartData",
3171
+ "options",
3172
+ "userLocale",
3173
+ "annotationX",
3174
+ "annotationLabel",
3175
+ "annotationColor",
3176
+ "legendDisplay",
3177
+ "markerDisplay",
3178
+ "onClick",
3179
+ "onPointMouseOver",
3180
+ "onPointMouseOut",
3181
+ "onSelect",
3182
+ "splitByLayout",
3183
+ "trellisKey",
3184
+ "trellisSplitBy",
3185
+ "backgroundColor",
3186
+ "defaultFontColor",
3187
+ "additionalTooltipValues",
3188
+ // Extract showYAxisWithZero directly from props for accelerated render mode
3189
+ "showYAxisWithZero",
3190
+ "showY2AxisWithZero"
3191
+ ]);
3192
+ const { eventHandlers, xField: xFieldFromProps } = otherOptions;
3193
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
3194
+ const {
3195
+ backgroundColor: bgColorFromOptions,
2990
3196
  seriesColors: seriesColorsStr,
2991
3197
  fieldColors,
3198
+ legendLabels: legendLabelsStr,
3199
+ legendMode,
2992
3200
  "axisTitleX.text": xAxisTitleText,
2993
3201
  "axisTitleY.text": yAxisTitleText,
2994
3202
  "axisTitleY2.text": y2AxisTitleText,
@@ -2996,8 +3204,11 @@ var TimeSeriesChartWrapper = (props) => {
2996
3204
  "axisTitleY.visibility": yAxisTitleVisibility,
2997
3205
  "axisTitleY2.visibility": y2AxisTitleVisibility,
2998
3206
  "axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
3207
+ "axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
2999
3208
  "axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
3209
+ "axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
3000
3210
  "axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
3211
+ "axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
3001
3212
  "axisY.abbreviation": yAxisAbbreviation,
3002
3213
  "axisY.scale": yAxisScale,
3003
3214
  "axisY2.abbreviation": y2AxisAbbreviation,
@@ -3007,10 +3218,63 @@ var TimeSeriesChartWrapper = (props) => {
3007
3218
  "axisLabelsY2.integerUnits": y2IntegerUnits,
3008
3219
  "chart.overlayFields": overlayFieldsStr,
3009
3220
  "chart.nullValueMode": nullValueMode,
3010
- lineWidth
3221
+ "chart.showDataLabels": showDataLabels,
3222
+ lineWidth,
3223
+ lineDashStyle,
3224
+ fieldDashStyles: lineDashStylesByFieldStr,
3225
+ yAxisMin: yAxisMinRaw,
3226
+ yAxisMax: yAxisMaxRaw,
3227
+ y2AxisMin: y2AxisMinRaw,
3228
+ y2AxisMax: y2AxisMaxRaw,
3229
+ showXMajorGridLines,
3230
+ showYMajorGridLines,
3231
+ showY2MajorGridLines,
3232
+ showYMinorGridLines,
3233
+ showY2MinorGridLines,
3234
+ showLineSmoothing,
3235
+ yAxisMajorTickVisibility,
3236
+ y2AxisMajorTickVisibility,
3237
+ yAxisMajorTickSize,
3238
+ y2AxisMajorTickSize,
3239
+ yAxisMajorTickInterval,
3240
+ y2AxisMajorTickInterval,
3241
+ yAxisMinorTickVisibility,
3242
+ y2AxisMinorTickVisibility,
3243
+ yAxisMinorTickSize,
3244
+ y2AxisMinorTickSize,
3245
+ showYAxisWithZero: showYAxisWithZeroFromOptions,
3246
+ showY2AxisWithZero: showY2AxisWithZeroFromOptions
3011
3247
  } = options;
3248
+ const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
3249
+ const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
3250
+ const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
3251
+ const showYMajorTicks = yAxisMajorTickVisibility === "show";
3252
+ const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
3253
+ const showYMinorTicks = yAxisMinorTickVisibility === "show";
3254
+ const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
3255
+ const yAxisMin = parseAxisValue(yAxisMinRaw);
3256
+ const yAxisMax = parseAxisValue(yAxisMaxRaw);
3257
+ const y2AxisMin = parseAxisValue(y2AxisMinRaw);
3258
+ const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
3259
+ const parseTickInterval = (simpleXMLValue, canvasValue) => {
3260
+ if (simpleXMLValue) return Number(simpleXMLValue);
3261
+ if (canvasValue) return Number(canvasValue);
3262
+ return void 0;
3263
+ };
3264
+ const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
3265
+ const y2AxisMajorTickIntervalNum = parseTickInterval(
3266
+ y2AxisMajorUnitFromSimpleXML,
3267
+ y2AxisMajorTickInterval
3268
+ );
3269
+ const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
3270
+ const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
3271
+ const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
3272
+ const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
3012
3273
  const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
3013
3274
  const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
3275
+ const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
3276
+ const legendLabels = parseArrayOption(legendLabelsStr);
3277
+ const bgColor = backgroundColor || bgColorFromOptions;
3014
3278
  const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
3015
3279
  const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
3016
3280
  const cachedHandleResize = react_exports.useCallback((w, h) => {
@@ -3021,31 +3285,64 @@ var TimeSeriesChartWrapper = (props) => {
3021
3285
  fields: chartData.fields,
3022
3286
  columns: chartData.seriesList
3023
3287
  });
3024
- const xField = getFieldName(filteredChartData.fields[0]);
3288
+ const xField = getFieldName2(filteredChartData.fields[0]);
3025
3289
  const yFields = getFieldNames(
3026
3290
  filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
3027
3291
  );
3028
- const y2Fields = y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [];
3029
- const overlayFields = overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [];
3292
+ const y2Fields = (0, react_exports.useMemo)(
3293
+ () => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
3294
+ [y2FieldsStr]
3295
+ );
3296
+ const overlayFields = (0, react_exports.useMemo)(
3297
+ () => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
3298
+ [overlayFieldsStr]
3299
+ );
3030
3300
  let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
3031
3301
  xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
3032
- let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFields, yAxisTitleVisibility);
3302
+ const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
3303
+ let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
3033
3304
  yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
3034
3305
  const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
3035
3306
  let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
3036
3307
  y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
3037
- const xScaleConfig = getXScaleConfig(xAxisTitle, xAxisLabelVisibility);
3038
- const yScaleConfig = getYScaleConfig(yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility);
3039
- let y2ScaleConfig = {};
3040
- if (y2Enabled) {
3041
- y2ScaleConfig = getY2ScaleConfig(
3042
- y2AxisTitle,
3043
- y2AxisAbbreviation,
3044
- y2AxisScale,
3045
- y2IntegerUnits,
3046
- y2AxisLabelVisibility
3047
- );
3048
- }
3308
+ const xScaleConfig = (0, react_exports.useMemo)(
3309
+ () => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
3310
+ [xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
3311
+ );
3312
+ const yScaleConfig = (0, react_exports.useMemo)(
3313
+ () => getYScaleConfig(
3314
+ yAxisTitle,
3315
+ yAxisAbbreviation,
3316
+ yAxisScale,
3317
+ yAxisLabelVisibility,
3318
+ yAxisMin,
3319
+ yAxisMax
3320
+ ),
3321
+ [yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
3322
+ );
3323
+ const y2ScaleConfig = (0, react_exports.useMemo)(() => {
3324
+ if (y2Enabled) {
3325
+ return getY2ScaleConfig(
3326
+ y2AxisTitle,
3327
+ y2AxisAbbreviation,
3328
+ y2AxisScale,
3329
+ y2IntegerUnits,
3330
+ y2AxisLabelVisibility,
3331
+ y2AxisMin,
3332
+ y2AxisMax
3333
+ );
3334
+ }
3335
+ return {};
3336
+ }, [
3337
+ y2Enabled,
3338
+ y2AxisTitle,
3339
+ y2AxisAbbreviation,
3340
+ y2AxisScale,
3341
+ y2IntegerUnits,
3342
+ y2AxisLabelVisibility,
3343
+ y2AxisMin,
3344
+ y2AxisMax
3345
+ ]);
3049
3346
  const uplotContainerElement = (0, react_exports.useRef)(null);
3050
3347
  const seriesDataFormatted = [
3051
3348
  filteredChartData.columns[0],
@@ -3061,9 +3358,21 @@ var TimeSeriesChartWrapper = (props) => {
3061
3358
  overlayFields,
3062
3359
  y2Enabled,
3063
3360
  nullValueMode,
3064
- markerDisplay
3361
+ markerDisplay,
3362
+ lineDashStyle,
3363
+ lineDashStylesByField
3065
3364
  ),
3066
- [yFields, y2Fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay]
3365
+ [
3366
+ yFields,
3367
+ y2Fields,
3368
+ lineWidth,
3369
+ overlayFields,
3370
+ y2Enabled,
3371
+ nullValueMode,
3372
+ markerDisplay,
3373
+ lineDashStyle,
3374
+ lineDashStylesByField
3375
+ ]
3067
3376
  );
3068
3377
  const chartingEventAnnotations = (0, react_exports.useMemo)(
3069
3378
  () => getAnnotationsForCanvas({
@@ -3077,25 +3386,54 @@ var TimeSeriesChartWrapper = (props) => {
3077
3386
  () => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
3078
3387
  [xScaleConfig, yScaleConfig, y2ScaleConfig]
3079
3388
  );
3080
- const legend = (0, react_exports.useMemo)(() => getLegend({ legendDisplay }), [legendDisplay]);
3389
+ const legend = (0, react_exports.useMemo)(
3390
+ () => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
3391
+ [legendDisplay, legendMode]
3392
+ );
3081
3393
  const handleChartClick = react_exports.useCallback(
3082
3394
  (event) => {
3083
3395
  if (onClick) {
3084
- handleClick(event, onClick);
3396
+ handleClick(event, onClick, trellisKey, trellisSplitBy);
3085
3397
  }
3086
3398
  },
3087
- [onClick]
3399
+ [onClick, trellisKey, trellisSplitBy]
3088
3400
  );
3089
3401
  const handleChartLegendClick = react_exports.useCallback(
3090
3402
  (event) => {
3091
3403
  if (onClick) {
3092
- handleLegendClick(event, onClick);
3404
+ handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
3405
+ }
3406
+ },
3407
+ [onClick, trellisKey, trellisSplitBy]
3408
+ );
3409
+ const handleChartRangeSelection = react_exports.useCallback(
3410
+ (range2) => {
3411
+ if (onSelect) {
3412
+ handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
3413
+ }
3414
+ },
3415
+ [onSelect, chartData, trellisKey, trellisSplitBy]
3416
+ );
3417
+ const handleChartRangeZoom = react_exports.useCallback(
3418
+ (range2) => {
3419
+ if (onSelect) {
3420
+ handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
3093
3421
  }
3094
3422
  },
3095
- [onClick]
3423
+ [onSelect, chartData, trellisKey, trellisSplitBy]
3424
+ );
3425
+ const xFieldToUse = xFieldFromProps || xField;
3426
+ const enableSearchZoom = react_exports.useMemo(
3427
+ () => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
3428
+ [eventHandlers, xFieldToUse]
3096
3429
  );
3097
3430
  const lastPayloadRef = react_exports.useRef(null);
3098
3431
  const lastOriginalEventRef = react_exports.useRef(null);
3432
+ const previousMouseoverPayloadRef = react_exports.useRef(null);
3433
+ const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
3434
+ react_exports.useEffect(() => {
3435
+ additionalTooltipValuesRef.current = additionalTooltipValues;
3436
+ }, [additionalTooltipValues]);
3099
3437
  const handleChartCrosshairChange = react_exports.useCallback(
3100
3438
  (event) => {
3101
3439
  if (onPointMouseOver || onPointMouseOut) {
@@ -3107,6 +3445,7 @@ var TimeSeriesChartWrapper = (props) => {
3107
3445
  payload: lastPayloadRef.current
3108
3446
  });
3109
3447
  }
3448
+ previousMouseoverPayloadRef.current = null;
3110
3449
  return;
3111
3450
  }
3112
3451
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
@@ -3114,25 +3453,36 @@ var TimeSeriesChartWrapper = (props) => {
3114
3453
  });
3115
3454
  delete payload.seriesKey;
3116
3455
  if (event.rowContext) {
3117
- Object.keys(event.rowContext).forEach((fieldName) => {
3118
- payload[`row.${fieldName}.value`] = event.rowContext[fieldName];
3119
- });
3456
+ Object.assign(
3457
+ payload,
3458
+ Object.keys(event.rowContext).reduce((acc, fieldName) => {
3459
+ acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
3460
+ return acc;
3461
+ }, {})
3462
+ );
3463
+ }
3464
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3465
+ if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
3466
+ return;
3120
3467
  }
3121
- lastPayloadRef.current = payload;
3468
+ lastPayloadRef.current = updatedPayload;
3122
3469
  lastOriginalEventRef.current = event;
3470
+ previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
3123
3471
  if (onPointMouseOver) {
3124
3472
  onPointMouseOver({
3125
3473
  type: "point.mouseover",
3126
3474
  originalEvent: event,
3127
- payload
3475
+ payload: updatedPayload
3128
3476
  });
3129
3477
  }
3130
3478
  }
3131
3479
  },
3132
- [onPointMouseOver, onPointMouseOut]
3480
+ [onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
3133
3481
  );
3134
- const memoizedChart = (0, react_exports.useMemo)(
3135
- () => /* @__PURE__ */ react_exports.createElement(
3482
+ 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}`;
3483
+ const memoizedChart = (0, react_exports.useMemo)(() => {
3484
+ const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
3485
+ return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
3136
3486
  visualization_canvas_exports.TimeSeriesChart,
3137
3487
  {
3138
3488
  data: chartData,
@@ -3142,49 +3492,107 @@ var TimeSeriesChartWrapper = (props) => {
3142
3492
  seriesColorsByField,
3143
3493
  seriesConfig: seriesOverrides,
3144
3494
  legend,
3495
+ legendLabels,
3496
+ isSeriesCompare: legendMode === "seriesCompare",
3497
+ maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
3145
3498
  scaleConfig,
3146
3499
  timestampFormat: "expanded",
3147
3500
  onCrosshairClick: onClick ? handleChartClick : void 0,
3148
3501
  onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
3149
3502
  onSeriesClick: onClick ? handleChartLegendClick : void 0,
3503
+ onRangeSelection: handleChartRangeSelection,
3504
+ onRangeZoom: computedOnRangeZoom,
3505
+ serverSideZoom: enableSearchZoom,
3150
3506
  userLocale,
3151
3507
  events: chartingEventAnnotations,
3152
- eventsConfig: { renderer: triangleEventAnnotationRenderer }
3153
- }
3154
- ),
3155
- [
3156
- chartData,
3157
- containerWidth,
3158
- containerHeight,
3159
- seriesColors,
3160
- seriesColorsByField,
3161
- seriesOverrides,
3162
- legend,
3163
- scaleConfig,
3164
- userLocale,
3165
- chartingEventAnnotations,
3166
- onClick,
3167
- handleChartClick,
3168
- onPointMouseOver,
3169
- onPointMouseOut,
3170
- handleChartCrosshairChange,
3171
- handleChartLegendClick
3172
- ]
3173
- );
3508
+ eventsConfig: { renderer: triangleEventAnnotationRenderer },
3509
+ additionalTooltipValuesRef,
3510
+ showXMajorGridLines,
3511
+ showYMajorGridLines,
3512
+ showY2MajorGridLines,
3513
+ showYMinorGridLines,
3514
+ showY2MinorGridLines,
3515
+ showLineSmoothing,
3516
+ dataValuesDisplay,
3517
+ showYMajorTicks,
3518
+ showY2MajorTicks,
3519
+ yAxisMajorTickSize: yAxisMajorTickSizeNum,
3520
+ y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
3521
+ yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
3522
+ y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
3523
+ showYMinorTicks,
3524
+ showY2MinorTicks,
3525
+ yAxisMinorTickSize: yAxisMinorTickSizeNum,
3526
+ y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
3527
+ showYAxisWithZero,
3528
+ showY2AxisWithZero
3529
+ }
3530
+ ));
3531
+ }, [
3532
+ onSelect,
3533
+ handleChartRangeZoom,
3534
+ dataKey,
3535
+ chartData,
3536
+ containerWidth,
3537
+ containerHeight,
3538
+ seriesColors,
3539
+ seriesColorsByField,
3540
+ seriesOverrides,
3541
+ legend,
3542
+ legendLabels,
3543
+ scaleConfig,
3544
+ onClick,
3545
+ handleChartClick,
3546
+ onPointMouseOver,
3547
+ onPointMouseOut,
3548
+ handleChartCrosshairChange,
3549
+ handleChartLegendClick,
3550
+ handleChartRangeSelection,
3551
+ enableSearchZoom,
3552
+ userLocale,
3553
+ chartingEventAnnotations,
3554
+ showXMajorGridLines,
3555
+ showYMajorGridLines,
3556
+ showY2MajorGridLines,
3557
+ showYMinorGridLines,
3558
+ showY2MinorGridLines,
3559
+ showLineSmoothing,
3560
+ dataValuesDisplay,
3561
+ showYMajorTicks,
3562
+ showY2MajorTicks,
3563
+ yAxisMajorTickSizeNum,
3564
+ y2AxisMajorTickSizeNum,
3565
+ yAxisMajorTickIntervalNum,
3566
+ y2AxisMajorTickIntervalNum,
3567
+ showYMinorTicks,
3568
+ showY2MinorTicks,
3569
+ yAxisMinorTickSizeNum,
3570
+ y2AxisMinorTickSizeNum,
3571
+ showYAxisWithZero,
3572
+ showY2AxisWithZero,
3573
+ legendMode
3574
+ ]);
3174
3575
  const memoizedVisualization = (0, react_exports.useMemo)(() => {
3175
- return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
3176
- }, [backgroundColor, memoizedChart]);
3177
- return /* @__PURE__ */ react_exports.createElement(
3576
+ return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
3577
+ }, [bgColor, memoizedChart]);
3578
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
3579
+ TrellisTitle,
3580
+ {
3581
+ trellisKey,
3582
+ backgroundColor: bgColor,
3583
+ fontColor: defaultFontColor
3584
+ }
3585
+ ), /* @__PURE__ */ react_exports.createElement(
3178
3586
  TimeSeriesChartContainer,
3179
3587
  {
3180
- height,
3588
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
3181
3589
  width,
3182
3590
  ref: uplotContainerElement,
3183
3591
  "data-test": "timeseries-chart-wrapper"
3184
3592
  },
3185
3593
  /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
3186
3594
  memoizedVisualization
3187
- );
3595
+ ));
3188
3596
  };
3189
3597
  var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
3190
3598