@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/MarkerGauge.js CHANGED
@@ -151,14 +151,23 @@ var defaultImport9 = __toESM(require("@splunk/ui-utils/id"));
151
151
  __reExport(id_exports, require("@splunk/ui-utils/id"));
152
152
  var id_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
153
153
 
154
+ // esm-externals:@splunk/visualization-schemas
155
+ var visualization_schemas_exports = {};
156
+ __export(visualization_schemas_exports, {
157
+ default: () => visualization_schemas_default
158
+ });
159
+ var defaultImport10 = __toESM(require("@splunk/visualization-schemas"));
160
+ __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
161
+ var visualization_schemas_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
162
+
154
163
  // esm-externals:@splunk/visualizations-shared/colorConstants
155
164
  var colorConstants_exports = {};
156
165
  __export(colorConstants_exports, {
157
166
  default: () => colorConstants_default
158
167
  });
159
- var defaultImport10 = __toESM(require("@splunk/visualizations-shared/colorConstants"));
168
+ var defaultImport11 = __toESM(require("@splunk/visualizations-shared/colorConstants"));
160
169
  __reExport(colorConstants_exports, require("@splunk/visualizations-shared/colorConstants"));
161
- var colorConstants_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
170
+ var colorConstants_default = "default" in defaultImport11 ? defaultImport11.default : defaultImport11;
162
171
 
163
172
  // src/common/gaugeUtils.ts
164
173
  var GAUGE_THICKNESS = 50;
@@ -375,9 +384,9 @@ var numberUtils_exports = {};
375
384
  __export(numberUtils_exports, {
376
385
  default: () => numberUtils_default
377
386
  });
378
- var defaultImport11 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
387
+ var defaultImport12 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
379
388
  __reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUtils"));
380
- var numberUtils_default = "default" in defaultImport11 ? defaultImport11.default : defaultImport11;
389
+ var numberUtils_default = "default" in defaultImport12 ? defaultImport12.default : defaultImport12;
381
390
 
382
391
  // src/common/GaugeMajorTicks.jsx
383
392
  var DEFAULT_NUM_OF_TICKS = 5;
@@ -577,9 +586,9 @@ var format_exports = {};
577
586
  __export(format_exports, {
578
587
  default: () => format_default
579
588
  });
580
- var defaultImport12 = __toESM(require("@splunk/ui-utils/format"));
589
+ var defaultImport13 = __toESM(require("@splunk/ui-utils/format"));
581
590
  __reExport(format_exports, require("@splunk/ui-utils/format"));
582
- var format_default = "default" in defaultImport12 ? defaultImport12.default : defaultImport12;
591
+ var format_default = "default" in defaultImport13 ? defaultImport13.default : defaultImport13;
583
592
 
584
593
  // src/common/GaugeValueMarker.jsx
585
594
  var MARKER_THICKNESS = 15;
@@ -724,6 +733,57 @@ ValueMarker.propTypes = {
724
733
  };
725
734
  var GaugeValueMarker_default = ValueMarker;
726
735
 
736
+ // esm-externals:@splunk/visualization-context/FeatureFlagContext
737
+ var FeatureFlagContext_exports = {};
738
+ __export(FeatureFlagContext_exports, {
739
+ default: () => FeatureFlagContext_default
740
+ });
741
+ var defaultImport14 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
742
+ __reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
743
+ var FeatureFlagContext_default = "default" in defaultImport14 ? defaultImport14.default : defaultImport14;
744
+
745
+ // src/common/hooks/useTrellisEnabled.ts
746
+ var useTrellisFeatureFlagOn = () => {
747
+ const context = (0, react_exports.useContext)(FeatureFlagContext_default);
748
+ return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
749
+ };
750
+ var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
751
+ const trellisFeatureEnabled = useTrellisFeatureFlagOn();
752
+ return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
753
+ };
754
+
755
+ // src/common/components/TrellisTitle.tsx
756
+ var TRELLIS_TITLE_HEIGHT = 28;
757
+ var TrellisTitleText = styled_components_default.div`
758
+ margin-left: 10px;
759
+ margin-right: 10px;
760
+ padding-top: 8px;
761
+ text-overflow: ellipsis;
762
+ white-space: nowrap;
763
+ overflow: hidden;
764
+ `;
765
+ var TrellisTitleDiv = styled_components_default.div`
766
+ height: ${TRELLIS_TITLE_HEIGHT}px;
767
+ font-size: 14px;
768
+ font-weight: 700;
769
+ color: ${(props) => props.fontColor};
770
+ background-color: ${(props) => props.backgroundColor};
771
+ box-shadow: 0 1px ${(props) => props.backgroundColor}; // this is added to avoid a 1px gap between title and viz divs that showed up intermittently because of pixel rounding error in chrome.
772
+ `;
773
+ var TrellisTitle = (props) => {
774
+ const titleText = String(props.trellisKey).toString();
775
+ return /* @__PURE__ */ react_exports.createElement(
776
+ TrellisTitleDiv,
777
+ {
778
+ fontColor: props.fontColor,
779
+ backgroundColor: props.backgroundColor,
780
+ "data-test": "trellis-title",
781
+ title: titleText
782
+ },
783
+ /* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
784
+ );
785
+ };
786
+
727
787
  // src/MarkerGauge/PureMarkerGauge/MarkerGauge.tsx
728
788
  var MAX_VERTICAL_CONTAINER_WIDTH = 200;
729
789
  var MIN_VERTICAL_CONTAINER_HEIGHT = 200;
@@ -774,8 +834,12 @@ var MarkerGauge = (_a) => {
774
834
  majorTickFillColor,
775
835
  majorTickStrokeColor,
776
836
  valueMarkerFillColor,
777
- valueMarkerLabelFillColor
837
+ valueMarkerLabelFillColor,
838
+ splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off,
839
+ defaultFontColor = "#000",
840
+ trellisKey = ""
778
841
  } = props;
842
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
779
843
  const cachedHandleResize = react_exports.useCallback((w, h) => {
780
844
  setContainerWidth(w);
781
845
  setContainerHeight(h);
@@ -930,6 +994,26 @@ var MarkerGauge = (_a) => {
930
994
  errorMessage,
931
995
  errorId
932
996
  ]);
997
+ if (trellisEnabled) {
998
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, /* @__PURE__ */ react_exports.createElement(
999
+ TrellisTitle,
1000
+ {
1001
+ fontColor: defaultFontColor,
1002
+ backgroundColor,
1003
+ trellisKey
1004
+ }
1005
+ ), /* @__PURE__ */ react_exports.createElement(
1006
+ Container,
1007
+ {
1008
+ "data-test": "marker-gauge-container",
1009
+ width,
1010
+ height: Number(height) - TRELLIS_TITLE_HEIGHT,
1011
+ backgroundColor
1012
+ },
1013
+ /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
1014
+ renderVisualization()
1015
+ ));
1016
+ }
933
1017
  return /* @__PURE__ */ react_exports.createElement(
934
1018
  Container,
935
1019
  {
@@ -946,7 +1030,6 @@ MarkerGauge.propTypes = {
946
1030
  width: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
947
1031
  height: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
948
1032
  value: prop_types_exports.number,
949
- // valueFieldName: T.string, // todo: need add it back when displaying name later
950
1033
  orientation: prop_types_exports.oneOf(["horizontal", "vertical"]),
951
1034
  majorUnit: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
952
1035
  showLabels: prop_types_exports.bool,
@@ -1009,45 +1092,36 @@ var visualization_icons_exports = {};
1009
1092
  __export(visualization_icons_exports, {
1010
1093
  default: () => visualization_icons_default
1011
1094
  });
1012
- var defaultImport13 = __toESM(require("@splunk/visualization-icons"));
1095
+ var defaultImport15 = __toESM(require("@splunk/visualization-icons"));
1013
1096
  __reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
1014
- var visualization_icons_default = "default" in defaultImport13 ? defaultImport13.default : defaultImport13;
1097
+ var visualization_icons_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
1015
1098
 
1016
1099
  // esm-externals:@splunk/visualization-icons/placeholders
1017
1100
  var placeholders_exports = {};
1018
1101
  __export(placeholders_exports, {
1019
1102
  default: () => placeholders_default
1020
1103
  });
1021
- var defaultImport14 = __toESM(require("@splunk/visualization-icons/placeholders"));
1104
+ var defaultImport16 = __toESM(require("@splunk/visualization-icons/placeholders"));
1022
1105
  __reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
1023
- var placeholders_default = "default" in defaultImport14 ? defaultImport14.default : defaultImport14;
1024
-
1025
- // esm-externals:@splunk/visualization-schemas
1026
- var visualization_schemas_exports = {};
1027
- __export(visualization_schemas_exports, {
1028
- default: () => visualization_schemas_default
1029
- });
1030
- var defaultImport15 = __toESM(require("@splunk/visualization-schemas"));
1031
- __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
1032
- var visualization_schemas_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
1106
+ var placeholders_default = "default" in defaultImport16 ? defaultImport16.default : defaultImport16;
1033
1107
 
1034
1108
  // esm-externals:@splunk/themes/variables
1035
1109
  var variables_exports = {};
1036
1110
  __export(variables_exports, {
1037
1111
  default: () => variables_default
1038
1112
  });
1039
- var defaultImport16 = __toESM(require("@splunk/themes/variables"));
1113
+ var defaultImport17 = __toESM(require("@splunk/themes/variables"));
1040
1114
  __reExport(variables_exports, require("@splunk/themes/variables"));
1041
- var variables_default = "default" in defaultImport16 ? defaultImport16.default : defaultImport16;
1115
+ var variables_default = "default" in defaultImport17 ? defaultImport17.default : defaultImport17;
1042
1116
 
1043
1117
  // esm-externals:@splunk/themes/pick
1044
1118
  var pick_exports = {};
1045
1119
  __export(pick_exports, {
1046
1120
  default: () => pick_default
1047
1121
  });
1048
- var defaultImport17 = __toESM(require("@splunk/themes/pick"));
1122
+ var defaultImport18 = __toESM(require("@splunk/themes/pick"));
1049
1123
  __reExport(pick_exports, require("@splunk/themes/pick"));
1050
- var pick_default = "default" in defaultImport17 ? defaultImport17.default : defaultImport17;
1124
+ var pick_default = "default" in defaultImport18 ? defaultImport18.default : defaultImport18;
1051
1125
 
1052
1126
  // src/common/editorConfig/Gauge.ts
1053
1127
  var gauge = {
@@ -1103,9 +1177,9 @@ var configUtils_exports = {};
1103
1177
  __export(configUtils_exports, {
1104
1178
  default: () => configUtils_default
1105
1179
  });
1106
- var defaultImport18 = __toESM(require("@splunk/visualizations-shared/configUtils"));
1180
+ var defaultImport19 = __toESM(require("@splunk/visualizations-shared/configUtils"));
1107
1181
  __reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
1108
- var configUtils_default = "default" in defaultImport18 ? defaultImport18.default : defaultImport18;
1182
+ var configUtils_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
1109
1183
 
1110
1184
  // src/common/utils/configUtils.ts
1111
1185
  function enhanceConfig(vizConfig) {
@@ -1143,6 +1217,110 @@ var defaultBackgroundColor = (props) => pick_default({
1143
1217
  prisma: variables_default.backgroundColorSection(props)
1144
1218
  })(props);
1145
1219
 
1220
+ // src/common/editorConfig/TrellisEditors.ts
1221
+ var isTrellisFeatureFlagOn = ({ featureFlags }) => {
1222
+ return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
1223
+ };
1224
+ var isTrellisEnabled = ({ options, featureFlags }) => {
1225
+ const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
1226
+ return isTrellisFeatureFlagOn({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
1227
+ };
1228
+ var TrellisEditorConfig = [
1229
+ [
1230
+ {
1231
+ label: (0, i18n_exports._)("Trellis layout"),
1232
+ option: "splitByLayout",
1233
+ editor: "editor.toggle",
1234
+ showEditor: isTrellisFeatureFlagOn
1235
+ }
1236
+ ],
1237
+ [
1238
+ {
1239
+ label: (0, i18n_exports._)("Split by"),
1240
+ option: "trellisSplitBy",
1241
+ editor: "editor.trellisSplitBy",
1242
+ editorProps: {
1243
+ dataSourceKey: "primary"
1244
+ },
1245
+ showEditor: isTrellisEnabled
1246
+ }
1247
+ ],
1248
+ [
1249
+ {
1250
+ label: (0, i18n_exports._)("Number of columns"),
1251
+ option: "trellisColumns",
1252
+ editor: "editor.number",
1253
+ editorProps: {
1254
+ min: 1
1255
+ },
1256
+ showEditor: isTrellisEnabled
1257
+ }
1258
+ ],
1259
+ [
1260
+ {
1261
+ label: (0, i18n_exports._)("Min column width"),
1262
+ option: "trellisMinColumnWidth",
1263
+ editor: "editor.number",
1264
+ editorProps: {
1265
+ min: 1
1266
+ },
1267
+ showEditor: isTrellisEnabled
1268
+ },
1269
+ {
1270
+ label: (0, i18n_exports._)("Row height"),
1271
+ option: "trellisRowHeight",
1272
+ editor: "editor.number",
1273
+ editorProps: {
1274
+ min: 1
1275
+ },
1276
+ showEditor: isTrellisEnabled
1277
+ }
1278
+ ],
1279
+ [
1280
+ {
1281
+ label: (0, i18n_exports._)("Max number of components per page"),
1282
+ option: "trellisPageCount",
1283
+ editor: "editor.number",
1284
+ editorProps: {
1285
+ min: 1
1286
+ },
1287
+ showEditor: isTrellisEnabled
1288
+ }
1289
+ ]
1290
+ ];
1291
+ var TimechartTrellisEditorConfig = [
1292
+ [
1293
+ {
1294
+ label: (0, i18n_exports._)("Trellis layout"),
1295
+ option: "splitByLayout",
1296
+ editor: "editor.toggle",
1297
+ showEditor: isTrellisFeatureFlagOn,
1298
+ // add help text for timecharts
1299
+ editorProps: {
1300
+ help: (0, i18n_exports._)(
1301
+ "Y2-axis and overlay field configurations are not supported when trellis is enabled."
1302
+ ),
1303
+ helpFormat: "under"
1304
+ }
1305
+ }
1306
+ ],
1307
+ ...TrellisEditorConfig.slice(1),
1308
+ [
1309
+ {
1310
+ label: (0, i18n_exports._)("Shared y-axis scale"),
1311
+ option: "trellisSharedScale",
1312
+ editor: "editor.checkbox",
1313
+ showEditor: isTrellisEnabled
1314
+ }
1315
+ ]
1316
+ ];
1317
+ var TrellisBackgroundColorEditor = {
1318
+ label: (0, i18n_exports._)("Trellis background"),
1319
+ option: "trellisBackgroundColor",
1320
+ editor: "editor.color",
1321
+ showEditor: isTrellisEnabled
1322
+ };
1323
+
1146
1324
  // src/MarkerGauge/config.ts
1147
1325
  var dataContract = {
1148
1326
  requiredDataSources: [
@@ -1185,6 +1363,10 @@ var themes = {
1185
1363
  valueMarkerLabelFillColor: (props) => pick_default({
1186
1364
  light: variables_default.gray96(props),
1187
1365
  dark: variables_default.black(props)
1366
+ })(props),
1367
+ defaultFontColor: (props) => pick_default({
1368
+ enterprise: variables_default.textColor(props),
1369
+ prisma: variables_default.contentColorDefault(props)
1188
1370
  })(props)
1189
1371
  };
1190
1372
  var editorConfig = [
@@ -1215,7 +1397,10 @@ var editorConfig = [
1215
1397
  ]
1216
1398
  ]
1217
1399
  },
1218
- Gauge_default,
1400
+ {
1401
+ label: Gauge_default.label,
1402
+ layout: [...Gauge_default.layout, ...TrellisEditorConfig]
1403
+ },
1219
1404
  {
1220
1405
  label: (0, i18n_exports._)("Color and style"),
1221
1406
  layout: [
@@ -1232,7 +1417,14 @@ var editorConfig = [
1232
1417
  }
1233
1418
  }
1234
1419
  ],
1235
- BackgroundColor_default({ themes, labelPosition: "top" })
1420
+ BackgroundColor_default({ themes, labelPosition: "top" }),
1421
+ [
1422
+ __spreadProps(__spreadValues({}, TrellisBackgroundColorEditor), {
1423
+ editorProps: {
1424
+ themes
1425
+ }
1426
+ })
1427
+ ]
1236
1428
  ]
1237
1429
  }
1238
1430
  ];
@@ -1256,7 +1448,7 @@ var config = {
1256
1448
  defaultContext,
1257
1449
  optionsSchema: visualization_schemas_exports.markerGaugeOptionsSchema,
1258
1450
  editorConfig,
1259
- supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */],
1451
+ supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */, "trellis" /* TRELLIS */],
1260
1452
  themes
1261
1453
  };
1262
1454
  var config_default = enhanceConfig(config);
@@ -1266,54 +1458,45 @@ var getSettingsFromThemedProps_exports = {};
1266
1458
  __export(getSettingsFromThemedProps_exports, {
1267
1459
  default: () => getSettingsFromThemedProps_default
1268
1460
  });
1269
- var defaultImport19 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
1461
+ var defaultImport20 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
1270
1462
  __reExport(getSettingsFromThemedProps_exports, require("@splunk/themes/getSettingsFromThemedProps"));
1271
- var getSettingsFromThemedProps_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
1463
+ var getSettingsFromThemedProps_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
1272
1464
 
1273
1465
  // esm-externals:@splunk/visualization-encoding/Options
1274
1466
  var Options_exports = {};
1275
1467
  __export(Options_exports, {
1276
1468
  default: () => Options_default
1277
1469
  });
1278
- var defaultImport20 = __toESM(require("@splunk/visualization-encoding/Options"));
1470
+ var defaultImport21 = __toESM(require("@splunk/visualization-encoding/Options"));
1279
1471
  __reExport(Options_exports, require("@splunk/visualization-encoding/Options"));
1280
- var Options_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
1472
+ var Options_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
1281
1473
 
1282
1474
  // esm-externals:@splunk/visualizations-shared/SanitizeProps
1283
1475
  var SanitizeProps_exports = {};
1284
1476
  __export(SanitizeProps_exports, {
1285
1477
  default: () => SanitizeProps_default
1286
1478
  });
1287
- var defaultImport21 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
1479
+ var defaultImport22 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
1288
1480
  __reExport(SanitizeProps_exports, require("@splunk/visualizations-shared/SanitizeProps"));
1289
- var SanitizeProps_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
1481
+ var SanitizeProps_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
1290
1482
 
1291
1483
  // esm-externals:@splunk/visualization-context/TimezoneContext
1292
1484
  var TimezoneContext_exports = {};
1293
1485
  __export(TimezoneContext_exports, {
1294
1486
  default: () => TimezoneContext_default
1295
1487
  });
1296
- var defaultImport22 = __toESM(require("@splunk/visualization-context/TimezoneContext"));
1488
+ var defaultImport23 = __toESM(require("@splunk/visualization-context/TimezoneContext"));
1297
1489
  __reExport(TimezoneContext_exports, require("@splunk/visualization-context/TimezoneContext"));
1298
- var TimezoneContext_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
1490
+ var TimezoneContext_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
1299
1491
 
1300
1492
  // esm-externals:@splunk/moment
1301
1493
  var moment_exports = {};
1302
1494
  __export(moment_exports, {
1303
1495
  default: () => moment_default
1304
1496
  });
1305
- var defaultImport23 = __toESM(require("@splunk/moment"));
1497
+ var defaultImport24 = __toESM(require("@splunk/moment"));
1306
1498
  __reExport(moment_exports, require("@splunk/moment"));
1307
- var moment_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
1308
-
1309
- // esm-externals:@splunk/visualization-context/FeatureFlagContext
1310
- var FeatureFlagContext_exports = {};
1311
- __export(FeatureFlagContext_exports, {
1312
- default: () => FeatureFlagContext_default
1313
- });
1314
- var defaultImport24 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
1315
- __reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
1316
- var FeatureFlagContext_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
1499
+ var moment_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
1317
1500
 
1318
1501
  // esm-externals:@splunk/visualizations-shared/hocUtils
1319
1502
  var hocUtils_exports = {};
@@ -1596,7 +1779,7 @@ var Cover = styled_components_default.div`
1596
1779
  bottom: 0;
1597
1780
  `;
1598
1781
  var Blocker = styled_components_default.div.attrs({
1599
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b"
1782
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f"
1600
1783
  })`
1601
1784
  position: relative;
1602
1785
  width: 100%;
@@ -1677,7 +1860,7 @@ var withFixedSizeContainer = (Viz) => {
1677
1860
  FixSizeItem,
1678
1861
  {
1679
1862
  "data-test": "fix-size-item",
1680
- "data-splunk-visualization-version": "28.3.0 - 843e0f60b",
1863
+ "data-splunk-visualization-version": "28.4.0 - 002bd482f",
1681
1864
  width,
1682
1865
  height,
1683
1866
  backgroundColor
@@ -1764,6 +1947,7 @@ var withPlaceholder = (Visualization, useIconPlaceholder = shouldShowIconPlaceho
1764
1947
  var withPlaceholder_default = withPlaceholder;
1765
1948
 
1766
1949
  // src/common/utils/dataUtils.ts
1950
+ var getFieldName = (field) => typeof field === "string" ? field : field.name;
1767
1951
  var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
1768
1952
  const dataLength = data.length;
1769
1953
  const downsampledIndices = [];
@@ -1880,9 +2064,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
1880
2064
  let xColumn = [];
1881
2065
  const yColumns = [];
1882
2066
  const canDownsample = !ds.data.fields.some((field, index) => {
1883
- var _a, _b;
1884
- const fieldName = (_a = field.name) != null ? _a : field;
1885
- const fieldType = (_b = fieldTypes[index]) != null ? _b : "unknown";
2067
+ var _a;
2068
+ const fieldName = getFieldName(field);
2069
+ const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
1886
2070
  const column = ds.data.columns[index];
1887
2071
  let hasDisplayedColumnThatCantBeDownsampled = false;
1888
2072
  if (fieldName === xField) {
@@ -2166,6 +2350,307 @@ __reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisU
2166
2350
  var trellisUtils_default = "default" in defaultImport30 ? defaultImport30.default : defaultImport30;
2167
2351
 
2168
2352
  // src/common/utils/trellisUtils.ts
2353
+ var AGGREGATIONS = "aggregations";
2354
+ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
2355
+ var _a, _b, _c, _d;
2356
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2357
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2358
+ let splitDataSources = null;
2359
+ let errorCode = null;
2360
+ if (fields && fields.length) {
2361
+ splitDataSources = {};
2362
+ for (let i = 0; i < fields.length; i += 1) {
2363
+ const fieldName = fields[i].name;
2364
+ if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
2365
+ splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
2366
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2367
+ );
2368
+ splitDataSources[fieldName].primary.data.fields = [fields[i]];
2369
+ splitDataSources[fieldName].primary.data.columns = [columns[i]];
2370
+ }
2371
+ }
2372
+ } else {
2373
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2374
+ }
2375
+ return { splitDataSources, errorCode };
2376
+ };
2377
+ var toFieldEntries = (fields = []) => {
2378
+ return fields.map((field) => {
2379
+ if (typeof field === "string") {
2380
+ return { name: field };
2381
+ }
2382
+ return field;
2383
+ });
2384
+ };
2385
+ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
2386
+ var _a, _b, _c, _d;
2387
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2388
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2389
+ let splitDataSources = null;
2390
+ let splitByFields = [];
2391
+ let errorCode = null;
2392
+ if (fields.length > 0) {
2393
+ splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2394
+ }
2395
+ if (splitByFields && splitByFields.length > 0) {
2396
+ splitDataSources = {};
2397
+ splitByFields.forEach((splitByField) => {
2398
+ splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
2399
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2400
+ );
2401
+ splitDataSources[splitByField].primary.data.fields = [fields[0]];
2402
+ splitDataSources[splitByField].primary.data.columns = [columns[0]];
2403
+ fields.forEach((field, idx) => {
2404
+ const fieldName = field == null ? void 0 : field.name;
2405
+ if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
2406
+ splitDataSources[splitByField].primary.data.fields.push(field);
2407
+ splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
2408
+ }
2409
+ });
2410
+ });
2411
+ } else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
2412
+ splitDataSources = {};
2413
+ for (let i = 1; i < fields.length; i += 1) {
2414
+ const fieldName = fields[i].name;
2415
+ if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
2416
+ splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
2417
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2418
+ );
2419
+ splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
2420
+ splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
2421
+ }
2422
+ }
2423
+ } else {
2424
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2425
+ }
2426
+ return { splitDataSources, errorCode };
2427
+ };
2428
+ var dataSourcesSplitByAggregationsStats = (dataSource) => {
2429
+ var _a, _b, _c, _d;
2430
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2431
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2432
+ let splitDataSources = null;
2433
+ let splitByFields = [];
2434
+ let errorCode = null;
2435
+ if (fields.length > 0) {
2436
+ splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
2437
+ }
2438
+ if (splitByFields && splitByFields.length > 0) {
2439
+ splitDataSources = {};
2440
+ splitByFields.forEach((splitByField) => {
2441
+ splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
2442
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2443
+ );
2444
+ splitDataSources[splitByField].primary.data.fields = [fields[0]];
2445
+ splitDataSources[splitByField].primary.data.columns = [columns[0]];
2446
+ const idx = fields.findIndex((field) => field.name === splitByField);
2447
+ if (idx > 0) {
2448
+ splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
2449
+ splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
2450
+ }
2451
+ });
2452
+ } else {
2453
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2454
+ }
2455
+ return { splitDataSources, errorCode };
2456
+ };
2457
+ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
2458
+ var _a, _b, _c, _d, _e;
2459
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2460
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2461
+ let splitDataSources = null;
2462
+ let splitByFields = [];
2463
+ let errorCode = null;
2464
+ if (fields.length > 0) {
2465
+ splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
2466
+ }
2467
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
2468
+ splitDataSources = {};
2469
+ const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2470
+ const valueKeys = [];
2471
+ for (let i = 1; i < fields.length; i += 1) {
2472
+ if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
2473
+ valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
2474
+ }
2475
+ }
2476
+ valueKeys.forEach((val) => {
2477
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2478
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2479
+ );
2480
+ splitDataSources[val].primary.data.fields = [
2481
+ { name: fields[0].name },
2482
+ ...dataSourceKeys.map((k) => ({
2483
+ name: k
2484
+ }))
2485
+ ];
2486
+ splitDataSources[val].primary.data.columns = [[...columns[0]]];
2487
+ dataSourceKeys.forEach((dsKey) => {
2488
+ fields.forEach((field, idx) => {
2489
+ if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
2490
+ splitDataSources[val].primary.data.columns.push([...columns[idx]]);
2491
+ }
2492
+ });
2493
+ });
2494
+ });
2495
+ } else {
2496
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2497
+ }
2498
+ return { splitDataSources, errorCode };
2499
+ };
2500
+ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
2501
+ var _a, _b, _c, _d;
2502
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2503
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2504
+ let splitDataSources = null;
2505
+ let splitByFields = [];
2506
+ let errorCode = null;
2507
+ if (fields.length > 0) {
2508
+ splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
2509
+ }
2510
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
2511
+ splitDataSources = {};
2512
+ const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
2513
+ const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
2514
+ const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2515
+ const nonDataSourceAggregations = [];
2516
+ if (!dataSourceKeys.length && fields[0].groupby_rank === "0" && fields.length && !fields[1].groupby_rank) {
2517
+ for (let i = 1; i < fields.length; i += 1) {
2518
+ nonDataSourceAggregations.push(fields[i].name);
2519
+ }
2520
+ }
2521
+ if (splitByFieldIdx === 0) {
2522
+ const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
2523
+ valueKeys.forEach((val, idx) => {
2524
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2525
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2526
+ );
2527
+ splitDataSources[val].primary.data.fields = [];
2528
+ if (otherSplitBy.length) {
2529
+ splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
2530
+ }
2531
+ if (dataSourceKeys.length) {
2532
+ const columnValues = [[]];
2533
+ splitDataSources[val].primary.data.fields = [
2534
+ ...splitDataSources[val].primary.data.fields,
2535
+ ...dataSourceKeys.map((k) => ({
2536
+ name: k
2537
+ }))
2538
+ ];
2539
+ dataSourceKeys.forEach(() => {
2540
+ columnValues.push([]);
2541
+ });
2542
+ for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
2543
+ columnValues[0].push(
2544
+ fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
2545
+ );
2546
+ dataSourceKeys.forEach((dskey, dsIndx) => {
2547
+ const mul = (fields.length - 1) / dataSourceKeys.length;
2548
+ columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
2549
+ });
2550
+ }
2551
+ splitDataSources[val].primary.data.columns = columnValues;
2552
+ } else if (nonDataSourceAggregations.length) {
2553
+ const columnValues = [];
2554
+ fields.forEach((aggregationField, fieldIdx) => {
2555
+ if (fieldIdx > 0) {
2556
+ splitDataSources[val].primary.data.fields.push(aggregationField);
2557
+ columnValues.push([columns[fieldIdx][idx]]);
2558
+ }
2559
+ });
2560
+ splitDataSources[val].primary.data.columns = columnValues;
2561
+ }
2562
+ });
2563
+ } else {
2564
+ const valueKeys = [];
2565
+ for (let i = 1; i < fields.length; i += 1) {
2566
+ valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
2567
+ }
2568
+ valueKeys.forEach((val) => {
2569
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2570
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2571
+ );
2572
+ splitDataSources[val].primary.data.fields = [
2573
+ { name: otherSplitBy[0] },
2574
+ ...dataSourceKeys.map((k) => ({
2575
+ name: k
2576
+ }))
2577
+ ];
2578
+ splitDataSources[val].primary.data.columns = [[...columns[0]]];
2579
+ dataSourceKeys.forEach((dsKey) => {
2580
+ fields.forEach((field, idx) => {
2581
+ if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
2582
+ splitDataSources[val].primary.data.columns.push([...columns[idx]]);
2583
+ }
2584
+ });
2585
+ });
2586
+ });
2587
+ }
2588
+ } else {
2589
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2590
+ }
2591
+ return { splitDataSources, errorCode };
2592
+ };
2593
+ var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
2594
+ var _a, _b, _c, _d, _e, _f;
2595
+ const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
2596
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2597
+ let splitDataSources = null;
2598
+ let splitByFields = [];
2599
+ let errorCode = null;
2600
+ if (fields.length > 0) {
2601
+ splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
2602
+ }
2603
+ const splitByIndex = fields.findIndex((field) => field.name === splitBy);
2604
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
2605
+ const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
2606
+ splitDataSources = {};
2607
+ splitByColumn.forEach((val, idx) => {
2608
+ if (!splitDataSources[val]) {
2609
+ splitDataSources[val] = [idx];
2610
+ } else {
2611
+ splitDataSources[val].push(idx);
2612
+ }
2613
+ });
2614
+ const cloneFields = (0, lodash_exports.cloneDeep)(fields);
2615
+ cloneFields.splice(splitByIndex, 1);
2616
+ const valueKeys = Object.keys(splitDataSources);
2617
+ valueKeys.forEach((val) => {
2618
+ const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
2619
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2620
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2621
+ );
2622
+ splitDataSources[val].primary.data.fields = cloneFields;
2623
+ splitDataSources[val].primary.data.columns = [];
2624
+ columns.forEach((col, idx) => {
2625
+ if (idx !== splitByIndex) {
2626
+ const newCol = valIndices.map((valIdx) => col[valIdx]);
2627
+ splitDataSources[val].primary.data.columns.push(newCol);
2628
+ }
2629
+ });
2630
+ });
2631
+ } else {
2632
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2633
+ }
2634
+ return { splitDataSources, errorCode };
2635
+ };
2636
+ var getTrellisDataSourcesBySplitMode = (splitMode, dataSources, trellisSplitBy) => {
2637
+ let result = null;
2638
+ try {
2639
+ if (splitMode === trellisUtils_exports.TIMECHART) {
2640
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeTimechart(dataSources, trellisSplitBy);
2641
+ } else if (splitMode === trellisUtils_exports.STATS) {
2642
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsStats(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.STATS);
2643
+ } else if (splitMode === trellisUtils_exports.CHART) {
2644
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeChart(dataSources, trellisSplitBy);
2645
+ } else if (splitMode === trellisUtils_exports.UNKNOWN) {
2646
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsUnknown(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.UNKNOWN);
2647
+ }
2648
+ } catch (ex) {
2649
+ console.error("getTrellisDataSourcesBySplitMode ", ex);
2650
+ result = { splitDataSources: null, errorCode: "UNKNOWN" };
2651
+ }
2652
+ return result;
2653
+ };
2169
2654
  var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
2170
2655
  if (isTrellisOn && !options.legendDisplay) {
2171
2656
  return {
@@ -2174,6 +2659,36 @@ var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
2174
2659
  }
2175
2660
  return {};
2176
2661
  };
2662
+ var calculateSharedMinMax = (splitData) => {
2663
+ let max = -Infinity;
2664
+ let min = Infinity;
2665
+ Object.keys(splitData).forEach((splitByKey) => {
2666
+ const datasources = splitData[splitByKey];
2667
+ Object.keys(datasources).forEach((datasourceName) => {
2668
+ const dataColumns = datasources[datasourceName].data.columns;
2669
+ dataColumns.forEach((column) => {
2670
+ column.forEach((point) => {
2671
+ const pointNumber = Number(point);
2672
+ if (pointNumber > max) {
2673
+ max = pointNumber;
2674
+ }
2675
+ if (pointNumber < min) {
2676
+ min = pointNumber;
2677
+ }
2678
+ });
2679
+ });
2680
+ });
2681
+ });
2682
+ return [min, max];
2683
+ };
2684
+ var determineMinMax = (splitData, trellisSharedScale, yAxisMin, yAxisMax, stackMode) => {
2685
+ if (!trellisSharedScale || stackMode === "stacked100" || yAxisMin !== "auto" && yAxisMax !== "auto")
2686
+ return [yAxisMin, yAxisMax];
2687
+ const [sharedMin, sharedMax] = calculateSharedMinMax(splitData);
2688
+ const shouldUseSharedMax = sharedMax !== -Infinity && yAxisMax === "auto";
2689
+ const shouldUseSharedMin = sharedMin !== Infinity && yAxisMin === "auto";
2690
+ return [shouldUseSharedMin ? sharedMin : yAxisMin, shouldUseSharedMax ? sharedMax : yAxisMax];
2691
+ };
2177
2692
 
2178
2693
  // esm-externals:@splunk/visualization-canvas
2179
2694
  var visualization_canvas_exports = {};
@@ -2235,6 +2750,16 @@ var triangleEventAnnotationRenderer = ({
2235
2750
  eventColor: eventWithColor.color
2236
2751
  });
2237
2752
  };
2753
+ var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
2754
+ const rangeSelectEventHandler = eventHandlers.find(
2755
+ (eventHandler) => {
2756
+ var _a;
2757
+ return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
2758
+ }
2759
+ );
2760
+ const xAxisIsTime = xField === "_time";
2761
+ return !!rangeSelectEventHandler && xAxisIsTime;
2762
+ };
2238
2763
  var canvasSupportedTimeSeriesCharts = ["splunk.line"];
2239
2764
  var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
2240
2765
  return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
@@ -2255,16 +2780,31 @@ var filterChartDataFromInternalFields = (chartData) => {
2255
2780
  var convert2DArrayToNumbers = (arr) => {
2256
2781
  return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
2257
2782
  };
2783
+ var parseAxisValue = (val) => {
2784
+ if (val === void 0 || val === null || val === "auto" || val === "") {
2785
+ return void 0;
2786
+ }
2787
+ const num = typeof val === "number" ? val : Number.parseFloat(val);
2788
+ return Number.isNaN(num) ? void 0 : num;
2789
+ };
2258
2790
  var SideLegendWidth = 75;
2259
- var commonLegendProps = { center: true, fontSize: 12, largerTiles: true, hideSeriesValue: true };
2791
+ var SeriesCompareLegendWidth = 200;
2260
2792
  var getLegend = (props) => {
2261
2793
  const legendPlacement = props == null ? void 0 : props.legendDisplay;
2794
+ const { isSeriesCompare } = props;
2795
+ const commonLegendProps = {
2796
+ center: true,
2797
+ fontSize: 12,
2798
+ largerTiles: true,
2799
+ hideSeriesValue: !isSeriesCompare
2800
+ // Show values if in seriesCompare mode
2801
+ };
2262
2802
  switch (legendPlacement) {
2263
2803
  case "off":
2264
2804
  return false;
2265
2805
  case "left":
2266
2806
  return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
2267
- width: SideLegendWidth
2807
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
2268
2808
  }, commonLegendProps));
2269
2809
  case "bottom":
2270
2810
  return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
@@ -2276,7 +2816,7 @@ var getLegend = (props) => {
2276
2816
  }, commonLegendProps));
2277
2817
  default:
2278
2818
  return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
2279
- width: SideLegendWidth
2819
+ width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
2280
2820
  }, commonLegendProps));
2281
2821
  }
2282
2822
  };
@@ -2312,22 +2852,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
2312
2852
  const end = axisTitle.slice(-halfChars);
2313
2853
  return `${start}...${end}`;
2314
2854
  };
2315
- var getFieldName = (field) => {
2855
+ var getFieldName2 = (field) => {
2316
2856
  const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
2317
2857
  return fieldName;
2318
2858
  };
2319
2859
  var getFieldNames = (fields) => {
2320
- return fields.map((field) => getFieldName(field));
2860
+ return fields.map((field) => getFieldName2(field));
2321
2861
  };
2322
- var getXScaleConfig = (label, xAxisLabelVisibility) => {
2862
+ var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
2323
2863
  const xConfig = { x: {} };
2324
2864
  xConfig.x.label = label;
2325
2865
  if (xAxisLabelVisibility === "hide") {
2326
2866
  xConfig.x.hideLabels = true;
2327
2867
  }
2868
+ if (xAxisLabelRotation !== void 0) {
2869
+ xConfig.x.labelRotation = xAxisLabelRotation;
2870
+ }
2328
2871
  return xConfig;
2329
2872
  };
2330
- var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
2873
+ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
2331
2874
  const scaleType = yAxisScale != null ? yAxisScale : "linear";
2332
2875
  const yConfig = { y: {} };
2333
2876
  yConfig.y.label = label;
@@ -2343,14 +2886,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
2343
2886
  if (yAxisLabelVisibility === "hide") {
2344
2887
  yConfig.y.hideLabels = true;
2345
2888
  }
2889
+ if (yAxisMin !== void 0 || yAxisMax !== void 0) {
2890
+ yConfig.y.range = (u, dataMin, dataMax) => {
2891
+ const min = yAxisMin != null ? yAxisMin : dataMin;
2892
+ const max = yAxisMax != null ? yAxisMax : dataMax;
2893
+ return [min, max];
2894
+ };
2895
+ }
2346
2896
  return yConfig;
2347
2897
  };
2348
- var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
2898
+ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
2349
2899
  const y2Config = { y2: {} };
2350
2900
  const scaleType = axisScale != null ? axisScale : "linear";
2351
2901
  y2Config.y2.label = label;
2352
2902
  y2Config.y2.side = "right";
2353
- y2Config.y2.showGrid = false;
2354
2903
  y2Config.y2.type = scaleType;
2355
2904
  if (axisAbbreviation !== "none") {
2356
2905
  y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
@@ -2360,9 +2909,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
2360
2909
  if (y2AxisLabelVisibility === "hide") {
2361
2910
  y2Config.y2.hideLabels = true;
2362
2911
  }
2912
+ if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
2913
+ y2Config.y2.range = (u, dataMin, dataMax) => {
2914
+ const min = y2AxisMin != null ? y2AxisMin : dataMin;
2915
+ const max = y2AxisMax != null ? y2AxisMax : dataMax;
2916
+ return [min, max];
2917
+ };
2918
+ }
2363
2919
  return y2Config;
2364
2920
  };
2365
- var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
2921
+ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
2366
2922
  const seriesConfig = {};
2367
2923
  let spanGaps;
2368
2924
  let replaceNullsWithZero;
@@ -2397,12 +2953,45 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
2397
2953
  if (markerDisplay !== void 0) {
2398
2954
  seriesConfig[field].markerDisplay = markerDisplay;
2399
2955
  }
2956
+ const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
2957
+ if (fieldDashStyle) {
2958
+ seriesConfig[field].lineDashStyle = fieldDashStyle;
2959
+ }
2400
2960
  if (replaceNullsWithZero !== void 0) {
2401
2961
  seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
2402
2962
  }
2403
2963
  });
2404
2964
  return seriesConfig;
2405
2965
  };
2966
+ var findRangeIndices = (xData, startValue, endValue) => {
2967
+ let startXIndex = -1;
2968
+ let endXIndex = -1;
2969
+ const xDataEpoch = xData.map((val) => {
2970
+ if (typeof val === "string") {
2971
+ return new Date(val).getTime() / 1e3;
2972
+ }
2973
+ return val;
2974
+ });
2975
+ for (let i = 0; i < xDataEpoch.length; i += 1) {
2976
+ if (xDataEpoch[i] >= startValue) {
2977
+ startXIndex = i;
2978
+ break;
2979
+ }
2980
+ }
2981
+ if (startXIndex === -1 && xDataEpoch.length > 0) {
2982
+ startXIndex = xDataEpoch.length - 1;
2983
+ }
2984
+ for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
2985
+ if (xDataEpoch[i] <= endValue) {
2986
+ endXIndex = i;
2987
+ break;
2988
+ }
2989
+ }
2990
+ if (endXIndex === -1 && xDataEpoch.length > 0) {
2991
+ endXIndex = 0;
2992
+ }
2993
+ return { startXIndex, endXIndex };
2994
+ };
2406
2995
 
2407
2996
  // src/common/TimeSeriesChartWrapper.tsx
2408
2997
  var TimeSeriesChartContainer = styled_components_default.div`
@@ -2413,38 +3002,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
2413
3002
  position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
2414
3003
  }
2415
3004
  `;
2416
- var handleClick = (chartEvent, onClick) => {
3005
+ var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
3006
+ const result = __spreadValues({}, payload);
3007
+ if (trellisSplitBy) {
3008
+ result["trellis.name"] = trellisSplitBy;
3009
+ }
3010
+ if (trellisKey) {
3011
+ result["trellis.value"] = trellisKey;
3012
+ }
3013
+ return result;
3014
+ };
3015
+ var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
3016
+ if (!previousPayload) {
3017
+ return true;
3018
+ }
3019
+ if (currentPayload.index !== previousPayload.index) {
3020
+ return true;
3021
+ }
3022
+ if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
3023
+ return true;
3024
+ }
3025
+ if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
3026
+ return true;
3027
+ }
3028
+ if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
3029
+ return true;
3030
+ }
3031
+ return false;
3032
+ };
3033
+ var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
2417
3034
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
2418
3035
  name: chartEvent.seriesKey
2419
3036
  });
2420
3037
  delete payload.seriesKey;
2421
3038
  if (chartEvent.rowContext) {
2422
- Object.keys(chartEvent.rowContext).forEach((fieldName) => {
2423
- payload[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
2424
- });
3039
+ Object.assign(
3040
+ payload,
3041
+ Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
3042
+ acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
3043
+ return acc;
3044
+ }, {})
3045
+ );
2425
3046
  }
3047
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2426
3048
  if (onClick) {
2427
3049
  onClick({
2428
3050
  type: "point.click",
2429
3051
  originalEvent: chartEvent,
2430
- payload
3052
+ payload: updatedPayload
2431
3053
  });
2432
3054
  }
2433
3055
  };
2434
- var handleLegendClick = (chartEvent, onClick) => {
3056
+ var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
2435
3057
  const payload = {
2436
3058
  name: chartEvent
2437
3059
  };
3060
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
2438
3061
  if (onClick) {
2439
3062
  onClick({
2440
3063
  type: "legend.click",
2441
3064
  originalEvent: chartEvent,
2442
- payload
3065
+ payload: updatedPayload
3066
+ });
3067
+ }
3068
+ };
3069
+ var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3070
+ var _a;
3071
+ if (!rangeEvent) {
3072
+ return;
3073
+ }
3074
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3075
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3076
+ const payload = {
3077
+ startXIndex,
3078
+ startXValue: rangeEvent.start,
3079
+ endXIndex,
3080
+ endXValue: rangeEvent.end
3081
+ };
3082
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3083
+ if (onSelect) {
3084
+ onSelect({
3085
+ type: "range.selectBeforeZoom",
3086
+ originalEvent: rangeEvent,
3087
+ payload: updatedPayload
2443
3088
  });
2444
3089
  }
2445
3090
  };
3091
+ var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
3092
+ var _a;
3093
+ const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
3094
+ const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
3095
+ const payload = {
3096
+ startXIndex,
3097
+ startXValue: rangeEvent.start,
3098
+ endXIndex,
3099
+ endXValue: rangeEvent.end
3100
+ };
3101
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3102
+ if (onSelect) {
3103
+ onSelect({
3104
+ type: "range.select",
3105
+ originalEvent: rangeEvent,
3106
+ payload: updatedPayload
3107
+ });
3108
+ }
3109
+ };
3110
+ var parseArrayOption = (value) => {
3111
+ if (Array.isArray(value)) {
3112
+ return value;
3113
+ }
3114
+ if (value) {
3115
+ return JSON.parse(value);
3116
+ }
3117
+ return void 0;
3118
+ };
2446
3119
  var TimeSeriesChartWrapper = (props) => {
2447
- const {
3120
+ var _b, _c, _d;
3121
+ const _a = props, {
2448
3122
  width,
2449
3123
  height,
2450
3124
  chartData,
@@ -2457,12 +3131,49 @@ var TimeSeriesChartWrapper = (props) => {
2457
3131
  markerDisplay,
2458
3132
  onClick,
2459
3133
  onPointMouseOver,
2460
- onPointMouseOut
2461
- } = props;
2462
- const {
3134
+ onPointMouseOut,
3135
+ onSelect,
3136
+ splitByLayout,
3137
+ trellisKey,
3138
+ trellisSplitBy,
2463
3139
  backgroundColor,
3140
+ defaultFontColor,
3141
+ additionalTooltipValues,
3142
+ showYAxisWithZero: showYAxisWithZeroFromProps,
3143
+ showY2AxisWithZero: showY2AxisWithZeroFromProps
3144
+ } = _a, otherOptions = __objRest(_a, [
3145
+ "width",
3146
+ "height",
3147
+ "chartData",
3148
+ "options",
3149
+ "userLocale",
3150
+ "annotationX",
3151
+ "annotationLabel",
3152
+ "annotationColor",
3153
+ "legendDisplay",
3154
+ "markerDisplay",
3155
+ "onClick",
3156
+ "onPointMouseOver",
3157
+ "onPointMouseOut",
3158
+ "onSelect",
3159
+ "splitByLayout",
3160
+ "trellisKey",
3161
+ "trellisSplitBy",
3162
+ "backgroundColor",
3163
+ "defaultFontColor",
3164
+ "additionalTooltipValues",
3165
+ // Extract showYAxisWithZero directly from props for accelerated render mode
3166
+ "showYAxisWithZero",
3167
+ "showY2AxisWithZero"
3168
+ ]);
3169
+ const { eventHandlers, xField: xFieldFromProps } = otherOptions;
3170
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
3171
+ const {
3172
+ backgroundColor: bgColorFromOptions,
2464
3173
  seriesColors: seriesColorsStr,
2465
3174
  fieldColors,
3175
+ legendLabels: legendLabelsStr,
3176
+ legendMode,
2466
3177
  "axisTitleX.text": xAxisTitleText,
2467
3178
  "axisTitleY.text": yAxisTitleText,
2468
3179
  "axisTitleY2.text": y2AxisTitleText,
@@ -2470,8 +3181,11 @@ var TimeSeriesChartWrapper = (props) => {
2470
3181
  "axisTitleY.visibility": yAxisTitleVisibility,
2471
3182
  "axisTitleY2.visibility": y2AxisTitleVisibility,
2472
3183
  "axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
3184
+ "axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
2473
3185
  "axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
3186
+ "axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
2474
3187
  "axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
3188
+ "axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
2475
3189
  "axisY.abbreviation": yAxisAbbreviation,
2476
3190
  "axisY.scale": yAxisScale,
2477
3191
  "axisY2.abbreviation": y2AxisAbbreviation,
@@ -2481,10 +3195,63 @@ var TimeSeriesChartWrapper = (props) => {
2481
3195
  "axisLabelsY2.integerUnits": y2IntegerUnits,
2482
3196
  "chart.overlayFields": overlayFieldsStr,
2483
3197
  "chart.nullValueMode": nullValueMode,
2484
- lineWidth
3198
+ "chart.showDataLabels": showDataLabels,
3199
+ lineWidth,
3200
+ lineDashStyle,
3201
+ fieldDashStyles: lineDashStylesByFieldStr,
3202
+ yAxisMin: yAxisMinRaw,
3203
+ yAxisMax: yAxisMaxRaw,
3204
+ y2AxisMin: y2AxisMinRaw,
3205
+ y2AxisMax: y2AxisMaxRaw,
3206
+ showXMajorGridLines,
3207
+ showYMajorGridLines,
3208
+ showY2MajorGridLines,
3209
+ showYMinorGridLines,
3210
+ showY2MinorGridLines,
3211
+ showLineSmoothing,
3212
+ yAxisMajorTickVisibility,
3213
+ y2AxisMajorTickVisibility,
3214
+ yAxisMajorTickSize,
3215
+ y2AxisMajorTickSize,
3216
+ yAxisMajorTickInterval,
3217
+ y2AxisMajorTickInterval,
3218
+ yAxisMinorTickVisibility,
3219
+ y2AxisMinorTickVisibility,
3220
+ yAxisMinorTickSize,
3221
+ y2AxisMinorTickSize,
3222
+ showYAxisWithZero: showYAxisWithZeroFromOptions,
3223
+ showY2AxisWithZero: showY2AxisWithZeroFromOptions
2485
3224
  } = options;
3225
+ const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
3226
+ const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
3227
+ const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
3228
+ const showYMajorTicks = yAxisMajorTickVisibility === "show";
3229
+ const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
3230
+ const showYMinorTicks = yAxisMinorTickVisibility === "show";
3231
+ const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
3232
+ const yAxisMin = parseAxisValue(yAxisMinRaw);
3233
+ const yAxisMax = parseAxisValue(yAxisMaxRaw);
3234
+ const y2AxisMin = parseAxisValue(y2AxisMinRaw);
3235
+ const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
3236
+ const parseTickInterval = (simpleXMLValue, canvasValue) => {
3237
+ if (simpleXMLValue) return Number(simpleXMLValue);
3238
+ if (canvasValue) return Number(canvasValue);
3239
+ return void 0;
3240
+ };
3241
+ const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
3242
+ const y2AxisMajorTickIntervalNum = parseTickInterval(
3243
+ y2AxisMajorUnitFromSimpleXML,
3244
+ y2AxisMajorTickInterval
3245
+ );
3246
+ const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
3247
+ const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
3248
+ const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
3249
+ const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
2486
3250
  const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
2487
3251
  const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
3252
+ const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
3253
+ const legendLabels = parseArrayOption(legendLabelsStr);
3254
+ const bgColor = backgroundColor || bgColorFromOptions;
2488
3255
  const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
2489
3256
  const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
2490
3257
  const cachedHandleResize = react_exports.useCallback((w, h) => {
@@ -2495,31 +3262,64 @@ var TimeSeriesChartWrapper = (props) => {
2495
3262
  fields: chartData.fields,
2496
3263
  columns: chartData.seriesList
2497
3264
  });
2498
- const xField = getFieldName(filteredChartData.fields[0]);
3265
+ const xField = getFieldName2(filteredChartData.fields[0]);
2499
3266
  const yFields = getFieldNames(
2500
3267
  filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
2501
3268
  );
2502
- const y2Fields = y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [];
2503
- const overlayFields = overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [];
3269
+ const y2Fields = (0, react_exports.useMemo)(
3270
+ () => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
3271
+ [y2FieldsStr]
3272
+ );
3273
+ const overlayFields = (0, react_exports.useMemo)(
3274
+ () => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
3275
+ [overlayFieldsStr]
3276
+ );
2504
3277
  let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
2505
3278
  xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
2506
- let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFields, yAxisTitleVisibility);
3279
+ const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
3280
+ let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
2507
3281
  yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
2508
3282
  const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
2509
3283
  let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
2510
3284
  y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
2511
- const xScaleConfig = getXScaleConfig(xAxisTitle, xAxisLabelVisibility);
2512
- const yScaleConfig = getYScaleConfig(yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility);
2513
- let y2ScaleConfig = {};
2514
- if (y2Enabled) {
2515
- y2ScaleConfig = getY2ScaleConfig(
2516
- y2AxisTitle,
2517
- y2AxisAbbreviation,
2518
- y2AxisScale,
2519
- y2IntegerUnits,
2520
- y2AxisLabelVisibility
2521
- );
2522
- }
3285
+ const xScaleConfig = (0, react_exports.useMemo)(
3286
+ () => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
3287
+ [xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
3288
+ );
3289
+ const yScaleConfig = (0, react_exports.useMemo)(
3290
+ () => getYScaleConfig(
3291
+ yAxisTitle,
3292
+ yAxisAbbreviation,
3293
+ yAxisScale,
3294
+ yAxisLabelVisibility,
3295
+ yAxisMin,
3296
+ yAxisMax
3297
+ ),
3298
+ [yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
3299
+ );
3300
+ const y2ScaleConfig = (0, react_exports.useMemo)(() => {
3301
+ if (y2Enabled) {
3302
+ return getY2ScaleConfig(
3303
+ y2AxisTitle,
3304
+ y2AxisAbbreviation,
3305
+ y2AxisScale,
3306
+ y2IntegerUnits,
3307
+ y2AxisLabelVisibility,
3308
+ y2AxisMin,
3309
+ y2AxisMax
3310
+ );
3311
+ }
3312
+ return {};
3313
+ }, [
3314
+ y2Enabled,
3315
+ y2AxisTitle,
3316
+ y2AxisAbbreviation,
3317
+ y2AxisScale,
3318
+ y2IntegerUnits,
3319
+ y2AxisLabelVisibility,
3320
+ y2AxisMin,
3321
+ y2AxisMax
3322
+ ]);
2523
3323
  const uplotContainerElement = (0, react_exports.useRef)(null);
2524
3324
  const seriesDataFormatted = [
2525
3325
  filteredChartData.columns[0],
@@ -2535,9 +3335,21 @@ var TimeSeriesChartWrapper = (props) => {
2535
3335
  overlayFields,
2536
3336
  y2Enabled,
2537
3337
  nullValueMode,
2538
- markerDisplay
3338
+ markerDisplay,
3339
+ lineDashStyle,
3340
+ lineDashStylesByField
2539
3341
  ),
2540
- [yFields, y2Fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay]
3342
+ [
3343
+ yFields,
3344
+ y2Fields,
3345
+ lineWidth,
3346
+ overlayFields,
3347
+ y2Enabled,
3348
+ nullValueMode,
3349
+ markerDisplay,
3350
+ lineDashStyle,
3351
+ lineDashStylesByField
3352
+ ]
2541
3353
  );
2542
3354
  const chartingEventAnnotations = (0, react_exports.useMemo)(
2543
3355
  () => getAnnotationsForCanvas({
@@ -2551,25 +3363,54 @@ var TimeSeriesChartWrapper = (props) => {
2551
3363
  () => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
2552
3364
  [xScaleConfig, yScaleConfig, y2ScaleConfig]
2553
3365
  );
2554
- const legend = (0, react_exports.useMemo)(() => getLegend({ legendDisplay }), [legendDisplay]);
3366
+ const legend = (0, react_exports.useMemo)(
3367
+ () => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
3368
+ [legendDisplay, legendMode]
3369
+ );
2555
3370
  const handleChartClick = react_exports.useCallback(
2556
3371
  (event) => {
2557
3372
  if (onClick) {
2558
- handleClick(event, onClick);
3373
+ handleClick(event, onClick, trellisKey, trellisSplitBy);
2559
3374
  }
2560
3375
  },
2561
- [onClick]
3376
+ [onClick, trellisKey, trellisSplitBy]
2562
3377
  );
2563
3378
  const handleChartLegendClick = react_exports.useCallback(
2564
3379
  (event) => {
2565
3380
  if (onClick) {
2566
- handleLegendClick(event, onClick);
3381
+ handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
3382
+ }
3383
+ },
3384
+ [onClick, trellisKey, trellisSplitBy]
3385
+ );
3386
+ const handleChartRangeSelection = react_exports.useCallback(
3387
+ (range2) => {
3388
+ if (onSelect) {
3389
+ handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
2567
3390
  }
2568
3391
  },
2569
- [onClick]
3392
+ [onSelect, chartData, trellisKey, trellisSplitBy]
3393
+ );
3394
+ const handleChartRangeZoom = react_exports.useCallback(
3395
+ (range2) => {
3396
+ if (onSelect) {
3397
+ handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
3398
+ }
3399
+ },
3400
+ [onSelect, chartData, trellisKey, trellisSplitBy]
3401
+ );
3402
+ const xFieldToUse = xFieldFromProps || xField;
3403
+ const enableSearchZoom = react_exports.useMemo(
3404
+ () => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
3405
+ [eventHandlers, xFieldToUse]
2570
3406
  );
2571
3407
  const lastPayloadRef = react_exports.useRef(null);
2572
3408
  const lastOriginalEventRef = react_exports.useRef(null);
3409
+ const previousMouseoverPayloadRef = react_exports.useRef(null);
3410
+ const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
3411
+ react_exports.useEffect(() => {
3412
+ additionalTooltipValuesRef.current = additionalTooltipValues;
3413
+ }, [additionalTooltipValues]);
2573
3414
  const handleChartCrosshairChange = react_exports.useCallback(
2574
3415
  (event) => {
2575
3416
  if (onPointMouseOver || onPointMouseOut) {
@@ -2581,6 +3422,7 @@ var TimeSeriesChartWrapper = (props) => {
2581
3422
  payload: lastPayloadRef.current
2582
3423
  });
2583
3424
  }
3425
+ previousMouseoverPayloadRef.current = null;
2584
3426
  return;
2585
3427
  }
2586
3428
  const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
@@ -2588,25 +3430,36 @@ var TimeSeriesChartWrapper = (props) => {
2588
3430
  });
2589
3431
  delete payload.seriesKey;
2590
3432
  if (event.rowContext) {
2591
- Object.keys(event.rowContext).forEach((fieldName) => {
2592
- payload[`row.${fieldName}.value`] = event.rowContext[fieldName];
2593
- });
3433
+ Object.assign(
3434
+ payload,
3435
+ Object.keys(event.rowContext).reduce((acc, fieldName) => {
3436
+ acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
3437
+ return acc;
3438
+ }, {})
3439
+ );
3440
+ }
3441
+ const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
3442
+ if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
3443
+ return;
2594
3444
  }
2595
- lastPayloadRef.current = payload;
3445
+ lastPayloadRef.current = updatedPayload;
2596
3446
  lastOriginalEventRef.current = event;
3447
+ previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
2597
3448
  if (onPointMouseOver) {
2598
3449
  onPointMouseOver({
2599
3450
  type: "point.mouseover",
2600
3451
  originalEvent: event,
2601
- payload
3452
+ payload: updatedPayload
2602
3453
  });
2603
3454
  }
2604
3455
  }
2605
3456
  },
2606
- [onPointMouseOver, onPointMouseOut]
3457
+ [onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
2607
3458
  );
2608
- const memoizedChart = (0, react_exports.useMemo)(
2609
- () => /* @__PURE__ */ react_exports.createElement(
3459
+ 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}`;
3460
+ const memoizedChart = (0, react_exports.useMemo)(() => {
3461
+ const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
3462
+ return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
2610
3463
  visualization_canvas_exports.TimeSeriesChart,
2611
3464
  {
2612
3465
  data: chartData,
@@ -2616,49 +3469,107 @@ var TimeSeriesChartWrapper = (props) => {
2616
3469
  seriesColorsByField,
2617
3470
  seriesConfig: seriesOverrides,
2618
3471
  legend,
3472
+ legendLabels,
3473
+ isSeriesCompare: legendMode === "seriesCompare",
3474
+ maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
2619
3475
  scaleConfig,
2620
3476
  timestampFormat: "expanded",
2621
3477
  onCrosshairClick: onClick ? handleChartClick : void 0,
2622
3478
  onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
2623
3479
  onSeriesClick: onClick ? handleChartLegendClick : void 0,
3480
+ onRangeSelection: handleChartRangeSelection,
3481
+ onRangeZoom: computedOnRangeZoom,
3482
+ serverSideZoom: enableSearchZoom,
2624
3483
  userLocale,
2625
3484
  events: chartingEventAnnotations,
2626
- eventsConfig: { renderer: triangleEventAnnotationRenderer }
3485
+ eventsConfig: { renderer: triangleEventAnnotationRenderer },
3486
+ additionalTooltipValuesRef,
3487
+ showXMajorGridLines,
3488
+ showYMajorGridLines,
3489
+ showY2MajorGridLines,
3490
+ showYMinorGridLines,
3491
+ showY2MinorGridLines,
3492
+ showLineSmoothing,
3493
+ dataValuesDisplay,
3494
+ showYMajorTicks,
3495
+ showY2MajorTicks,
3496
+ yAxisMajorTickSize: yAxisMajorTickSizeNum,
3497
+ y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
3498
+ yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
3499
+ y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
3500
+ showYMinorTicks,
3501
+ showY2MinorTicks,
3502
+ yAxisMinorTickSize: yAxisMinorTickSizeNum,
3503
+ y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
3504
+ showYAxisWithZero,
3505
+ showY2AxisWithZero
2627
3506
  }
2628
- ),
2629
- [
2630
- chartData,
2631
- containerWidth,
2632
- containerHeight,
2633
- seriesColors,
2634
- seriesColorsByField,
2635
- seriesOverrides,
2636
- legend,
2637
- scaleConfig,
2638
- userLocale,
2639
- chartingEventAnnotations,
2640
- onClick,
2641
- handleChartClick,
2642
- onPointMouseOver,
2643
- onPointMouseOut,
2644
- handleChartCrosshairChange,
2645
- handleChartLegendClick
2646
- ]
2647
- );
3507
+ ));
3508
+ }, [
3509
+ onSelect,
3510
+ handleChartRangeZoom,
3511
+ dataKey,
3512
+ chartData,
3513
+ containerWidth,
3514
+ containerHeight,
3515
+ seriesColors,
3516
+ seriesColorsByField,
3517
+ seriesOverrides,
3518
+ legend,
3519
+ legendLabels,
3520
+ scaleConfig,
3521
+ onClick,
3522
+ handleChartClick,
3523
+ onPointMouseOver,
3524
+ onPointMouseOut,
3525
+ handleChartCrosshairChange,
3526
+ handleChartLegendClick,
3527
+ handleChartRangeSelection,
3528
+ enableSearchZoom,
3529
+ userLocale,
3530
+ chartingEventAnnotations,
3531
+ showXMajorGridLines,
3532
+ showYMajorGridLines,
3533
+ showY2MajorGridLines,
3534
+ showYMinorGridLines,
3535
+ showY2MinorGridLines,
3536
+ showLineSmoothing,
3537
+ dataValuesDisplay,
3538
+ showYMajorTicks,
3539
+ showY2MajorTicks,
3540
+ yAxisMajorTickSizeNum,
3541
+ y2AxisMajorTickSizeNum,
3542
+ yAxisMajorTickIntervalNum,
3543
+ y2AxisMajorTickIntervalNum,
3544
+ showYMinorTicks,
3545
+ showY2MinorTicks,
3546
+ yAxisMinorTickSizeNum,
3547
+ y2AxisMinorTickSizeNum,
3548
+ showYAxisWithZero,
3549
+ showY2AxisWithZero,
3550
+ legendMode
3551
+ ]);
2648
3552
  const memoizedVisualization = (0, react_exports.useMemo)(() => {
2649
- return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
2650
- }, [backgroundColor, memoizedChart]);
2651
- return /* @__PURE__ */ react_exports.createElement(
3553
+ return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
3554
+ }, [bgColor, memoizedChart]);
3555
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
3556
+ TrellisTitle,
3557
+ {
3558
+ trellisKey,
3559
+ backgroundColor: bgColor,
3560
+ fontColor: defaultFontColor
3561
+ }
3562
+ ), /* @__PURE__ */ react_exports.createElement(
2652
3563
  TimeSeriesChartContainer,
2653
3564
  {
2654
- height,
3565
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
2655
3566
  width,
2656
3567
  ref: uplotContainerElement,
2657
3568
  "data-test": "timeseries-chart-wrapper"
2658
3569
  },
2659
3570
  /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
2660
3571
  memoizedVisualization
2661
- );
3572
+ ));
2662
3573
  };
2663
3574
  var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
2664
3575
 
@@ -2721,10 +3632,10 @@ var withDashboardViz = (opts) => {
2721
3632
  const isDownsamplingEnabledByFeatureFlag = Boolean(
2722
3633
  featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
2723
3634
  );
2724
- const isTrellisFeatureFlagOn = Boolean(
3635
+ const isTrellisFeatureFlagOn2 = Boolean(
2725
3636
  featureFlagContext && featureFlagContext.visualizations_enableTrellis
2726
3637
  );
2727
- const isTrellisOn = isTrellisFeatureFlagOn && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
3638
+ const isTrellisOn = isTrellisFeatureFlagOn2 && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
2728
3639
  const isAcceleratedRenderFeatureFlagOn = Boolean(
2729
3640
  featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableAcceleratedRender
2730
3641
  );
@@ -2948,6 +3859,268 @@ var withDashboardViz = (opts) => {
2948
3859
  };
2949
3860
  var withDashboardViz_default = withDashboardViz;
2950
3861
 
3862
+ // esm-externals:@splunk/react-ui/Paginator
3863
+ var Paginator_exports = {};
3864
+ __export(Paginator_exports, {
3865
+ default: () => Paginator_default
3866
+ });
3867
+ var defaultImport33 = __toESM(require("@splunk/react-ui/Paginator"));
3868
+ __reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
3869
+ var Paginator_default = "default" in defaultImport33 ? defaultImport33.default : defaultImport33;
3870
+
3871
+ // esm-externals:@splunk/themes
3872
+ var themes_exports = {};
3873
+ __export(themes_exports, {
3874
+ default: () => themes_default
3875
+ });
3876
+ var defaultImport34 = __toESM(require("@splunk/themes"));
3877
+ __reExport(themes_exports, require("@splunk/themes"));
3878
+ var themes_default = "default" in defaultImport34 ? defaultImport34.default : defaultImport34;
3879
+
3880
+ // esm-externals:@splunk/themes/useSplunkTheme
3881
+ var useSplunkTheme_exports = {};
3882
+ __export(useSplunkTheme_exports, {
3883
+ default: () => useSplunkTheme_default
3884
+ });
3885
+ var defaultImport35 = __toESM(require("@splunk/themes/useSplunkTheme"));
3886
+ __reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
3887
+ var useSplunkTheme_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
3888
+
3889
+ // src/common/hocs/withTrellis.tsx
3890
+ var TrellisContainer = styled_components_default.div`
3891
+ overflow: hidden;
3892
+ display: flex;
3893
+ flex-direction: column;
3894
+ background-color: ${(props) => props.backgroundColor};
3895
+ ${(props) => (0, style_exports.toDimension)((0, lodash_exports.pick)(props, ["width", "height"]))};
3896
+ > [data-test='paginator'] {
3897
+ align-self: flex-end;
3898
+ margin-bottom: 10px;
3899
+ }
3900
+ `;
3901
+ var TrellisContainerGrid = styled_components_default.div`
3902
+ display: grid;
3903
+ height: ${(props) => {
3904
+ return `${props.height}px`;
3905
+ }};
3906
+ gap: 10px 10px;
3907
+ grid-template-columns: ${(props) => {
3908
+ return props.colCount ? `repeat(${props.colCount}, minmax(${props.colMinWidth}px, 1fr))` : `repeat(auto-fit, minmax(${props.colMinWidth}px, 1fr))`;
3909
+ }};
3910
+ overflow: auto;
3911
+ justify-items: stretch;
3912
+ grid-auto-rows: ${(props) => `${props.rowHeight}px`};
3913
+ .child {
3914
+ height: ${(props) => `${props.rowHeight}px`};
3915
+ }
3916
+ `;
3917
+ var showErrorMessage = (errorCode, width, height) => {
3918
+ if (errorCode === "INVALID_SPLIT_BY_FIELD") {
3919
+ return /* @__PURE__ */ react_exports.createElement(
3920
+ Message_default,
3921
+ {
3922
+ width,
3923
+ height,
3924
+ message: (0, i18n_exports._)("Select a valid trellis split by field"),
3925
+ level: "info"
3926
+ }
3927
+ );
3928
+ }
3929
+ if (errorCode === "UNKNOWN_DATA_SPLIT_MODE") {
3930
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Unknown data split mode"), level: "info" });
3931
+ }
3932
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Error render in trellis"), level: "info" });
3933
+ };
3934
+ var withTrellis = (Viz) => {
3935
+ const VizWithTrellis = (opts) => {
3936
+ const cachedHandleResize = react_exports.useCallback((w, h) => {
3937
+ setContainerWidth(w);
3938
+ setContainerHeight(h);
3939
+ }, []);
3940
+ const [containerWidth, setContainerWidth] = react_exports.useState(Number(opts.width));
3941
+ const [containerHeight, setContainerHeight] = react_exports.useState(Number(opts.height));
3942
+ const _a = opts, { options = {}, height, width } = _a, otherProps = __objRest(_a, ["options", "height", "width"]);
3943
+ const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(Viz.config.optionsSchema, "default");
3944
+ const mergedOptions = (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
3945
+ const {
3946
+ trellisColumns,
3947
+ trellisPageCount,
3948
+ trellisMinColumnWidth,
3949
+ trellisRowHeight,
3950
+ splitByLayout,
3951
+ trellisSplitBy,
3952
+ trellisSharedScale,
3953
+ stackMode,
3954
+ yAxisMin,
3955
+ yAxisMax
3956
+ } = mergedOptions;
3957
+ const colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
3958
+ const pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
3959
+ const colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
3960
+ const rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
3961
+ const [pageNum, setPageNum] = (0, react_exports.useState)(1);
3962
+ const [pagedData, setPagedData] = (0, react_exports.useState)(null);
3963
+ let splitByKeys = [];
3964
+ let totalPages = 0;
3965
+ let showPaginator = false;
3966
+ const { dataSources } = otherProps;
3967
+ const theme = {
3968
+ splunkThemeV1: useSplunkTheme_default()
3969
+ };
3970
+ const {
3971
+ family: currentThemeFamily,
3972
+ colorScheme: currentThemeColorScheme,
3973
+ density: currentThemeDensity
3974
+ } = (0, themes_exports.getSettingsFromThemedProps)({ theme });
3975
+ const trellisBackgroundColor = (0, react_exports.useMemo)(() => {
3976
+ const themeFunc = (themeVar) => {
3977
+ var _a2, _b;
3978
+ return (_b = (_a2 = Viz.config.themes)[themeVar]) == null ? void 0 : _b.call(_a2, {
3979
+ trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
3980
+ theme
3981
+ });
3982
+ };
3983
+ const evaluated = Options_exports.Options.evaluate(
3984
+ {
3985
+ context: Viz.config.context,
3986
+ options: {
3987
+ trellisBackgroundColor: mergedOptions.trellisBackgroundColor
3988
+ }
3989
+ },
3990
+ {},
3991
+ themeFunc
3992
+ );
3993
+ return evaluated.trellisBackgroundColor;
3994
+ }, [
3995
+ mergedOptions.trellisBackgroundColor,
3996
+ currentThemeFamily,
3997
+ currentThemeColorScheme,
3998
+ currentThemeDensity
3999
+ ]);
4000
+ const columns = (0, lodash_exports.get)(dataSources, "primary.data.columns", void 0);
4001
+ const fields = (0, lodash_exports.get)(dataSources, "primary.data.fields", void 0);
4002
+ const noColumns = columns === void 0;
4003
+ const noFields = fields === void 0;
4004
+ const updateDataDisplay = (currPage) => {
4005
+ if (!showPaginator) {
4006
+ setPagedData(splitByKeys);
4007
+ setPageNum(1);
4008
+ } else {
4009
+ const startIdx = pageCount * (currPage - 1);
4010
+ const paged = splitByKeys.slice(startIdx, startIdx + pageCount);
4011
+ setPagedData(paged);
4012
+ }
4013
+ };
4014
+ (0, react_exports.useEffect)(() => {
4015
+ setPageNum(1);
4016
+ updateDataDisplay(1);
4017
+ }, [pageCount, trellisSplitBy]);
4018
+ (0, react_exports.useEffect)(() => {
4019
+ updateDataDisplay(pageNum);
4020
+ }, [columns, fields, trellisSplitBy, pageNum, splitByLayout]);
4021
+ const handlePageChange = (0, react_exports.useCallback)(
4022
+ (event, { page }) => {
4023
+ setPageNum(page);
4024
+ },
4025
+ [pageNum, pagedData]
4026
+ );
4027
+ const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
4028
+ const isTrellisFeatureFlagOn2 = Boolean(
4029
+ featureFlagContext && featureFlagContext.visualizations_enableTrellis
4030
+ );
4031
+ if (!isTrellisFeatureFlagOn2 || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
4032
+ return /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, opts));
4033
+ }
4034
+ if (splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
4035
+ if (noColumns || noFields) {
4036
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Loading"), level: "info" });
4037
+ }
4038
+ let currTrellisSplitBy = trellisSplitBy;
4039
+ if (!trellisSplitBy || trellisSplitBy.length === 0) {
4040
+ const splitByPossibleFields = (0, trellisUtils_exports.getAllPossibleSplitByFields)(fields);
4041
+ currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : AGGREGATIONS;
4042
+ }
4043
+ const splitMode = (0, trellisUtils_exports.getTrellisDataSplitterMode)(fields);
4044
+ const dataSplitResult = getTrellisDataSourcesBySplitMode(
4045
+ splitMode,
4046
+ dataSources,
4047
+ currTrellisSplitBy
4048
+ );
4049
+ const modifiedDataSourceBySplitBy = dataSplitResult == null ? void 0 : dataSplitResult.splitDataSources;
4050
+ const dataSplitErrorCode = dataSplitResult == null ? void 0 : dataSplitResult.errorCode;
4051
+ if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
4052
+ return showErrorMessage(dataSplitErrorCode, width, height);
4053
+ }
4054
+ const splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
4055
+ if (splitByKeysModified) {
4056
+ showPaginator = splitByKeysModified.length > pageCount;
4057
+ splitByKeys = splitByKeysModified;
4058
+ totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
4059
+ }
4060
+ const [calculatedMin, calculatedMax] = determineMinMax(
4061
+ modifiedDataSourceBySplitBy,
4062
+ trellisSharedScale,
4063
+ yAxisMin,
4064
+ yAxisMax,
4065
+ stackMode
4066
+ );
4067
+ return /* @__PURE__ */ react_exports.createElement(TrellisContainer, { height, width, backgroundColor: trellisBackgroundColor }, /* @__PURE__ */ react_exports.createElement(
4068
+ TrellisContainerGrid,
4069
+ {
4070
+ height,
4071
+ colCount,
4072
+ colMinWidth,
4073
+ rowHeight
4074
+ },
4075
+ pagedData == null ? void 0 : pagedData.map((splitByKey, idx) => /* @__PURE__ */ react_exports.createElement(
4076
+ "div",
4077
+ {
4078
+ className: "child",
4079
+ "data-test": "trellis-child",
4080
+ key: `div-child-${idx.toString()}`
4081
+ },
4082
+ /* @__PURE__ */ react_exports.createElement(
4083
+ SizeAwareWrapper_default,
4084
+ {
4085
+ width,
4086
+ height,
4087
+ onResize: cachedHandleResize
4088
+ }
4089
+ ),
4090
+ /* @__PURE__ */ react_exports.createElement(
4091
+ Viz,
4092
+ __spreadProps(__spreadValues({}, otherProps), {
4093
+ trellisKey: splitByKey,
4094
+ trellisSplitBy: currTrellisSplitBy,
4095
+ dataSources: modifiedDataSourceBySplitBy[splitByKey],
4096
+ options: __spreadProps(__spreadValues({}, options), {
4097
+ yAxisMin: calculatedMin,
4098
+ yAxisMax: calculatedMax
4099
+ }),
4100
+ key: `viz-${idx.toString()}`,
4101
+ height: containerHeight,
4102
+ width: containerWidth
4103
+ })
4104
+ )
4105
+ ))
4106
+ ), showPaginator && totalPages >= pageNum && /* @__PURE__ */ react_exports.createElement(
4107
+ Paginator_default,
4108
+ {
4109
+ onChange: handlePageChange,
4110
+ current: pageNum,
4111
+ alwaysShowLastPageLink: true,
4112
+ totalPages
4113
+ }
4114
+ ));
4115
+ }
4116
+ return null;
4117
+ };
4118
+ VizWithTrellis.propTypes = Viz.proptypes;
4119
+ VizWithTrellis.config = Viz.config;
4120
+ return VizWithTrellis;
4121
+ };
4122
+ var withTrellis_default = withTrellis;
4123
+
2951
4124
  // src/MarkerGauge/MarkerGauge.tsx
2952
4125
  var PureMarkerGauge = MarkerGauge_default;
2953
4126
  var validOptions = Object.keys(config_default.optionsSchema);
@@ -2959,14 +4132,17 @@ var computeVizProps = (_a) => {
2959
4132
  majorTickFillColor: config_default.themes.majorTickFillColor(props),
2960
4133
  majorTickStrokeColor: config_default.themes.majorTickStrokeColor(props),
2961
4134
  valueMarkerFillColor: config_default.themes.valueMarkerFillColor(props),
2962
- valueMarkerLabelFillColor: config_default.themes.valueMarkerLabelFillColor(props)
4135
+ valueMarkerLabelFillColor: config_default.themes.valueMarkerLabelFillColor(props),
4136
+ defaultFontColor: props.themeFunc("defaultFontColor")
2963
4137
  };
2964
- return __spreadValues(__spreadValues({}, options), defaultColors);
4138
+ return __spreadProps(__spreadValues(__spreadValues({}, options), defaultColors), { trellisKey: props.trellisKey });
2965
4139
  };
2966
- var viz = withDashboardViz_default({
2967
- ReactViz: MarkerGauge_default,
2968
- computeVizProps,
2969
- vizConfig: config_default
2970
- });
4140
+ var viz = withTrellis_default(
4141
+ withDashboardViz_default({
4142
+ ReactViz: MarkerGauge_default,
4143
+ computeVizProps,
4144
+ vizConfig: config_default
4145
+ })
4146
+ );
2971
4147
  var MarkerGauge_default2 = viz;
2972
4148
  //# sourceMappingURL=MarkerGauge.js.map