@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/SingleValue.js CHANGED
@@ -344,7 +344,6 @@ var computeText = ({
344
344
  }) => {
345
345
  let text = (0, numberUtils_exports.isNumerial)(value) ? (0, numberUtils_exports.formatNumber)(value, numberPrecision, {
346
346
  useThousandSeparators: shouldUseThousandSeparators,
347
- // todo: need update formatNumber
348
347
  useTrendUnits: shouldAbbreviateValue
349
348
  }) : value;
350
349
  text = text || "";
@@ -653,16 +652,19 @@ var changeColor = (color, ratio) => {
653
652
  return `#${newR.toString(16).padStart(2, 0)}${newG.toString(16).padStart(2, 0)}${newB.toString(16).padStart(2, 0)}`;
654
653
  };
655
654
  var darken = (color) => changeColor(color, 0.5);
656
- var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled = false, trellisSplitBy = "", trellisKey = "") => onValueClick(__spreadProps(__spreadValues({}, ev), {
657
- payload: __spreadValues({
658
- trendValue,
659
- value: majorValue,
660
- name: majorValueField
661
- }, trellisEnabled && {
662
- "trellis.name": trellisSplitBy,
663
- "trellis.value": trellisKey
664
- })
665
- }));
655
+ var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisContext = {}) => {
656
+ const { trellisEnabled = false, trellisSplitBy = "", trellisKey = "" } = trellisContext;
657
+ return onValueClick(__spreadProps(__spreadValues({}, ev), {
658
+ payload: __spreadValues({
659
+ trendValue,
660
+ value: majorValue,
661
+ name: majorValueField
662
+ }, trellisEnabled && {
663
+ "trellis.name": trellisSplitBy,
664
+ "trellis.value": trellisKey
665
+ })
666
+ }));
667
+ };
666
668
  var getTrendColorWithPercent = (options) => {
667
669
  const shouldUsePercentTrendColor = options.trendColor === "> trendValue | rangeValue(trendColorEditorConfig)" && options.trendDisplay === "percent";
668
670
  return shouldUsePercentTrendColor ? {
@@ -976,6 +978,8 @@ var StyledSvg = styled_components_default.svg`
976
978
  var StyledTooltip = styled_components_default.div`
977
979
  padding: 3px 8px;
978
980
  font-size: 12px;
981
+ text-align: center;
982
+ min-width: 20px;
979
983
  `;
980
984
  var preventDefault = (e) => e.preventDefault();
981
985
  var _SparkLine = class _SparkLine extends react_exports.Component {
@@ -1112,16 +1116,19 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
1112
1116
  * @method getSegmentSets
1113
1117
  * @param {Array} data
1114
1118
  * @param {Array} points
1115
- * @returns {Array} List of datapoint sets used for drawing lines
1119
+ * @returns {Object} Object containing lines (arrays of points for polylines) and isolatedPoints (single points surrounded by nulls)
1116
1120
  */
1117
1121
  getSegmentSets(data, points) {
1118
1122
  const { acceptNull } = this.props;
1119
1123
  const lines = [];
1124
+ const isolatedPoints = [];
1120
1125
  let currentLine = [];
1121
1126
  for (const [idx, p] of data.entries()) {
1122
1127
  if (!acceptNull && (0, lodash_exports.isNull)(p)) {
1123
1128
  if (currentLine.length > 1) {
1124
1129
  lines.push(currentLine);
1130
+ } else if (currentLine.length === 1) {
1131
+ isolatedPoints.push(currentLine[0]);
1125
1132
  }
1126
1133
  currentLine = [];
1127
1134
  } else {
@@ -1130,8 +1137,10 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
1130
1137
  }
1131
1138
  if (currentLine.length > 1) {
1132
1139
  lines.push(currentLine);
1140
+ } else if (currentLine.length === 1) {
1141
+ isolatedPoints.push(currentLine[0]);
1133
1142
  }
1134
- return lines;
1143
+ return { lines, isolatedPoints };
1135
1144
  }
1136
1145
  /**
1137
1146
  * Utility for fill null value with number 0.
@@ -1199,8 +1208,8 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
1199
1208
  if (!isArea || points.length === 0) {
1200
1209
  return null;
1201
1210
  }
1202
- let segments = this.getSegmentSets(data, points);
1203
- segments = segments.map(
1211
+ const { lines } = this.getSegmentSets(data, points);
1212
+ const segments = lines.map(
1204
1213
  (s) => s.concat([
1205
1214
  [s.at(-1)[0], height],
1206
1215
  // down to bottom of graph
@@ -1246,6 +1255,7 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
1246
1255
  }
1247
1256
  renderTooltip(tooltipValue, isOpen) {
1248
1257
  const { anchor } = this.state;
1258
+ const displayValue = tooltipValue === null ? "-" : tooltipValue;
1249
1259
  return /* @__PURE__ */ react_default.createElement(
1250
1260
  Popover_default,
1251
1261
  {
@@ -1257,7 +1267,7 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
1257
1267
  defaultPlacement: "above",
1258
1268
  animation: false
1259
1269
  },
1260
- /* @__PURE__ */ react_default.createElement(StyledTooltip, null, tooltipValue)
1270
+ /* @__PURE__ */ react_default.createElement(StyledTooltip, null, displayValue)
1261
1271
  );
1262
1272
  }
1263
1273
  /**
@@ -1287,16 +1297,46 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
1287
1297
  }
1288
1298
  )));
1289
1299
  }
1300
+ /**
1301
+ * Renders circles for isolated points (single data points surrounded by nulls)
1302
+ * These would otherwise be invisible since a line requires at least 2 points
1303
+ * @method renderIsolatedPoints
1304
+ * @param {Array} isolatedPoints - Array of [x, y] coordinates for isolated points
1305
+ * @returns {Object} SVG Group of circles
1306
+ */
1307
+ renderIsolatedPoints(isolatedPoints) {
1308
+ const { lineColor, lineStrokeWidth } = this.props;
1309
+ if (!isolatedPoints || isolatedPoints.length === 0) {
1310
+ return null;
1311
+ }
1312
+ const radius = lineStrokeWidth + 0.5;
1313
+ return /* @__PURE__ */ react_default.createElement("g", { "data-test": "isolated-points" }, isolatedPoints.map((point) => /* @__PURE__ */ react_default.createElement(
1314
+ "circle",
1315
+ {
1316
+ key: `isolated-${point[0]}-${point[1]}`,
1317
+ "data-test": "isolated-point",
1318
+ cx: point[0],
1319
+ cy: point[1],
1320
+ r: radius,
1321
+ style: {
1322
+ fill: lineColor
1323
+ }
1324
+ }
1325
+ )));
1326
+ }
1290
1327
  /**
1291
1328
  * Renders the line(s) above the area graph
1292
1329
  * @method renderPolyline
1293
1330
  * @param {Array} points
1294
- * @returns {Object} SVG Group of polylines
1331
+ * @returns {Object} SVG Group of polylines and isolated points
1295
1332
  */
1296
1333
  renderPolyline(points) {
1297
1334
  const { data, lineColor, lineLength, lineStrokeWidth } = this.props;
1298
1335
  const linePoints = (0, lodash_exports.isFinite)(lineLength) && lineLength > 0 ? lineLength : points.length;
1299
- const lines = this.getSegmentSets(data.slice(-linePoints), points.slice(-linePoints));
1336
+ const { lines, isolatedPoints } = this.getSegmentSets(
1337
+ data.slice(-linePoints),
1338
+ points.slice(-linePoints)
1339
+ );
1300
1340
  return /* @__PURE__ */ react_default.createElement("g", { "data-test": "sparkline" }, lines.map((lineData) => /* @__PURE__ */ react_default.createElement(
1301
1341
  "polyline",
1302
1342
  {
@@ -1311,7 +1351,7 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
1311
1351
  },
1312
1352
  points: lineData.join(" ")
1313
1353
  }
1314
- )));
1354
+ )), this.renderIsolatedPoints(isolatedPoints));
1315
1355
  }
1316
1356
  getInteractionState({ data, points, showTooltip, activeIndex, hoveredIndex, componentIsFocused }) {
1317
1357
  if (!showTooltip) {
@@ -1519,6 +1559,21 @@ var SparkLine = _SparkLine;
1519
1559
  var SparkLine_default = SparkLine;
1520
1560
 
1521
1561
  // src/SingleValue/PureSingleValue/SingleValueSparkline.jsx
1562
+ var processDataForNullDisplay = (data, nullValueDisplay) => {
1563
+ if (!Array.isArray(data)) {
1564
+ return [];
1565
+ }
1566
+ if (nullValueDisplay === "connect") {
1567
+ return data.filter((d) => d !== null);
1568
+ }
1569
+ return data;
1570
+ };
1571
+ var getAcceptNull = (nullValueDisplay) => (
1572
+ // acceptNull=true treats null as 0 (for 'zero' mode)
1573
+ // acceptNull=false creates gaps (for 'gaps' mode)
1574
+ // For 'connect' mode, nulls are filtered out so this doesn't matter
1575
+ nullValueDisplay === "zero"
1576
+ );
1522
1577
  var SingleValueSparkline = ({
1523
1578
  width,
1524
1579
  height,
@@ -1530,42 +1585,64 @@ var SingleValueSparkline = ({
1530
1585
  isArea,
1531
1586
  lineLength = 0,
1532
1587
  endDotCount = 0,
1533
- acceptNull = true
1534
- }) => /* @__PURE__ */ react_default.createElement(
1535
- SparkLine_default,
1536
- {
1537
- lineColor: (0, propUtils_exports.formatColor)(stroke),
1538
- fillColor: (0, propUtils_exports.formatColor)(fill),
1539
- fillOpacity: fillOpacity.toString(10),
1540
- data,
1541
- height,
1542
- width,
1543
- showTooltip,
1544
- isArea,
1545
- lineStrokeWidth: 1.5,
1546
- lineLength: isArea ? lineLength : void 0,
1547
- endDotCount: isArea ? endDotCount : void 0,
1548
- endDotRadius: Math.min(width, height) < 15 ? 1 : 3,
1549
- endDotStroke: (0, propUtils_exports.formatColor)(stroke),
1550
- endDotFillColor: (0, propUtils_exports.formatColor)(stroke),
1551
- acceptNull,
1552
- style: {
1553
- flex: "0 0 auto",
1554
- justifyContent: "center",
1555
- display: "flex",
1556
- alignItems: "flex-end"
1588
+ acceptNull = false,
1589
+ nullValueDisplay
1590
+ }) => {
1591
+ const effectiveNullValueDisplay = (0, react_exports.useMemo)(() => {
1592
+ if (nullValueDisplay !== void 0) {
1593
+ return nullValueDisplay;
1557
1594
  }
1558
- }
1559
- );
1595
+ if (acceptNull === true) {
1596
+ return "zero";
1597
+ }
1598
+ return "gaps";
1599
+ }, [nullValueDisplay, acceptNull]);
1600
+ const processedData = (0, react_exports.useMemo)(
1601
+ () => processDataForNullDisplay(data, effectiveNullValueDisplay),
1602
+ [data, effectiveNullValueDisplay]
1603
+ );
1604
+ const sparklineAcceptNull = (0, react_exports.useMemo)(
1605
+ () => getAcceptNull(effectiveNullValueDisplay),
1606
+ [effectiveNullValueDisplay]
1607
+ );
1608
+ return /* @__PURE__ */ react_default.createElement(
1609
+ SparkLine_default,
1610
+ {
1611
+ lineColor: (0, propUtils_exports.formatColor)(stroke),
1612
+ fillColor: (0, propUtils_exports.formatColor)(fill),
1613
+ fillOpacity: fillOpacity.toString(10),
1614
+ data: processedData,
1615
+ height,
1616
+ width,
1617
+ showTooltip,
1618
+ isArea,
1619
+ lineStrokeWidth: 1.5,
1620
+ lineLength: isArea ? lineLength : void 0,
1621
+ endDotCount: isArea ? endDotCount : void 0,
1622
+ endDotRadius: Math.min(width, height) < 15 ? 1 : 3,
1623
+ endDotStroke: (0, propUtils_exports.formatColor)(stroke),
1624
+ endDotFillColor: (0, propUtils_exports.formatColor)(stroke),
1625
+ acceptNull: sparklineAcceptNull,
1626
+ style: {
1627
+ flex: "0 0 auto",
1628
+ justifyContent: "center",
1629
+ display: "flex",
1630
+ alignItems: "flex-end"
1631
+ }
1632
+ }
1633
+ );
1634
+ };
1560
1635
  SingleValueSparkline.propTypes = {
1636
+ /** @deprecated Use nullValueDisplay instead */
1561
1637
  acceptNull: prop_types_default.bool,
1562
- data: prop_types_default.arrayOf(prop_types_default.number),
1638
+ data: prop_types_default.arrayOf(prop_types_default.oneOfType([prop_types_default.number, prop_types_default.oneOf([null])])),
1563
1639
  endDotCount: prop_types_default.number,
1564
1640
  fill: prop_types_default.string,
1565
1641
  fillOpacity: prop_types_default.number,
1566
1642
  height: prop_types_default.number,
1567
1643
  isArea: prop_types_default.bool,
1568
1644
  lineLength: prop_types_default.number,
1645
+ nullValueDisplay: prop_types_default.oneOf(["gaps", "zero", "connect"]),
1569
1646
  showTooltip: prop_types_default.bool,
1570
1647
  stroke: prop_types_default.string,
1571
1648
  width: prop_types_default.number
@@ -1603,17 +1680,13 @@ var getAvailableContentHeight = ({
1603
1680
  return majorTextFontSize + CONTENT_SPARKLINE_SPACING + underLabelHeight;
1604
1681
  };
1605
1682
  var isValidPosition = (sparklinePosition) => VALID_SPARKLINE_POSITIONS.indexOf(sparklinePosition) > -1;
1606
- var parseSparklineValues = ({ sparklineValues }) => (
1607
- // todo: need this function to maitain the behavior for dashboard-viz and react-viz.
1608
- // can refactor it after we discard dashboard-viz and react-viz repo
1609
- Array.isArray(sparklineValues) ? sparklineValues.map((v) => {
1610
- const numV = (0, numberUtils_exports.parseNumber)(v);
1611
- if (numV === 0) {
1612
- return null;
1613
- }
1614
- return numV || v;
1615
- }) : void 0
1616
- );
1683
+ var parseSparklineValues = ({ sparklineValues }) => Array.isArray(sparklineValues) ? sparklineValues.map((v) => {
1684
+ const numV = (0, numberUtils_exports.parseNumber)(v);
1685
+ if (numV === 0) {
1686
+ return null;
1687
+ }
1688
+ return numV || v;
1689
+ }) : void 0;
1617
1690
  var shouldShowSparkline = ({ showSparkline, sparklineValues }) => showSparkline && Array.isArray(sparklineValues) && sparklineValues.length > 1 && sparklineValues.every((v) => v === null || !Number.isNaN((0, numberUtils_exports.parseNumber)(v))) && sparklineValues.filter((v) => v !== null).length > 0;
1618
1691
  var getSparklineWidth = ({ width, isSparklinePositionBelow }) => {
1619
1692
  const spaceRatio = isSparklinePositionBelow ? 1 : 0.6;
@@ -1748,7 +1821,7 @@ var SingleValueContent = (_a) => {
1748
1821
  sparklineStrokeColor,
1749
1822
  showSparklineTooltip,
1750
1823
  showSparklineAreaGraph,
1751
- shouldSparklineAcceptNullData,
1824
+ sparklineNullValueDisplay,
1752
1825
  sparklineSegments,
1753
1826
  endDots,
1754
1827
  align
@@ -1765,7 +1838,7 @@ var SingleValueContent = (_a) => {
1765
1838
  stroke: sparklineStrokeColor,
1766
1839
  showTooltip: showSparklineTooltip,
1767
1840
  isArea: showSparklineAreaGraph,
1768
- acceptNull: shouldSparklineAcceptNullData,
1841
+ nullValueDisplay: sparklineNullValueDisplay,
1769
1842
  lineLength: sparklineSegments,
1770
1843
  endDotCount: endDots
1771
1844
  }
@@ -1812,7 +1885,7 @@ SingleValueContent.propTypes = __spreadProps(__spreadValues({}, SingleValueBasic
1812
1885
  sparklineStrokeColor: prop_types_default.string,
1813
1886
  showSparklineTooltip: prop_types_default.bool,
1814
1887
  showSparklineAreaGraph: prop_types_default.bool,
1815
- shouldSparklineAcceptNullData: prop_types_default.bool,
1888
+ sparklineNullValueDisplay: prop_types_default.oneOf(["gaps", "zero", "connect"]),
1816
1889
  sparklineSegments: prop_types_default.number,
1817
1890
  endDots: prop_types_default.number
1818
1891
  });
@@ -1867,20 +1940,16 @@ var SingleValue = (_a) => {
1867
1940
  unitPosition,
1868
1941
  underLabelFontSize,
1869
1942
  numberPrecision,
1870
- // fixme todo probably belongs in a DSL formatter
1871
1943
  shouldUseThousandSeparators,
1872
- // fixme todo probably belongs in a DSL formatter
1873
1944
  shouldAbbreviateTrendValue,
1874
- // fixme todo probably belongs in a DSL formatter
1875
1945
  shouldAbbreviateMajorValue,
1876
- // fixme todo probably belongs in a DSL formatter
1877
1946
  sparklineValues,
1878
1947
  sparklineHighlightSegments,
1879
- // fixme this is not a pure viz if it has lots of rendering logic for a sub-viz.
1880
1948
  sparklineHighlightDots,
1881
1949
  showSparklineAreaGraph,
1882
1950
  showSparklineTooltip,
1883
1951
  shouldSparklineAcceptNullData,
1952
+ sparklineNullValueDisplay,
1884
1953
  onValueClick,
1885
1954
  defaultFontColor,
1886
1955
  defaultBackgroundColor: defaultBackgroundColor2,
@@ -1907,16 +1976,11 @@ var SingleValue = (_a) => {
1907
1976
  }, []);
1908
1977
  const trellisEnabled = useTrellisEnabled(splitByLayout);
1909
1978
  const handleValueClick = (0, react_exports.useCallback)(
1910
- (ev) => handleValueClickCallback(
1911
- ev,
1912
- majorValue,
1913
- majorValueField,
1914
- trendValue,
1915
- onValueClick,
1979
+ (ev) => handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick, {
1916
1980
  trellisEnabled,
1917
1981
  trellisSplitBy,
1918
1982
  trellisKey
1919
- ),
1983
+ }),
1920
1984
  [onValueClick, majorValue, majorValueField, trendValue, trellisEnabled, trellisSplitBy, trellisKey]
1921
1985
  );
1922
1986
  const { backgroundEnabled, backgroundColor, majorColor, trendColor, underLabelColor } = computeColors(
@@ -1928,6 +1992,15 @@ var SingleValue = (_a) => {
1928
1992
  backgroundColor,
1929
1993
  sparklineSeverityColors
1930
1994
  }).stroke;
1995
+ const effectiveSparklineNullValueDisplay = (0, react_exports.useMemo)(() => {
1996
+ if (sparklineNullValueDisplay !== void 0) {
1997
+ return sparklineNullValueDisplay;
1998
+ }
1999
+ if (shouldSparklineAcceptNullData === true) {
2000
+ return "zero";
2001
+ }
2002
+ return "gaps";
2003
+ }, [sparklineNullValueDisplay, shouldSparklineAcceptNullData]);
1931
2004
  const renderVisualization = () => {
1932
2005
  if (!containerWidth || !containerHeight) {
1933
2006
  return null;
@@ -2029,7 +2102,7 @@ var SingleValue = (_a) => {
2029
2102
  sparklineStrokeColor,
2030
2103
  showSparklineTooltip,
2031
2104
  showSparklineAreaGraph,
2032
- shouldSparklineAcceptNullData,
2105
+ sparklineNullValueDisplay: effectiveSparklineNullValueDisplay,
2033
2106
  sparklineSegments,
2034
2107
  endDots,
2035
2108
  align
@@ -2077,6 +2150,7 @@ SingleValue.propTypes = {
2077
2150
  sparklineAreaColor: prop_types_default.string,
2078
2151
  sparklineStrokeColor: prop_types_default.string,
2079
2152
  shouldSparklineAcceptNullData: prop_types_default.bool,
2153
+ sparklineNullValueDisplay: prop_types_default.oneOf(["gaps", "zero", "connect"]),
2080
2154
  sparklineHighlightSegments: prop_types_default.number,
2081
2155
  sparklineHighlightDots: prop_types_default.number,
2082
2156
  hasEventHandlers: prop_types_default.bool,
@@ -2107,6 +2181,7 @@ SingleValue.defaultProps = {
2107
2181
  showSparklineAreaGraph: false,
2108
2182
  sparklineDisplay: "below",
2109
2183
  shouldSparklineAcceptNullData: true,
2184
+ sparklineNullValueDisplay: void 0,
2110
2185
  sparklineHighlightSegments: 0,
2111
2186
  sparklineHighlightDots: 0,
2112
2187
  hasEventHandlers: false,
@@ -2453,7 +2528,7 @@ var Cover = styled_components_default.div`
2453
2528
  bottom: 0;
2454
2529
  `;
2455
2530
  var Blocker = styled_components_default.div.attrs({
2456
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b"
2531
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f"
2457
2532
  })`
2458
2533
  position: relative;
2459
2534
  width: 100%;
@@ -2543,7 +2618,7 @@ var withFixedSizeContainer = (Viz) => {
2543
2618
  FixSizeItem,
2544
2619
  {
2545
2620
  "data-test": "fix-size-item",
2546
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b",
2621
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f",
2547
2622
  width,
2548
2623
  height,
2549
2624
  backgroundColor
@@ -2630,6 +2705,7 @@ var withPlaceholder = (Visualization, useIconPlaceholder = shouldShowIconPlaceho
2630
2705
  var withPlaceholder_default = withPlaceholder;
2631
2706
 
2632
2707
  // src/common/utils/dataUtils.ts
2708
+ var getFieldName = (field) => typeof field === "string" ? field : field.name;
2633
2709
  var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
2634
2710
  const dataLength = data.length;
2635
2711
  const downsampledIndices = [];
@@ -2746,9 +2822,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
2746
2822
  let xColumn = [];
2747
2823
  const yColumns = [];
2748
2824
  const canDownsample = !ds.data.fields.some((field, index) => {
2749
- var _a, _b;
2750
- const fieldName = (_a = field.name) != null ? _a : field;
2751
- const fieldType = (_b = fieldTypes[index]) != null ? _b : "unknown";
2825
+ var _a;
2826
+ const fieldName = getFieldName(field);
2827
+ const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
2752
2828
  const column = ds.data.columns[index];
2753
2829
  let hasDisplayedColumnThatCantBeDownsampled = false;
2754
2830
  if (fieldName === xField) {
@@ -3035,7 +3111,7 @@ var trellisUtils_default = "default" in defaultImport33 ? defaultImport33.defaul
3035
3111
  var AGGREGATIONS = "aggregations";
3036
3112
  var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
3037
3113
  var _a, _b, _c, _d;
3038
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3114
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3039
3115
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3040
3116
  let splitDataSources = null;
3041
3117
  let errorCode = null;
@@ -3056,7 +3132,7 @@ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
3056
3132
  }
3057
3133
  return { splitDataSources, errorCode };
3058
3134
  };
3059
- var toFieldEntries = (fields) => {
3135
+ var toFieldEntries = (fields = []) => {
3060
3136
  return fields.map((field) => {
3061
3137
  if (typeof field === "string") {
3062
3138
  return { name: field };
@@ -3071,7 +3147,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
3071
3147
  let splitDataSources = null;
3072
3148
  let splitByFields = [];
3073
3149
  let errorCode = null;
3074
- if (typeof fields[0] !== "string") {
3150
+ if (fields.length > 0) {
3075
3151
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
3076
3152
  }
3077
3153
  if (splitByFields && splitByFields.length > 0) {
@@ -3109,12 +3185,12 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
3109
3185
  };
3110
3186
  var dataSourcesSplitByAggregationsStats = (dataSource) => {
3111
3187
  var _a, _b, _c, _d;
3112
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3188
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3113
3189
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3114
3190
  let splitDataSources = null;
3115
3191
  let splitByFields = [];
3116
3192
  let errorCode = null;
3117
- if (typeof fields[0] !== "string") {
3193
+ if (fields.length > 0) {
3118
3194
  splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
3119
3195
  }
3120
3196
  if (splitByFields && splitByFields.length > 0) {
@@ -3138,12 +3214,12 @@ var dataSourcesSplitByAggregationsStats = (dataSource) => {
3138
3214
  };
3139
3215
  var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
3140
3216
  var _a, _b, _c, _d, _e;
3141
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3217
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3142
3218
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3143
3219
  let splitDataSources = null;
3144
3220
  let splitByFields = [];
3145
3221
  let errorCode = null;
3146
- if (typeof fields[0] !== "string") {
3222
+ if (fields.length > 0) {
3147
3223
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3148
3224
  }
3149
3225
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -3181,12 +3257,12 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
3181
3257
  };
3182
3258
  var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
3183
3259
  var _a, _b, _c, _d;
3184
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3260
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3185
3261
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3186
3262
  let splitDataSources = null;
3187
3263
  let splitByFields = [];
3188
3264
  let errorCode = null;
3189
- if (typeof fields[0] !== "string") {
3265
+ if (fields.length > 0) {
3190
3266
  splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3191
3267
  }
3192
3268
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
@@ -3274,17 +3350,15 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
3274
3350
  };
3275
3351
  var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
3276
3352
  var _a, _b, _c, _d, _e, _f;
3277
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3353
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
3278
3354
  const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3279
3355
  let splitDataSources = null;
3280
3356
  let splitByFields = [];
3281
3357
  let errorCode = null;
3282
- if (typeof fields[0] !== "string") {
3358
+ if (fields.length > 0) {
3283
3359
  splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
3284
3360
  }
3285
- const splitByIndex = fields == null ? void 0 : fields.findIndex(
3286
- (field) => field === splitBy || field.name === splitBy
3287
- );
3361
+ const splitByIndex = fields.findIndex((field) => field.name === splitBy);
3288
3362
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
3289
3363
  const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
3290
3364
  splitDataSources = {};
@@ -3419,6 +3493,16 @@ var triangleEventAnnotationRenderer = ({
3419
3493
  eventColor: eventWithColor.color
3420
3494
  });
3421
3495
  };
3496
+ var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
3497
+ const rangeSelectEventHandler = eventHandlers.find(
3498
+ (eventHandler) => {
3499
+ var _a;
3500
+ return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
3501
+ }
3502
+ );
3503
+ const xAxisIsTime = xField === "_time";
3504
+ return !!rangeSelectEventHandler && xAxisIsTime;
3505
+ };
3422
3506
  var canvasSupportedTimeSeriesCharts = ["splunk.line"];
3423
3507
  var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
3424
3508
  return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
@@ -3439,16 +3523,31 @@ var filterChartDataFromInternalFields = (chartData) => {
3439
3523
  var convert2DArrayToNumbers = (arr) => {
3440
3524
  return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
3441
3525
  };
3526
+ var parseAxisValue = (val) => {
3527
+ if (val === void 0 || val === null || val === "auto" || val === "") {
3528
+ return void 0;
3529
+ }
3530
+ const num = typeof val === "number" ? val : Number.parseFloat(val);
3531
+ return Number.isNaN(num) ? void 0 : num;
3532
+ };
3442
3533
  var SideLegendWidth = 75;
3443
- var commonLegendProps = { center: true, fontSize: 12, largerTiles: true, hideSeriesValue: true };
3534
+ var SeriesCompareLegendWidth = 200;
3444
3535
  var getLegend = (props) => {
3445
3536
  const legendPlacement = props == null ? void 0 : props.legendDisplay;
3537
+ const { isSeriesCompare } = props;
3538
+ const commonLegendProps = {
3539
+ center: true,
3540
+ fontSize: 12,
3541
+ largerTiles: true,
3542
+ hideSeriesValue: !isSeriesCompare
3543
+ // Show values if in seriesCompare mode
3544
+ };
3446
3545
  switch (legendPlacement) {
3447
3546
  case "off":
3448
3547
  return false;
3449
3548
  case "left":
3450
3549
  return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
3451
- width: SideLegendWidth
3550
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
3452
3551
  }, commonLegendProps));
3453
3552
  case "bottom":
3454
3553
  return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
@@ -3460,7 +3559,7 @@ var getLegend = (props) => {
3460
3559
  }, commonLegendProps));
3461
3560
  default:
3462
3561
  return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
3463
- width: SideLegendWidth
3562
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
3464
3563
  }, commonLegendProps));
3465
3564
  }
3466
3565
  };
@@ -3496,22 +3595,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
3496
3595
  const end = axisTitle.slice(-halfChars);
3497
3596
  return `${start}...${end}`;
3498
3597
  };
3499
- var getFieldName = (field) => {
3598
+ var getFieldName2 = (field) => {
3500
3599
  const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
3501
3600
  return fieldName;
3502
3601
  };
3503
3602
  var getFieldNames = (fields) => {
3504
- return fields.map((field) => getFieldName(field));
3603
+ return fields.map((field) => getFieldName2(field));
3505
3604
  };
3506
- var getXScaleConfig = (label, xAxisLabelVisibility) => {
3605
+ var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
3507
3606
  const xConfig = { x: {} };
3508
3607
  xConfig.x.label = label;
3509
3608
  if (xAxisLabelVisibility === "hide") {
3510
3609
  xConfig.x.hideLabels = true;
3511
3610
  }
3611
+ if (xAxisLabelRotation !== void 0) {
3612
+ xConfig.x.labelRotation = xAxisLabelRotation;
3613
+ }
3512
3614
  return xConfig;
3513
3615
  };
3514
- var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
3616
+ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
3515
3617
  const scaleType = yAxisScale != null ? yAxisScale : "linear";
3516
3618
  const yConfig = { y: {} };
3517
3619
  yConfig.y.label = label;
@@ -3527,14 +3629,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
3527
3629
  if (yAxisLabelVisibility === "hide") {
3528
3630
  yConfig.y.hideLabels = true;
3529
3631
  }
3632
+ if (yAxisMin !== void 0 || yAxisMax !== void 0) {
3633
+ yConfig.y.range = (u, dataMin, dataMax) => {
3634
+ const min2 = yAxisMin != null ? yAxisMin : dataMin;
3635
+ const max2 = yAxisMax != null ? yAxisMax : dataMax;
3636
+ return [min2, max2];
3637
+ };
3638
+ }
3530
3639
  return yConfig;
3531
3640
  };
3532
- var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
3641
+ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
3533
3642
  const y2Config = { y2: {} };
3534
3643
  const scaleType = axisScale != null ? axisScale : "linear";
3535
3644
  y2Config.y2.label = label;
3536
3645
  y2Config.y2.side = "right";
3537
- y2Config.y2.showGrid = false;
3538
3646
  y2Config.y2.type = scaleType;
3539
3647
  if (axisAbbreviation !== "none") {
3540
3648
  y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
@@ -3544,9 +3652,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
3544
3652
  if (y2AxisLabelVisibility === "hide") {
3545
3653
  y2Config.y2.hideLabels = true;
3546
3654
  }
3655
+ if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
3656
+ y2Config.y2.range = (u, dataMin, dataMax) => {
3657
+ const min2 = y2AxisMin != null ? y2AxisMin : dataMin;
3658
+ const max2 = y2AxisMax != null ? y2AxisMax : dataMax;
3659
+ return [min2, max2];
3660
+ };
3661
+ }
3547
3662
  return y2Config;
3548
3663
  };
3549
- var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
3664
+ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
3550
3665
  const seriesConfig = {};
3551
3666
  let spanGaps;
3552
3667
  let replaceNullsWithZero;
@@ -3581,12 +3696,45 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
3581
3696
  if (markerDisplay !== void 0) {
3582
3697
  seriesConfig[field].markerDisplay = markerDisplay;
3583
3698
  }
3699
+ const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
3700
+ if (fieldDashStyle) {
3701
+ seriesConfig[field].lineDashStyle = fieldDashStyle;
3702
+ }
3584
3703
  if (replaceNullsWithZero !== void 0) {
3585
3704
  seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
3586
3705
  }
3587
3706
  });
3588
3707
  return seriesConfig;
3589
3708
  };
3709
+ var findRangeIndices = (xData, startValue, endValue) => {
3710
+ let startXIndex = -1;
3711
+ let endXIndex = -1;
3712
+ const xDataEpoch = xData.map((val) => {
3713
+ if (typeof val === "string") {
3714
+ return new Date(val).getTime() / 1e3;
3715
+ }
3716
+ return val;
3717
+ });
3718
+ for (let i = 0; i < xDataEpoch.length; i += 1) {
3719
+ if (xDataEpoch[i] >= startValue) {
3720
+ startXIndex = i;
3721
+ break;
3722
+ }
3723
+ }
3724
+ if (startXIndex === -1 && xDataEpoch.length > 0) {
3725
+ startXIndex = xDataEpoch.length - 1;
3726
+ }
3727
+ for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
3728
+ if (xDataEpoch[i] <= endValue) {
3729
+ endXIndex = i;
3730
+ break;
3731
+ }
3732
+ }
3733
+ if (endXIndex === -1 && xDataEpoch.length > 0) {
3734
+ endXIndex = 0;
3735
+ }
3736
+ return { startXIndex, endXIndex };
3737
+ };
3590
3738
 
3591
3739
  // src/common/TimeSeriesChartWrapper.tsx
3592
3740
  var TimeSeriesChartContainer = styled_components_default.div`
@@ -3597,38 +3745,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
3597
3745
  position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
3598
3746
  }
3599
3747
  `;
3600
- var handleClick = (chartEvent, onClick) => {
3748
+ var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
3749
+ const result = __spreadValues({}, payload);
3750
+ if (trellisSplitBy) {
3751
+ result["trellis.name"] = trellisSplitBy;
3752
+ }
3753
+ if (trellisKey) {
3754
+ result["trellis.value"] = trellisKey;
3755
+ }
3756
+ return result;
3757
+ };
3758
+ var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
3759
+ if (!previousPayload) {
3760
+ return true;
3761
+ }
3762
+ if (currentPayload.index !== previousPayload.index) {
3763
+ return true;
3764
+ }
3765
+ if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
3766
+ return true;
3767
+ }
3768
+ if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
3769
+ return true;
3770
+ }
3771
+ if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
3772
+ return true;
3773
+ }
3774
+ return false;
3775
+ };
3776
+ var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
3601
3777
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
3602
3778
  name: chartEvent.seriesKey
3603
3779
  });
3604
3780
  delete payload.seriesKey;
3605
3781
  if (chartEvent.rowContext) {
3606
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
3607
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3608
- });
3782
+ Object.assign(
3783
+ payload,
3784
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
3785
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3786
+ return acc;
3787
+ }, {})
3788
+ );
3609
3789
  }
3790
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3610
3791
  if (onClick) {
3611
3792
  onClick({
3612
3793
  type: "point.click",
3613
3794
  originalEvent: chartEvent,
3614
- payload
3795
+ payload: updatedPayload
3615
3796
  });
3616
3797
  }
3617
3798
  };
3618
- var handleLegendClick = (chartEvent, onClick) => {
3799
+ var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
3619
3800
  const payload = {
3620
3801
  name: chartEvent
3621
3802
  };
3803
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3622
3804
  if (onClick) {
3623
3805
  onClick({
3624
3806
  type: "legend.click",
3625
3807
  originalEvent: chartEvent,
3626
- payload
3808
+ payload: updatedPayload
3809
+ });
3810
+ }
3811
+ };
3812
+ var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3813
+ var _a;
3814
+ if (!rangeEvent) {
3815
+ return;
3816
+ }
3817
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3818
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3819
+ const payload = {
3820
+ startXIndex,
3821
+ startXValue: rangeEvent.start,
3822
+ endXIndex,
3823
+ endXValue: rangeEvent.end
3824
+ };
3825
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3826
+ if (onSelect) {
3827
+ onSelect({
3828
+ type: "range.selectBeforeZoom",
3829
+ originalEvent: rangeEvent,
3830
+ payload: updatedPayload
3831
+ });
3832
+ }
3833
+ };
3834
+ var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3835
+ var _a;
3836
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3837
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3838
+ const payload = {
3839
+ startXIndex,
3840
+ startXValue: rangeEvent.start,
3841
+ endXIndex,
3842
+ endXValue: rangeEvent.end
3843
+ };
3844
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3845
+ if (onSelect) {
3846
+ onSelect({
3847
+ type: "range.select",
3848
+ originalEvent: rangeEvent,
3849
+ payload: updatedPayload
3627
3850
  });
3628
3851
  }
3629
3852
  };
3853
+ var parseArrayOption = (value) => {
3854
+ if (Array.isArray(value)) {
3855
+ return value;
3856
+ }
3857
+ if (value) {
3858
+ return JSON.parse(value);
3859
+ }
3860
+ return void 0;
3861
+ };
3630
3862
  var TimeSeriesChartWrapper = (props) => {
3631
- const {
3863
+ var _b, _c, _d;
3864
+ const _a = props, {
3632
3865
  width,
3633
3866
  height,
3634
3867
  chartData,
@@ -3641,12 +3874,49 @@ var TimeSeriesChartWrapper = (props) => {
3641
3874
  markerDisplay,
3642
3875
  onClick,
3643
3876
  onPointMouseOver,
3644
- onPointMouseOut
3645
- } = props;
3646
- const {
3877
+ onPointMouseOut,
3878
+ onSelect,
3879
+ splitByLayout,
3880
+ trellisKey,
3881
+ trellisSplitBy,
3647
3882
  backgroundColor,
3883
+ defaultFontColor,
3884
+ additionalTooltipValues,
3885
+ showYAxisWithZero: showYAxisWithZeroFromProps,
3886
+ showY2AxisWithZero: showY2AxisWithZeroFromProps
3887
+ } = _a, otherOptions = __objRest(_a, [
3888
+ "width",
3889
+ "height",
3890
+ "chartData",
3891
+ "options",
3892
+ "userLocale",
3893
+ "annotationX",
3894
+ "annotationLabel",
3895
+ "annotationColor",
3896
+ "legendDisplay",
3897
+ "markerDisplay",
3898
+ "onClick",
3899
+ "onPointMouseOver",
3900
+ "onPointMouseOut",
3901
+ "onSelect",
3902
+ "splitByLayout",
3903
+ "trellisKey",
3904
+ "trellisSplitBy",
3905
+ "backgroundColor",
3906
+ "defaultFontColor",
3907
+ "additionalTooltipValues",
3908
+ // Extract showYAxisWithZero directly from props for accelerated render mode
3909
+ "showYAxisWithZero",
3910
+ "showY2AxisWithZero"
3911
+ ]);
3912
+ const { eventHandlers, xField: xFieldFromProps } = otherOptions;
3913
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
3914
+ const {
3915
+ backgroundColor: bgColorFromOptions,
3648
3916
  seriesColors: seriesColorsStr,
3649
3917
  fieldColors,
3918
+ legendLabels: legendLabelsStr,
3919
+ legendMode,
3650
3920
  "axisTitleX.text": xAxisTitleText,
3651
3921
  "axisTitleY.text": yAxisTitleText,
3652
3922
  "axisTitleY2.text": y2AxisTitleText,
@@ -3654,8 +3924,11 @@ var TimeSeriesChartWrapper = (props) => {
3654
3924
  "axisTitleY.visibility": yAxisTitleVisibility,
3655
3925
  "axisTitleY2.visibility": y2AxisTitleVisibility,
3656
3926
  "axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
3927
+ "axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
3657
3928
  "axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
3929
+ "axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
3658
3930
  "axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
3931
+ "axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
3659
3932
  "axisY.abbreviation": yAxisAbbreviation,
3660
3933
  "axisY.scale": yAxisScale,
3661
3934
  "axisY2.abbreviation": y2AxisAbbreviation,
@@ -3665,10 +3938,63 @@ var TimeSeriesChartWrapper = (props) => {
3665
3938
  "axisLabelsY2.integerUnits": y2IntegerUnits,
3666
3939
  "chart.overlayFields": overlayFieldsStr,
3667
3940
  "chart.nullValueMode": nullValueMode,
3668
- lineWidth
3941
+ "chart.showDataLabels": showDataLabels,
3942
+ lineWidth,
3943
+ lineDashStyle,
3944
+ fieldDashStyles: lineDashStylesByFieldStr,
3945
+ yAxisMin: yAxisMinRaw,
3946
+ yAxisMax: yAxisMaxRaw,
3947
+ y2AxisMin: y2AxisMinRaw,
3948
+ y2AxisMax: y2AxisMaxRaw,
3949
+ showXMajorGridLines,
3950
+ showYMajorGridLines,
3951
+ showY2MajorGridLines,
3952
+ showYMinorGridLines,
3953
+ showY2MinorGridLines,
3954
+ showLineSmoothing,
3955
+ yAxisMajorTickVisibility,
3956
+ y2AxisMajorTickVisibility,
3957
+ yAxisMajorTickSize,
3958
+ y2AxisMajorTickSize,
3959
+ yAxisMajorTickInterval,
3960
+ y2AxisMajorTickInterval,
3961
+ yAxisMinorTickVisibility,
3962
+ y2AxisMinorTickVisibility,
3963
+ yAxisMinorTickSize,
3964
+ y2AxisMinorTickSize,
3965
+ showYAxisWithZero: showYAxisWithZeroFromOptions,
3966
+ showY2AxisWithZero: showY2AxisWithZeroFromOptions
3669
3967
  } = options;
3968
+ const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
3969
+ const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
3970
+ const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
3971
+ const showYMajorTicks = yAxisMajorTickVisibility === "show";
3972
+ const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
3973
+ const showYMinorTicks = yAxisMinorTickVisibility === "show";
3974
+ const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
3975
+ const yAxisMin = parseAxisValue(yAxisMinRaw);
3976
+ const yAxisMax = parseAxisValue(yAxisMaxRaw);
3977
+ const y2AxisMin = parseAxisValue(y2AxisMinRaw);
3978
+ const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
3979
+ const parseTickInterval = (simpleXMLValue, canvasValue) => {
3980
+ if (simpleXMLValue) return Number(simpleXMLValue);
3981
+ if (canvasValue) return Number(canvasValue);
3982
+ return void 0;
3983
+ };
3984
+ const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
3985
+ const y2AxisMajorTickIntervalNum = parseTickInterval(
3986
+ y2AxisMajorUnitFromSimpleXML,
3987
+ y2AxisMajorTickInterval
3988
+ );
3989
+ const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
3990
+ const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
3991
+ const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
3992
+ const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
3670
3993
  const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
3671
3994
  const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
3995
+ const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
3996
+ const legendLabels = parseArrayOption(legendLabelsStr);
3997
+ const bgColor = backgroundColor || bgColorFromOptions;
3672
3998
  const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
3673
3999
  const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
3674
4000
  const cachedHandleResize = react_exports.useCallback((w, h) => {
@@ -3679,31 +4005,64 @@ var TimeSeriesChartWrapper = (props) => {
3679
4005
  fields: chartData.fields,
3680
4006
  columns: chartData.seriesList
3681
4007
  });
3682
- const xField = getFieldName(filteredChartData.fields[0]);
4008
+ const xField = getFieldName2(filteredChartData.fields[0]);
3683
4009
  const yFields = getFieldNames(
3684
4010
  filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
3685
4011
  );
3686
- const y2Fields = y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [];
3687
- const overlayFields = overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [];
4012
+ const y2Fields = (0, react_exports.useMemo)(
4013
+ () => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
4014
+ [y2FieldsStr]
4015
+ );
4016
+ const overlayFields = (0, react_exports.useMemo)(
4017
+ () => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
4018
+ [overlayFieldsStr]
4019
+ );
3688
4020
  let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
3689
4021
  xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
3690
- let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFields, yAxisTitleVisibility);
4022
+ const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
4023
+ let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
3691
4024
  yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
3692
4025
  const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
3693
4026
  let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
3694
4027
  y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
3695
- const xScaleConfig = getXScaleConfig(xAxisTitle, xAxisLabelVisibility);
3696
- const yScaleConfig = getYScaleConfig(yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility);
3697
- let y2ScaleConfig = {};
3698
- if (y2Enabled) {
3699
- y2ScaleConfig = getY2ScaleConfig(
3700
- y2AxisTitle,
3701
- y2AxisAbbreviation,
3702
- y2AxisScale,
3703
- y2IntegerUnits,
3704
- y2AxisLabelVisibility
3705
- );
3706
- }
4028
+ const xScaleConfig = (0, react_exports.useMemo)(
4029
+ () => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
4030
+ [xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
4031
+ );
4032
+ const yScaleConfig = (0, react_exports.useMemo)(
4033
+ () => getYScaleConfig(
4034
+ yAxisTitle,
4035
+ yAxisAbbreviation,
4036
+ yAxisScale,
4037
+ yAxisLabelVisibility,
4038
+ yAxisMin,
4039
+ yAxisMax
4040
+ ),
4041
+ [yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
4042
+ );
4043
+ const y2ScaleConfig = (0, react_exports.useMemo)(() => {
4044
+ if (y2Enabled) {
4045
+ return getY2ScaleConfig(
4046
+ y2AxisTitle,
4047
+ y2AxisAbbreviation,
4048
+ y2AxisScale,
4049
+ y2IntegerUnits,
4050
+ y2AxisLabelVisibility,
4051
+ y2AxisMin,
4052
+ y2AxisMax
4053
+ );
4054
+ }
4055
+ return {};
4056
+ }, [
4057
+ y2Enabled,
4058
+ y2AxisTitle,
4059
+ y2AxisAbbreviation,
4060
+ y2AxisScale,
4061
+ y2IntegerUnits,
4062
+ y2AxisLabelVisibility,
4063
+ y2AxisMin,
4064
+ y2AxisMax
4065
+ ]);
3707
4066
  const uplotContainerElement = (0, react_exports.useRef)(null);
3708
4067
  const seriesDataFormatted = [
3709
4068
  filteredChartData.columns[0],
@@ -3719,9 +4078,21 @@ var TimeSeriesChartWrapper = (props) => {
3719
4078
  overlayFields,
3720
4079
  y2Enabled,
3721
4080
  nullValueMode,
3722
- markerDisplay
4081
+ markerDisplay,
4082
+ lineDashStyle,
4083
+ lineDashStylesByField
3723
4084
  ),
3724
- [yFields, y2Fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay]
4085
+ [
4086
+ yFields,
4087
+ y2Fields,
4088
+ lineWidth,
4089
+ overlayFields,
4090
+ y2Enabled,
4091
+ nullValueMode,
4092
+ markerDisplay,
4093
+ lineDashStyle,
4094
+ lineDashStylesByField
4095
+ ]
3725
4096
  );
3726
4097
  const chartingEventAnnotations = (0, react_exports.useMemo)(
3727
4098
  () => getAnnotationsForCanvas({
@@ -3735,25 +4106,54 @@ var TimeSeriesChartWrapper = (props) => {
3735
4106
  () => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
3736
4107
  [xScaleConfig, yScaleConfig, y2ScaleConfig]
3737
4108
  );
3738
- const legend = (0, react_exports.useMemo)(() => getLegend({ legendDisplay }), [legendDisplay]);
4109
+ const legend = (0, react_exports.useMemo)(
4110
+ () => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
4111
+ [legendDisplay, legendMode]
4112
+ );
3739
4113
  const handleChartClick = react_exports.useCallback(
3740
4114
  (event) => {
3741
4115
  if (onClick) {
3742
- handleClick(event, onClick);
4116
+ handleClick(event, onClick, trellisKey, trellisSplitBy);
3743
4117
  }
3744
4118
  },
3745
- [onClick]
4119
+ [onClick, trellisKey, trellisSplitBy]
3746
4120
  );
3747
4121
  const handleChartLegendClick = react_exports.useCallback(
3748
4122
  (event) => {
3749
4123
  if (onClick) {
3750
- handleLegendClick(event, onClick);
4124
+ handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
4125
+ }
4126
+ },
4127
+ [onClick, trellisKey, trellisSplitBy]
4128
+ );
4129
+ const handleChartRangeSelection = react_exports.useCallback(
4130
+ (range2) => {
4131
+ if (onSelect) {
4132
+ handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
4133
+ }
4134
+ },
4135
+ [onSelect, chartData, trellisKey, trellisSplitBy]
4136
+ );
4137
+ const handleChartRangeZoom = react_exports.useCallback(
4138
+ (range2) => {
4139
+ if (onSelect) {
4140
+ handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
3751
4141
  }
3752
4142
  },
3753
- [onClick]
4143
+ [onSelect, chartData, trellisKey, trellisSplitBy]
4144
+ );
4145
+ const xFieldToUse = xFieldFromProps || xField;
4146
+ const enableSearchZoom = react_exports.useMemo(
4147
+ () => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
4148
+ [eventHandlers, xFieldToUse]
3754
4149
  );
3755
4150
  const lastPayloadRef = react_exports.useRef(null);
3756
4151
  const lastOriginalEventRef = react_exports.useRef(null);
4152
+ const previousMouseoverPayloadRef = react_exports.useRef(null);
4153
+ const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
4154
+ react_exports.useEffect(() => {
4155
+ additionalTooltipValuesRef.current = additionalTooltipValues;
4156
+ }, [additionalTooltipValues]);
3757
4157
  const handleChartCrosshairChange = react_exports.useCallback(
3758
4158
  (event) => {
3759
4159
  if (onPointMouseOver || onPointMouseOut) {
@@ -3765,6 +4165,7 @@ var TimeSeriesChartWrapper = (props) => {
3765
4165
  payload: lastPayloadRef.current
3766
4166
  });
3767
4167
  }
4168
+ previousMouseoverPayloadRef.current = null;
3768
4169
  return;
3769
4170
  }
3770
4171
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
@@ -3772,25 +4173,36 @@ var TimeSeriesChartWrapper = (props) => {
3772
4173
  });
3773
4174
  delete payload.seriesKey;
3774
4175
  if (event.rowContext) {
3775
- Object.keys(event.rowContext).forEach((fieldName) => {
3776
- payload[`row.${fieldName}.value`] = event.rowContext[fieldName];
3777
- });
4176
+ Object.assign(
4177
+ payload,
4178
+ Object.keys(event.rowContext).reduce((acc, fieldName) => {
4179
+ acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
4180
+ return acc;
4181
+ }, {})
4182
+ );
4183
+ }
4184
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
4185
+ if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
4186
+ return;
3778
4187
  }
3779
- lastPayloadRef.current = payload;
4188
+ lastPayloadRef.current = updatedPayload;
3780
4189
  lastOriginalEventRef.current = event;
4190
+ previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
3781
4191
  if (onPointMouseOver) {
3782
4192
  onPointMouseOver({
3783
4193
  type: "point.mouseover",
3784
4194
  originalEvent: event,
3785
- payload
4195
+ payload: updatedPayload
3786
4196
  });
3787
4197
  }
3788
4198
  }
3789
4199
  },
3790
- [onPointMouseOver, onPointMouseOut]
4200
+ [onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
3791
4201
  );
3792
- const memoizedChart = (0, react_exports.useMemo)(
3793
- () => /* @__PURE__ */ react_exports.createElement(
4202
+ 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}`;
4203
+ const memoizedChart = (0, react_exports.useMemo)(() => {
4204
+ const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
4205
+ return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
3794
4206
  visualization_canvas_exports.TimeSeriesChart,
3795
4207
  {
3796
4208
  data: chartData,
@@ -3800,49 +4212,107 @@ var TimeSeriesChartWrapper = (props) => {
3800
4212
  seriesColorsByField,
3801
4213
  seriesConfig: seriesOverrides,
3802
4214
  legend,
4215
+ legendLabels,
4216
+ isSeriesCompare: legendMode === "seriesCompare",
4217
+ maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
3803
4218
  scaleConfig,
3804
4219
  timestampFormat: "expanded",
3805
4220
  onCrosshairClick: onClick ? handleChartClick : void 0,
3806
4221
  onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
3807
4222
  onSeriesClick: onClick ? handleChartLegendClick : void 0,
4223
+ onRangeSelection: handleChartRangeSelection,
4224
+ onRangeZoom: computedOnRangeZoom,
4225
+ serverSideZoom: enableSearchZoom,
3808
4226
  userLocale,
3809
4227
  events: chartingEventAnnotations,
3810
- eventsConfig: { renderer: triangleEventAnnotationRenderer }
4228
+ eventsConfig: { renderer: triangleEventAnnotationRenderer },
4229
+ additionalTooltipValuesRef,
4230
+ showXMajorGridLines,
4231
+ showYMajorGridLines,
4232
+ showY2MajorGridLines,
4233
+ showYMinorGridLines,
4234
+ showY2MinorGridLines,
4235
+ showLineSmoothing,
4236
+ dataValuesDisplay,
4237
+ showYMajorTicks,
4238
+ showY2MajorTicks,
4239
+ yAxisMajorTickSize: yAxisMajorTickSizeNum,
4240
+ y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
4241
+ yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
4242
+ y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
4243
+ showYMinorTicks,
4244
+ showY2MinorTicks,
4245
+ yAxisMinorTickSize: yAxisMinorTickSizeNum,
4246
+ y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
4247
+ showYAxisWithZero,
4248
+ showY2AxisWithZero
3811
4249
  }
3812
- ),
3813
- [
3814
- chartData,
3815
- containerWidth,
3816
- containerHeight,
3817
- seriesColors,
3818
- seriesColorsByField,
3819
- seriesOverrides,
3820
- legend,
3821
- scaleConfig,
3822
- userLocale,
3823
- chartingEventAnnotations,
3824
- onClick,
3825
- handleChartClick,
3826
- onPointMouseOver,
3827
- onPointMouseOut,
3828
- handleChartCrosshairChange,
3829
- handleChartLegendClick
3830
- ]
3831
- );
4250
+ ));
4251
+ }, [
4252
+ onSelect,
4253
+ handleChartRangeZoom,
4254
+ dataKey,
4255
+ chartData,
4256
+ containerWidth,
4257
+ containerHeight,
4258
+ seriesColors,
4259
+ seriesColorsByField,
4260
+ seriesOverrides,
4261
+ legend,
4262
+ legendLabels,
4263
+ scaleConfig,
4264
+ onClick,
4265
+ handleChartClick,
4266
+ onPointMouseOver,
4267
+ onPointMouseOut,
4268
+ handleChartCrosshairChange,
4269
+ handleChartLegendClick,
4270
+ handleChartRangeSelection,
4271
+ enableSearchZoom,
4272
+ userLocale,
4273
+ chartingEventAnnotations,
4274
+ showXMajorGridLines,
4275
+ showYMajorGridLines,
4276
+ showY2MajorGridLines,
4277
+ showYMinorGridLines,
4278
+ showY2MinorGridLines,
4279
+ showLineSmoothing,
4280
+ dataValuesDisplay,
4281
+ showYMajorTicks,
4282
+ showY2MajorTicks,
4283
+ yAxisMajorTickSizeNum,
4284
+ y2AxisMajorTickSizeNum,
4285
+ yAxisMajorTickIntervalNum,
4286
+ y2AxisMajorTickIntervalNum,
4287
+ showYMinorTicks,
4288
+ showY2MinorTicks,
4289
+ yAxisMinorTickSizeNum,
4290
+ y2AxisMinorTickSizeNum,
4291
+ showYAxisWithZero,
4292
+ showY2AxisWithZero,
4293
+ legendMode
4294
+ ]);
3832
4295
  const memoizedVisualization = (0, react_exports.useMemo)(() => {
3833
- return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
3834
- }, [backgroundColor, memoizedChart]);
3835
- return /* @__PURE__ */ react_exports.createElement(
4296
+ return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
4297
+ }, [bgColor, memoizedChart]);
4298
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
4299
+ TrellisTitle,
4300
+ {
4301
+ trellisKey,
4302
+ backgroundColor: bgColor,
4303
+ fontColor: defaultFontColor
4304
+ }
4305
+ ), /* @__PURE__ */ react_exports.createElement(
3836
4306
  TimeSeriesChartContainer,
3837
4307
  {
3838
- height,
4308
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
3839
4309
  width,
3840
4310
  ref: uplotContainerElement,
3841
4311
  "data-test": "timeseries-chart-wrapper"
3842
4312
  },
3843
4313
  /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
3844
4314
  memoizedVisualization
3845
- );
4315
+ ));
3846
4316
  };
3847
4317
  var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
3848
4318
 
@@ -4322,7 +4792,6 @@ var StaticMajorAndTrendLayout = [
4322
4792
  [
4323
4793
  {
4324
4794
  label: (0, i18n_exports._)("Unit position"),
4325
- // todo: we need a new editor combining unit and position
4326
4795
  option: "unitPosition",
4327
4796
  editor: "editor.select",
4328
4797
  editorProps: {
@@ -4632,7 +5101,6 @@ var themes = {
4632
5101
  enterprise: variables_default.textColor(props),
4633
5102
  prisma: variables_default.contentColorActive(props)
4634
5103
  })(props),
4635
- // TODO(fkurniawan): update with SCP-36839
4636
5104
  sparklineSeverityColors: (props) => pick_default2({
4637
5105
  enterprise: {
4638
5106
  dark: JSON.stringify({
@@ -4780,6 +5248,21 @@ var editorConfig = [
4780
5248
  }
4781
5249
  }
4782
5250
  ],
5251
+ [
5252
+ {
5253
+ label: (0, i18n_exports._)("Null value display"),
5254
+ option: "sparklineNullValueDisplay",
5255
+ editor: "editor.radioBar",
5256
+ editorProps: {
5257
+ values: [
5258
+ { label: (0, i18n_exports._)("Gaps"), value: "gaps" },
5259
+ { label: (0, i18n_exports._)("Zero"), value: "zero" },
5260
+ { label: (0, i18n_exports._)("Connect"), value: "connect" }
5261
+ ]
5262
+ },
5263
+ showEditor: ({ options }) => options.sparklineDisplay !== "off"
5264
+ }
5265
+ ],
4783
5266
  ...TrellisEditorConfig
4784
5267
  ]
4785
5268
  },