@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/Column.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
  }
@@ -1168,7 +1181,6 @@ var AcceleratedRenderEditorLayout = [
1168
1181
  "Render visualizations faster for large datasets. Some functionalities might not be available in this mode."
1169
1182
  ),
1170
1183
  helpFormat: "under"
1171
- // TODO: uncomment and replace link with real link (SCP-75907)
1172
1184
  // helpTextLink: {
1173
1185
  // href: 'https://splunkui.splunk.com/Packages/visualizations/Overview',
1174
1186
  // label: 'Learn More.',
@@ -2709,7 +2721,7 @@ var Cover = styled_components_default.div`
2709
2721
  bottom: 0;
2710
2722
  `;
2711
2723
  var Blocker = styled_components_default.div.attrs({
2712
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b"
2724
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f"
2713
2725
  })`
2714
2726
  position: relative;
2715
2727
  width: 100%;
@@ -2790,7 +2802,7 @@ var withFixedSizeContainer = (Viz) => {
2790
2802
  FixSizeItem,
2791
2803
  {
2792
2804
  "data-test": "fix-size-item",
2793
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b",
2805
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f",
2794
2806
  width,
2795
2807
  height,
2796
2808
  backgroundColor
@@ -3066,7 +3078,7 @@ var trellisUtils_default = "default" in defaultImport34 ? defaultImport34.defaul
3066
3078
  var AGGREGATIONS = "aggregations";
3067
3079
  var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
3068
3080
  var _a, _b, _c, _d;
3069
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3081
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3070
3082
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3071
3083
  let splitDataSources = null;
3072
3084
  let errorCode = null;
@@ -3087,7 +3099,7 @@ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
3087
3099
  }
3088
3100
  return { splitDataSources, errorCode };
3089
3101
  };
3090
- var toFieldEntries = (fields) => {
3102
+ var toFieldEntries = (fields = []) => {
3091
3103
  return fields.map((field) => {
3092
3104
  if (typeof field === "string") {
3093
3105
  return { name: field };
@@ -3102,7 +3114,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
3102
3114
  let splitDataSources = null;
3103
3115
  let splitByFields = [];
3104
3116
  let errorCode = null;
3105
- if (typeof fields[0] !== "string") {
3117
+ if (fields.length > 0) {
3106
3118
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
3107
3119
  }
3108
3120
  if (splitByFields && splitByFields.length > 0) {
@@ -3140,12 +3152,12 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
3140
3152
  };
3141
3153
  var dataSourcesSplitByAggregationsStats = (dataSource) => {
3142
3154
  var _a, _b, _c, _d;
3143
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3155
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3144
3156
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3145
3157
  let splitDataSources = null;
3146
3158
  let splitByFields = [];
3147
3159
  let errorCode = null;
3148
- if (typeof fields[0] !== "string") {
3160
+ if (fields.length > 0) {
3149
3161
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
3150
3162
  }
3151
3163
  if (splitByFields && splitByFields.length > 0) {
@@ -3169,12 +3181,12 @@ var dataSourcesSplitByAggregationsStats = (dataSource) => {
3169
3181
  };
3170
3182
  var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
3171
3183
  var _a, _b, _c, _d, _e;
3172
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3184
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3173
3185
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3174
3186
  let splitDataSources = null;
3175
3187
  let splitByFields = [];
3176
3188
  let errorCode = null;
3177
- if (typeof fields[0] !== "string") {
3189
+ if (fields.length > 0) {
3178
3190
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3179
3191
  }
3180
3192
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -3212,12 +3224,12 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
3212
3224
  };
3213
3225
  var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
3214
3226
  var _a, _b, _c, _d;
3215
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3227
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3216
3228
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3217
3229
  let splitDataSources = null;
3218
3230
  let splitByFields = [];
3219
3231
  let errorCode = null;
3220
- if (typeof fields[0] !== "string") {
3232
+ if (fields.length > 0) {
3221
3233
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3222
3234
  }
3223
3235
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -3305,17 +3317,15 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
3305
3317
  };
3306
3318
  var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
3307
3319
  var _a, _b, _c, _d, _e, _f;
3308
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3320
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3309
3321
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3310
3322
  let splitDataSources = null;
3311
3323
  let splitByFields = [];
3312
3324
  let errorCode = null;
3313
- if (typeof fields[0] !== "string") {
3325
+ if (fields.length > 0) {
3314
3326
  splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
3315
3327
  }
3316
- const splitByIndex = fields == null ? void 0 : fields.findIndex(
3317
- (field) => field === splitBy || field.name === splitBy
3318
- );
3328
+ const splitByIndex = fields.findIndex((field) => field.name === splitBy);
3319
3329
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
3320
3330
  const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
3321
3331
  splitDataSources = {};
@@ -3592,16 +3602,31 @@ var filterChartDataFromInternalFields = (chartData) => {
3592
3602
  var convert2DArrayToNumbers = (arr) => {
3593
3603
  return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
3594
3604
  };
3605
+ var parseAxisValue = (val) => {
3606
+ if (val === void 0 || val === null || val === "auto" || val === "") {
3607
+ return void 0;
3608
+ }
3609
+ const num = typeof val === "number" ? val : Number.parseFloat(val);
3610
+ return Number.isNaN(num) ? void 0 : num;
3611
+ };
3595
3612
  var SideLegendWidth = 75;
3596
- var commonLegendProps = { center: true, fontSize: 12, largerTiles: true, hideSeriesValue: true };
3613
+ var SeriesCompareLegendWidth = 200;
3597
3614
  var getLegend = (props) => {
3598
3615
  const legendPlacement = props == null ? void 0 : props.legendDisplay;
3616
+ const { isSeriesCompare } = props;
3617
+ const commonLegendProps = {
3618
+ center: true,
3619
+ fontSize: 12,
3620
+ largerTiles: true,
3621
+ hideSeriesValue: !isSeriesCompare
3622
+ // Show values if in seriesCompare mode
3623
+ };
3599
3624
  switch (legendPlacement) {
3600
3625
  case "off":
3601
3626
  return false;
3602
3627
  case "left":
3603
3628
  return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
3604
- width: SideLegendWidth
3629
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
3605
3630
  }, commonLegendProps));
3606
3631
  case "bottom":
3607
3632
  return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
@@ -3613,7 +3638,7 @@ var getLegend = (props) => {
3613
3638
  }, commonLegendProps));
3614
3639
  default:
3615
3640
  return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
3616
- width: SideLegendWidth
3641
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
3617
3642
  }, commonLegendProps));
3618
3643
  }
3619
3644
  };
@@ -3649,22 +3674,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
3649
3674
  const end = axisTitle.slice(-halfChars);
3650
3675
  return `${start}...${end}`;
3651
3676
  };
3652
- var getFieldName = (field) => {
3677
+ var getFieldName2 = (field) => {
3653
3678
  const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
3654
3679
  return fieldName;
3655
3680
  };
3656
3681
  var getFieldNames = (fields) => {
3657
- return fields.map((field) => getFieldName(field));
3682
+ return fields.map((field) => getFieldName2(field));
3658
3683
  };
3659
- var getXScaleConfig = (label, xAxisLabelVisibility) => {
3684
+ var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
3660
3685
  const xConfig = { x: {} };
3661
3686
  xConfig.x.label = label;
3662
3687
  if (xAxisLabelVisibility === "hide") {
3663
3688
  xConfig.x.hideLabels = true;
3664
3689
  }
3690
+ if (xAxisLabelRotation !== void 0) {
3691
+ xConfig.x.labelRotation = xAxisLabelRotation;
3692
+ }
3665
3693
  return xConfig;
3666
3694
  };
3667
- var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
3695
+ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
3668
3696
  const scaleType = yAxisScale != null ? yAxisScale : "linear";
3669
3697
  const yConfig = { y: {} };
3670
3698
  yConfig.y.label = label;
@@ -3680,14 +3708,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
3680
3708
  if (yAxisLabelVisibility === "hide") {
3681
3709
  yConfig.y.hideLabels = true;
3682
3710
  }
3711
+ if (yAxisMin !== void 0 || yAxisMax !== void 0) {
3712
+ yConfig.y.range = (u, dataMin, dataMax) => {
3713
+ const min = yAxisMin != null ? yAxisMin : dataMin;
3714
+ const max = yAxisMax != null ? yAxisMax : dataMax;
3715
+ return [min, max];
3716
+ };
3717
+ }
3683
3718
  return yConfig;
3684
3719
  };
3685
- var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
3720
+ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
3686
3721
  const y2Config = { y2: {} };
3687
3722
  const scaleType = axisScale != null ? axisScale : "linear";
3688
3723
  y2Config.y2.label = label;
3689
3724
  y2Config.y2.side = "right";
3690
- y2Config.y2.showGrid = false;
3691
3725
  y2Config.y2.type = scaleType;
3692
3726
  if (axisAbbreviation !== "none") {
3693
3727
  y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
@@ -3697,9 +3731,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
3697
3731
  if (y2AxisLabelVisibility === "hide") {
3698
3732
  y2Config.y2.hideLabels = true;
3699
3733
  }
3734
+ if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
3735
+ y2Config.y2.range = (u, dataMin, dataMax) => {
3736
+ const min = y2AxisMin != null ? y2AxisMin : dataMin;
3737
+ const max = y2AxisMax != null ? y2AxisMax : dataMax;
3738
+ return [min, max];
3739
+ };
3740
+ }
3700
3741
  return y2Config;
3701
3742
  };
3702
- var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
3743
+ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
3703
3744
  const seriesConfig = {};
3704
3745
  let spanGaps;
3705
3746
  let replaceNullsWithZero;
@@ -3734,12 +3775,45 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
3734
3775
  if (markerDisplay !== void 0) {
3735
3776
  seriesConfig[field].markerDisplay = markerDisplay;
3736
3777
  }
3778
+ const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
3779
+ if (fieldDashStyle) {
3780
+ seriesConfig[field].lineDashStyle = fieldDashStyle;
3781
+ }
3737
3782
  if (replaceNullsWithZero !== void 0) {
3738
3783
  seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
3739
3784
  }
3740
3785
  });
3741
3786
  return seriesConfig;
3742
3787
  };
3788
+ var findRangeIndices = (xData, startValue, endValue) => {
3789
+ let startXIndex = -1;
3790
+ let endXIndex = -1;
3791
+ const xDataEpoch = xData.map((val) => {
3792
+ if (typeof val === "string") {
3793
+ return new Date(val).getTime() / 1e3;
3794
+ }
3795
+ return val;
3796
+ });
3797
+ for (let i = 0; i < xDataEpoch.length; i += 1) {
3798
+ if (xDataEpoch[i] >= startValue) {
3799
+ startXIndex = i;
3800
+ break;
3801
+ }
3802
+ }
3803
+ if (startXIndex === -1 && xDataEpoch.length > 0) {
3804
+ startXIndex = xDataEpoch.length - 1;
3805
+ }
3806
+ for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
3807
+ if (xDataEpoch[i] <= endValue) {
3808
+ endXIndex = i;
3809
+ break;
3810
+ }
3811
+ }
3812
+ if (endXIndex === -1 && xDataEpoch.length > 0) {
3813
+ endXIndex = 0;
3814
+ }
3815
+ return { startXIndex, endXIndex };
3816
+ };
3743
3817
 
3744
3818
  // src/common/TimeSeriesChartWrapper.tsx
3745
3819
  var TimeSeriesChartContainer = styled_components_default.div`
@@ -3750,38 +3824,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
3750
3824
  position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
3751
3825
  }
3752
3826
  `;
3753
- var handleClick = (chartEvent, onClick) => {
3827
+ var appendTrellisToPayload2 = (payload, trellisKey, trellisSplitBy) => {
3828
+ const result = __spreadValues({}, payload);
3829
+ if (trellisSplitBy) {
3830
+ result["trellis.name"] = trellisSplitBy;
3831
+ }
3832
+ if (trellisKey) {
3833
+ result["trellis.value"] = trellisKey;
3834
+ }
3835
+ return result;
3836
+ };
3837
+ var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
3838
+ if (!previousPayload) {
3839
+ return true;
3840
+ }
3841
+ if (currentPayload.index !== previousPayload.index) {
3842
+ return true;
3843
+ }
3844
+ if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
3845
+ return true;
3846
+ }
3847
+ if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
3848
+ return true;
3849
+ }
3850
+ if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
3851
+ return true;
3852
+ }
3853
+ return false;
3854
+ };
3855
+ var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
3754
3856
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
3755
3857
  name: chartEvent.seriesKey
3756
3858
  });
3757
3859
  delete payload.seriesKey;
3758
3860
  if (chartEvent.rowContext) {
3759
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
3760
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3761
- });
3861
+ Object.assign(
3862
+ payload,
3863
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
3864
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3865
+ return acc;
3866
+ }, {})
3867
+ );
3762
3868
  }
3869
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3763
3870
  if (onClick) {
3764
3871
  onClick({
3765
3872
  type: "point.click",
3766
3873
  originalEvent: chartEvent,
3767
- payload
3874
+ payload: updatedPayload
3768
3875
  });
3769
3876
  }
3770
3877
  };
3771
- var handleLegendClick = (chartEvent, onClick) => {
3878
+ var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
3772
3879
  const payload = {
3773
3880
  name: chartEvent
3774
3881
  };
3882
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3775
3883
  if (onClick) {
3776
3884
  onClick({
3777
3885
  type: "legend.click",
3778
3886
  originalEvent: chartEvent,
3779
- payload
3887
+ payload: updatedPayload
3888
+ });
3889
+ }
3890
+ };
3891
+ var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3892
+ var _a;
3893
+ if (!rangeEvent) {
3894
+ return;
3895
+ }
3896
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3897
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3898
+ const payload = {
3899
+ startXIndex,
3900
+ startXValue: rangeEvent.start,
3901
+ endXIndex,
3902
+ endXValue: rangeEvent.end
3903
+ };
3904
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3905
+ if (onSelect) {
3906
+ onSelect({
3907
+ type: "range.selectBeforeZoom",
3908
+ originalEvent: rangeEvent,
3909
+ payload: updatedPayload
3780
3910
  });
3781
3911
  }
3782
3912
  };
3913
+ var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3914
+ var _a;
3915
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3916
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3917
+ const payload = {
3918
+ startXIndex,
3919
+ startXValue: rangeEvent.start,
3920
+ endXIndex,
3921
+ endXValue: rangeEvent.end
3922
+ };
3923
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3924
+ if (onSelect) {
3925
+ onSelect({
3926
+ type: "range.select",
3927
+ originalEvent: rangeEvent,
3928
+ payload: updatedPayload
3929
+ });
3930
+ }
3931
+ };
3932
+ var parseArrayOption = (value) => {
3933
+ if (Array.isArray(value)) {
3934
+ return value;
3935
+ }
3936
+ if (value) {
3937
+ return JSON.parse(value);
3938
+ }
3939
+ return void 0;
3940
+ };
3783
3941
  var TimeSeriesChartWrapper = (props) => {
3784
- const {
3942
+ var _b, _c, _d;
3943
+ const _a = props, {
3785
3944
  width,
3786
3945
  height,
3787
3946
  chartData,
@@ -3794,12 +3953,49 @@ var TimeSeriesChartWrapper = (props) => {
3794
3953
  markerDisplay,
3795
3954
  onClick,
3796
3955
  onPointMouseOver,
3797
- onPointMouseOut
3798
- } = props;
3799
- const {
3956
+ onPointMouseOut,
3957
+ onSelect,
3958
+ splitByLayout,
3959
+ trellisKey,
3960
+ trellisSplitBy,
3800
3961
  backgroundColor,
3962
+ defaultFontColor,
3963
+ additionalTooltipValues,
3964
+ showYAxisWithZero: showYAxisWithZeroFromProps,
3965
+ showY2AxisWithZero: showY2AxisWithZeroFromProps
3966
+ } = _a, otherOptions = __objRest(_a, [
3967
+ "width",
3968
+ "height",
3969
+ "chartData",
3970
+ "options",
3971
+ "userLocale",
3972
+ "annotationX",
3973
+ "annotationLabel",
3974
+ "annotationColor",
3975
+ "legendDisplay",
3976
+ "markerDisplay",
3977
+ "onClick",
3978
+ "onPointMouseOver",
3979
+ "onPointMouseOut",
3980
+ "onSelect",
3981
+ "splitByLayout",
3982
+ "trellisKey",
3983
+ "trellisSplitBy",
3984
+ "backgroundColor",
3985
+ "defaultFontColor",
3986
+ "additionalTooltipValues",
3987
+ // Extract showYAxisWithZero directly from props for accelerated render mode
3988
+ "showYAxisWithZero",
3989
+ "showY2AxisWithZero"
3990
+ ]);
3991
+ const { eventHandlers, xField: xFieldFromProps } = otherOptions;
3992
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
3993
+ const {
3994
+ backgroundColor: bgColorFromOptions,
3801
3995
  seriesColors: seriesColorsStr,
3802
3996
  fieldColors,
3997
+ legendLabels: legendLabelsStr,
3998
+ legendMode,
3803
3999
  "axisTitleX.text": xAxisTitleText,
3804
4000
  "axisTitleY.text": yAxisTitleText,
3805
4001
  "axisTitleY2.text": y2AxisTitleText,
@@ -3807,8 +4003,11 @@ var TimeSeriesChartWrapper = (props) => {
3807
4003
  "axisTitleY.visibility": yAxisTitleVisibility,
3808
4004
  "axisTitleY2.visibility": y2AxisTitleVisibility,
3809
4005
  "axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
4006
+ "axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
3810
4007
  "axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
4008
+ "axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
3811
4009
  "axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
4010
+ "axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
3812
4011
  "axisY.abbreviation": yAxisAbbreviation,
3813
4012
  "axisY.scale": yAxisScale,
3814
4013
  "axisY2.abbreviation": y2AxisAbbreviation,
@@ -3818,10 +4017,63 @@ var TimeSeriesChartWrapper = (props) => {
3818
4017
  "axisLabelsY2.integerUnits": y2IntegerUnits,
3819
4018
  "chart.overlayFields": overlayFieldsStr,
3820
4019
  "chart.nullValueMode": nullValueMode,
3821
- lineWidth
4020
+ "chart.showDataLabels": showDataLabels,
4021
+ lineWidth,
4022
+ lineDashStyle,
4023
+ fieldDashStyles: lineDashStylesByFieldStr,
4024
+ yAxisMin: yAxisMinRaw,
4025
+ yAxisMax: yAxisMaxRaw,
4026
+ y2AxisMin: y2AxisMinRaw,
4027
+ y2AxisMax: y2AxisMaxRaw,
4028
+ showXMajorGridLines,
4029
+ showYMajorGridLines,
4030
+ showY2MajorGridLines,
4031
+ showYMinorGridLines,
4032
+ showY2MinorGridLines,
4033
+ showLineSmoothing,
4034
+ yAxisMajorTickVisibility,
4035
+ y2AxisMajorTickVisibility,
4036
+ yAxisMajorTickSize,
4037
+ y2AxisMajorTickSize,
4038
+ yAxisMajorTickInterval,
4039
+ y2AxisMajorTickInterval,
4040
+ yAxisMinorTickVisibility,
4041
+ y2AxisMinorTickVisibility,
4042
+ yAxisMinorTickSize,
4043
+ y2AxisMinorTickSize,
4044
+ showYAxisWithZero: showYAxisWithZeroFromOptions,
4045
+ showY2AxisWithZero: showY2AxisWithZeroFromOptions
3822
4046
  } = options;
4047
+ const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
4048
+ const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
4049
+ const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
4050
+ const showYMajorTicks = yAxisMajorTickVisibility === "show";
4051
+ const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
4052
+ const showYMinorTicks = yAxisMinorTickVisibility === "show";
4053
+ const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
4054
+ const yAxisMin = parseAxisValue(yAxisMinRaw);
4055
+ const yAxisMax = parseAxisValue(yAxisMaxRaw);
4056
+ const y2AxisMin = parseAxisValue(y2AxisMinRaw);
4057
+ const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
4058
+ const parseTickInterval = (simpleXMLValue, canvasValue) => {
4059
+ if (simpleXMLValue) return Number(simpleXMLValue);
4060
+ if (canvasValue) return Number(canvasValue);
4061
+ return void 0;
4062
+ };
4063
+ const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
4064
+ const y2AxisMajorTickIntervalNum = parseTickInterval(
4065
+ y2AxisMajorUnitFromSimpleXML,
4066
+ y2AxisMajorTickInterval
4067
+ );
4068
+ const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
4069
+ const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
4070
+ const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
4071
+ const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
3823
4072
  const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
3824
4073
  const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
4074
+ const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
4075
+ const legendLabels = parseArrayOption(legendLabelsStr);
4076
+ const bgColor = backgroundColor || bgColorFromOptions;
3825
4077
  const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
3826
4078
  const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
3827
4079
  const cachedHandleResize = react_exports.useCallback((w, h) => {
@@ -3832,31 +4084,64 @@ var TimeSeriesChartWrapper = (props) => {
3832
4084
  fields: chartData.fields,
3833
4085
  columns: chartData.seriesList
3834
4086
  });
3835
- const xField = getFieldName(filteredChartData.fields[0]);
4087
+ const xField = getFieldName2(filteredChartData.fields[0]);
3836
4088
  const yFields = getFieldNames(
3837
4089
  filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
3838
4090
  );
3839
- const y2Fields = y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [];
3840
- const overlayFields = overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [];
4091
+ const y2Fields = (0, react_exports.useMemo)(
4092
+ () => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
4093
+ [y2FieldsStr]
4094
+ );
4095
+ const overlayFields = (0, react_exports.useMemo)(
4096
+ () => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
4097
+ [overlayFieldsStr]
4098
+ );
3841
4099
  let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
3842
4100
  xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
3843
- let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFields, yAxisTitleVisibility);
4101
+ const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
4102
+ let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
3844
4103
  yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
3845
4104
  const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
3846
4105
  let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
3847
4106
  y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
3848
- const xScaleConfig = getXScaleConfig(xAxisTitle, xAxisLabelVisibility);
3849
- const yScaleConfig = getYScaleConfig(yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility);
3850
- let y2ScaleConfig = {};
3851
- if (y2Enabled) {
3852
- y2ScaleConfig = getY2ScaleConfig(
3853
- y2AxisTitle,
3854
- y2AxisAbbreviation,
3855
- y2AxisScale,
3856
- y2IntegerUnits,
3857
- y2AxisLabelVisibility
3858
- );
3859
- }
4107
+ const xScaleConfig = (0, react_exports.useMemo)(
4108
+ () => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
4109
+ [xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
4110
+ );
4111
+ const yScaleConfig = (0, react_exports.useMemo)(
4112
+ () => getYScaleConfig(
4113
+ yAxisTitle,
4114
+ yAxisAbbreviation,
4115
+ yAxisScale,
4116
+ yAxisLabelVisibility,
4117
+ yAxisMin,
4118
+ yAxisMax
4119
+ ),
4120
+ [yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
4121
+ );
4122
+ const y2ScaleConfig = (0, react_exports.useMemo)(() => {
4123
+ if (y2Enabled) {
4124
+ return getY2ScaleConfig(
4125
+ y2AxisTitle,
4126
+ y2AxisAbbreviation,
4127
+ y2AxisScale,
4128
+ y2IntegerUnits,
4129
+ y2AxisLabelVisibility,
4130
+ y2AxisMin,
4131
+ y2AxisMax
4132
+ );
4133
+ }
4134
+ return {};
4135
+ }, [
4136
+ y2Enabled,
4137
+ y2AxisTitle,
4138
+ y2AxisAbbreviation,
4139
+ y2AxisScale,
4140
+ y2IntegerUnits,
4141
+ y2AxisLabelVisibility,
4142
+ y2AxisMin,
4143
+ y2AxisMax
4144
+ ]);
3860
4145
  const uplotContainerElement = (0, react_exports.useRef)(null);
3861
4146
  const seriesDataFormatted = [
3862
4147
  filteredChartData.columns[0],
@@ -3872,9 +4157,21 @@ var TimeSeriesChartWrapper = (props) => {
3872
4157
  overlayFields,
3873
4158
  y2Enabled,
3874
4159
  nullValueMode,
3875
- markerDisplay
4160
+ markerDisplay,
4161
+ lineDashStyle,
4162
+ lineDashStylesByField
3876
4163
  ),
3877
- [yFields, y2Fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay]
4164
+ [
4165
+ yFields,
4166
+ y2Fields,
4167
+ lineWidth,
4168
+ overlayFields,
4169
+ y2Enabled,
4170
+ nullValueMode,
4171
+ markerDisplay,
4172
+ lineDashStyle,
4173
+ lineDashStylesByField
4174
+ ]
3878
4175
  );
3879
4176
  const chartingEventAnnotations = (0, react_exports.useMemo)(
3880
4177
  () => getAnnotationsForCanvas({
@@ -3888,25 +4185,54 @@ var TimeSeriesChartWrapper = (props) => {
3888
4185
  () => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
3889
4186
  [xScaleConfig, yScaleConfig, y2ScaleConfig]
3890
4187
  );
3891
- const legend = (0, react_exports.useMemo)(() => getLegend({ legendDisplay }), [legendDisplay]);
4188
+ const legend = (0, react_exports.useMemo)(
4189
+ () => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
4190
+ [legendDisplay, legendMode]
4191
+ );
3892
4192
  const handleChartClick = react_exports.useCallback(
3893
4193
  (event) => {
3894
4194
  if (onClick) {
3895
- handleClick(event, onClick);
4195
+ handleClick(event, onClick, trellisKey, trellisSplitBy);
3896
4196
  }
3897
4197
  },
3898
- [onClick]
4198
+ [onClick, trellisKey, trellisSplitBy]
3899
4199
  );
3900
4200
  const handleChartLegendClick = react_exports.useCallback(
3901
4201
  (event) => {
3902
4202
  if (onClick) {
3903
- handleLegendClick(event, onClick);
4203
+ handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
3904
4204
  }
3905
4205
  },
3906
- [onClick]
4206
+ [onClick, trellisKey, trellisSplitBy]
4207
+ );
4208
+ const handleChartRangeSelection = react_exports.useCallback(
4209
+ (range2) => {
4210
+ if (onSelect) {
4211
+ handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
4212
+ }
4213
+ },
4214
+ [onSelect, chartData, trellisKey, trellisSplitBy]
4215
+ );
4216
+ const handleChartRangeZoom = react_exports.useCallback(
4217
+ (range2) => {
4218
+ if (onSelect) {
4219
+ handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
4220
+ }
4221
+ },
4222
+ [onSelect, chartData, trellisKey, trellisSplitBy]
4223
+ );
4224
+ const xFieldToUse = xFieldFromProps || xField;
4225
+ const enableSearchZoom = react_exports.useMemo(
4226
+ () => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
4227
+ [eventHandlers, xFieldToUse]
3907
4228
  );
3908
4229
  const lastPayloadRef = react_exports.useRef(null);
3909
4230
  const lastOriginalEventRef = react_exports.useRef(null);
4231
+ const previousMouseoverPayloadRef = react_exports.useRef(null);
4232
+ const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
4233
+ react_exports.useEffect(() => {
4234
+ additionalTooltipValuesRef.current = additionalTooltipValues;
4235
+ }, [additionalTooltipValues]);
3910
4236
  const handleChartCrosshairChange = react_exports.useCallback(
3911
4237
  (event) => {
3912
4238
  if (onPointMouseOver || onPointMouseOut) {
@@ -3918,6 +4244,7 @@ var TimeSeriesChartWrapper = (props) => {
3918
4244
  payload: lastPayloadRef.current
3919
4245
  });
3920
4246
  }
4247
+ previousMouseoverPayloadRef.current = null;
3921
4248
  return;
3922
4249
  }
3923
4250
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
@@ -3925,25 +4252,36 @@ var TimeSeriesChartWrapper = (props) => {
3925
4252
  });
3926
4253
  delete payload.seriesKey;
3927
4254
  if (event.rowContext) {
3928
- Object.keys(event.rowContext).forEach((fieldName) => {
3929
- payload[`row.${fieldName}.value`] = event.rowContext[fieldName];
3930
- });
4255
+ Object.assign(
4256
+ payload,
4257
+ Object.keys(event.rowContext).reduce((acc, fieldName) => {
4258
+ acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
4259
+ return acc;
4260
+ }, {})
4261
+ );
3931
4262
  }
3932
- lastPayloadRef.current = payload;
4263
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
4264
+ if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
4265
+ return;
4266
+ }
4267
+ lastPayloadRef.current = updatedPayload;
3933
4268
  lastOriginalEventRef.current = event;
4269
+ previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
3934
4270
  if (onPointMouseOver) {
3935
4271
  onPointMouseOver({
3936
4272
  type: "point.mouseover",
3937
4273
  originalEvent: event,
3938
- payload
4274
+ payload: updatedPayload
3939
4275
  });
3940
4276
  }
3941
4277
  }
3942
4278
  },
3943
- [onPointMouseOver, onPointMouseOut]
4279
+ [onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
3944
4280
  );
3945
- const memoizedChart = (0, react_exports.useMemo)(
3946
- () => /* @__PURE__ */ react_exports.createElement(
4281
+ 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}`;
4282
+ const memoizedChart = (0, react_exports.useMemo)(() => {
4283
+ const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
4284
+ return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
3947
4285
  visualization_canvas_exports.TimeSeriesChart,
3948
4286
  {
3949
4287
  data: chartData,
@@ -3953,49 +4291,107 @@ var TimeSeriesChartWrapper = (props) => {
3953
4291
  seriesColorsByField,
3954
4292
  seriesConfig: seriesOverrides,
3955
4293
  legend,
4294
+ legendLabels,
4295
+ isSeriesCompare: legendMode === "seriesCompare",
4296
+ maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
3956
4297
  scaleConfig,
3957
4298
  timestampFormat: "expanded",
3958
4299
  onCrosshairClick: onClick ? handleChartClick : void 0,
3959
4300
  onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
3960
4301
  onSeriesClick: onClick ? handleChartLegendClick : void 0,
4302
+ onRangeSelection: handleChartRangeSelection,
4303
+ onRangeZoom: computedOnRangeZoom,
4304
+ serverSideZoom: enableSearchZoom,
3961
4305
  userLocale,
3962
4306
  events: chartingEventAnnotations,
3963
- eventsConfig: { renderer: triangleEventAnnotationRenderer }
4307
+ eventsConfig: { renderer: triangleEventAnnotationRenderer },
4308
+ additionalTooltipValuesRef,
4309
+ showXMajorGridLines,
4310
+ showYMajorGridLines,
4311
+ showY2MajorGridLines,
4312
+ showYMinorGridLines,
4313
+ showY2MinorGridLines,
4314
+ showLineSmoothing,
4315
+ dataValuesDisplay,
4316
+ showYMajorTicks,
4317
+ showY2MajorTicks,
4318
+ yAxisMajorTickSize: yAxisMajorTickSizeNum,
4319
+ y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
4320
+ yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
4321
+ y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
4322
+ showYMinorTicks,
4323
+ showY2MinorTicks,
4324
+ yAxisMinorTickSize: yAxisMinorTickSizeNum,
4325
+ y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
4326
+ showYAxisWithZero,
4327
+ showY2AxisWithZero
3964
4328
  }
3965
- ),
3966
- [
3967
- chartData,
3968
- containerWidth,
3969
- containerHeight,
3970
- seriesColors,
3971
- seriesColorsByField,
3972
- seriesOverrides,
3973
- legend,
3974
- scaleConfig,
3975
- userLocale,
3976
- chartingEventAnnotations,
3977
- onClick,
3978
- handleChartClick,
3979
- onPointMouseOver,
3980
- onPointMouseOut,
3981
- handleChartCrosshairChange,
3982
- handleChartLegendClick
3983
- ]
3984
- );
4329
+ ));
4330
+ }, [
4331
+ onSelect,
4332
+ handleChartRangeZoom,
4333
+ dataKey,
4334
+ chartData,
4335
+ containerWidth,
4336
+ containerHeight,
4337
+ seriesColors,
4338
+ seriesColorsByField,
4339
+ seriesOverrides,
4340
+ legend,
4341
+ legendLabels,
4342
+ scaleConfig,
4343
+ onClick,
4344
+ handleChartClick,
4345
+ onPointMouseOver,
4346
+ onPointMouseOut,
4347
+ handleChartCrosshairChange,
4348
+ handleChartLegendClick,
4349
+ handleChartRangeSelection,
4350
+ enableSearchZoom,
4351
+ userLocale,
4352
+ chartingEventAnnotations,
4353
+ showXMajorGridLines,
4354
+ showYMajorGridLines,
4355
+ showY2MajorGridLines,
4356
+ showYMinorGridLines,
4357
+ showY2MinorGridLines,
4358
+ showLineSmoothing,
4359
+ dataValuesDisplay,
4360
+ showYMajorTicks,
4361
+ showY2MajorTicks,
4362
+ yAxisMajorTickSizeNum,
4363
+ y2AxisMajorTickSizeNum,
4364
+ yAxisMajorTickIntervalNum,
4365
+ y2AxisMajorTickIntervalNum,
4366
+ showYMinorTicks,
4367
+ showY2MinorTicks,
4368
+ yAxisMinorTickSizeNum,
4369
+ y2AxisMinorTickSizeNum,
4370
+ showYAxisWithZero,
4371
+ showY2AxisWithZero,
4372
+ legendMode
4373
+ ]);
3985
4374
  const memoizedVisualization = (0, react_exports.useMemo)(() => {
3986
- return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
3987
- }, [backgroundColor, memoizedChart]);
3988
- return /* @__PURE__ */ react_exports.createElement(
4375
+ return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
4376
+ }, [bgColor, memoizedChart]);
4377
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
4378
+ TrellisTitle,
4379
+ {
4380
+ trellisKey,
4381
+ backgroundColor: bgColor,
4382
+ fontColor: defaultFontColor
4383
+ }
4384
+ ), /* @__PURE__ */ react_exports.createElement(
3989
4385
  TimeSeriesChartContainer,
3990
4386
  {
3991
- height,
4387
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
3992
4388
  width,
3993
4389
  ref: uplotContainerElement,
3994
4390
  "data-test": "timeseries-chart-wrapper"
3995
4391
  },
3996
4392
  /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
3997
4393
  memoizedVisualization
3998
- );
4394
+ ));
3999
4395
  };
4000
4396
  var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
4001
4397