@cloudtower/eagle 4100.0.18 → 4100.0.19

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 (266) hide show
  1. package/dist/cjs/core/AccordionCard/index.js +1 -1
  2. package/dist/cjs/core/Alert/alert.style.js +2 -2
  3. package/dist/cjs/core/Antd5Tree/Antd5Tree.style.js +1 -1
  4. package/dist/cjs/core/Avatar/index.js +1 -1
  5. package/dist/cjs/core/Banner/banner.style.js +4 -4
  6. package/dist/cjs/core/BasicCTError/BasicCTError.style.js +1 -1
  7. package/dist/cjs/core/BlankState/style.js +1 -1
  8. package/dist/cjs/core/Breadcrumb/index.js +1 -1
  9. package/dist/cjs/core/Button/index.js +1 -1
  10. package/dist/cjs/core/ButtonGroup/index.js +2 -2
  11. package/dist/cjs/core/Card/CardBody.js +1 -1
  12. package/dist/cjs/core/Card/CardTitle.js +1 -1
  13. package/dist/cjs/core/Card/CardWrapper.js +2 -2
  14. package/dist/cjs/core/Cascader/cascader.style.js +11 -11
  15. package/dist/cjs/core/Checkbox/checkbox.style.js +1 -1
  16. package/dist/cjs/core/DetailCard/index.js +1 -1
  17. package/dist/cjs/core/DonutChart/index.js +2 -2
  18. package/dist/cjs/core/DropdownMenu/index.js +1 -1
  19. package/dist/cjs/core/ExpandableList/ExpandIcon.js +1 -1
  20. package/dist/cjs/core/ExpandableList/ExpandableContainer.js +1 -1
  21. package/dist/cjs/core/ExpandableList/ExpandableItem.js +2 -2
  22. package/dist/cjs/core/ExpandableList/RoundOrder.js +1 -1
  23. package/dist/cjs/core/FailedLoad/index.js +1 -1
  24. package/dist/cjs/core/FormItem/index.js +1 -1
  25. package/dist/cjs/core/Icon/index.js +1 -1
  26. package/dist/cjs/core/ImmersiveDialog/styles.js +14 -14
  27. package/dist/cjs/core/Input/index.js +1 -1
  28. package/dist/cjs/core/InputGroup/index.js +1 -1
  29. package/dist/cjs/core/InputInteger/index.js +1 -1
  30. package/dist/cjs/core/InputNumber/index.js +1 -1
  31. package/dist/cjs/core/InputPassword/index.js +1 -1
  32. package/dist/cjs/core/InputTagItem/index.js +1 -1
  33. package/dist/cjs/core/LegacySelect/select.style.js +1 -1
  34. package/dist/cjs/core/Legend/index.js +5 -5
  35. package/dist/cjs/core/LineChart/AreaHighlightLayer.js +122 -0
  36. package/dist/cjs/core/LineChart/ForecastLineLayer.js +134 -0
  37. package/dist/cjs/core/LineChart/LineChartActions.js +2 -2
  38. package/dist/cjs/core/LineChart/RenderChart.js +274 -20
  39. package/dist/cjs/core/LineChart/ThresholdIntersectionLayer.js +144 -0
  40. package/dist/cjs/core/LineChart/TooltipFormatter.js +44 -39
  41. package/dist/cjs/core/LineChart/areaHighlightUtils.js +89 -0
  42. package/dist/cjs/core/LineChart/index.js +20 -2
  43. package/dist/cjs/core/LineChart/lineChartDisplayUtils.js +32 -0
  44. package/dist/cjs/core/LineChart/lineSegments.js +90 -0
  45. package/dist/cjs/core/LineChart/styled.js +21 -9
  46. package/dist/cjs/core/LineChart/utils.js +93 -4
  47. package/dist/cjs/core/Link/index.js +1 -1
  48. package/dist/cjs/core/Loading/style.js +4 -4
  49. package/dist/cjs/core/LocalUpload/LocalUpload.style.js +2 -2
  50. package/dist/cjs/core/LogView/LogView.style.js +5 -5
  51. package/dist/cjs/core/MediumDialog/MediumDialog.js +1 -1
  52. package/dist/cjs/core/Metric/styled.js +8 -8
  53. package/dist/cjs/core/Nav/index.js +1 -1
  54. package/dist/cjs/core/Nav/style.js +2 -2
  55. package/dist/cjs/core/Overflow/index.js +2 -2
  56. package/dist/cjs/core/Pagination/index.js +2 -2
  57. package/dist/cjs/core/Progress/components.js +2 -2
  58. package/dist/cjs/core/Progress/index.js +2 -2
  59. package/dist/cjs/core/Progress/progress.style.js +4 -4
  60. package/dist/cjs/core/Progress/progress.widgets.js +2 -2
  61. package/dist/cjs/core/Radio/index.js +3 -3
  62. package/dist/cjs/core/SearchInput/SearchInput.style.js +5 -5
  63. package/dist/cjs/core/SegmentControl/index.js +4 -4
  64. package/dist/cjs/core/Select/select.style.js +4 -4
  65. package/dist/cjs/core/Select/select.widgets.js +3 -3
  66. package/dist/cjs/core/SimplePagination/index.js +2 -2
  67. package/dist/cjs/core/Skeleton/Content.js +1 -1
  68. package/dist/cjs/core/SmallDialog/SmallDialog.style.js +7 -7
  69. package/dist/cjs/core/StatusCapsule/index.js +2 -2
  70. package/dist/cjs/core/StepProgress/index.js +1 -1
  71. package/dist/cjs/core/Steps/style.js +5 -5
  72. package/dist/cjs/core/Styled/index.js +40 -40
  73. package/dist/cjs/core/Switch/index.js +2 -2
  74. package/dist/cjs/core/Tab/Tab.js +1 -1
  75. package/dist/cjs/core/Tab/Tab.style.js +4 -4
  76. package/dist/cjs/core/Table/TableSkeleton.js +1 -1
  77. package/dist/cjs/core/Table/TableWidget.js +1 -1
  78. package/dist/cjs/core/Table/index.js +3 -3
  79. package/dist/cjs/core/TableForm/Columns/FormItem.js +1 -1
  80. package/dist/cjs/core/TableForm/style.js +7 -7
  81. package/dist/cjs/core/Tag/SplitTag.js +1 -1
  82. package/dist/cjs/core/Tag/style.js +5 -5
  83. package/dist/cjs/core/Time/index.js +1 -1
  84. package/dist/cjs/core/TimeZoneSelect/index.js +7 -7
  85. package/dist/cjs/core/Timeline/Timeline.style.js +5 -5
  86. package/dist/cjs/core/Token/index.js +4 -4
  87. package/dist/cjs/core/Token/style.js +1 -1
  88. package/dist/cjs/core/Tooltip/EllipsisTooltipContent.js +1 -1
  89. package/dist/cjs/core/Tooltip/index.js +1 -1
  90. package/dist/cjs/core/Truncate/index.js +1 -1
  91. package/dist/cjs/core/Typo/index.js +58 -58
  92. package/dist/cjs/core/WizardDialog/styles.js +4 -4
  93. package/dist/cjs/coreX/BarChart/index.js +1 -1
  94. package/dist/cjs/coreX/BatchOperation/index.js +2 -2
  95. package/dist/cjs/coreX/ChartWithTooltip/index.js +6 -6
  96. package/dist/cjs/coreX/CheckPointList/checkpointlist.style.js +3 -3
  97. package/dist/cjs/coreX/CircleLoading/index.js +1 -1
  98. package/dist/cjs/coreX/CronCalendar/index.js +4 -4
  99. package/dist/cjs/coreX/CronPlan/index.js +4 -4
  100. package/dist/cjs/coreX/DateRangePicker/DateRangePicker.style.js +12 -12
  101. package/dist/cjs/coreX/DateRangePicker/RelativeTime.js +9 -6
  102. package/dist/cjs/coreX/DateRangePicker/common.js +104 -5
  103. package/dist/cjs/coreX/DateRangePicker/index.js +107 -47
  104. package/dist/cjs/coreX/Dialogs/DeleteDialog/DeleteDialog.js +2 -2
  105. package/dist/cjs/coreX/Dialogs/RejectDialog/RejectDialog.js +6 -6
  106. package/dist/cjs/coreX/GoBackButton/index.js +1 -1
  107. package/dist/cjs/coreX/I18nNameTag/index.js +1 -1
  108. package/dist/cjs/coreX/InfoRowList/InfoRow.js +1 -1
  109. package/dist/cjs/coreX/InfoRowList/InfoRowList.js +4 -4
  110. package/dist/cjs/coreX/KubeConfigModal/KubeConfigModal.style.js +8 -8
  111. package/dist/cjs/coreX/NamesTooltip/index.js +3 -3
  112. package/dist/cjs/coreX/OverflowTooltip/index.js +4 -4
  113. package/dist/cjs/coreX/Sider/index.js +3 -3
  114. package/dist/cjs/coreX/SummaryTable/index.js +5 -5
  115. package/dist/cjs/coreX/SwitchWithText/index.js +1 -1
  116. package/dist/cjs/coreX/TabMenu/index.js +2 -2
  117. package/dist/cjs/coreX/UnderlineTootip/index.js +1 -1
  118. package/dist/cjs/coreX/UnitWithChart/index.js +3 -3
  119. package/dist/cjs/index.js +13 -0
  120. package/dist/cjs/stats1.html +1 -1
  121. package/dist/components.css +4504 -4480
  122. package/dist/esm/core/AccordionCard/index.js +1 -1
  123. package/dist/esm/core/Alert/alert.style.js +2 -2
  124. package/dist/esm/core/Antd5Tree/Antd5Tree.style.js +1 -1
  125. package/dist/esm/core/Avatar/index.js +1 -1
  126. package/dist/esm/core/Banner/banner.style.js +4 -4
  127. package/dist/esm/core/BasicCTError/BasicCTError.style.js +1 -1
  128. package/dist/esm/core/BlankState/style.js +1 -1
  129. package/dist/esm/core/Breadcrumb/index.js +1 -1
  130. package/dist/esm/core/Button/index.js +1 -1
  131. package/dist/esm/core/ButtonGroup/index.js +2 -2
  132. package/dist/esm/core/Card/CardBody.js +1 -1
  133. package/dist/esm/core/Card/CardTitle.js +1 -1
  134. package/dist/esm/core/Card/CardWrapper.js +2 -2
  135. package/dist/esm/core/Cascader/cascader.style.js +11 -11
  136. package/dist/esm/core/Checkbox/checkbox.style.js +1 -1
  137. package/dist/esm/core/DetailCard/index.js +1 -1
  138. package/dist/esm/core/DonutChart/index.js +2 -2
  139. package/dist/esm/core/DropdownMenu/index.js +1 -1
  140. package/dist/esm/core/ExpandableList/ExpandIcon.js +1 -1
  141. package/dist/esm/core/ExpandableList/ExpandableContainer.js +1 -1
  142. package/dist/esm/core/ExpandableList/ExpandableItem.js +2 -2
  143. package/dist/esm/core/ExpandableList/RoundOrder.js +1 -1
  144. package/dist/esm/core/FailedLoad/index.js +1 -1
  145. package/dist/esm/core/FormItem/index.js +1 -1
  146. package/dist/esm/core/Icon/index.js +1 -1
  147. package/dist/esm/core/ImmersiveDialog/styles.js +14 -14
  148. package/dist/esm/core/Input/index.js +1 -1
  149. package/dist/esm/core/InputGroup/index.js +1 -1
  150. package/dist/esm/core/InputInteger/index.js +1 -1
  151. package/dist/esm/core/InputNumber/index.js +1 -1
  152. package/dist/esm/core/InputPassword/index.js +1 -1
  153. package/dist/esm/core/InputTagItem/index.js +1 -1
  154. package/dist/esm/core/LegacySelect/select.style.js +1 -1
  155. package/dist/esm/core/Legend/index.js +5 -5
  156. package/dist/esm/core/LineChart/AreaHighlightLayer.js +115 -0
  157. package/dist/esm/core/LineChart/ForecastLineLayer.js +124 -0
  158. package/dist/esm/core/LineChart/LineChartActions.js +2 -2
  159. package/dist/esm/core/LineChart/RenderChart.js +276 -23
  160. package/dist/esm/core/LineChart/ThresholdIntersectionLayer.js +134 -0
  161. package/dist/esm/core/LineChart/TooltipFormatter.js +41 -39
  162. package/dist/esm/core/LineChart/areaHighlightUtils.js +87 -0
  163. package/dist/esm/core/LineChart/index.js +21 -3
  164. package/dist/esm/core/LineChart/lineChartDisplayUtils.js +26 -0
  165. package/dist/esm/core/LineChart/lineSegments.js +87 -0
  166. package/dist/esm/core/LineChart/styled.js +20 -10
  167. package/dist/esm/core/LineChart/utils.js +91 -5
  168. package/dist/esm/core/Link/index.js +1 -1
  169. package/dist/esm/core/Loading/style.js +4 -4
  170. package/dist/esm/core/LocalUpload/LocalUpload.style.js +2 -2
  171. package/dist/esm/core/LogView/LogView.style.js +5 -5
  172. package/dist/esm/core/MediumDialog/MediumDialog.js +1 -1
  173. package/dist/esm/core/Metric/styled.js +8 -8
  174. package/dist/esm/core/Nav/index.js +1 -1
  175. package/dist/esm/core/Nav/style.js +2 -2
  176. package/dist/esm/core/Overflow/index.js +2 -2
  177. package/dist/esm/core/Pagination/index.js +2 -2
  178. package/dist/esm/core/Progress/components.js +2 -2
  179. package/dist/esm/core/Progress/index.js +2 -2
  180. package/dist/esm/core/Progress/progress.style.js +4 -4
  181. package/dist/esm/core/Progress/progress.widgets.js +2 -2
  182. package/dist/esm/core/Radio/index.js +3 -3
  183. package/dist/esm/core/SearchInput/SearchInput.style.js +5 -5
  184. package/dist/esm/core/SegmentControl/index.js +4 -4
  185. package/dist/esm/core/Select/select.style.js +4 -4
  186. package/dist/esm/core/Select/select.widgets.js +3 -3
  187. package/dist/esm/core/SimplePagination/index.js +2 -2
  188. package/dist/esm/core/Skeleton/Content.js +1 -1
  189. package/dist/esm/core/SmallDialog/SmallDialog.style.js +7 -7
  190. package/dist/esm/core/StatusCapsule/index.js +2 -2
  191. package/dist/esm/core/StepProgress/index.js +1 -1
  192. package/dist/esm/core/Steps/style.js +5 -5
  193. package/dist/esm/core/Styled/index.js +40 -40
  194. package/dist/esm/core/Switch/index.js +2 -2
  195. package/dist/esm/core/Tab/Tab.js +1 -1
  196. package/dist/esm/core/Tab/Tab.style.js +4 -4
  197. package/dist/esm/core/Table/TableSkeleton.js +1 -1
  198. package/dist/esm/core/Table/TableWidget.js +1 -1
  199. package/dist/esm/core/Table/index.js +3 -3
  200. package/dist/esm/core/TableForm/Columns/FormItem.js +1 -1
  201. package/dist/esm/core/TableForm/style.js +7 -7
  202. package/dist/esm/core/Tag/SplitTag.js +1 -1
  203. package/dist/esm/core/Tag/style.js +5 -5
  204. package/dist/esm/core/Time/index.js +1 -1
  205. package/dist/esm/core/TimeZoneSelect/index.js +7 -7
  206. package/dist/esm/core/Timeline/Timeline.style.js +5 -5
  207. package/dist/esm/core/Token/index.js +4 -4
  208. package/dist/esm/core/Token/style.js +1 -1
  209. package/dist/esm/core/Tooltip/EllipsisTooltipContent.js +1 -1
  210. package/dist/esm/core/Tooltip/index.js +1 -1
  211. package/dist/esm/core/Truncate/index.js +1 -1
  212. package/dist/esm/core/Typo/index.js +58 -58
  213. package/dist/esm/core/WizardDialog/styles.js +4 -4
  214. package/dist/esm/coreX/BarChart/index.js +1 -1
  215. package/dist/esm/coreX/BatchOperation/index.js +2 -2
  216. package/dist/esm/coreX/ChartWithTooltip/index.js +6 -6
  217. package/dist/esm/coreX/CheckPointList/checkpointlist.style.js +3 -3
  218. package/dist/esm/coreX/CircleLoading/index.js +1 -1
  219. package/dist/esm/coreX/CronCalendar/index.js +4 -4
  220. package/dist/esm/coreX/CronPlan/index.js +4 -4
  221. package/dist/esm/coreX/DateRangePicker/DateRangePicker.style.js +12 -12
  222. package/dist/esm/coreX/DateRangePicker/RelativeTime.js +10 -7
  223. package/dist/esm/coreX/DateRangePicker/common.js +99 -6
  224. package/dist/esm/coreX/DateRangePicker/index.js +108 -48
  225. package/dist/esm/coreX/Dialogs/DeleteDialog/DeleteDialog.js +2 -2
  226. package/dist/esm/coreX/Dialogs/RejectDialog/RejectDialog.js +6 -6
  227. package/dist/esm/coreX/GoBackButton/index.js +1 -1
  228. package/dist/esm/coreX/I18nNameTag/index.js +1 -1
  229. package/dist/esm/coreX/InfoRowList/InfoRow.js +1 -1
  230. package/dist/esm/coreX/InfoRowList/InfoRowList.js +4 -4
  231. package/dist/esm/coreX/KubeConfigModal/KubeConfigModal.style.js +8 -8
  232. package/dist/esm/coreX/NamesTooltip/index.js +3 -3
  233. package/dist/esm/coreX/OverflowTooltip/index.js +4 -4
  234. package/dist/esm/coreX/Sider/index.js +3 -3
  235. package/dist/esm/coreX/SummaryTable/index.js +5 -5
  236. package/dist/esm/coreX/SwitchWithText/index.js +1 -1
  237. package/dist/esm/coreX/TabMenu/index.js +2 -2
  238. package/dist/esm/coreX/UnderlineTootip/index.js +1 -1
  239. package/dist/esm/coreX/UnitWithChart/index.js +3 -3
  240. package/dist/esm/index.js +4 -1
  241. package/dist/esm/stats1.html +1 -1
  242. package/dist/linaria.merged.scss +5086 -5060
  243. package/dist/src/core/LineChart/AreaHighlightLayer.d.ts +31 -0
  244. package/dist/src/core/LineChart/ForecastLineLayer.d.ts +24 -0
  245. package/dist/src/core/LineChart/RenderChart.d.ts +5 -1
  246. package/dist/src/core/LineChart/ThresholdIntersectionLayer.d.ts +19 -0
  247. package/dist/src/core/LineChart/TooltipFormatter.d.ts +10 -0
  248. package/dist/src/core/LineChart/__test__/AreaHighlightLayer.test.d.ts +1 -0
  249. package/dist/src/core/LineChart/__test__/ForecastLineLayer.test.d.ts +1 -0
  250. package/dist/src/core/LineChart/__test__/utils.test.d.ts +1 -0
  251. package/dist/src/core/LineChart/areaHighlightUtils.d.ts +6 -0
  252. package/dist/src/core/LineChart/lineChartDisplayUtils.d.ts +7 -0
  253. package/dist/src/core/LineChart/lineSegments.d.ts +16 -0
  254. package/dist/src/core/LineChart/styled.d.ts +2 -0
  255. package/dist/src/core/LineChart/type.d.ts +94 -8
  256. package/dist/src/core/LineChart/utils.d.ts +31 -4
  257. package/dist/src/coreX/DateRangePicker/__tests__/AbsoluteDate.test.d.ts +1 -0
  258. package/dist/src/coreX/DateRangePicker/__tests__/DateRangePicker.test.d.ts +1 -0
  259. package/dist/src/coreX/DateRangePicker/__tests__/RelativeTime.test.d.ts +1 -0
  260. package/dist/src/coreX/DateRangePicker/__tests__/common.test.d.ts +1 -0
  261. package/dist/src/coreX/DateRangePicker/common.d.ts +12 -3
  262. package/dist/src/coreX/DateRangePicker/dateRangePicker.type.d.ts +5 -1
  263. package/dist/stories/docs/core/LineChart.stories.d.ts +4 -0
  264. package/dist/stories/docs/coreX/DateRangePicker.stories.d.ts +1 -0
  265. package/dist/style.css +4515 -4491
  266. package/package.json +3 -3
@@ -21,8 +21,8 @@ var __spreadValues = (a, b) => {
21
21
  }
22
22
  return a;
23
23
  };
24
- const actionStyle = "E_4100_0_18_a9y3flr";
25
- const actionStyleLabel = "E_4100_0_18_a1njc627";
24
+ const actionStyle = "E_4100_0_19_a9y3flr";
25
+ const actionStyleLabel = "E_4100_0_19_a1njc627";
26
26
  const LineChartActions = props => {
27
27
  const {
28
28
  label,
@@ -1,19 +1,27 @@
1
1
  import { useKitDispatch } from '../KitStoreProvider/index.js';
2
2
  import LineChartLegend from './LineChartLegend.js';
3
- import { MetricLegendTabStyle } from './styled.js';
4
- import TooltipFormatter from './TooltipFormatter.js';
3
+ import { MetricLegendTabStyle, ChartContentWrapper, ThresholdTooltipOverlay } from './styled.js';
4
+ import TooltipFormatter, { LineChartTooltipContent } from './TooltipFormatter.js';
5
5
  import { ILineChartGraphType } from './type.js';
6
- import { convertLineChartDataStruct, getYAxisDomain, getLineChartXAxisDomain, lineChartXaxisCal, lineChartYaxisTickFormatter, lineChartTickFormatter } from './utils.js';
6
+ import { convertLineChartDataStruct, getYAxisDomain, lineChartXaxisCal, getLineChartAreaHighlightRanges, lineChartYaxisTickFormatter, getLineChartThresholdIntersections, getLineChartMetricPayloadMatches, lineChartTickFormatter } from './utils.js';
7
+ import { getLineChartAreaHighlightRuns } from './areaHighlightUtils.js';
8
+ import { getLineChartDefaultYAxisTicks, getLineChartStreamStroke, getLineChartLegacyThresholdTooltipInfo } from './lineChartDisplayUtils.js';
7
9
  import useParrotTranslation from '../../hooks/useParrotTranslation.js';
8
10
  import { Empty } from 'antd';
9
11
  import cs from 'classnames';
10
12
  import dayjs from 'dayjs';
13
+ import _ from 'lodash';
11
14
  import React__default, { useState, useMemo, useCallback } from 'react';
12
- import { ResponsiveContainer, AreaChart, XAxis, YAxis, Tooltip, Area } from 'recharts';
15
+ import { ResponsiveContainer, AreaChart, XAxis, YAxis, ReferenceLine, Tooltip, Area, Customized } from 'recharts';
16
+ import AreaHighlightLayer from './AreaHighlightLayer.js';
17
+ import ForecastLineLayer from './ForecastLineLayer.js';
13
18
  import LineChartToolBar from './LineChartToolBar.js';
19
+ import ThresholdIntersectionLayer, { isThresholdIntersectionLabelVisible } from './ThresholdIntersectionLayer.js';
14
20
  import { ChartActions } from '../../store/chart.js';
15
21
 
16
22
  var __defProp = Object.defineProperty;
23
+ var __defProps = Object.defineProperties;
24
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
17
25
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
18
26
  var __hasOwnProp = Object.prototype.hasOwnProperty;
19
27
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -29,7 +37,11 @@ var __spreadValues = (a, b) => {
29
37
  }
30
38
  return a;
31
39
  };
40
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41
+ const DEFAULT_THRESHOLD_LINE_STROKE = "#ff4d4f";
42
+ const DEFAULT_THRESHOLD_LINE_DASHARRAY = "4 4";
32
43
  const RenderChart = (props) => {
44
+ var _a;
33
45
  const {
34
46
  metricName,
35
47
  showLegend,
@@ -40,8 +52,11 @@ const RenderChart = (props) => {
40
52
  type,
41
53
  mode = "legend",
42
54
  dropdownProps,
43
- onLabelsChange,
44
55
  metric,
56
+ areaHighlightRanges,
57
+ forecastStartTimestamp,
58
+ thresholdLineProps,
59
+ renderThresholdTooltip,
45
60
  yAxisProps,
46
61
  xAxisProps,
47
62
  actionsProps,
@@ -57,6 +72,7 @@ const RenderChart = (props) => {
57
72
  const [hovering, setHovering] = useState([]);
58
73
  const [hoveringSelf, setHoveringSelf] = useState([]);
59
74
  const [tempDeselected, setTempDeselected] = useState([]);
75
+ const [hoveredThresholdIntersection, setHoveredThresholdIntersection] = useState(null);
60
76
  const streams = useMemo(() => metric.sample_streams, [metric]);
61
77
  const legends = useMemo(() => {
62
78
  return metric.sample_streams.map((stream) => stream.legend);
@@ -65,21 +81,119 @@ const RenderChart = (props) => {
65
81
  () => convertLineChartDataStruct(streams.map((stream) => stream.points)),
66
82
  [streams]
67
83
  );
68
- const yDomain = getYAxisDomain(areaChartData, type, metric.unit);
69
- const xDomain = getLineChartXAxisDomain(dateRange, dateRange[1].valueOf());
84
+ const xDomainStart = dateRange[0].valueOf();
85
+ const xDomainEnd = dateRange[1].valueOf();
86
+ const xDomain = useMemo(
87
+ () => [xDomainStart, xDomainEnd],
88
+ [xDomainStart, xDomainEnd]
89
+ );
90
+ const thresholdValue = thresholdLineProps == null ? void 0 : thresholdLineProps.value;
91
+ const thresholdExtraValues = useMemo(() => {
92
+ if (_.isNumber(thresholdValue)) {
93
+ return [thresholdValue];
94
+ }
95
+ return [];
96
+ }, [thresholdValue]);
97
+ const yDomain = (_a = yAxisProps == null ? void 0 : yAxisProps.domain) != null ? _a : getYAxisDomain(areaChartData, type, metric.unit, thresholdExtraValues);
98
+ const yTicks = getLineChartDefaultYAxisTicks(yDomain);
70
99
  const xTicks = lineChartXaxisCal(xDomain[1], dateRange, width);
100
+ const normalizedAreaHighlightRanges = useMemo(() => {
101
+ return getLineChartAreaHighlightRanges(areaHighlightRanges, xDomain);
102
+ }, [areaHighlightRanges, xDomain]);
103
+ const thresholdIntersectionLabelProps = thresholdLineProps == null ? void 0 : thresholdLineProps.intersectionLabelProps;
104
+ const hasForecastStartTimestamp = Number.isFinite(forecastStartTimestamp);
105
+ const areaHighlightOverlays = useMemo(() => {
106
+ if (type !== ILineChartGraphType.Area) {
107
+ return [];
108
+ }
109
+ return normalizedAreaHighlightRanges.flatMap((range, rangeIndex) => {
110
+ return streams.flatMap((stream, streamIndex) => {
111
+ var _a2;
112
+ if (range.legendId && stream.legend.id !== range.legendId) {
113
+ return [];
114
+ }
115
+ const data = getLineChartAreaHighlightRuns(stream.points, range);
116
+ if (!data.length) {
117
+ return [];
118
+ }
119
+ return [
120
+ {
121
+ key: `${stream.legend.id}-${range.start}-${range.end}-${rangeIndex}-${streamIndex}`,
122
+ data,
123
+ fill: range.fill,
124
+ fillOpacity: (_a2 = range.fillOpacity) != null ? _a2 : 0.18,
125
+ legendId: stream.legend.id,
126
+ stroke: getLineChartStreamStroke(stream)
127
+ }
128
+ ];
129
+ });
130
+ });
131
+ }, [normalizedAreaHighlightRanges, streams, type]);
132
+ const formatIntersectionValue = useCallback(
133
+ (streamIndex, value, timestamp) => {
134
+ var _a2, _b, _c;
135
+ if (!tooltipProps.format) {
136
+ return lineChartYaxisTickFormatter(value, metric.unit);
137
+ }
138
+ const payload = {
139
+ color: (_a2 = legends[streamIndex]) == null ? void 0 : _a2.color,
140
+ dataKey: `v${streamIndex}`,
141
+ fill: (_b = legends[streamIndex]) == null ? void 0 : _b.fill,
142
+ name: `v${streamIndex}`,
143
+ payload: {
144
+ [`v${streamIndex}`]: value,
145
+ t: timestamp,
146
+ v: value
147
+ },
148
+ stroke: (_c = legends[streamIndex]) == null ? void 0 : _c.color,
149
+ value
150
+ };
151
+ return tooltipProps.format(payload);
152
+ },
153
+ [legends, metric.unit, tooltipProps]
154
+ );
155
+ const thresholdIntersections = useMemo(() => {
156
+ if (!_.isNumber(thresholdValue)) {
157
+ return [];
158
+ }
159
+ const formattedThresholdValue = lineChartYaxisTickFormatter(
160
+ thresholdValue,
161
+ metric.unit
162
+ );
163
+ return getLineChartThresholdIntersections(
164
+ streams,
165
+ thresholdValue,
166
+ xDomain
167
+ ).map((intersection) => {
168
+ return __spreadProps(__spreadValues({}, intersection), {
169
+ formattedThresholdValue,
170
+ formattedValue: formatIntersectionValue(
171
+ intersection.streamIndex,
172
+ intersection.value,
173
+ intersection.timestamp
174
+ ),
175
+ thresholdValue
176
+ });
177
+ });
178
+ }, [formatIntersectionValue, metric.unit, streams, thresholdValue, xDomain]);
179
+ const visibleThresholdIntersections = useMemo(() => {
180
+ return thresholdIntersections.filter((intersection) => {
181
+ return !deselected.includes(intersection.legend.id);
182
+ });
183
+ }, [deselected, thresholdIntersections]);
71
184
  const onLegendClick = useCallback(
72
185
  (id) => {
186
+ setHoveredThresholdIntersection(null);
73
187
  setDeselected((prev) => {
74
- var _a;
188
+ var _a2;
75
189
  const currentDeselected = tempDeselected.length ? tempDeselected : prev;
76
190
  if (currentDeselected.length === 0) {
77
191
  return streams.map((stream) => stream.legend.id).filter((legendId) => legendId !== id);
78
192
  }
79
193
  if (currentDeselected.length === streams.length - 1) {
80
- const highlightedId = (_a = streams.find(
194
+ const highlightedId = (_a2 = streams.find(
81
195
  (stream) => !currentDeselected.includes(stream.legend.id)
82
- )) == null ? void 0 : _a.legend.id;
196
+ )) == null ? void 0 : _a2.legend.id;
83
197
  if (id === highlightedId) {
84
198
  return [];
85
199
  } else {
@@ -154,6 +268,7 @@ const RenderChart = (props) => {
154
268
  [deselected, streams, tempDeselected]
155
269
  );
156
270
  const hidePointer = useCallback(() => {
271
+ setHoveredThresholdIntersection(null);
157
272
  dispatch({
158
273
  type: ChartActions.SET_POINTER,
159
274
  payload: { visible: false, uuid: syncId }
@@ -161,10 +276,14 @@ const RenderChart = (props) => {
161
276
  }, [dispatch, syncId]);
162
277
  const handleMouseMove = useCallback(
163
278
  (e) => {
164
- var _a;
279
+ var _a2;
165
280
  if (e.isTooltipActive) {
166
281
  const { chartX, activePayload } = e;
167
- if (!((_a = activePayload == null ? void 0 : activePayload[0]) == null ? void 0 : _a.payload)) {
282
+ const activeMetricPayload = (_a2 = getLineChartMetricPayloadMatches(
283
+ activePayload,
284
+ legends
285
+ )[0]) == null ? void 0 : _a2.payload;
286
+ if (!(activeMetricPayload == null ? void 0 : activeMetricPayload.payload)) {
168
287
  return;
169
288
  }
170
289
  dispatch({
@@ -173,19 +292,73 @@ const RenderChart = (props) => {
173
292
  uuid: syncId,
174
293
  visible: true,
175
294
  left: chartX,
176
- text: dayjs(Number(activePayload[0].payload.t)).format(
295
+ text: dayjs(Number(activeMetricPayload.payload.t)).format(
177
296
  "MM/DD HH:mm:ss"
178
297
  ),
179
- value: activePayload[0].payload.v
298
+ value: activeMetricPayload.payload.v
180
299
  }
181
300
  });
182
301
  }
183
302
  },
184
- [dispatch, syncId]
303
+ [dispatch, legends, syncId]
185
304
  );
305
+ const handleThresholdIntersectionEnter = useCallback(
306
+ (info, left, top) => {
307
+ setHoveredThresholdIntersection({
308
+ info,
309
+ left,
310
+ top
311
+ });
312
+ },
313
+ []
314
+ );
315
+ const thresholdTooltipContent = useMemo(() => {
316
+ if (!hoveredThresholdIntersection) {
317
+ return null;
318
+ }
319
+ const renderer = thresholdLineProps == null ? void 0 : thresholdLineProps.renderTooltip;
320
+ if (renderer) {
321
+ return renderer(hoveredThresholdIntersection.info);
322
+ }
323
+ if (renderThresholdTooltip) {
324
+ return renderThresholdTooltip(
325
+ getLineChartLegacyThresholdTooltipInfo(
326
+ hoveredThresholdIntersection.info
327
+ )
328
+ );
329
+ }
330
+ const showHoveredThresholdIntersectionLabel = isThresholdIntersectionLabelVisible(
331
+ thresholdIntersectionLabelProps,
332
+ hoveredThresholdIntersection.info
333
+ );
334
+ if (showHoveredThresholdIntersectionLabel) {
335
+ return null;
336
+ }
337
+ return /* @__PURE__ */ React__default.createElement(
338
+ LineChartTooltipContent,
339
+ {
340
+ title: dayjs(hoveredThresholdIntersection.info.timestamp).format(
341
+ "MM/DD HH:mm:ss"
342
+ ),
343
+ items: [
344
+ {
345
+ id: hoveredThresholdIntersection.info.legend.id,
346
+ color: hoveredThresholdIntersection.info.legend.color,
347
+ label: hoveredThresholdIntersection.info.legend.name,
348
+ value: hoveredThresholdIntersection.info.formattedValue
349
+ }
350
+ ]
351
+ }
352
+ );
353
+ }, [
354
+ thresholdIntersectionLabelProps,
355
+ hoveredThresholdIntersection,
356
+ renderThresholdTooltip,
357
+ thresholdLineProps == null ? void 0 : thresholdLineProps.renderTooltip
358
+ ]);
186
359
  if (!(streams == null ? void 0 : streams.length) || streams.every((stream) => {
187
- var _a;
188
- return !((_a = stream.points) == null ? void 0 : _a.length);
360
+ var _a2;
361
+ return !((_a2 = stream.points) == null ? void 0 : _a2.length);
189
362
  })) {
190
363
  return /* @__PURE__ */ React__default.createElement("div", { className: MetricLegendTabStyle }, /* @__PURE__ */ React__default.createElement("div", { className: "name-toolbar" }, /* @__PURE__ */ React__default.createElement(
191
364
  LineChartLegend,
@@ -223,11 +396,21 @@ const RenderChart = (props) => {
223
396
  dropdownProps,
224
397
  onLegendHover
225
398
  }
226
- ), /* @__PURE__ */ React__default.createElement(ResponsiveContainer, { height }, /* @__PURE__ */ React__default.createElement(
399
+ ), /* @__PURE__ */ React__default.createElement(ChartContentWrapper, { style: { height } }, /* @__PURE__ */ React__default.createElement(ResponsiveContainer, { height: "100%" }, /* @__PURE__ */ React__default.createElement(
227
400
  AreaChart,
228
401
  {
229
402
  style: { backgroundColor: "white" },
230
- margin: showLegend ? { top: 10, left: -20, right: 0, bottom: 0 } : { top: 20, left: -20, right: 0, bottom: 5 },
403
+ margin: showLegend ? {
404
+ top: 0,
405
+ left: 0,
406
+ right: 0,
407
+ bottom: 0
408
+ } : {
409
+ top: 0,
410
+ left: 0,
411
+ right: 0,
412
+ bottom: 5
413
+ },
231
414
  data: areaChartData,
232
415
  syncId,
233
416
  onMouseLeave: hidePointer,
@@ -261,10 +444,26 @@ const RenderChart = (props) => {
261
444
  dy: 16,
262
445
  fontSize: 12
263
446
  },
264
- ticks: [yDomain[1] / 2, yDomain[1]],
447
+ ticks: yTicks,
265
448
  tickFormatter: (tick) => lineChartYaxisTickFormatter(tick, metric.unit)
266
449
  }, yAxisProps)
267
450
  ),
451
+ _.isNumber(thresholdValue) && /* @__PURE__ */ React__default.createElement(
452
+ ReferenceLine,
453
+ {
454
+ "data-testid": "line-chart-threshold-line",
455
+ className: cs(
456
+ "line-chart-threshold-line",
457
+ thresholdLineProps == null ? void 0 : thresholdLineProps.className
458
+ ),
459
+ style: thresholdLineProps == null ? void 0 : thresholdLineProps.style,
460
+ y: thresholdValue,
461
+ stroke: (thresholdLineProps == null ? void 0 : thresholdLineProps.stroke) || DEFAULT_THRESHOLD_LINE_STROKE,
462
+ strokeDasharray: (thresholdLineProps == null ? void 0 : thresholdLineProps.strokeDasharray) || DEFAULT_THRESHOLD_LINE_DASHARRAY,
463
+ ifOverflow: "discard",
464
+ isFront: true
465
+ }
466
+ ),
268
467
  /* @__PURE__ */ React__default.createElement(
269
468
  Tooltip,
270
469
  __spreadValues({
@@ -289,19 +488,73 @@ const RenderChart = (props) => {
289
488
  key: index,
290
489
  dataKey: `v${index}`,
291
490
  stackId: type === ILineChartGraphType.Stack ? "stack" : void 0,
292
- stroke: item.legend.stroke ? `${item.legend.color}1A` : item.legend.color,
491
+ stroke: hasForecastStartTimestamp ? "none" : getLineChartStreamStroke(item),
293
492
  fill: item.legend.fill,
294
493
  isAnimationActive: false,
295
494
  activeDot: {
296
495
  stroke: item.legend.color,
297
496
  r: 4,
298
497
  strokeWidth: 2,
299
- fill: "white"
498
+ fill: "white",
499
+ strokeOpacity: 1,
500
+ fillOpacity: 1
300
501
  },
301
502
  opacity: hovering.includes(item.legend.id) ? 0.3 : 1
302
503
  }
303
504
  );
304
- })
505
+ }),
506
+ areaHighlightOverlays.map((overlay) => {
507
+ if (deselected.includes(overlay.legendId)) {
508
+ return null;
509
+ }
510
+ return /* @__PURE__ */ React__default.createElement(
511
+ Customized,
512
+ {
513
+ key: overlay.key,
514
+ component: AreaHighlightLayer,
515
+ overlay,
516
+ hovering,
517
+ forecastStartTimestamp
518
+ }
519
+ );
520
+ }),
521
+ hasForecastStartTimestamp && /* @__PURE__ */ React__default.createElement(
522
+ Customized,
523
+ {
524
+ key: "line-chart-forecast-lines",
525
+ component: ForecastLineLayer,
526
+ forecastStartTimestamp,
527
+ stacked: type === ILineChartGraphType.Stack,
528
+ hovering,
529
+ streams,
530
+ deselected
531
+ }
532
+ ),
533
+ visibleThresholdIntersections.map((intersection, index) => /* @__PURE__ */ React__default.createElement(
534
+ Customized,
535
+ {
536
+ key: `${intersection.legend.id}-${intersection.timestamp}-${index}`,
537
+ component: ThresholdIntersectionLayer,
538
+ intersection,
539
+ index,
540
+ hovering,
541
+ intersectionLabelProps: thresholdIntersectionLabelProps,
542
+ thresholdStroke: thresholdLineProps == null ? void 0 : thresholdLineProps.stroke,
543
+ onMouseEnter: handleThresholdIntersectionEnter,
544
+ onMouseLeave: () => setHoveredThresholdIntersection(null)
545
+ }
546
+ ))
547
+ )), hoveredThresholdIntersection && thresholdTooltipContent && /* @__PURE__ */ React__default.createElement(
548
+ ThresholdTooltipOverlay,
549
+ {
550
+ "data-testid": "line-chart-threshold-tooltip",
551
+ role: "tooltip",
552
+ style: {
553
+ left: hoveredThresholdIntersection.left,
554
+ top: hoveredThresholdIntersection.top
555
+ }
556
+ },
557
+ thresholdTooltipContent
305
558
  )));
306
559
  };
307
560
  var RenderChart$1 = RenderChart;
@@ -0,0 +1,134 @@
1
+ import React__default from 'react';
2
+ import _ from 'lodash';
3
+ import { ReferenceDot } from 'recharts';
4
+
5
+ const DEFAULT_THRESHOLD_LINE_STROKE = "#ff4d4f";
6
+ const DEFAULT_THRESHOLD_INTERSECTION_LABEL_TEXT_COLOR = "#ffffff";
7
+ const THRESHOLD_INTERSECTION_LABEL_HEIGHT = 28;
8
+ const THRESHOLD_INTERSECTION_LABEL_RADIUS = 4;
9
+ const THRESHOLD_INTERSECTION_LABEL_OFFSET = 8;
10
+ const THRESHOLD_INTERSECTION_LABEL_PADDING_X = 12;
11
+ const THRESHOLD_INTERSECTION_LABEL_MIN_WIDTH = 48;
12
+ const THRESHOLD_INTERSECTION_LABEL_FONT_SIZE = 12;
13
+ const THRESHOLD_INTERSECTION_CJK_REGEXP = /[\u3400-\u9fff\uf900-\ufaff]/;
14
+ const isThresholdIntersectionLabelVisible = (labelProps, info) => {
15
+ if (!labelProps) {
16
+ return false;
17
+ }
18
+ const { visible = true } = labelProps;
19
+ if (_.isFunction(visible)) {
20
+ return visible(info);
21
+ }
22
+ return visible;
23
+ };
24
+ const getThresholdIntersectionLabelText = (labelProps, info) => {
25
+ const text = labelProps == null ? void 0 : labelProps.text;
26
+ if (_.isFunction(text)) {
27
+ return text(info) || info.formattedThresholdValue;
28
+ }
29
+ return text || info.formattedThresholdValue;
30
+ };
31
+ const getThresholdIntersectionLabelWidth = (label) => {
32
+ const contentWidth = Array.from(label).reduce((sum, char) => {
33
+ return sum + (THRESHOLD_INTERSECTION_CJK_REGEXP.test(char) ? THRESHOLD_INTERSECTION_LABEL_FONT_SIZE : THRESHOLD_INTERSECTION_LABEL_FONT_SIZE * 0.65);
34
+ }, 0);
35
+ return Math.max(
36
+ THRESHOLD_INTERSECTION_LABEL_MIN_WIDTH,
37
+ Math.ceil(contentWidth) + THRESHOLD_INTERSECTION_LABEL_PADDING_X * 2
38
+ );
39
+ };
40
+ const ThresholdIntersectionLayer = ({
41
+ intersection,
42
+ index,
43
+ hovering,
44
+ intersectionLabelProps,
45
+ thresholdStroke,
46
+ onMouseEnter,
47
+ onMouseLeave,
48
+ xAxisMap,
49
+ yAxisMap
50
+ }) => {
51
+ const xAxis = xAxisMap == null ? void 0 : xAxisMap[0];
52
+ const yAxis = yAxisMap == null ? void 0 : yAxisMap[0];
53
+ if (typeof (xAxis == null ? void 0 : xAxis.scale) !== "function" || typeof (yAxis == null ? void 0 : yAxis.scale) !== "function") {
54
+ return null;
55
+ }
56
+ return /* @__PURE__ */ React__default.createElement(
57
+ ReferenceDot,
58
+ {
59
+ xAxis,
60
+ yAxis,
61
+ x: intersection.timestamp,
62
+ y: intersection.value,
63
+ isFront: true,
64
+ shape: (shapeProps) => {
65
+ const { cx = 0, cy = 0 } = shapeProps;
66
+ const intersectionOpacity = hovering.includes(intersection.legend.id) ? 0.3 : 1;
67
+ const showIntersectionLabel = isThresholdIntersectionLabelVisible(
68
+ intersectionLabelProps,
69
+ intersection
70
+ );
71
+ const intersectionLabelText = showIntersectionLabel ? getThresholdIntersectionLabelText(
72
+ intersectionLabelProps,
73
+ intersection
74
+ ) : "";
75
+ const intersectionLabelColor = (intersectionLabelProps == null ? void 0 : intersectionLabelProps.color) || thresholdStroke || DEFAULT_THRESHOLD_LINE_STROKE;
76
+ const intersectionLabelTextColor = (intersectionLabelProps == null ? void 0 : intersectionLabelProps.textColor) || DEFAULT_THRESHOLD_INTERSECTION_LABEL_TEXT_COLOR;
77
+ const intersectionLabelWidth = getThresholdIntersectionLabelWidth(
78
+ intersectionLabelText
79
+ );
80
+ const intersectionLabelX = cx - intersectionLabelWidth / 2;
81
+ const intersectionLabelY = cy - THRESHOLD_INTERSECTION_LABEL_HEIGHT - THRESHOLD_INTERSECTION_LABEL_OFFSET;
82
+ return /* @__PURE__ */ React__default.createElement(
83
+ "g",
84
+ {
85
+ "data-testid": "line-chart-threshold-intersection-dot",
86
+ "data-intersection-id": `${intersection.legend.id}-${index}`,
87
+ onMouseEnter: () => onMouseEnter(intersection, cx, cy),
88
+ onMouseLeave
89
+ },
90
+ /* @__PURE__ */ React__default.createElement(
91
+ "circle",
92
+ {
93
+ cx,
94
+ cy,
95
+ r: 8,
96
+ fill: "transparent",
97
+ stroke: "transparent"
98
+ }
99
+ ),
100
+ showIntersectionLabel && /* @__PURE__ */ React__default.createElement("g", { "data-testid": "line-chart-threshold-intersection-label" }, /* @__PURE__ */ React__default.createElement(
101
+ "rect",
102
+ {
103
+ "data-testid": "line-chart-threshold-intersection-label-background",
104
+ x: intersectionLabelX,
105
+ y: intersectionLabelY,
106
+ width: intersectionLabelWidth,
107
+ height: THRESHOLD_INTERSECTION_LABEL_HEIGHT,
108
+ rx: THRESHOLD_INTERSECTION_LABEL_RADIUS,
109
+ ry: THRESHOLD_INTERSECTION_LABEL_RADIUS,
110
+ fill: intersectionLabelColor,
111
+ opacity: intersectionOpacity
112
+ }
113
+ ), /* @__PURE__ */ React__default.createElement(
114
+ "text",
115
+ {
116
+ x: cx,
117
+ y: intersectionLabelY + THRESHOLD_INTERSECTION_LABEL_HEIGHT / 2,
118
+ fill: intersectionLabelTextColor,
119
+ fontSize: THRESHOLD_INTERSECTION_LABEL_FONT_SIZE,
120
+ fontWeight: 500,
121
+ textAnchor: "middle",
122
+ dominantBaseline: "middle",
123
+ opacity: intersectionOpacity
124
+ },
125
+ intersectionLabelText
126
+ ))
127
+ );
128
+ }
129
+ }
130
+ );
131
+ };
132
+ var ThresholdIntersectionLayer$1 = ThresholdIntersectionLayer;
133
+
134
+ export { ThresholdIntersectionLayer$1 as default, isThresholdIntersectionLabelVisible };
@@ -1,36 +1,35 @@
1
1
  import { styled } from '@linaria/react';
2
2
  import { LineChartColorBlock } from './LineChartLegend.js';
3
3
  import { TooltipWrapper, TooltipColumn } from './styled.js';
4
+ import { getLineChartMetricPayloadMatches } from './utils.js';
4
5
  import dayjs from 'dayjs';
5
6
  import React__default from 'react';
6
7
  import { Typo } from '../Typo/index.js';
7
8
 
8
- var __defProp = Object.defineProperty;
9
- var __defProps = Object.defineProperties;
10
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
11
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
12
- var __hasOwnProp = Object.prototype.hasOwnProperty;
13
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
14
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
15
- enumerable: true,
16
- configurable: true,
17
- writable: true,
18
- value
19
- }) : obj[key] = value;
20
- var __spreadValues = (a, b) => {
21
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
22
- if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
23
- if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
24
- }
25
- return a;
26
- };
27
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
9
  const TooltipTitle = /*#__PURE__*/styled('div')({
29
10
  name: "TooltipTitle",
30
- class: "E_4100_0_18_t1616y1o",
11
+ class: "E_4100_0_19_t1616y1o",
31
12
  propsAsIs: false
32
13
  });
14
+ const LineChartTooltipContent = ({
15
+ title,
16
+ items
17
+ }) => {
18
+ return /* @__PURE__ */React__default.createElement(TooltipWrapper, null, /* @__PURE__ */React__default.createElement(TooltipTitle, {
19
+ className: Typo.Label.l4_bold_title
20
+ }, title), items.map(item => {
21
+ return /* @__PURE__ */React__default.createElement(TooltipColumn, {
22
+ key: item.id
23
+ }, /* @__PURE__ */React__default.createElement("div", null, /* @__PURE__ */React__default.createElement(LineChartColorBlock, {
24
+ background: item.color,
25
+ borderd: true
26
+ }), item.label), /* @__PURE__ */React__default.createElement("div", {
27
+ className: "column-value"
28
+ }, item.value));
29
+ }));
30
+ };
33
31
  const TooltipFormatter = props => {
32
+ var _a, _b;
34
33
  const {
35
34
  active,
36
35
  payload,
@@ -41,24 +40,27 @@ const TooltipFormatter = props => {
41
40
  if (!active || !(payload == null ? void 0 : payload.length)) {
42
41
  return null;
43
42
  }
44
- return /* @__PURE__ */React__default.createElement(TooltipWrapper, null, /* @__PURE__ */React__default.createElement(TooltipTitle, {
45
- className: Typo.Label.l4_bold_title
46
- }, dayjs(Number(payload[0].payload.t)).format("MM/DD HH:mm:ss")), payload.map(item => {
47
- return __spreadProps(__spreadValues({}, item), {
48
- legend: legends.find((_legend, index) => `v${index}` === item.name)
49
- });
50
- }).sort((a, b) => b.value - a.value).map(item => {
51
- var _a, _b, _c, _d;
52
- return deselected.includes(((_a = item.legend) == null ? void 0 : _a.id) || "") ? null : /* @__PURE__ */React__default.createElement(TooltipColumn, {
53
- key: (_b = item.legend) == null ? void 0 : _b.id
54
- }, /* @__PURE__ */React__default.createElement("div", null, /* @__PURE__ */React__default.createElement(LineChartColorBlock, {
55
- background: (_c = item.legend) == null ? void 0 : _c.color,
56
- borderd: true
57
- }), (_d = item.legend) == null ? void 0 : _d.name), /* @__PURE__ */React__default.createElement("div", {
58
- className: "column-value"
59
- }, format(item)));
60
- }));
43
+ const metricPayloads = getLineChartMetricPayloadMatches(payload, legends);
44
+ const titlePayload = (_b = (_a = metricPayloads[0]) == null ? void 0 : _a.payload) == null ? void 0 : _b.payload;
45
+ if (!titlePayload) {
46
+ return null;
47
+ }
48
+ const items = metricPayloads.sort((a, b) => b.payload.value - a.payload.value).flatMap(item => {
49
+ if (deselected.includes(item.legend.id)) {
50
+ return [];
51
+ }
52
+ return [{
53
+ id: item.legend.id,
54
+ color: item.legend.color,
55
+ label: item.legend.name,
56
+ value: format(item.payload)
57
+ }];
58
+ });
59
+ return /* @__PURE__ */React__default.createElement(LineChartTooltipContent, {
60
+ title: dayjs(Number(titlePayload.t)).format("MM/DD HH:mm:ss"),
61
+ items
62
+ });
61
63
  };
62
64
  var TooltipFormatter$1 = TooltipFormatter;
63
65
 
64
- export { TooltipFormatter$1 as default };
66
+ export { LineChartTooltipContent, TooltipFormatter$1 as default };