@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/Bar.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.',
@@ -2749,7 +2761,7 @@ var Cover = styled_components_default.div`
2749
2761
  bottom: 0;
2750
2762
  `;
2751
2763
  var Blocker = styled_components_default.div.attrs({
2752
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b"
2764
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f"
2753
2765
  })`
2754
2766
  position: relative;
2755
2767
  width: 100%;
@@ -2830,7 +2842,7 @@ var withFixedSizeContainer = (Viz) => {
2830
2842
  FixSizeItem,
2831
2843
  {
2832
2844
  "data-test": "fix-size-item",
2833
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b",
2845
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f",
2834
2846
  width,
2835
2847
  height,
2836
2848
  backgroundColor
@@ -3106,7 +3118,7 @@ var trellisUtils_default = "default" in defaultImport34 ? defaultImport34.defaul
3106
3118
  var AGGREGATIONS = "aggregations";
3107
3119
  var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
3108
3120
  var _a, _b, _c, _d;
3109
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3121
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3110
3122
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3111
3123
  let splitDataSources = null;
3112
3124
  let errorCode = null;
@@ -3127,7 +3139,7 @@ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
3127
3139
  }
3128
3140
  return { splitDataSources, errorCode };
3129
3141
  };
3130
- var toFieldEntries = (fields) => {
3142
+ var toFieldEntries = (fields = []) => {
3131
3143
  return fields.map((field) => {
3132
3144
  if (typeof field === "string") {
3133
3145
  return { name: field };
@@ -3142,7 +3154,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
3142
3154
  let splitDataSources = null;
3143
3155
  let splitByFields = [];
3144
3156
  let errorCode = null;
3145
- if (typeof fields[0] !== "string") {
3157
+ if (fields.length > 0) {
3146
3158
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
3147
3159
  }
3148
3160
  if (splitByFields && splitByFields.length > 0) {
@@ -3180,12 +3192,12 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
3180
3192
  };
3181
3193
  var dataSourcesSplitByAggregationsStats = (dataSource) => {
3182
3194
  var _a, _b, _c, _d;
3183
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3195
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3184
3196
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3185
3197
  let splitDataSources = null;
3186
3198
  let splitByFields = [];
3187
3199
  let errorCode = null;
3188
- if (typeof fields[0] !== "string") {
3200
+ if (fields.length > 0) {
3189
3201
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
3190
3202
  }
3191
3203
  if (splitByFields && splitByFields.length > 0) {
@@ -3209,12 +3221,12 @@ var dataSourcesSplitByAggregationsStats = (dataSource) => {
3209
3221
  };
3210
3222
  var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
3211
3223
  var _a, _b, _c, _d, _e;
3212
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3224
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3213
3225
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3214
3226
  let splitDataSources = null;
3215
3227
  let splitByFields = [];
3216
3228
  let errorCode = null;
3217
- if (typeof fields[0] !== "string") {
3229
+ if (fields.length > 0) {
3218
3230
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3219
3231
  }
3220
3232
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -3252,12 +3264,12 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
3252
3264
  };
3253
3265
  var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
3254
3266
  var _a, _b, _c, _d;
3255
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3267
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3256
3268
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3257
3269
  let splitDataSources = null;
3258
3270
  let splitByFields = [];
3259
3271
  let errorCode = null;
3260
- if (typeof fields[0] !== "string") {
3272
+ if (fields.length > 0) {
3261
3273
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3262
3274
  }
3263
3275
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -3345,17 +3357,15 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
3345
3357
  };
3346
3358
  var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
3347
3359
  var _a, _b, _c, _d, _e, _f;
3348
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3360
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3349
3361
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3350
3362
  let splitDataSources = null;
3351
3363
  let splitByFields = [];
3352
3364
  let errorCode = null;
3353
- if (typeof fields[0] !== "string") {
3365
+ if (fields.length > 0) {
3354
3366
  splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
3355
3367
  }
3356
- const splitByIndex = fields == null ? void 0 : fields.findIndex(
3357
- (field) => field === splitBy || field.name === splitBy
3358
- );
3368
+ const splitByIndex = fields.findIndex((field) => field.name === splitBy);
3359
3369
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
3360
3370
  const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
3361
3371
  splitDataSources = {};
@@ -3597,6 +3607,16 @@ function constructAdditionalTooltipFieldsMap({ fields, columns, additionalToolti
3597
3607
  });
3598
3608
  return map;
3599
3609
  }
3610
+ var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
3611
+ const rangeSelectEventHandler = eventHandlers.find(
3612
+ (eventHandler) => {
3613
+ var _a;
3614
+ return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
3615
+ }
3616
+ );
3617
+ const xAxisIsTime = xField === "_time";
3618
+ return !!rangeSelectEventHandler && xAxisIsTime;
3619
+ };
3600
3620
  var canvasSupportedTimeSeriesCharts = ["splunk.line"];
3601
3621
  var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
3602
3622
  return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
@@ -3617,16 +3637,31 @@ var filterChartDataFromInternalFields = (chartData) => {
3617
3637
  var convert2DArrayToNumbers = (arr) => {
3618
3638
  return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
3619
3639
  };
3640
+ var parseAxisValue = (val) => {
3641
+ if (val === void 0 || val === null || val === "auto" || val === "") {
3642
+ return void 0;
3643
+ }
3644
+ const num = typeof val === "number" ? val : Number.parseFloat(val);
3645
+ return Number.isNaN(num) ? void 0 : num;
3646
+ };
3620
3647
  var SideLegendWidth = 75;
3621
- var commonLegendProps = { center: true, fontSize: 12, largerTiles: true, hideSeriesValue: true };
3648
+ var SeriesCompareLegendWidth = 200;
3622
3649
  var getLegend = (props) => {
3623
3650
  const legendPlacement = props == null ? void 0 : props.legendDisplay;
3651
+ const { isSeriesCompare } = props;
3652
+ const commonLegendProps = {
3653
+ center: true,
3654
+ fontSize: 12,
3655
+ largerTiles: true,
3656
+ hideSeriesValue: !isSeriesCompare
3657
+ // Show values if in seriesCompare mode
3658
+ };
3624
3659
  switch (legendPlacement) {
3625
3660
  case "off":
3626
3661
  return false;
3627
3662
  case "left":
3628
3663
  return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
3629
- width: SideLegendWidth
3664
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
3630
3665
  }, commonLegendProps));
3631
3666
  case "bottom":
3632
3667
  return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
@@ -3638,7 +3673,7 @@ var getLegend = (props) => {
3638
3673
  }, commonLegendProps));
3639
3674
  default:
3640
3675
  return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
3641
- width: SideLegendWidth
3676
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
3642
3677
  }, commonLegendProps));
3643
3678
  }
3644
3679
  };
@@ -3674,22 +3709,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
3674
3709
  const end = axisTitle.slice(-halfChars);
3675
3710
  return `${start}...${end}`;
3676
3711
  };
3677
- var getFieldName = (field) => {
3712
+ var getFieldName2 = (field) => {
3678
3713
  const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
3679
3714
  return fieldName;
3680
3715
  };
3681
3716
  var getFieldNames = (fields) => {
3682
- return fields.map((field) => getFieldName(field));
3717
+ return fields.map((field) => getFieldName2(field));
3683
3718
  };
3684
- var getXScaleConfig = (label, xAxisLabelVisibility) => {
3719
+ var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
3685
3720
  const xConfig = { x: {} };
3686
3721
  xConfig.x.label = label;
3687
3722
  if (xAxisLabelVisibility === "hide") {
3688
3723
  xConfig.x.hideLabels = true;
3689
3724
  }
3725
+ if (xAxisLabelRotation !== void 0) {
3726
+ xConfig.x.labelRotation = xAxisLabelRotation;
3727
+ }
3690
3728
  return xConfig;
3691
3729
  };
3692
- var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
3730
+ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
3693
3731
  const scaleType = yAxisScale != null ? yAxisScale : "linear";
3694
3732
  const yConfig = { y: {} };
3695
3733
  yConfig.y.label = label;
@@ -3705,14 +3743,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
3705
3743
  if (yAxisLabelVisibility === "hide") {
3706
3744
  yConfig.y.hideLabels = true;
3707
3745
  }
3746
+ if (yAxisMin !== void 0 || yAxisMax !== void 0) {
3747
+ yConfig.y.range = (u, dataMin, dataMax) => {
3748
+ const min = yAxisMin != null ? yAxisMin : dataMin;
3749
+ const max = yAxisMax != null ? yAxisMax : dataMax;
3750
+ return [min, max];
3751
+ };
3752
+ }
3708
3753
  return yConfig;
3709
3754
  };
3710
- var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
3755
+ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
3711
3756
  const y2Config = { y2: {} };
3712
3757
  const scaleType = axisScale != null ? axisScale : "linear";
3713
3758
  y2Config.y2.label = label;
3714
3759
  y2Config.y2.side = "right";
3715
- y2Config.y2.showGrid = false;
3716
3760
  y2Config.y2.type = scaleType;
3717
3761
  if (axisAbbreviation !== "none") {
3718
3762
  y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
@@ -3722,9 +3766,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
3722
3766
  if (y2AxisLabelVisibility === "hide") {
3723
3767
  y2Config.y2.hideLabels = true;
3724
3768
  }
3769
+ if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
3770
+ y2Config.y2.range = (u, dataMin, dataMax) => {
3771
+ const min = y2AxisMin != null ? y2AxisMin : dataMin;
3772
+ const max = y2AxisMax != null ? y2AxisMax : dataMax;
3773
+ return [min, max];
3774
+ };
3775
+ }
3725
3776
  return y2Config;
3726
3777
  };
3727
- var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
3778
+ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
3728
3779
  const seriesConfig = {};
3729
3780
  let spanGaps;
3730
3781
  let replaceNullsWithZero;
@@ -3759,12 +3810,45 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
3759
3810
  if (markerDisplay !== void 0) {
3760
3811
  seriesConfig[field].markerDisplay = markerDisplay;
3761
3812
  }
3813
+ const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
3814
+ if (fieldDashStyle) {
3815
+ seriesConfig[field].lineDashStyle = fieldDashStyle;
3816
+ }
3762
3817
  if (replaceNullsWithZero !== void 0) {
3763
3818
  seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
3764
3819
  }
3765
3820
  });
3766
3821
  return seriesConfig;
3767
3822
  };
3823
+ var findRangeIndices = (xData, startValue, endValue) => {
3824
+ let startXIndex = -1;
3825
+ let endXIndex = -1;
3826
+ const xDataEpoch = xData.map((val) => {
3827
+ if (typeof val === "string") {
3828
+ return new Date(val).getTime() / 1e3;
3829
+ }
3830
+ return val;
3831
+ });
3832
+ for (let i = 0; i < xDataEpoch.length; i += 1) {
3833
+ if (xDataEpoch[i] >= startValue) {
3834
+ startXIndex = i;
3835
+ break;
3836
+ }
3837
+ }
3838
+ if (startXIndex === -1 && xDataEpoch.length > 0) {
3839
+ startXIndex = xDataEpoch.length - 1;
3840
+ }
3841
+ for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
3842
+ if (xDataEpoch[i] <= endValue) {
3843
+ endXIndex = i;
3844
+ break;
3845
+ }
3846
+ }
3847
+ if (endXIndex === -1 && xDataEpoch.length > 0) {
3848
+ endXIndex = 0;
3849
+ }
3850
+ return { startXIndex, endXIndex };
3851
+ };
3768
3852
 
3769
3853
  // src/common/TimeSeriesChartWrapper.tsx
3770
3854
  var TimeSeriesChartContainer = styled_components_default.div`
@@ -3775,38 +3859,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
3775
3859
  position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
3776
3860
  }
3777
3861
  `;
3778
- var handleClick = (chartEvent, onClick) => {
3862
+ var appendTrellisToPayload2 = (payload, trellisKey, trellisSplitBy) => {
3863
+ const result = __spreadValues({}, payload);
3864
+ if (trellisSplitBy) {
3865
+ result["trellis.name"] = trellisSplitBy;
3866
+ }
3867
+ if (trellisKey) {
3868
+ result["trellis.value"] = trellisKey;
3869
+ }
3870
+ return result;
3871
+ };
3872
+ var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
3873
+ if (!previousPayload) {
3874
+ return true;
3875
+ }
3876
+ if (currentPayload.index !== previousPayload.index) {
3877
+ return true;
3878
+ }
3879
+ if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
3880
+ return true;
3881
+ }
3882
+ if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
3883
+ return true;
3884
+ }
3885
+ if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
3886
+ return true;
3887
+ }
3888
+ return false;
3889
+ };
3890
+ var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
3779
3891
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
3780
3892
  name: chartEvent.seriesKey
3781
3893
  });
3782
3894
  delete payload.seriesKey;
3783
3895
  if (chartEvent.rowContext) {
3784
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
3785
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3786
- });
3896
+ Object.assign(
3897
+ payload,
3898
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
3899
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3900
+ return acc;
3901
+ }, {})
3902
+ );
3787
3903
  }
3904
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3788
3905
  if (onClick) {
3789
3906
  onClick({
3790
3907
  type: "point.click",
3791
3908
  originalEvent: chartEvent,
3792
- payload
3909
+ payload: updatedPayload
3793
3910
  });
3794
3911
  }
3795
3912
  };
3796
- var handleLegendClick = (chartEvent, onClick) => {
3913
+ var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
3797
3914
  const payload = {
3798
3915
  name: chartEvent
3799
3916
  };
3917
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3800
3918
  if (onClick) {
3801
3919
  onClick({
3802
3920
  type: "legend.click",
3803
3921
  originalEvent: chartEvent,
3804
- payload
3922
+ payload: updatedPayload
3923
+ });
3924
+ }
3925
+ };
3926
+ var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3927
+ var _a;
3928
+ if (!rangeEvent) {
3929
+ return;
3930
+ }
3931
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3932
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3933
+ const payload = {
3934
+ startXIndex,
3935
+ startXValue: rangeEvent.start,
3936
+ endXIndex,
3937
+ endXValue: rangeEvent.end
3938
+ };
3939
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3940
+ if (onSelect) {
3941
+ onSelect({
3942
+ type: "range.selectBeforeZoom",
3943
+ originalEvent: rangeEvent,
3944
+ payload: updatedPayload
3805
3945
  });
3806
3946
  }
3807
3947
  };
3948
+ var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3949
+ var _a;
3950
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3951
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3952
+ const payload = {
3953
+ startXIndex,
3954
+ startXValue: rangeEvent.start,
3955
+ endXIndex,
3956
+ endXValue: rangeEvent.end
3957
+ };
3958
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
3959
+ if (onSelect) {
3960
+ onSelect({
3961
+ type: "range.select",
3962
+ originalEvent: rangeEvent,
3963
+ payload: updatedPayload
3964
+ });
3965
+ }
3966
+ };
3967
+ var parseArrayOption = (value) => {
3968
+ if (Array.isArray(value)) {
3969
+ return value;
3970
+ }
3971
+ if (value) {
3972
+ return JSON.parse(value);
3973
+ }
3974
+ return void 0;
3975
+ };
3808
3976
  var TimeSeriesChartWrapper = (props) => {
3809
- const {
3977
+ var _b, _c, _d;
3978
+ const _a = props, {
3810
3979
  width,
3811
3980
  height,
3812
3981
  chartData,
@@ -3819,12 +3988,49 @@ var TimeSeriesChartWrapper = (props) => {
3819
3988
  markerDisplay,
3820
3989
  onClick,
3821
3990
  onPointMouseOver,
3822
- onPointMouseOut
3823
- } = props;
3824
- const {
3991
+ onPointMouseOut,
3992
+ onSelect,
3993
+ splitByLayout,
3994
+ trellisKey,
3995
+ trellisSplitBy,
3825
3996
  backgroundColor,
3997
+ defaultFontColor,
3998
+ additionalTooltipValues,
3999
+ showYAxisWithZero: showYAxisWithZeroFromProps,
4000
+ showY2AxisWithZero: showY2AxisWithZeroFromProps
4001
+ } = _a, otherOptions = __objRest(_a, [
4002
+ "width",
4003
+ "height",
4004
+ "chartData",
4005
+ "options",
4006
+ "userLocale",
4007
+ "annotationX",
4008
+ "annotationLabel",
4009
+ "annotationColor",
4010
+ "legendDisplay",
4011
+ "markerDisplay",
4012
+ "onClick",
4013
+ "onPointMouseOver",
4014
+ "onPointMouseOut",
4015
+ "onSelect",
4016
+ "splitByLayout",
4017
+ "trellisKey",
4018
+ "trellisSplitBy",
4019
+ "backgroundColor",
4020
+ "defaultFontColor",
4021
+ "additionalTooltipValues",
4022
+ // Extract showYAxisWithZero directly from props for accelerated render mode
4023
+ "showYAxisWithZero",
4024
+ "showY2AxisWithZero"
4025
+ ]);
4026
+ const { eventHandlers, xField: xFieldFromProps } = otherOptions;
4027
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
4028
+ const {
4029
+ backgroundColor: bgColorFromOptions,
3826
4030
  seriesColors: seriesColorsStr,
3827
4031
  fieldColors,
4032
+ legendLabels: legendLabelsStr,
4033
+ legendMode,
3828
4034
  "axisTitleX.text": xAxisTitleText,
3829
4035
  "axisTitleY.text": yAxisTitleText,
3830
4036
  "axisTitleY2.text": y2AxisTitleText,
@@ -3832,8 +4038,11 @@ var TimeSeriesChartWrapper = (props) => {
3832
4038
  "axisTitleY.visibility": yAxisTitleVisibility,
3833
4039
  "axisTitleY2.visibility": y2AxisTitleVisibility,
3834
4040
  "axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
4041
+ "axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
3835
4042
  "axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
4043
+ "axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
3836
4044
  "axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
4045
+ "axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
3837
4046
  "axisY.abbreviation": yAxisAbbreviation,
3838
4047
  "axisY.scale": yAxisScale,
3839
4048
  "axisY2.abbreviation": y2AxisAbbreviation,
@@ -3843,10 +4052,63 @@ var TimeSeriesChartWrapper = (props) => {
3843
4052
  "axisLabelsY2.integerUnits": y2IntegerUnits,
3844
4053
  "chart.overlayFields": overlayFieldsStr,
3845
4054
  "chart.nullValueMode": nullValueMode,
3846
- lineWidth
4055
+ "chart.showDataLabels": showDataLabels,
4056
+ lineWidth,
4057
+ lineDashStyle,
4058
+ fieldDashStyles: lineDashStylesByFieldStr,
4059
+ yAxisMin: yAxisMinRaw,
4060
+ yAxisMax: yAxisMaxRaw,
4061
+ y2AxisMin: y2AxisMinRaw,
4062
+ y2AxisMax: y2AxisMaxRaw,
4063
+ showXMajorGridLines,
4064
+ showYMajorGridLines,
4065
+ showY2MajorGridLines,
4066
+ showYMinorGridLines,
4067
+ showY2MinorGridLines,
4068
+ showLineSmoothing,
4069
+ yAxisMajorTickVisibility,
4070
+ y2AxisMajorTickVisibility,
4071
+ yAxisMajorTickSize,
4072
+ y2AxisMajorTickSize,
4073
+ yAxisMajorTickInterval,
4074
+ y2AxisMajorTickInterval,
4075
+ yAxisMinorTickVisibility,
4076
+ y2AxisMinorTickVisibility,
4077
+ yAxisMinorTickSize,
4078
+ y2AxisMinorTickSize,
4079
+ showYAxisWithZero: showYAxisWithZeroFromOptions,
4080
+ showY2AxisWithZero: showY2AxisWithZeroFromOptions
3847
4081
  } = options;
4082
+ const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
4083
+ const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
4084
+ const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
4085
+ const showYMajorTicks = yAxisMajorTickVisibility === "show";
4086
+ const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
4087
+ const showYMinorTicks = yAxisMinorTickVisibility === "show";
4088
+ const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
4089
+ const yAxisMin = parseAxisValue(yAxisMinRaw);
4090
+ const yAxisMax = parseAxisValue(yAxisMaxRaw);
4091
+ const y2AxisMin = parseAxisValue(y2AxisMinRaw);
4092
+ const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
4093
+ const parseTickInterval = (simpleXMLValue, canvasValue) => {
4094
+ if (simpleXMLValue) return Number(simpleXMLValue);
4095
+ if (canvasValue) return Number(canvasValue);
4096
+ return void 0;
4097
+ };
4098
+ const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
4099
+ const y2AxisMajorTickIntervalNum = parseTickInterval(
4100
+ y2AxisMajorUnitFromSimpleXML,
4101
+ y2AxisMajorTickInterval
4102
+ );
4103
+ const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
4104
+ const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
4105
+ const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
4106
+ const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
3848
4107
  const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
3849
4108
  const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
4109
+ const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
4110
+ const legendLabels = parseArrayOption(legendLabelsStr);
4111
+ const bgColor = backgroundColor || bgColorFromOptions;
3850
4112
  const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
3851
4113
  const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
3852
4114
  const cachedHandleResize = react_exports.useCallback((w, h) => {
@@ -3857,31 +4119,64 @@ var TimeSeriesChartWrapper = (props) => {
3857
4119
  fields: chartData.fields,
3858
4120
  columns: chartData.seriesList
3859
4121
  });
3860
- const xField = getFieldName(filteredChartData.fields[0]);
4122
+ const xField = getFieldName2(filteredChartData.fields[0]);
3861
4123
  const yFields = getFieldNames(
3862
4124
  filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
3863
4125
  );
3864
- const y2Fields = y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [];
3865
- const overlayFields = overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [];
4126
+ const y2Fields = (0, react_exports.useMemo)(
4127
+ () => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
4128
+ [y2FieldsStr]
4129
+ );
4130
+ const overlayFields = (0, react_exports.useMemo)(
4131
+ () => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
4132
+ [overlayFieldsStr]
4133
+ );
3866
4134
  let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
3867
4135
  xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
3868
- let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFields, yAxisTitleVisibility);
4136
+ const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
4137
+ let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
3869
4138
  yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
3870
4139
  const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
3871
4140
  let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
3872
4141
  y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
3873
- const xScaleConfig = getXScaleConfig(xAxisTitle, xAxisLabelVisibility);
3874
- const yScaleConfig = getYScaleConfig(yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility);
3875
- let y2ScaleConfig = {};
3876
- if (y2Enabled) {
3877
- y2ScaleConfig = getY2ScaleConfig(
3878
- y2AxisTitle,
3879
- y2AxisAbbreviation,
3880
- y2AxisScale,
3881
- y2IntegerUnits,
3882
- y2AxisLabelVisibility
3883
- );
3884
- }
4142
+ const xScaleConfig = (0, react_exports.useMemo)(
4143
+ () => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
4144
+ [xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
4145
+ );
4146
+ const yScaleConfig = (0, react_exports.useMemo)(
4147
+ () => getYScaleConfig(
4148
+ yAxisTitle,
4149
+ yAxisAbbreviation,
4150
+ yAxisScale,
4151
+ yAxisLabelVisibility,
4152
+ yAxisMin,
4153
+ yAxisMax
4154
+ ),
4155
+ [yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
4156
+ );
4157
+ const y2ScaleConfig = (0, react_exports.useMemo)(() => {
4158
+ if (y2Enabled) {
4159
+ return getY2ScaleConfig(
4160
+ y2AxisTitle,
4161
+ y2AxisAbbreviation,
4162
+ y2AxisScale,
4163
+ y2IntegerUnits,
4164
+ y2AxisLabelVisibility,
4165
+ y2AxisMin,
4166
+ y2AxisMax
4167
+ );
4168
+ }
4169
+ return {};
4170
+ }, [
4171
+ y2Enabled,
4172
+ y2AxisTitle,
4173
+ y2AxisAbbreviation,
4174
+ y2AxisScale,
4175
+ y2IntegerUnits,
4176
+ y2AxisLabelVisibility,
4177
+ y2AxisMin,
4178
+ y2AxisMax
4179
+ ]);
3885
4180
  const uplotContainerElement = (0, react_exports.useRef)(null);
3886
4181
  const seriesDataFormatted = [
3887
4182
  filteredChartData.columns[0],
@@ -3897,9 +4192,21 @@ var TimeSeriesChartWrapper = (props) => {
3897
4192
  overlayFields,
3898
4193
  y2Enabled,
3899
4194
  nullValueMode,
3900
- markerDisplay
4195
+ markerDisplay,
4196
+ lineDashStyle,
4197
+ lineDashStylesByField
3901
4198
  ),
3902
- [yFields, y2Fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay]
4199
+ [
4200
+ yFields,
4201
+ y2Fields,
4202
+ lineWidth,
4203
+ overlayFields,
4204
+ y2Enabled,
4205
+ nullValueMode,
4206
+ markerDisplay,
4207
+ lineDashStyle,
4208
+ lineDashStylesByField
4209
+ ]
3903
4210
  );
3904
4211
  const chartingEventAnnotations = (0, react_exports.useMemo)(
3905
4212
  () => getAnnotationsForCanvas({
@@ -3913,25 +4220,54 @@ var TimeSeriesChartWrapper = (props) => {
3913
4220
  () => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
3914
4221
  [xScaleConfig, yScaleConfig, y2ScaleConfig]
3915
4222
  );
3916
- const legend = (0, react_exports.useMemo)(() => getLegend({ legendDisplay }), [legendDisplay]);
4223
+ const legend = (0, react_exports.useMemo)(
4224
+ () => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
4225
+ [legendDisplay, legendMode]
4226
+ );
3917
4227
  const handleChartClick = react_exports.useCallback(
3918
4228
  (event) => {
3919
4229
  if (onClick) {
3920
- handleClick(event, onClick);
4230
+ handleClick(event, onClick, trellisKey, trellisSplitBy);
3921
4231
  }
3922
4232
  },
3923
- [onClick]
4233
+ [onClick, trellisKey, trellisSplitBy]
3924
4234
  );
3925
4235
  const handleChartLegendClick = react_exports.useCallback(
3926
4236
  (event) => {
3927
4237
  if (onClick) {
3928
- handleLegendClick(event, onClick);
4238
+ handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
3929
4239
  }
3930
4240
  },
3931
- [onClick]
4241
+ [onClick, trellisKey, trellisSplitBy]
4242
+ );
4243
+ const handleChartRangeSelection = react_exports.useCallback(
4244
+ (range2) => {
4245
+ if (onSelect) {
4246
+ handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
4247
+ }
4248
+ },
4249
+ [onSelect, chartData, trellisKey, trellisSplitBy]
4250
+ );
4251
+ const handleChartRangeZoom = react_exports.useCallback(
4252
+ (range2) => {
4253
+ if (onSelect) {
4254
+ handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
4255
+ }
4256
+ },
4257
+ [onSelect, chartData, trellisKey, trellisSplitBy]
4258
+ );
4259
+ const xFieldToUse = xFieldFromProps || xField;
4260
+ const enableSearchZoom = react_exports.useMemo(
4261
+ () => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
4262
+ [eventHandlers, xFieldToUse]
3932
4263
  );
3933
4264
  const lastPayloadRef = react_exports.useRef(null);
3934
4265
  const lastOriginalEventRef = react_exports.useRef(null);
4266
+ const previousMouseoverPayloadRef = react_exports.useRef(null);
4267
+ const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
4268
+ react_exports.useEffect(() => {
4269
+ additionalTooltipValuesRef.current = additionalTooltipValues;
4270
+ }, [additionalTooltipValues]);
3935
4271
  const handleChartCrosshairChange = react_exports.useCallback(
3936
4272
  (event) => {
3937
4273
  if (onPointMouseOver || onPointMouseOut) {
@@ -3943,6 +4279,7 @@ var TimeSeriesChartWrapper = (props) => {
3943
4279
  payload: lastPayloadRef.current
3944
4280
  });
3945
4281
  }
4282
+ previousMouseoverPayloadRef.current = null;
3946
4283
  return;
3947
4284
  }
3948
4285
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
@@ -3950,25 +4287,36 @@ var TimeSeriesChartWrapper = (props) => {
3950
4287
  });
3951
4288
  delete payload.seriesKey;
3952
4289
  if (event.rowContext) {
3953
- Object.keys(event.rowContext).forEach((fieldName) => {
3954
- payload[`row.${fieldName}.value`] = event.rowContext[fieldName];
3955
- });
4290
+ Object.assign(
4291
+ payload,
4292
+ Object.keys(event.rowContext).reduce((acc, fieldName) => {
4293
+ acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
4294
+ return acc;
4295
+ }, {})
4296
+ );
3956
4297
  }
3957
- lastPayloadRef.current = payload;
4298
+ const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
4299
+ if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
4300
+ return;
4301
+ }
4302
+ lastPayloadRef.current = updatedPayload;
3958
4303
  lastOriginalEventRef.current = event;
4304
+ previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
3959
4305
  if (onPointMouseOver) {
3960
4306
  onPointMouseOver({
3961
4307
  type: "point.mouseover",
3962
4308
  originalEvent: event,
3963
- payload
4309
+ payload: updatedPayload
3964
4310
  });
3965
4311
  }
3966
4312
  }
3967
4313
  },
3968
- [onPointMouseOver, onPointMouseOut]
4314
+ [onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
3969
4315
  );
3970
- const memoizedChart = (0, react_exports.useMemo)(
3971
- () => /* @__PURE__ */ react_exports.createElement(
4316
+ 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}`;
4317
+ const memoizedChart = (0, react_exports.useMemo)(() => {
4318
+ const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
4319
+ return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
3972
4320
  visualization_canvas_exports.TimeSeriesChart,
3973
4321
  {
3974
4322
  data: chartData,
@@ -3978,49 +4326,107 @@ var TimeSeriesChartWrapper = (props) => {
3978
4326
  seriesColorsByField,
3979
4327
  seriesConfig: seriesOverrides,
3980
4328
  legend,
4329
+ legendLabels,
4330
+ isSeriesCompare: legendMode === "seriesCompare",
4331
+ maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
3981
4332
  scaleConfig,
3982
4333
  timestampFormat: "expanded",
3983
4334
  onCrosshairClick: onClick ? handleChartClick : void 0,
3984
4335
  onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
3985
4336
  onSeriesClick: onClick ? handleChartLegendClick : void 0,
4337
+ onRangeSelection: handleChartRangeSelection,
4338
+ onRangeZoom: computedOnRangeZoom,
4339
+ serverSideZoom: enableSearchZoom,
3986
4340
  userLocale,
3987
4341
  events: chartingEventAnnotations,
3988
- eventsConfig: { renderer: triangleEventAnnotationRenderer }
4342
+ eventsConfig: { renderer: triangleEventAnnotationRenderer },
4343
+ additionalTooltipValuesRef,
4344
+ showXMajorGridLines,
4345
+ showYMajorGridLines,
4346
+ showY2MajorGridLines,
4347
+ showYMinorGridLines,
4348
+ showY2MinorGridLines,
4349
+ showLineSmoothing,
4350
+ dataValuesDisplay,
4351
+ showYMajorTicks,
4352
+ showY2MajorTicks,
4353
+ yAxisMajorTickSize: yAxisMajorTickSizeNum,
4354
+ y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
4355
+ yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
4356
+ y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
4357
+ showYMinorTicks,
4358
+ showY2MinorTicks,
4359
+ yAxisMinorTickSize: yAxisMinorTickSizeNum,
4360
+ y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
4361
+ showYAxisWithZero,
4362
+ showY2AxisWithZero
3989
4363
  }
3990
- ),
3991
- [
3992
- chartData,
3993
- containerWidth,
3994
- containerHeight,
3995
- seriesColors,
3996
- seriesColorsByField,
3997
- seriesOverrides,
3998
- legend,
3999
- scaleConfig,
4000
- userLocale,
4001
- chartingEventAnnotations,
4002
- onClick,
4003
- handleChartClick,
4004
- onPointMouseOver,
4005
- onPointMouseOut,
4006
- handleChartCrosshairChange,
4007
- handleChartLegendClick
4008
- ]
4009
- );
4364
+ ));
4365
+ }, [
4366
+ onSelect,
4367
+ handleChartRangeZoom,
4368
+ dataKey,
4369
+ chartData,
4370
+ containerWidth,
4371
+ containerHeight,
4372
+ seriesColors,
4373
+ seriesColorsByField,
4374
+ seriesOverrides,
4375
+ legend,
4376
+ legendLabels,
4377
+ scaleConfig,
4378
+ onClick,
4379
+ handleChartClick,
4380
+ onPointMouseOver,
4381
+ onPointMouseOut,
4382
+ handleChartCrosshairChange,
4383
+ handleChartLegendClick,
4384
+ handleChartRangeSelection,
4385
+ enableSearchZoom,
4386
+ userLocale,
4387
+ chartingEventAnnotations,
4388
+ showXMajorGridLines,
4389
+ showYMajorGridLines,
4390
+ showY2MajorGridLines,
4391
+ showYMinorGridLines,
4392
+ showY2MinorGridLines,
4393
+ showLineSmoothing,
4394
+ dataValuesDisplay,
4395
+ showYMajorTicks,
4396
+ showY2MajorTicks,
4397
+ yAxisMajorTickSizeNum,
4398
+ y2AxisMajorTickSizeNum,
4399
+ yAxisMajorTickIntervalNum,
4400
+ y2AxisMajorTickIntervalNum,
4401
+ showYMinorTicks,
4402
+ showY2MinorTicks,
4403
+ yAxisMinorTickSizeNum,
4404
+ y2AxisMinorTickSizeNum,
4405
+ showYAxisWithZero,
4406
+ showY2AxisWithZero,
4407
+ legendMode
4408
+ ]);
4010
4409
  const memoizedVisualization = (0, react_exports.useMemo)(() => {
4011
- return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
4012
- }, [backgroundColor, memoizedChart]);
4013
- return /* @__PURE__ */ react_exports.createElement(
4410
+ return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
4411
+ }, [bgColor, memoizedChart]);
4412
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
4413
+ TrellisTitle,
4414
+ {
4415
+ trellisKey,
4416
+ backgroundColor: bgColor,
4417
+ fontColor: defaultFontColor
4418
+ }
4419
+ ), /* @__PURE__ */ react_exports.createElement(
4014
4420
  TimeSeriesChartContainer,
4015
4421
  {
4016
- height,
4422
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
4017
4423
  width,
4018
4424
  ref: uplotContainerElement,
4019
4425
  "data-test": "timeseries-chart-wrapper"
4020
4426
  },
4021
4427
  /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
4022
4428
  memoizedVisualization
4023
- );
4429
+ ));
4024
4430
  };
4025
4431
  var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
4026
4432