@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
@@ -346,7 +346,6 @@ var computeText = ({
346
346
  }) => {
347
347
  let text = (0, numberUtils_exports.isNumerial)(value) ? (0, numberUtils_exports.formatNumber)(value, numberPrecision, {
348
348
  useThousandSeparators: shouldUseThousandSeparators,
349
- // todo: need update formatNumber
350
349
  useTrendUnits: shouldAbbreviateValue
351
350
  }) : value;
352
351
  text = text || "";
@@ -423,13 +422,10 @@ var getTrendFontSize = ({ width, height, trendText, spaceRatio = 1 }) => {
423
422
  return trendFontSize;
424
423
  };
425
424
  var getUnderLabelHeight = (height) => height > DEFAULT_FONT ? DEFAULT_FONT : height;
426
- var getUnderLabel = ({ underLabel, width, height }) => (
427
- // todo: may need truncate underLabel later
428
- computeFontSize(underLabel, {
429
- width,
430
- height
431
- })
432
- );
425
+ var getUnderLabel = ({ underLabel, width, height }) => computeFontSize(underLabel, {
426
+ width,
427
+ height
428
+ });
433
429
  var getMajorAndTrend = ({
434
430
  width,
435
431
  height,
@@ -603,16 +599,19 @@ var computeSingleValueContent = ({
603
599
  smallVizProps
604
600
  };
605
601
  };
606
- var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled = false, trellisSplitBy = "", trellisKey = "") => onValueClick(__spreadProps(__spreadValues({}, ev), {
607
- payload: __spreadValues({
608
- trendValue,
609
- value: majorValue,
610
- name: majorValueField
611
- }, trellisEnabled && {
612
- "trellis.name": trellisSplitBy,
613
- "trellis.value": trellisKey
614
- })
615
- }));
602
+ var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisContext = {}) => {
603
+ const { trellisEnabled = false, trellisSplitBy = "", trellisKey = "" } = trellisContext;
604
+ return onValueClick(__spreadProps(__spreadValues({}, ev), {
605
+ payload: __spreadValues({
606
+ trendValue,
607
+ value: majorValue,
608
+ name: majorValueField
609
+ }, trellisEnabled && {
610
+ "trellis.name": trellisSplitBy,
611
+ "trellis.value": trellisKey
612
+ })
613
+ }));
614
+ };
616
615
  var getTrendColorWithPercent = (options) => {
617
616
  const shouldUsePercentTrendColor = options.trendColor === "> trendValue | rangeValue(trendColorEditorConfig)" && options.trendDisplay === "percent";
618
617
  return shouldUsePercentTrendColor ? {
@@ -1196,16 +1195,11 @@ var SingleValueIcon = (_a) => {
1196
1195
  });
1197
1196
  const trellisEnabled = useTrellisEnabled(splitByLayout);
1198
1197
  const handleValueClick = (0, react_exports.useCallback)(
1199
- (ev) => handleValueClickCallback(
1200
- ev,
1201
- majorValue,
1202
- majorValueField,
1203
- trendValue,
1204
- onValueClick,
1198
+ (ev) => handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick, {
1205
1199
  trellisEnabled,
1206
1200
  trellisSplitBy,
1207
1201
  trellisKey
1208
- ),
1202
+ }),
1209
1203
  [onValueClick, majorValue, majorValueField, trendValue, trellisEnabled, trellisSplitBy, trellisKey]
1210
1204
  );
1211
1205
  const renderVisualization = () => {
@@ -1768,7 +1762,7 @@ var Cover = styled_components_default.div`
1768
1762
  bottom: 0;
1769
1763
  `;
1770
1764
  var Blocker = styled_components_default.div.attrs({
1771
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b"
1765
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f"
1772
1766
  })`
1773
1767
  position: relative;
1774
1768
  width: 100%;
@@ -1858,7 +1852,7 @@ var withFixedSizeContainer = (Viz) => {
1858
1852
  FixSizeItem,
1859
1853
  {
1860
1854
  "data-test": "fix-size-item",
1861
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b",
1855
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f",
1862
1856
  width,
1863
1857
  height,
1864
1858
  backgroundColor
@@ -1945,6 +1939,7 @@ var withPlaceholder = (Visualization, useIconPlaceholder = shouldShowIconPlaceho
1945
1939
  var withPlaceholder_default = withPlaceholder;
1946
1940
 
1947
1941
  // src/common/utils/dataUtils.ts
1942
+ var getFieldName = (field) => typeof field === "string" ? field : field.name;
1948
1943
  var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
1949
1944
  const dataLength = data.length;
1950
1945
  const downsampledIndices = [];
@@ -2061,9 +2056,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
2061
2056
  let xColumn = [];
2062
2057
  const yColumns = [];
2063
2058
  const canDownsample = !ds.data.fields.some((field, index) => {
2064
- var _a, _b;
2065
- const fieldName = (_a = field.name) != null ? _a : field;
2066
- const fieldType = (_b = fieldTypes[index]) != null ? _b : "unknown";
2059
+ var _a;
2060
+ const fieldName = getFieldName(field);
2061
+ const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
2067
2062
  const column = ds.data.columns[index];
2068
2063
  let hasDisplayedColumnThatCantBeDownsampled = false;
2069
2064
  if (fieldName === xField) {
@@ -2350,7 +2345,7 @@ var trellisUtils_default = "default" in defaultImport39 ? defaultImport39.defaul
2350
2345
  var AGGREGATIONS = "aggregations";
2351
2346
  var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
2352
2347
  var _a, _b, _c, _d;
2353
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2348
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2354
2349
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2355
2350
  let splitDataSources = null;
2356
2351
  let errorCode = null;
@@ -2371,7 +2366,7 @@ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
2371
2366
  }
2372
2367
  return { splitDataSources, errorCode };
2373
2368
  };
2374
- var toFieldEntries = (fields) => {
2369
+ var toFieldEntries = (fields = []) => {
2375
2370
  return fields.map((field) => {
2376
2371
  if (typeof field === "string") {
2377
2372
  return { name: field };
@@ -2386,7 +2381,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
2386
2381
  let splitDataSources = null;
2387
2382
  let splitByFields = [];
2388
2383
  let errorCode = null;
2389
- if (typeof fields[0] !== "string") {
2384
+ if (fields.length > 0) {
2390
2385
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2391
2386
  }
2392
2387
  if (splitByFields && splitByFields.length > 0) {
@@ -2424,12 +2419,12 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
2424
2419
  };
2425
2420
  var dataSourcesSplitByAggregationsStats = (dataSource) => {
2426
2421
  var _a, _b, _c, _d;
2427
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2422
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2428
2423
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2429
2424
  let splitDataSources = null;
2430
2425
  let splitByFields = [];
2431
2426
  let errorCode = null;
2432
- if (typeof fields[0] !== "string") {
2427
+ if (fields.length > 0) {
2433
2428
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
2434
2429
  }
2435
2430
  if (splitByFields && splitByFields.length > 0) {
@@ -2453,12 +2448,12 @@ var dataSourcesSplitByAggregationsStats = (dataSource) => {
2453
2448
  };
2454
2449
  var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
2455
2450
  var _a, _b, _c, _d, _e;
2456
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2451
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2457
2452
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2458
2453
  let splitDataSources = null;
2459
2454
  let splitByFields = [];
2460
2455
  let errorCode = null;
2461
- if (typeof fields[0] !== "string") {
2456
+ if (fields.length > 0) {
2462
2457
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
2463
2458
  }
2464
2459
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -2496,12 +2491,12 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
2496
2491
  };
2497
2492
  var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
2498
2493
  var _a, _b, _c, _d;
2499
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2494
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2500
2495
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2501
2496
  let splitDataSources = null;
2502
2497
  let splitByFields = [];
2503
2498
  let errorCode = null;
2504
- if (typeof fields[0] !== "string") {
2499
+ if (fields.length > 0) {
2505
2500
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
2506
2501
  }
2507
2502
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -2589,17 +2584,15 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
2589
2584
  };
2590
2585
  var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
2591
2586
  var _a, _b, _c, _d, _e, _f;
2592
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2587
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2593
2588
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2594
2589
  let splitDataSources = null;
2595
2590
  let splitByFields = [];
2596
2591
  let errorCode = null;
2597
- if (typeof fields[0] !== "string") {
2592
+ if (fields.length > 0) {
2598
2593
  splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
2599
2594
  }
2600
- const splitByIndex = fields == null ? void 0 : fields.findIndex(
2601
- (field) => field === splitBy || field.name === splitBy
2602
- );
2595
+ const splitByIndex = fields.findIndex((field) => field.name === splitBy);
2603
2596
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
2604
2597
  const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
2605
2598
  splitDataSources = {};
@@ -2734,6 +2727,16 @@ var triangleEventAnnotationRenderer = ({
2734
2727
  eventColor: eventWithColor.color
2735
2728
  });
2736
2729
  };
2730
+ var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
2731
+ const rangeSelectEventHandler = eventHandlers.find(
2732
+ (eventHandler) => {
2733
+ var _a;
2734
+ return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
2735
+ }
2736
+ );
2737
+ const xAxisIsTime = xField === "_time";
2738
+ return !!rangeSelectEventHandler && xAxisIsTime;
2739
+ };
2737
2740
  var canvasSupportedTimeSeriesCharts = ["splunk.line"];
2738
2741
  var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
2739
2742
  return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
@@ -2754,16 +2757,31 @@ var filterChartDataFromInternalFields = (chartData) => {
2754
2757
  var convert2DArrayToNumbers = (arr) => {
2755
2758
  return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
2756
2759
  };
2760
+ var parseAxisValue = (val) => {
2761
+ if (val === void 0 || val === null || val === "auto" || val === "") {
2762
+ return void 0;
2763
+ }
2764
+ const num = typeof val === "number" ? val : Number.parseFloat(val);
2765
+ return Number.isNaN(num) ? void 0 : num;
2766
+ };
2757
2767
  var SideLegendWidth = 75;
2758
- var commonLegendProps = { center: true, fontSize: 12, largerTiles: true, hideSeriesValue: true };
2768
+ var SeriesCompareLegendWidth = 200;
2759
2769
  var getLegend = (props) => {
2760
2770
  const legendPlacement = props == null ? void 0 : props.legendDisplay;
2771
+ const { isSeriesCompare } = props;
2772
+ const commonLegendProps = {
2773
+ center: true,
2774
+ fontSize: 12,
2775
+ largerTiles: true,
2776
+ hideSeriesValue: !isSeriesCompare
2777
+ // Show values if in seriesCompare mode
2778
+ };
2761
2779
  switch (legendPlacement) {
2762
2780
  case "off":
2763
2781
  return false;
2764
2782
  case "left":
2765
2783
  return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
2766
- width: SideLegendWidth
2784
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
2767
2785
  }, commonLegendProps));
2768
2786
  case "bottom":
2769
2787
  return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
@@ -2775,7 +2793,7 @@ var getLegend = (props) => {
2775
2793
  }, commonLegendProps));
2776
2794
  default:
2777
2795
  return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
2778
- width: SideLegendWidth
2796
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
2779
2797
  }, commonLegendProps));
2780
2798
  }
2781
2799
  };
@@ -2811,22 +2829,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
2811
2829
  const end = axisTitle.slice(-halfChars);
2812
2830
  return `${start}...${end}`;
2813
2831
  };
2814
- var getFieldName = (field) => {
2832
+ var getFieldName2 = (field) => {
2815
2833
  const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
2816
2834
  return fieldName;
2817
2835
  };
2818
2836
  var getFieldNames = (fields) => {
2819
- return fields.map((field) => getFieldName(field));
2837
+ return fields.map((field) => getFieldName2(field));
2820
2838
  };
2821
- var getXScaleConfig = (label, xAxisLabelVisibility) => {
2839
+ var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
2822
2840
  const xConfig = { x: {} };
2823
2841
  xConfig.x.label = label;
2824
2842
  if (xAxisLabelVisibility === "hide") {
2825
2843
  xConfig.x.hideLabels = true;
2826
2844
  }
2845
+ if (xAxisLabelRotation !== void 0) {
2846
+ xConfig.x.labelRotation = xAxisLabelRotation;
2847
+ }
2827
2848
  return xConfig;
2828
2849
  };
2829
- var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
2850
+ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
2830
2851
  const scaleType = yAxisScale != null ? yAxisScale : "linear";
2831
2852
  const yConfig = { y: {} };
2832
2853
  yConfig.y.label = label;
@@ -2842,14 +2863,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
2842
2863
  if (yAxisLabelVisibility === "hide") {
2843
2864
  yConfig.y.hideLabels = true;
2844
2865
  }
2866
+ if (yAxisMin !== void 0 || yAxisMax !== void 0) {
2867
+ yConfig.y.range = (u, dataMin, dataMax) => {
2868
+ const min = yAxisMin != null ? yAxisMin : dataMin;
2869
+ const max = yAxisMax != null ? yAxisMax : dataMax;
2870
+ return [min, max];
2871
+ };
2872
+ }
2845
2873
  return yConfig;
2846
2874
  };
2847
- var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
2875
+ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
2848
2876
  const y2Config = { y2: {} };
2849
2877
  const scaleType = axisScale != null ? axisScale : "linear";
2850
2878
  y2Config.y2.label = label;
2851
2879
  y2Config.y2.side = "right";
2852
- y2Config.y2.showGrid = false;
2853
2880
  y2Config.y2.type = scaleType;
2854
2881
  if (axisAbbreviation !== "none") {
2855
2882
  y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
@@ -2859,9 +2886,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
2859
2886
  if (y2AxisLabelVisibility === "hide") {
2860
2887
  y2Config.y2.hideLabels = true;
2861
2888
  }
2889
+ if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
2890
+ y2Config.y2.range = (u, dataMin, dataMax) => {
2891
+ const min = y2AxisMin != null ? y2AxisMin : dataMin;
2892
+ const max = y2AxisMax != null ? y2AxisMax : dataMax;
2893
+ return [min, max];
2894
+ };
2895
+ }
2862
2896
  return y2Config;
2863
2897
  };
2864
- var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
2898
+ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
2865
2899
  const seriesConfig = {};
2866
2900
  let spanGaps;
2867
2901
  let replaceNullsWithZero;
@@ -2896,12 +2930,45 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
2896
2930
  if (markerDisplay !== void 0) {
2897
2931
  seriesConfig[field].markerDisplay = markerDisplay;
2898
2932
  }
2933
+ const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
2934
+ if (fieldDashStyle) {
2935
+ seriesConfig[field].lineDashStyle = fieldDashStyle;
2936
+ }
2899
2937
  if (replaceNullsWithZero !== void 0) {
2900
2938
  seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
2901
2939
  }
2902
2940
  });
2903
2941
  return seriesConfig;
2904
2942
  };
2943
+ var findRangeIndices = (xData, startValue, endValue) => {
2944
+ let startXIndex = -1;
2945
+ let endXIndex = -1;
2946
+ const xDataEpoch = xData.map((val) => {
2947
+ if (typeof val === "string") {
2948
+ return new Date(val).getTime() / 1e3;
2949
+ }
2950
+ return val;
2951
+ });
2952
+ for (let i = 0; i < xDataEpoch.length; i += 1) {
2953
+ if (xDataEpoch[i] >= startValue) {
2954
+ startXIndex = i;
2955
+ break;
2956
+ }
2957
+ }
2958
+ if (startXIndex === -1 && xDataEpoch.length > 0) {
2959
+ startXIndex = xDataEpoch.length - 1;
2960
+ }
2961
+ for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
2962
+ if (xDataEpoch[i] <= endValue) {
2963
+ endXIndex = i;
2964
+ break;
2965
+ }
2966
+ }
2967
+ if (endXIndex === -1 && xDataEpoch.length > 0) {
2968
+ endXIndex = 0;
2969
+ }
2970
+ return { startXIndex, endXIndex };
2971
+ };
2905
2972
 
2906
2973
  // src/common/TimeSeriesChartWrapper.tsx
2907
2974
  var TimeSeriesChartContainer = styled_components_default.div`
@@ -2912,38 +2979,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
2912
2979
  position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
2913
2980
  }
2914
2981
  `;
2915
- var handleClick = (chartEvent, onClick) => {
2982
+ var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
2983
+ const result = __spreadValues({}, payload);
2984
+ if (trellisSplitBy) {
2985
+ result["trellis.name"] = trellisSplitBy;
2986
+ }
2987
+ if (trellisKey) {
2988
+ result["trellis.value"] = trellisKey;
2989
+ }
2990
+ return result;
2991
+ };
2992
+ var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
2993
+ if (!previousPayload) {
2994
+ return true;
2995
+ }
2996
+ if (currentPayload.index !== previousPayload.index) {
2997
+ return true;
2998
+ }
2999
+ if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
3000
+ return true;
3001
+ }
3002
+ if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
3003
+ return true;
3004
+ }
3005
+ if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
3006
+ return true;
3007
+ }
3008
+ return false;
3009
+ };
3010
+ var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
2916
3011
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
2917
3012
  name: chartEvent.seriesKey
2918
3013
  });
2919
3014
  delete payload.seriesKey;
2920
3015
  if (chartEvent.rowContext) {
2921
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
2922
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
2923
- });
3016
+ Object.assign(
3017
+ payload,
3018
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
3019
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3020
+ return acc;
3021
+ }, {})
3022
+ );
2924
3023
  }
3024
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2925
3025
  if (onClick) {
2926
3026
  onClick({
2927
3027
  type: "point.click",
2928
3028
  originalEvent: chartEvent,
2929
- payload
3029
+ payload: updatedPayload
2930
3030
  });
2931
3031
  }
2932
3032
  };
2933
- var handleLegendClick = (chartEvent, onClick) => {
3033
+ var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
2934
3034
  const payload = {
2935
3035
  name: chartEvent
2936
3036
  };
3037
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2937
3038
  if (onClick) {
2938
3039
  onClick({
2939
3040
  type: "legend.click",
2940
3041
  originalEvent: chartEvent,
2941
- payload
3042
+ payload: updatedPayload
3043
+ });
3044
+ }
3045
+ };
3046
+ var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3047
+ var _a;
3048
+ if (!rangeEvent) {
3049
+ return;
3050
+ }
3051
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3052
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3053
+ const payload = {
3054
+ startXIndex,
3055
+ startXValue: rangeEvent.start,
3056
+ endXIndex,
3057
+ endXValue: rangeEvent.end
3058
+ };
3059
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3060
+ if (onSelect) {
3061
+ onSelect({
3062
+ type: "range.selectBeforeZoom",
3063
+ originalEvent: rangeEvent,
3064
+ payload: updatedPayload
3065
+ });
3066
+ }
3067
+ };
3068
+ var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3069
+ var _a;
3070
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3071
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3072
+ const payload = {
3073
+ startXIndex,
3074
+ startXValue: rangeEvent.start,
3075
+ endXIndex,
3076
+ endXValue: rangeEvent.end
3077
+ };
3078
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3079
+ if (onSelect) {
3080
+ onSelect({
3081
+ type: "range.select",
3082
+ originalEvent: rangeEvent,
3083
+ payload: updatedPayload
2942
3084
  });
2943
3085
  }
2944
3086
  };
3087
+ var parseArrayOption = (value) => {
3088
+ if (Array.isArray(value)) {
3089
+ return value;
3090
+ }
3091
+ if (value) {
3092
+ return JSON.parse(value);
3093
+ }
3094
+ return void 0;
3095
+ };
2945
3096
  var TimeSeriesChartWrapper = (props) => {
2946
- const {
3097
+ var _b, _c, _d;
3098
+ const _a = props, {
2947
3099
  width,
2948
3100
  height,
2949
3101
  chartData,
@@ -2956,12 +3108,49 @@ var TimeSeriesChartWrapper = (props) => {
2956
3108
  markerDisplay,
2957
3109
  onClick,
2958
3110
  onPointMouseOver,
2959
- onPointMouseOut
2960
- } = props;
2961
- const {
3111
+ onPointMouseOut,
3112
+ onSelect,
3113
+ splitByLayout,
3114
+ trellisKey,
3115
+ trellisSplitBy,
2962
3116
  backgroundColor,
3117
+ defaultFontColor,
3118
+ additionalTooltipValues,
3119
+ showYAxisWithZero: showYAxisWithZeroFromProps,
3120
+ showY2AxisWithZero: showY2AxisWithZeroFromProps
3121
+ } = _a, otherOptions = __objRest(_a, [
3122
+ "width",
3123
+ "height",
3124
+ "chartData",
3125
+ "options",
3126
+ "userLocale",
3127
+ "annotationX",
3128
+ "annotationLabel",
3129
+ "annotationColor",
3130
+ "legendDisplay",
3131
+ "markerDisplay",
3132
+ "onClick",
3133
+ "onPointMouseOver",
3134
+ "onPointMouseOut",
3135
+ "onSelect",
3136
+ "splitByLayout",
3137
+ "trellisKey",
3138
+ "trellisSplitBy",
3139
+ "backgroundColor",
3140
+ "defaultFontColor",
3141
+ "additionalTooltipValues",
3142
+ // Extract showYAxisWithZero directly from props for accelerated render mode
3143
+ "showYAxisWithZero",
3144
+ "showY2AxisWithZero"
3145
+ ]);
3146
+ const { eventHandlers, xField: xFieldFromProps } = otherOptions;
3147
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
3148
+ const {
3149
+ backgroundColor: bgColorFromOptions,
2963
3150
  seriesColors: seriesColorsStr,
2964
3151
  fieldColors,
3152
+ legendLabels: legendLabelsStr,
3153
+ legendMode,
2965
3154
  "axisTitleX.text": xAxisTitleText,
2966
3155
  "axisTitleY.text": yAxisTitleText,
2967
3156
  "axisTitleY2.text": y2AxisTitleText,
@@ -2969,8 +3158,11 @@ var TimeSeriesChartWrapper = (props) => {
2969
3158
  "axisTitleY.visibility": yAxisTitleVisibility,
2970
3159
  "axisTitleY2.visibility": y2AxisTitleVisibility,
2971
3160
  "axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
3161
+ "axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
2972
3162
  "axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
3163
+ "axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
2973
3164
  "axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
3165
+ "axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
2974
3166
  "axisY.abbreviation": yAxisAbbreviation,
2975
3167
  "axisY.scale": yAxisScale,
2976
3168
  "axisY2.abbreviation": y2AxisAbbreviation,
@@ -2980,10 +3172,63 @@ var TimeSeriesChartWrapper = (props) => {
2980
3172
  "axisLabelsY2.integerUnits": y2IntegerUnits,
2981
3173
  "chart.overlayFields": overlayFieldsStr,
2982
3174
  "chart.nullValueMode": nullValueMode,
2983
- lineWidth
3175
+ "chart.showDataLabels": showDataLabels,
3176
+ lineWidth,
3177
+ lineDashStyle,
3178
+ fieldDashStyles: lineDashStylesByFieldStr,
3179
+ yAxisMin: yAxisMinRaw,
3180
+ yAxisMax: yAxisMaxRaw,
3181
+ y2AxisMin: y2AxisMinRaw,
3182
+ y2AxisMax: y2AxisMaxRaw,
3183
+ showXMajorGridLines,
3184
+ showYMajorGridLines,
3185
+ showY2MajorGridLines,
3186
+ showYMinorGridLines,
3187
+ showY2MinorGridLines,
3188
+ showLineSmoothing,
3189
+ yAxisMajorTickVisibility,
3190
+ y2AxisMajorTickVisibility,
3191
+ yAxisMajorTickSize,
3192
+ y2AxisMajorTickSize,
3193
+ yAxisMajorTickInterval,
3194
+ y2AxisMajorTickInterval,
3195
+ yAxisMinorTickVisibility,
3196
+ y2AxisMinorTickVisibility,
3197
+ yAxisMinorTickSize,
3198
+ y2AxisMinorTickSize,
3199
+ showYAxisWithZero: showYAxisWithZeroFromOptions,
3200
+ showY2AxisWithZero: showY2AxisWithZeroFromOptions
2984
3201
  } = options;
3202
+ const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
3203
+ const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
3204
+ const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
3205
+ const showYMajorTicks = yAxisMajorTickVisibility === "show";
3206
+ const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
3207
+ const showYMinorTicks = yAxisMinorTickVisibility === "show";
3208
+ const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
3209
+ const yAxisMin = parseAxisValue(yAxisMinRaw);
3210
+ const yAxisMax = parseAxisValue(yAxisMaxRaw);
3211
+ const y2AxisMin = parseAxisValue(y2AxisMinRaw);
3212
+ const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
3213
+ const parseTickInterval = (simpleXMLValue, canvasValue) => {
3214
+ if (simpleXMLValue) return Number(simpleXMLValue);
3215
+ if (canvasValue) return Number(canvasValue);
3216
+ return void 0;
3217
+ };
3218
+ const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
3219
+ const y2AxisMajorTickIntervalNum = parseTickInterval(
3220
+ y2AxisMajorUnitFromSimpleXML,
3221
+ y2AxisMajorTickInterval
3222
+ );
3223
+ const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
3224
+ const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
3225
+ const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
3226
+ const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
2985
3227
  const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
2986
3228
  const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
3229
+ const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
3230
+ const legendLabels = parseArrayOption(legendLabelsStr);
3231
+ const bgColor = backgroundColor || bgColorFromOptions;
2987
3232
  const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
2988
3233
  const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
2989
3234
  const cachedHandleResize = react_exports.useCallback((w, h) => {
@@ -2994,31 +3239,64 @@ var TimeSeriesChartWrapper = (props) => {
2994
3239
  fields: chartData.fields,
2995
3240
  columns: chartData.seriesList
2996
3241
  });
2997
- const xField = getFieldName(filteredChartData.fields[0]);
3242
+ const xField = getFieldName2(filteredChartData.fields[0]);
2998
3243
  const yFields = getFieldNames(
2999
3244
  filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
3000
3245
  );
3001
- const y2Fields = y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [];
3002
- const overlayFields = overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [];
3246
+ const y2Fields = (0, react_exports.useMemo)(
3247
+ () => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
3248
+ [y2FieldsStr]
3249
+ );
3250
+ const overlayFields = (0, react_exports.useMemo)(
3251
+ () => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
3252
+ [overlayFieldsStr]
3253
+ );
3003
3254
  let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
3004
3255
  xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
3005
- let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFields, yAxisTitleVisibility);
3256
+ const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
3257
+ let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
3006
3258
  yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
3007
3259
  const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
3008
3260
  let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
3009
3261
  y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
3010
- const xScaleConfig = getXScaleConfig(xAxisTitle, xAxisLabelVisibility);
3011
- const yScaleConfig = getYScaleConfig(yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility);
3012
- let y2ScaleConfig = {};
3013
- if (y2Enabled) {
3014
- y2ScaleConfig = getY2ScaleConfig(
3015
- y2AxisTitle,
3016
- y2AxisAbbreviation,
3017
- y2AxisScale,
3018
- y2IntegerUnits,
3019
- y2AxisLabelVisibility
3020
- );
3021
- }
3262
+ const xScaleConfig = (0, react_exports.useMemo)(
3263
+ () => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
3264
+ [xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
3265
+ );
3266
+ const yScaleConfig = (0, react_exports.useMemo)(
3267
+ () => getYScaleConfig(
3268
+ yAxisTitle,
3269
+ yAxisAbbreviation,
3270
+ yAxisScale,
3271
+ yAxisLabelVisibility,
3272
+ yAxisMin,
3273
+ yAxisMax
3274
+ ),
3275
+ [yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
3276
+ );
3277
+ const y2ScaleConfig = (0, react_exports.useMemo)(() => {
3278
+ if (y2Enabled) {
3279
+ return getY2ScaleConfig(
3280
+ y2AxisTitle,
3281
+ y2AxisAbbreviation,
3282
+ y2AxisScale,
3283
+ y2IntegerUnits,
3284
+ y2AxisLabelVisibility,
3285
+ y2AxisMin,
3286
+ y2AxisMax
3287
+ );
3288
+ }
3289
+ return {};
3290
+ }, [
3291
+ y2Enabled,
3292
+ y2AxisTitle,
3293
+ y2AxisAbbreviation,
3294
+ y2AxisScale,
3295
+ y2IntegerUnits,
3296
+ y2AxisLabelVisibility,
3297
+ y2AxisMin,
3298
+ y2AxisMax
3299
+ ]);
3022
3300
  const uplotContainerElement = (0, react_exports.useRef)(null);
3023
3301
  const seriesDataFormatted = [
3024
3302
  filteredChartData.columns[0],
@@ -3034,9 +3312,21 @@ var TimeSeriesChartWrapper = (props) => {
3034
3312
  overlayFields,
3035
3313
  y2Enabled,
3036
3314
  nullValueMode,
3037
- markerDisplay
3315
+ markerDisplay,
3316
+ lineDashStyle,
3317
+ lineDashStylesByField
3038
3318
  ),
3039
- [yFields, y2Fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay]
3319
+ [
3320
+ yFields,
3321
+ y2Fields,
3322
+ lineWidth,
3323
+ overlayFields,
3324
+ y2Enabled,
3325
+ nullValueMode,
3326
+ markerDisplay,
3327
+ lineDashStyle,
3328
+ lineDashStylesByField
3329
+ ]
3040
3330
  );
3041
3331
  const chartingEventAnnotations = (0, react_exports.useMemo)(
3042
3332
  () => getAnnotationsForCanvas({
@@ -3050,25 +3340,54 @@ var TimeSeriesChartWrapper = (props) => {
3050
3340
  () => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
3051
3341
  [xScaleConfig, yScaleConfig, y2ScaleConfig]
3052
3342
  );
3053
- const legend = (0, react_exports.useMemo)(() => getLegend({ legendDisplay }), [legendDisplay]);
3343
+ const legend = (0, react_exports.useMemo)(
3344
+ () => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
3345
+ [legendDisplay, legendMode]
3346
+ );
3054
3347
  const handleChartClick = react_exports.useCallback(
3055
3348
  (event) => {
3056
3349
  if (onClick) {
3057
- handleClick(event, onClick);
3350
+ handleClick(event, onClick, trellisKey, trellisSplitBy);
3058
3351
  }
3059
3352
  },
3060
- [onClick]
3353
+ [onClick, trellisKey, trellisSplitBy]
3061
3354
  );
3062
3355
  const handleChartLegendClick = react_exports.useCallback(
3063
3356
  (event) => {
3064
3357
  if (onClick) {
3065
- handleLegendClick(event, onClick);
3358
+ handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
3359
+ }
3360
+ },
3361
+ [onClick, trellisKey, trellisSplitBy]
3362
+ );
3363
+ const handleChartRangeSelection = react_exports.useCallback(
3364
+ (range2) => {
3365
+ if (onSelect) {
3366
+ handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
3066
3367
  }
3067
3368
  },
3068
- [onClick]
3369
+ [onSelect, chartData, trellisKey, trellisSplitBy]
3370
+ );
3371
+ const handleChartRangeZoom = react_exports.useCallback(
3372
+ (range2) => {
3373
+ if (onSelect) {
3374
+ handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
3375
+ }
3376
+ },
3377
+ [onSelect, chartData, trellisKey, trellisSplitBy]
3378
+ );
3379
+ const xFieldToUse = xFieldFromProps || xField;
3380
+ const enableSearchZoom = react_exports.useMemo(
3381
+ () => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
3382
+ [eventHandlers, xFieldToUse]
3069
3383
  );
3070
3384
  const lastPayloadRef = react_exports.useRef(null);
3071
3385
  const lastOriginalEventRef = react_exports.useRef(null);
3386
+ const previousMouseoverPayloadRef = react_exports.useRef(null);
3387
+ const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
3388
+ react_exports.useEffect(() => {
3389
+ additionalTooltipValuesRef.current = additionalTooltipValues;
3390
+ }, [additionalTooltipValues]);
3072
3391
  const handleChartCrosshairChange = react_exports.useCallback(
3073
3392
  (event) => {
3074
3393
  if (onPointMouseOver || onPointMouseOut) {
@@ -3080,6 +3399,7 @@ var TimeSeriesChartWrapper = (props) => {
3080
3399
  payload: lastPayloadRef.current
3081
3400
  });
3082
3401
  }
3402
+ previousMouseoverPayloadRef.current = null;
3083
3403
  return;
3084
3404
  }
3085
3405
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
@@ -3087,25 +3407,36 @@ var TimeSeriesChartWrapper = (props) => {
3087
3407
  });
3088
3408
  delete payload.seriesKey;
3089
3409
  if (event.rowContext) {
3090
- Object.keys(event.rowContext).forEach((fieldName) => {
3091
- payload[`row.${fieldName}.value`] = event.rowContext[fieldName];
3092
- });
3410
+ Object.assign(
3411
+ payload,
3412
+ Object.keys(event.rowContext).reduce((acc, fieldName) => {
3413
+ acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
3414
+ return acc;
3415
+ }, {})
3416
+ );
3417
+ }
3418
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3419
+ if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
3420
+ return;
3093
3421
  }
3094
- lastPayloadRef.current = payload;
3422
+ lastPayloadRef.current = updatedPayload;
3095
3423
  lastOriginalEventRef.current = event;
3424
+ previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
3096
3425
  if (onPointMouseOver) {
3097
3426
  onPointMouseOver({
3098
3427
  type: "point.mouseover",
3099
3428
  originalEvent: event,
3100
- payload
3429
+ payload: updatedPayload
3101
3430
  });
3102
3431
  }
3103
3432
  }
3104
3433
  },
3105
- [onPointMouseOver, onPointMouseOut]
3434
+ [onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
3106
3435
  );
3107
- const memoizedChart = (0, react_exports.useMemo)(
3108
- () => /* @__PURE__ */ react_exports.createElement(
3436
+ 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}`;
3437
+ const memoizedChart = (0, react_exports.useMemo)(() => {
3438
+ const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
3439
+ return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
3109
3440
  visualization_canvas_exports.TimeSeriesChart,
3110
3441
  {
3111
3442
  data: chartData,
@@ -3115,49 +3446,107 @@ var TimeSeriesChartWrapper = (props) => {
3115
3446
  seriesColorsByField,
3116
3447
  seriesConfig: seriesOverrides,
3117
3448
  legend,
3449
+ legendLabels,
3450
+ isSeriesCompare: legendMode === "seriesCompare",
3451
+ maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
3118
3452
  scaleConfig,
3119
3453
  timestampFormat: "expanded",
3120
3454
  onCrosshairClick: onClick ? handleChartClick : void 0,
3121
3455
  onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
3122
3456
  onSeriesClick: onClick ? handleChartLegendClick : void 0,
3457
+ onRangeSelection: handleChartRangeSelection,
3458
+ onRangeZoom: computedOnRangeZoom,
3459
+ serverSideZoom: enableSearchZoom,
3123
3460
  userLocale,
3124
3461
  events: chartingEventAnnotations,
3125
- eventsConfig: { renderer: triangleEventAnnotationRenderer }
3462
+ eventsConfig: { renderer: triangleEventAnnotationRenderer },
3463
+ additionalTooltipValuesRef,
3464
+ showXMajorGridLines,
3465
+ showYMajorGridLines,
3466
+ showY2MajorGridLines,
3467
+ showYMinorGridLines,
3468
+ showY2MinorGridLines,
3469
+ showLineSmoothing,
3470
+ dataValuesDisplay,
3471
+ showYMajorTicks,
3472
+ showY2MajorTicks,
3473
+ yAxisMajorTickSize: yAxisMajorTickSizeNum,
3474
+ y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
3475
+ yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
3476
+ y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
3477
+ showYMinorTicks,
3478
+ showY2MinorTicks,
3479
+ yAxisMinorTickSize: yAxisMinorTickSizeNum,
3480
+ y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
3481
+ showYAxisWithZero,
3482
+ showY2AxisWithZero
3126
3483
  }
3127
- ),
3128
- [
3129
- chartData,
3130
- containerWidth,
3131
- containerHeight,
3132
- seriesColors,
3133
- seriesColorsByField,
3134
- seriesOverrides,
3135
- legend,
3136
- scaleConfig,
3137
- userLocale,
3138
- chartingEventAnnotations,
3139
- onClick,
3140
- handleChartClick,
3141
- onPointMouseOver,
3142
- onPointMouseOut,
3143
- handleChartCrosshairChange,
3144
- handleChartLegendClick
3145
- ]
3146
- );
3484
+ ));
3485
+ }, [
3486
+ onSelect,
3487
+ handleChartRangeZoom,
3488
+ dataKey,
3489
+ chartData,
3490
+ containerWidth,
3491
+ containerHeight,
3492
+ seriesColors,
3493
+ seriesColorsByField,
3494
+ seriesOverrides,
3495
+ legend,
3496
+ legendLabels,
3497
+ scaleConfig,
3498
+ onClick,
3499
+ handleChartClick,
3500
+ onPointMouseOver,
3501
+ onPointMouseOut,
3502
+ handleChartCrosshairChange,
3503
+ handleChartLegendClick,
3504
+ handleChartRangeSelection,
3505
+ enableSearchZoom,
3506
+ userLocale,
3507
+ chartingEventAnnotations,
3508
+ showXMajorGridLines,
3509
+ showYMajorGridLines,
3510
+ showY2MajorGridLines,
3511
+ showYMinorGridLines,
3512
+ showY2MinorGridLines,
3513
+ showLineSmoothing,
3514
+ dataValuesDisplay,
3515
+ showYMajorTicks,
3516
+ showY2MajorTicks,
3517
+ yAxisMajorTickSizeNum,
3518
+ y2AxisMajorTickSizeNum,
3519
+ yAxisMajorTickIntervalNum,
3520
+ y2AxisMajorTickIntervalNum,
3521
+ showYMinorTicks,
3522
+ showY2MinorTicks,
3523
+ yAxisMinorTickSizeNum,
3524
+ y2AxisMinorTickSizeNum,
3525
+ showYAxisWithZero,
3526
+ showY2AxisWithZero,
3527
+ legendMode
3528
+ ]);
3147
3529
  const memoizedVisualization = (0, react_exports.useMemo)(() => {
3148
- return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
3149
- }, [backgroundColor, memoizedChart]);
3150
- return /* @__PURE__ */ react_exports.createElement(
3530
+ return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
3531
+ }, [bgColor, memoizedChart]);
3532
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
3533
+ TrellisTitle,
3534
+ {
3535
+ trellisKey,
3536
+ backgroundColor: bgColor,
3537
+ fontColor: defaultFontColor
3538
+ }
3539
+ ), /* @__PURE__ */ react_exports.createElement(
3151
3540
  TimeSeriesChartContainer,
3152
3541
  {
3153
- height,
3542
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
3154
3543
  width,
3155
3544
  ref: uplotContainerElement,
3156
3545
  "data-test": "timeseries-chart-wrapper"
3157
3546
  },
3158
3547
  /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
3159
3548
  memoizedVisualization
3160
- );
3549
+ ));
3161
3550
  };
3162
3551
  var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
3163
3552
 
@@ -3504,7 +3893,6 @@ var StaticMajorAndTrendLayout = [
3504
3893
  [
3505
3894
  {
3506
3895
  label: (0, i18n_exports._)("Unit position"),
3507
- // todo: we need a new editor combining unit and position
3508
3896
  option: "unitPosition",
3509
3897
  editor: "editor.select",
3510
3898
  editorProps: {