@elliemae/ds-dataviz 3.80.0-next.67 → 3.80.0-next.71

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 (398) hide show
  1. package/dist/cjs/constants/index.js +73 -0
  2. package/dist/cjs/constants/index.js.map +7 -0
  3. package/dist/cjs/graphs/Chart/Chart.js +6 -1
  4. package/dist/cjs/graphs/Chart/Chart.js.map +2 -2
  5. package/dist/cjs/graphs/Chart/ChartContext.js.map +2 -2
  6. package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js +36 -24
  7. package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +3 -3
  8. package/dist/cjs/graphs/Chart/SingleStackedBar/styles.js +12 -5
  9. package/dist/cjs/graphs/Chart/SingleStackedBar/styles.js.map +2 -2
  10. package/dist/cjs/graphs/Chart/config/chartInteractionStore.js +98 -0
  11. package/dist/cjs/graphs/Chart/config/chartInteractionStore.js.map +7 -0
  12. package/dist/cjs/graphs/Chart/config/useChart.js +56 -40
  13. package/dist/cjs/graphs/Chart/config/useChart.js.map +2 -2
  14. package/dist/cjs/graphs/Chart/config/useChartDescription.js +62 -0
  15. package/dist/cjs/graphs/Chart/config/useChartDescription.js.map +7 -0
  16. package/dist/cjs/graphs/Chart/config/useEntranceAnimation.js +141 -0
  17. package/dist/cjs/graphs/Chart/config/useEntranceAnimation.js.map +7 -0
  18. package/dist/cjs/graphs/Chart/config/useGetters.js +10 -0
  19. package/dist/cjs/graphs/Chart/config/useGetters.js.map +2 -2
  20. package/dist/cjs/graphs/Chart/config/useInternalMargins.js +25 -5
  21. package/dist/cjs/graphs/Chart/config/useInternalMargins.js.map +2 -2
  22. package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +35 -51
  23. package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
  24. package/dist/cjs/graphs/Chart/config/useScales.js +200 -67
  25. package/dist/cjs/graphs/Chart/config/useScales.js.map +2 -2
  26. package/dist/cjs/graphs/Chart/config/useValidateProps.js +53 -4
  27. package/dist/cjs/graphs/Chart/config/useValidateProps.js.map +2 -2
  28. package/dist/cjs/graphs/Chart/config/useValueAxisTransition.js +128 -0
  29. package/dist/cjs/graphs/Chart/config/useValueAxisTransition.js.map +7 -0
  30. package/dist/cjs/graphs/Chart/config/useWheelScroll.js +111 -0
  31. package/dist/cjs/graphs/Chart/config/useWheelScroll.js.map +7 -0
  32. package/dist/cjs/graphs/Chart/helpers/alignedTicks.js +56 -0
  33. package/dist/cjs/graphs/Chart/helpers/alignedTicks.js.map +7 -0
  34. package/dist/cjs/graphs/Chart/helpers/barPath.js +53 -0
  35. package/dist/cjs/graphs/Chart/helpers/barPath.js.map +7 -0
  36. package/dist/cjs/graphs/Chart/{react-desc-prop-types.js → helpers/dataInView.js} +26 -27
  37. package/dist/cjs/graphs/Chart/helpers/dataInView.js.map +7 -0
  38. package/dist/cjs/graphs/Chart/helpers/index.js +34 -0
  39. package/dist/cjs/graphs/Chart/helpers/index.js.map +2 -2
  40. package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/theming.js → helpers/logAxis.js} +13 -9
  41. package/dist/cjs/graphs/Chart/helpers/logAxis.js.map +7 -0
  42. package/dist/cjs/graphs/Chart/helpers/tickRotation.js +54 -0
  43. package/dist/cjs/graphs/Chart/helpers/tickRotation.js.map +7 -0
  44. package/dist/cjs/graphs/Chart/helpers/timeTicks.js +56 -0
  45. package/dist/cjs/graphs/Chart/helpers/timeTicks.js.map +7 -0
  46. package/dist/cjs/graphs/Chart/helpers/trend.js +45 -0
  47. package/dist/cjs/graphs/Chart/helpers/trend.js.map +7 -0
  48. package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/index.js → helpers/useSerieDimming.js} +20 -6
  49. package/dist/cjs/graphs/Chart/helpers/useSerieDimming.js.map +7 -0
  50. package/dist/cjs/graphs/Chart/helpers/useUniqueData.js +15 -18
  51. package/dist/cjs/graphs/Chart/helpers/useUniqueData.js.map +2 -2
  52. package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js +12 -5
  53. package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js.map +2 -2
  54. package/dist/cjs/graphs/Chart/{DataTestIds.js → helpers/zeroLine.js} +12 -9
  55. package/dist/cjs/graphs/Chart/helpers/zeroLine.js.map +7 -0
  56. package/dist/cjs/graphs/Chart/parts/A11yRegion.js +8 -2
  57. package/dist/cjs/graphs/Chart/parts/A11yRegion.js.map +2 -2
  58. package/dist/cjs/graphs/Chart/parts/Axis/Axis.js +40 -4
  59. package/dist/cjs/graphs/Chart/parts/Axis/Axis.js.map +2 -2
  60. package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js +18 -4
  61. package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
  62. package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js +14 -6
  63. package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
  64. package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js +14 -4
  65. package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
  66. package/dist/cjs/graphs/Chart/parts/Axis/GridLine.js +15 -1
  67. package/dist/cjs/graphs/Chart/parts/Axis/GridLine.js.map +2 -2
  68. package/dist/cjs/graphs/Chart/parts/Axis/Tick.js +10 -4
  69. package/dist/cjs/graphs/Chart/parts/Axis/Tick.js.map +2 -2
  70. package/dist/cjs/graphs/Chart/parts/Axis/useTickTransition.js +170 -0
  71. package/dist/cjs/graphs/Chart/parts/Axis/useTickTransition.js.map +7 -0
  72. package/dist/cjs/graphs/Chart/parts/ChartContainer.js +41 -19
  73. package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +2 -2
  74. package/dist/cjs/graphs/Chart/parts/FocusableRegion.js +6 -3
  75. package/dist/cjs/graphs/Chart/parts/FocusableRegion.js.map +2 -2
  76. package/dist/cjs/graphs/Chart/parts/HoverBand.js +86 -0
  77. package/dist/cjs/graphs/Chart/parts/HoverBand.js.map +7 -0
  78. package/dist/cjs/graphs/Chart/parts/Labels/Label.js +12 -1
  79. package/dist/cjs/graphs/Chart/parts/Labels/Label.js.map +2 -2
  80. package/dist/cjs/graphs/Chart/parts/Labels/index.js +12 -4
  81. package/dist/cjs/graphs/Chart/parts/Labels/index.js.map +2 -2
  82. package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js +6 -3
  83. package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
  84. package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js +2 -6
  85. package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
  86. package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js +91 -9
  87. package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js.map +2 -2
  88. package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js +3 -4
  89. package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
  90. package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js +8 -6
  91. package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
  92. package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js +29 -3
  93. package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
  94. package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js +82 -55
  95. package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +3 -3
  96. package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js +14 -6
  97. package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
  98. package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +67 -43
  99. package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
  100. package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/data-test-ids.js → parts/ScreenReaderText.js} +17 -7
  101. package/dist/cjs/graphs/Chart/parts/ScreenReaderText.js.map +7 -0
  102. package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js +14 -9
  103. package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js.map +2 -2
  104. package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js +152 -49
  105. package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js.map +2 -2
  106. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js +22 -6
  107. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
  108. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js +13 -6
  109. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js.map +2 -2
  110. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js +42 -35
  111. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
  112. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js +9 -4
  113. package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +2 -2
  114. package/dist/cjs/graphs/Chart/parts/SeriesFactory.js +39 -30
  115. package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +2 -2
  116. package/dist/cjs/graphs/Chart/parts/TrendHighlight.js +57 -19
  117. package/dist/cjs/graphs/Chart/parts/TrendHighlight.js.map +2 -2
  118. package/dist/cjs/graphs/Chart/parts/ZeroLine.js +66 -0
  119. package/dist/cjs/graphs/Chart/parts/ZeroLine.js.map +7 -0
  120. package/dist/cjs/graphs/Chart/scales/index.js +50 -20
  121. package/dist/cjs/graphs/Chart/scales/index.js.map +3 -3
  122. package/dist/cjs/graphs/Chart/series/Area.js +76 -9
  123. package/dist/cjs/graphs/Chart/series/Area.js.map +2 -2
  124. package/dist/cjs/graphs/Chart/series/Bars.js +3 -1
  125. package/dist/cjs/graphs/Chart/series/Bars.js.map +2 -2
  126. package/dist/cjs/graphs/Chart/series/HorizontalBars.js +4 -1
  127. package/dist/cjs/graphs/Chart/series/HorizontalBars.js.map +2 -2
  128. package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js +14 -7
  129. package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
  130. package/dist/cjs/graphs/Chart/series/Line.js +9 -7
  131. package/dist/cjs/graphs/Chart/series/Line.js.map +2 -2
  132. package/dist/cjs/graphs/Chart/series/Point.js +114 -128
  133. package/dist/cjs/graphs/Chart/series/Point.js.map +3 -3
  134. package/dist/cjs/graphs/Chart/series/Points.js +8 -2
  135. package/dist/cjs/graphs/Chart/series/Points.js.map +2 -2
  136. package/dist/cjs/graphs/Chart/series/Rect.js +133 -122
  137. package/dist/cjs/graphs/Chart/series/Rect.js.map +3 -3
  138. package/dist/cjs/graphs/Chart/series/StackedBar.js +14 -6
  139. package/dist/cjs/graphs/Chart/series/StackedBar.js.map +2 -2
  140. package/dist/cjs/graphs/Chart/styles.js +65 -34
  141. package/dist/cjs/graphs/Chart/styles.js.map +2 -2
  142. package/dist/cjs/graphs/constants.js +24 -9
  143. package/dist/cjs/graphs/constants.js.map +2 -2
  144. package/dist/cjs/index.js +17 -6
  145. package/dist/cjs/index.js.map +3 -3
  146. package/dist/cjs/react-desc-prop-types.js +150 -0
  147. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  148. package/dist/cjs/typescript-testing/slot-props.js +69 -0
  149. package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
  150. package/dist/cjs/typescript-testing/typescript-data-viz-valid.js +34 -2
  151. package/dist/cjs/typescript-testing/typescript-data-viz-valid.js.map +2 -2
  152. package/dist/cjs/typescript-testing/typescript-single-stacked-bar-valid.js +93 -0
  153. package/dist/cjs/typescript-testing/typescript-single-stacked-bar-valid.js.map +7 -0
  154. package/dist/esm/constants/index.js +43 -0
  155. package/dist/esm/constants/index.js.map +7 -0
  156. package/dist/esm/graphs/Chart/Chart.js +6 -1
  157. package/dist/esm/graphs/Chart/Chart.js.map +2 -2
  158. package/dist/esm/graphs/Chart/ChartContext.js.map +2 -2
  159. package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js +40 -23
  160. package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +2 -2
  161. package/dist/esm/graphs/Chart/SingleStackedBar/styles.js +12 -5
  162. package/dist/esm/graphs/Chart/SingleStackedBar/styles.js.map +2 -2
  163. package/dist/esm/graphs/Chart/config/chartInteractionStore.js +68 -0
  164. package/dist/esm/graphs/Chart/config/chartInteractionStore.js.map +7 -0
  165. package/dist/esm/graphs/Chart/config/useChart.js +58 -42
  166. package/dist/esm/graphs/Chart/config/useChart.js.map +2 -2
  167. package/dist/esm/graphs/Chart/config/useChartDescription.js +32 -0
  168. package/dist/esm/graphs/Chart/config/useChartDescription.js.map +7 -0
  169. package/dist/esm/graphs/Chart/config/useEntranceAnimation.js +111 -0
  170. package/dist/esm/graphs/Chart/config/useEntranceAnimation.js.map +7 -0
  171. package/dist/esm/graphs/Chart/config/useGetters.js +10 -0
  172. package/dist/esm/graphs/Chart/config/useGetters.js.map +2 -2
  173. package/dist/esm/graphs/Chart/config/useInternalMargins.js +26 -6
  174. package/dist/esm/graphs/Chart/config/useInternalMargins.js.map +2 -2
  175. package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +35 -51
  176. package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
  177. package/dist/esm/graphs/Chart/config/useScales.js +202 -69
  178. package/dist/esm/graphs/Chart/config/useScales.js.map +2 -2
  179. package/dist/esm/graphs/Chart/config/useValidateProps.js +53 -4
  180. package/dist/esm/graphs/Chart/config/useValidateProps.js.map +2 -2
  181. package/dist/esm/graphs/Chart/config/useValueAxisTransition.js +98 -0
  182. package/dist/esm/graphs/Chart/config/useValueAxisTransition.js.map +7 -0
  183. package/dist/esm/graphs/Chart/config/useWheelScroll.js +81 -0
  184. package/dist/esm/graphs/Chart/config/useWheelScroll.js.map +7 -0
  185. package/dist/esm/graphs/Chart/helpers/alignedTicks.js +26 -0
  186. package/dist/esm/graphs/Chart/helpers/alignedTicks.js.map +7 -0
  187. package/dist/esm/graphs/Chart/helpers/barPath.js +23 -0
  188. package/dist/esm/graphs/Chart/helpers/barPath.js.map +7 -0
  189. package/dist/esm/graphs/Chart/helpers/dataInView.js +28 -0
  190. package/dist/esm/graphs/Chart/helpers/dataInView.js.map +7 -0
  191. package/dist/esm/graphs/Chart/helpers/index.js +34 -0
  192. package/dist/esm/graphs/Chart/helpers/index.js.map +2 -2
  193. package/dist/esm/graphs/Chart/helpers/logAxis.js +14 -0
  194. package/dist/esm/graphs/Chart/helpers/logAxis.js.map +7 -0
  195. package/dist/esm/graphs/Chart/helpers/tickRotation.js +24 -0
  196. package/dist/esm/graphs/Chart/helpers/tickRotation.js.map +7 -0
  197. package/dist/esm/graphs/Chart/helpers/timeTicks.js +26 -0
  198. package/dist/esm/graphs/Chart/helpers/timeTicks.js.map +7 -0
  199. package/dist/esm/graphs/Chart/helpers/trend.js +15 -0
  200. package/dist/esm/graphs/Chart/helpers/trend.js.map +7 -0
  201. package/dist/esm/graphs/Chart/helpers/useSerieDimming.js +15 -0
  202. package/dist/esm/graphs/Chart/helpers/useSerieDimming.js.map +7 -0
  203. package/dist/esm/graphs/Chart/helpers/useUniqueData.js +15 -18
  204. package/dist/esm/graphs/Chart/helpers/useUniqueData.js.map +2 -2
  205. package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js +12 -5
  206. package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js.map +2 -2
  207. package/dist/esm/graphs/Chart/helpers/zeroLine.js +13 -0
  208. package/dist/esm/graphs/Chart/helpers/zeroLine.js.map +7 -0
  209. package/dist/esm/graphs/Chart/parts/A11yRegion.js +7 -1
  210. package/dist/esm/graphs/Chart/parts/A11yRegion.js.map +2 -2
  211. package/dist/esm/graphs/Chart/parts/Axis/Axis.js +40 -4
  212. package/dist/esm/graphs/Chart/parts/Axis/Axis.js.map +2 -2
  213. package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js +18 -4
  214. package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
  215. package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js +14 -6
  216. package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
  217. package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js +14 -4
  218. package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
  219. package/dist/esm/graphs/Chart/parts/Axis/GridLine.js +16 -2
  220. package/dist/esm/graphs/Chart/parts/Axis/GridLine.js.map +2 -2
  221. package/dist/esm/graphs/Chart/parts/Axis/Tick.js +11 -5
  222. package/dist/esm/graphs/Chart/parts/Axis/Tick.js.map +2 -2
  223. package/dist/esm/graphs/Chart/parts/Axis/useTickTransition.js +140 -0
  224. package/dist/esm/graphs/Chart/parts/Axis/useTickTransition.js.map +7 -0
  225. package/dist/esm/graphs/Chart/parts/ChartContainer.js +41 -19
  226. package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +2 -2
  227. package/dist/esm/graphs/Chart/parts/FocusableRegion.js +7 -4
  228. package/dist/esm/graphs/Chart/parts/FocusableRegion.js.map +2 -2
  229. package/dist/esm/graphs/Chart/parts/HoverBand.js +56 -0
  230. package/dist/esm/graphs/Chart/parts/HoverBand.js.map +7 -0
  231. package/dist/esm/graphs/Chart/parts/Labels/Label.js +12 -1
  232. package/dist/esm/graphs/Chart/parts/Labels/Label.js.map +2 -2
  233. package/dist/esm/graphs/Chart/parts/Labels/index.js +12 -4
  234. package/dist/esm/graphs/Chart/parts/Labels/index.js.map +2 -2
  235. package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js +7 -4
  236. package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
  237. package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js +3 -7
  238. package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
  239. package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js +91 -9
  240. package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js.map +2 -2
  241. package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js +4 -5
  242. package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
  243. package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js +9 -7
  244. package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
  245. package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js +29 -3
  246. package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
  247. package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js +83 -56
  248. package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +3 -3
  249. package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js +14 -6
  250. package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
  251. package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +68 -44
  252. package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
  253. package/dist/esm/graphs/Chart/parts/ScreenReaderText.js +18 -0
  254. package/dist/esm/graphs/Chart/parts/ScreenReaderText.js.map +7 -0
  255. package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js +14 -9
  256. package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js.map +2 -2
  257. package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js +154 -51
  258. package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js.map +2 -2
  259. package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js +22 -6
  260. package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
  261. package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js +13 -6
  262. package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js.map +2 -2
  263. package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js +43 -36
  264. package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
  265. package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js +10 -5
  266. package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +2 -2
  267. package/dist/esm/graphs/Chart/parts/SeriesFactory.js +40 -31
  268. package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +2 -2
  269. package/dist/esm/graphs/Chart/parts/TrendHighlight.js +58 -20
  270. package/dist/esm/graphs/Chart/parts/TrendHighlight.js.map +2 -2
  271. package/dist/esm/graphs/Chart/parts/ZeroLine.js +36 -0
  272. package/dist/esm/graphs/Chart/parts/ZeroLine.js.map +7 -0
  273. package/dist/esm/graphs/Chart/scales/index.js +51 -21
  274. package/dist/esm/graphs/Chart/scales/index.js.map +3 -3
  275. package/dist/esm/graphs/Chart/series/Area.js +77 -10
  276. package/dist/esm/graphs/Chart/series/Area.js.map +2 -2
  277. package/dist/esm/graphs/Chart/series/Bars.js +3 -1
  278. package/dist/esm/graphs/Chart/series/Bars.js.map +2 -2
  279. package/dist/esm/graphs/Chart/series/HorizontalBars.js +4 -1
  280. package/dist/esm/graphs/Chart/series/HorizontalBars.js.map +2 -2
  281. package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js +15 -8
  282. package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
  283. package/dist/esm/graphs/Chart/series/Line.js +9 -7
  284. package/dist/esm/graphs/Chart/series/Line.js.map +2 -2
  285. package/dist/esm/graphs/Chart/series/Point.js +120 -130
  286. package/dist/esm/graphs/Chart/series/Point.js.map +3 -3
  287. package/dist/esm/graphs/Chart/series/Points.js +8 -2
  288. package/dist/esm/graphs/Chart/series/Points.js.map +2 -2
  289. package/dist/esm/graphs/Chart/series/Rect.js +134 -123
  290. package/dist/esm/graphs/Chart/series/Rect.js.map +3 -3
  291. package/dist/esm/graphs/Chart/series/StackedBar.js +15 -7
  292. package/dist/esm/graphs/Chart/series/StackedBar.js.map +2 -2
  293. package/dist/esm/graphs/Chart/styles.js +66 -35
  294. package/dist/esm/graphs/Chart/styles.js.map +2 -2
  295. package/dist/esm/graphs/constants.js +25 -10
  296. package/dist/esm/graphs/constants.js.map +2 -2
  297. package/dist/esm/index.js +19 -7
  298. package/dist/esm/index.js.map +2 -2
  299. package/dist/esm/react-desc-prop-types.js +125 -0
  300. package/dist/esm/react-desc-prop-types.js.map +7 -0
  301. package/dist/esm/typescript-testing/slot-props.js +46 -0
  302. package/dist/esm/typescript-testing/slot-props.js.map +7 -0
  303. package/dist/esm/typescript-testing/typescript-data-viz-valid.js +35 -3
  304. package/dist/esm/typescript-testing/typescript-data-viz-valid.js.map +2 -2
  305. package/dist/esm/typescript-testing/typescript-single-stacked-bar-valid.js +70 -0
  306. package/dist/esm/typescript-testing/typescript-single-stacked-bar-valid.js.map +7 -0
  307. package/dist/types/constants/index.d.ts +42 -0
  308. package/dist/types/graphs/Chart/Chart.d.ts +4 -2
  309. package/dist/types/graphs/Chart/ChartContext.d.ts +9 -11
  310. package/dist/types/graphs/Chart/SingleStackedBar/SingleStackedBar.d.ts +1 -1
  311. package/dist/types/graphs/Chart/config/chartInteractionStore.d.ts +32 -0
  312. package/dist/types/graphs/Chart/config/useChart.d.ts +9 -11
  313. package/dist/types/graphs/Chart/config/useChartDescription.d.ts +5 -0
  314. package/dist/types/graphs/Chart/config/useEntranceAnimation.d.ts +16 -0
  315. package/dist/types/graphs/Chart/config/useGetters.d.ts +1 -1
  316. package/dist/types/graphs/Chart/config/useInternalMargins.d.ts +4 -1
  317. package/dist/types/graphs/Chart/config/useKeyboardNavigation.d.ts +1 -1
  318. package/dist/types/graphs/Chart/config/useScales.d.ts +8 -2
  319. package/dist/types/graphs/Chart/config/useValidateProps.d.ts +7 -1
  320. package/dist/types/graphs/Chart/config/useValueAxisTransition.d.ts +6 -0
  321. package/dist/types/graphs/Chart/config/useWheelScroll.d.ts +2 -0
  322. package/dist/types/graphs/Chart/helpers/alignedTicks.d.ts +1 -0
  323. package/dist/types/graphs/Chart/helpers/barPath.d.ts +11 -0
  324. package/dist/types/graphs/Chart/helpers/dataInView.d.ts +6 -0
  325. package/dist/types/graphs/Chart/helpers/index.d.ts +10 -1
  326. package/dist/types/graphs/Chart/helpers/logAxis.d.ts +8 -0
  327. package/dist/types/graphs/Chart/helpers/tickRotation.d.ts +2 -0
  328. package/dist/types/graphs/Chart/helpers/timeTicks.d.ts +2 -0
  329. package/dist/types/graphs/Chart/helpers/trend.d.ts +3 -0
  330. package/dist/types/graphs/Chart/helpers/useSerieDimming.d.ts +3 -0
  331. package/dist/types/graphs/Chart/helpers/useUniqueData.d.ts +1 -1
  332. package/dist/types/graphs/Chart/helpers/useVirtualizedSeries.d.ts +1 -1
  333. package/dist/types/graphs/Chart/helpers/zeroLine.d.ts +2 -0
  334. package/dist/types/graphs/Chart/parts/Axis/Axis.d.ts +4 -1
  335. package/dist/types/graphs/Chart/parts/Axis/Tick.d.ts +1 -0
  336. package/dist/types/graphs/Chart/parts/Axis/useTickTransition.d.ts +24 -0
  337. package/dist/types/graphs/Chart/parts/HoverBand.d.ts +2 -0
  338. package/dist/types/graphs/Chart/parts/Labels/Label.d.ts +3 -0
  339. package/dist/types/graphs/Chart/parts/Scrapper/ScrapperLine.d.ts +11 -1
  340. package/dist/types/graphs/Chart/parts/Scrapper/VerticalScrapperLine.d.ts +6 -7
  341. package/dist/types/graphs/Chart/parts/ScreenReaderText.d.ts +5 -0
  342. package/dist/types/graphs/Chart/parts/TrendHighlight.d.ts +3 -2
  343. package/dist/types/graphs/Chart/parts/ZeroLine.d.ts +2 -0
  344. package/dist/types/graphs/Chart/scales/index.d.ts +10 -3
  345. package/dist/types/graphs/Chart/series/Area.d.ts +1 -1
  346. package/dist/types/graphs/Chart/series/Bars.d.ts +1 -1
  347. package/dist/types/graphs/Chart/series/HorizontalBars.d.ts +1 -1
  348. package/dist/types/graphs/Chart/series/HorizontalStackedBars.d.ts +1 -1
  349. package/dist/types/graphs/Chart/series/Line.d.ts +1 -1
  350. package/dist/types/graphs/Chart/series/Point.d.ts +3 -2
  351. package/dist/types/graphs/Chart/series/Points.d.ts +1 -1
  352. package/dist/types/graphs/Chart/series/Rect.d.ts +3 -2
  353. package/dist/types/graphs/Chart/series/StackedBar.d.ts +1 -1
  354. package/dist/types/graphs/Chart/styles.d.ts +18 -5
  355. package/dist/types/graphs/constants.d.ts +13 -1
  356. package/dist/types/index.d.ts +6 -1
  357. package/dist/types/react-desc-prop-types.d.ts +228 -0
  358. package/package.json +8 -7
  359. package/dist/cjs/graphs/Chart/DataTestIds.js.map +0 -7
  360. package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js.map +0 -7
  361. package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/index.js.map +0 -7
  362. package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/theming.js.map +0 -7
  363. package/dist/cjs/graphs/Chart/SingleStackedBar/index.js +0 -31
  364. package/dist/cjs/graphs/Chart/SingleStackedBar/index.js.map +0 -7
  365. package/dist/cjs/graphs/Chart/SingleStackedBar/react-desc-prop-types.js +0 -51
  366. package/dist/cjs/graphs/Chart/SingleStackedBar/react-desc-prop-types.js.map +0 -7
  367. package/dist/cjs/graphs/Chart/index.js +0 -33
  368. package/dist/cjs/graphs/Chart/index.js.map +0 -7
  369. package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +0 -7
  370. package/dist/cjs/graphs/index.js +0 -31
  371. package/dist/cjs/graphs/index.js.map +0 -7
  372. package/dist/esm/graphs/Chart/DataTestIds.js +0 -10
  373. package/dist/esm/graphs/Chart/DataTestIds.js.map +0 -7
  374. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js +0 -8
  375. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js.map +0 -7
  376. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/index.js +0 -4
  377. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/index.js.map +0 -7
  378. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/theming.js +0 -10
  379. package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/theming.js.map +0 -7
  380. package/dist/esm/graphs/Chart/SingleStackedBar/index.js +0 -4
  381. package/dist/esm/graphs/Chart/SingleStackedBar/index.js.map +0 -7
  382. package/dist/esm/graphs/Chart/SingleStackedBar/react-desc-prop-types.js +0 -21
  383. package/dist/esm/graphs/Chart/SingleStackedBar/react-desc-prop-types.js.map +0 -7
  384. package/dist/esm/graphs/Chart/index.js +0 -6
  385. package/dist/esm/graphs/Chart/index.js.map +0 -7
  386. package/dist/esm/graphs/Chart/react-desc-prop-types.js +0 -29
  387. package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +0 -7
  388. package/dist/esm/graphs/index.js +0 -4
  389. package/dist/esm/graphs/index.js.map +0 -7
  390. package/dist/types/graphs/Chart/DataTestIds.d.ts +0 -5
  391. package/dist/types/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.d.ts +0 -3
  392. package/dist/types/graphs/Chart/SingleStackedBar/exported-related/index.d.ts +0 -2
  393. package/dist/types/graphs/Chart/SingleStackedBar/exported-related/theming.d.ts +0 -4
  394. package/dist/types/graphs/Chart/SingleStackedBar/index.d.ts +0 -3
  395. package/dist/types/graphs/Chart/SingleStackedBar/react-desc-prop-types.d.ts +0 -44
  396. package/dist/types/graphs/Chart/index.d.ts +0 -4
  397. package/dist/types/graphs/Chart/react-desc-prop-types.d.ts +0 -510
  398. package/dist/types/graphs/index.d.ts +0 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/graphs/Chart/parts/Scroller/ScrollableContainerX.tsx", "../../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { AxisBottom } from '../Axis/AxisBottom.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarX } from './ScrollBarX.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\nexport const ScrollableContainerX = () => {\n const {\n props: { scrapper },\n xScrollbarPosition,\n xScale,\n containerRatio,\n innerWidth,\n isGrabbed,\n containerRef,\n setXScrollbarPosition,\n setContainerRatio,\n lastScrollbarPosition,\n innerHeight,\n internalMargin,\n chartId,\n isZooming,\n setIsZooming,\n zoomStartingPosition,\n setZoomStartingPosition,\n movingPosition,\n setMovingPosition,\n } = useContext(ChartContext);\n\n const getRealClientX = useCallback(\n (clientX: number) => clientX - internalMargin.left - (containerRef?.getBoundingClientRect().left || 0),\n [containerRef, internalMargin.left],\n );\n\n const Scrappers = useMemo(() => {\n if (scrapper && scrapper?.type === 'horizontal') return <Scrapper />;\n if (scrapper && scrapper?.type === 'vertical') return <VerticalScrapper />;\n return null;\n }, [scrapper]);\n\n const handleOnMouseDown: React.MouseEventHandler = useCallback(\n ({ clientX }) => {\n if (!isGrabbed && xScale?.type !== 'BAND') {\n setIsZooming(true);\n setZoomStartingPosition(getRealClientX(clientX));\n setMovingPosition(0);\n }\n },\n [getRealClientX, isGrabbed, setIsZooming, setMovingPosition, setZoomStartingPosition, xScale?.type],\n );\n\n const handleOnMouseMove: React.MouseEventHandler = useCallback(\n ({ clientX }) => {\n if (isZooming) setMovingPosition(getRealClientX(clientX));\n },\n [getRealClientX, isZooming, setMovingPosition],\n );\n const handleOnMouseUp: React.MouseEventHandler = useCallback(\n (e) => {\n if (!isZooming) return;\n setIsZooming(false);\n setMovingPosition(0);\n const endingPosition = getRealClientX(e.clientX);\n\n const diff = Math.abs(zoomStartingPosition - endingPosition);\n if (diff <= 0) return;\n const newRatio =\n innerWidth / ((innerWidth * containerRatio) / diff) < 40\n ? innerWidth / 40\n : (innerWidth * containerRatio) / diff;\n const newPosition =\n lastScrollbarPosition.current +\n (zoomStartingPosition > endingPosition ? endingPosition : zoomStartingPosition) / containerRatio;\n\n // if (newPosition < 0) setXScrollbarPosition(0);\n // if is bigger thant innerwidth possible we force the end\n if (newPosition > innerWidth - innerWidth / newRatio) setXScrollbarPosition(innerWidth - innerWidth / newRatio);\n else setXScrollbarPosition(newPosition);\n\n setContainerRatio(newRatio);\n lastScrollbarPosition.current = newPosition;\n e.stopPropagation();\n },\n [\n isZooming,\n setIsZooming,\n setMovingPosition,\n getRealClientX,\n zoomStartingPosition,\n innerWidth,\n containerRatio,\n lastScrollbarPosition,\n setXScrollbarPosition,\n setContainerRatio,\n ],\n );\n return (\n <g\n className=\"scrollable-container-x\"\n onMouseDown={handleOnMouseDown}\n onMouseMove={handleOnMouseMove}\n onMouseUp={handleOnMouseUp}\n >\n <g mask={`url(#mask-${chartId})`}>\n <g transform={`translate(${-xScrollbarPosition * containerRatio},0)`}>\n <AxisBottom />\n <SeriesFactory />\n {Scrappers}\n </g>\n {isZooming && movingPosition !== 0 ? (\n <rect\n x={movingPosition < zoomStartingPosition ? movingPosition : zoomStartingPosition}\n width={Math.abs(movingPosition - zoomStartingPosition)}\n height={innerHeight}\n fill=\"orange\"\n style={{ opacity: 0.2 }}\n />\n ) : null}\n </g>\n <ScrollBarX />\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": "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",
4
+ "sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext.js';\nimport { useChartInteraction } from '../../config/chartInteractionStore.js';\nimport { AxisBottom } from '../Axis/AxisBottom.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarX } from './ScrollBarX.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\n\n// The range being dragged to zoom into, in the brand color. It is the only part of the chart that follows the pointer\n// during the drag: it subscribes to the selection, which moves on every pointer move.\nconst ZoomSelection = () => {\n const { innerHeight } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n const isZooming = useChartInteraction((state) => state.isZooming);\n const start = useChartInteraction((state) => state.zoomStartingPosition);\n const end = useChartInteraction((state) => state.movingPosition);\n if (!isZooming || end === 0) return null;\n return (\n <rect\n x={Math.min(start, end)}\n width={Math.abs(end - start)}\n height={innerHeight}\n fill={theme?.colors?.brand?.['500'] ?? '#1394E5'}\n style={{ opacity: 0.15 }}\n />\n );\n};\n\nexport const ScrollableContainerX = () => {\n const {\n props: { scrapper },\n xScale,\n containerRatio,\n innerWidth,\n isGrabbed,\n containerRef,\n setXScrollbarPosition,\n setContainerRatio,\n lastScrollbarPosition,\n internalMargin,\n chartId,\n interactionStore,\n } = useContext(ChartContext);\n const xScrollbarPosition = useChartInteraction((state) => state.xScrollbarPosition);\n\n const getRealClientX = useCallback(\n (clientX: number) => clientX - internalMargin.left - (containerRef?.getBoundingClientRect().left || 0),\n [containerRef, internalMargin.left],\n );\n\n const Scrappers = useMemo(() => {\n if (scrapper && scrapper?.type === 'horizontal') return <Scrapper />;\n if (scrapper && scrapper?.type === 'vertical') return <VerticalScrapper />;\n return null;\n }, [scrapper]);\n\n // built once per change of its inputs, not on every scroll step: a scroll step only moves it (the series, the\n // scrapper and the axis subscribe to what they need themselves)\n const content = useMemo(\n () => (\n <>\n <AxisBottom />\n <SeriesFactory />\n {Scrappers}\n </>\n ),\n [Scrappers],\n );\n\n // the selection is read from the store when the pointer moves, not subscribed to: this group holds the whole plot\n const handleOnMouseDown: React.MouseEventHandler = useCallback(\n ({ clientX }) => {\n if (!isGrabbed && xScale?.type !== 'BAND') {\n interactionStore.setIsZooming(true);\n interactionStore.setZoomStartingPosition(getRealClientX(clientX));\n interactionStore.setMovingPosition(0);\n }\n },\n [getRealClientX, interactionStore, isGrabbed, xScale?.type],\n );\n\n const handleOnMouseMove: React.MouseEventHandler = useCallback(\n ({ clientX }) => {\n if (interactionStore.getState().isZooming) interactionStore.setMovingPosition(getRealClientX(clientX));\n },\n [getRealClientX, interactionStore],\n );\n const handleOnMouseUp: React.MouseEventHandler = useCallback(\n (e) => {\n const { isZooming, zoomStartingPosition } = interactionStore.getState();\n if (!isZooming) return;\n interactionStore.setIsZooming(false);\n interactionStore.setMovingPosition(0);\n const endingPosition = getRealClientX(e.clientX);\n\n const diff = Math.abs(zoomStartingPosition - endingPosition);\n if (diff <= 0) return;\n const newRatio =\n innerWidth / ((innerWidth * containerRatio) / diff) < 40\n ? innerWidth / 40\n : (innerWidth * containerRatio) / diff;\n const newPosition =\n lastScrollbarPosition.current +\n (zoomStartingPosition > endingPosition ? endingPosition : zoomStartingPosition) / containerRatio;\n\n // if (newPosition < 0) setXScrollbarPosition(0);\n // if is bigger thant innerwidth possible we force the end\n if (newPosition > innerWidth - innerWidth / newRatio) setXScrollbarPosition(innerWidth - innerWidth / newRatio);\n else setXScrollbarPosition(newPosition);\n\n setContainerRatio(newRatio);\n lastScrollbarPosition.current = newPosition;\n e.stopPropagation();\n },\n [\n interactionStore,\n getRealClientX,\n innerWidth,\n containerRatio,\n lastScrollbarPosition,\n setXScrollbarPosition,\n setContainerRatio,\n ],\n );\n return (\n <g\n className=\"scrollable-container-x\"\n onMouseDown={handleOnMouseDown}\n onMouseMove={handleOnMouseMove}\n onMouseUp={handleOnMouseUp}\n >\n <g mask={`url(#mask-${chartId})`}>\n <g transform={`translate(${-xScrollbarPosition * containerRatio},0)`}>{content}</g>\n <ZoomSelection />\n </g>\n <ScrollBarX />\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
@@ -35,6 +35,7 @@ var React = __toESM(require("react"));
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = require("react");
37
37
  var import_ChartContext = require("../../ChartContext.js");
38
+ var import_chartInteractionStore = require("../../config/chartInteractionStore.js");
38
39
  var import_SeriesFactory = require("../SeriesFactory.js");
39
40
  var import_ScrollBarY = require("./ScrollBarY.js");
40
41
  var import_Scrapper = require("../Scrapper/Scrapper.js");
@@ -43,21 +44,25 @@ var import_AxisLeft = require("../Axis/AxisLeft.js");
43
44
  const ScrollableContainerY = () => {
44
45
  const {
45
46
  props: { scrapper },
46
- xScrollbarPosition,
47
47
  containerRatio,
48
48
  chartId
49
49
  } = (0, import_react.useContext)(import_ChartContext.ChartContext);
50
+ const xScrollbarPosition = (0, import_chartInteractionStore.useChartInteraction)((state) => state.xScrollbarPosition);
50
51
  const Scrappers = (0, import_react.useMemo)(() => {
51
52
  if (scrapper?.type === "horizontal") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Scrapper.Scrapper, {});
52
53
  if (scrapper?.type === "vertical") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_VerticalScrapper.VerticalScrapper, {});
53
54
  return null;
54
55
  }, [scrapper?.type]);
55
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { className: "scrollable-container-y", children: [
56
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { mask: `url(#mask-y-${chartId})`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { transform: `translate(0,${-xScrollbarPosition * containerRatio})`, children: [
56
+ const content = (0, import_react.useMemo)(
57
+ () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
57
58
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SeriesFactory.SeriesFactory, {}),
58
59
  Scrappers,
59
60
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AxisLeft.AxisLeft, {})
60
- ] }) }),
61
+ ] }),
62
+ [Scrappers]
63
+ );
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { className: "scrollable-container-y", children: [
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { mask: `url(#mask-y-${chartId})`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { transform: `translate(0,${-xScrollbarPosition * containerRatio})`, children: content }) }),
61
66
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ScrollBarY.ScrollBarY, {})
62
67
  ] });
63
68
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/graphs/Chart/parts/Scroller/ScrollableContainerY.tsx", "../../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarY } from './ScrollBarY.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\nimport { AxisLeft } from '../Axis/AxisLeft.js';\nexport const ScrollableContainerY = () => {\n const {\n props: { scrapper },\n xScrollbarPosition,\n containerRatio,\n chartId,\n } = useContext(ChartContext);\n\n const Scrappers = useMemo(() => {\n if (scrapper?.type === 'horizontal') return <Scrapper />;\n if (scrapper?.type === 'vertical') return <VerticalScrapper />;\n return null;\n }, [scrapper?.type]);\n\n return (\n <g className=\"scrollable-container-y\">\n <g mask={`url(#mask-y-${chartId})`}>\n <g transform={`translate(0,${-xScrollbarPosition * containerRatio})`}>\n <SeriesFactory />\n {Scrappers}\n <AxisLeft />\n </g>\n </g>\n <ScrollBarY />\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkByB;AAhBhD,mBAA2C;AAC3C,0BAA6B;AAC7B,2BAA8B;AAC9B,wBAA2B;AAC3B,sBAAyB;AACzB,8BAAiC;AACjC,sBAAyB;AAClB,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAE3B,QAAM,gBAAY,sBAAQ,MAAM;AAC9B,QAAI,UAAU,SAAS,aAAc,QAAO,4CAAC,4BAAS;AACtD,QAAI,UAAU,SAAS,WAAY,QAAO,4CAAC,4CAAiB;AAC5D,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,IAAI,CAAC;AAEnB,SACE,6CAAC,OAAE,WAAU,0BACX;AAAA,gDAAC,OAAE,MAAM,eAAe,OAAO,KAC7B,uDAAC,OAAE,WAAW,eAAe,CAAC,qBAAqB,cAAc,KAC/D;AAAA,kDAAC,sCAAc;AAAA,MACd;AAAA,MACD,4CAAC,4BAAS;AAAA,OACZ,GACF;AAAA,IACA,4CAAC,gCAAW;AAAA,KACd;AAEJ;",
4
+ "sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { useChartInteraction } from '../../config/chartInteractionStore.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarY } from './ScrollBarY.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\nimport { AxisLeft } from '../Axis/AxisLeft.js';\nexport const ScrollableContainerY = () => {\n const {\n props: { scrapper },\n containerRatio,\n chartId,\n } = useContext(ChartContext);\n const xScrollbarPosition = useChartInteraction((state) => state.xScrollbarPosition);\n\n const Scrappers = useMemo(() => {\n if (scrapper?.type === 'horizontal') return <Scrapper />;\n if (scrapper?.type === 'vertical') return <VerticalScrapper />;\n return null;\n }, [scrapper?.type]);\n\n // built once per change of its inputs, not on every scroll step: a scroll step only moves it (the series, the\n // scrapper and the axis subscribe to what they need themselves)\n const content = useMemo(\n () => (\n <>\n <SeriesFactory />\n {Scrappers}\n <AxisLeft />\n </>\n ),\n [Scrappers],\n );\n\n return (\n <g className=\"scrollable-container-y\">\n <g mask={`url(#mask-y-${chartId})`}>\n <g transform={`translate(0,${-xScrollbarPosition * containerRatio})`}>{content}</g>\n </g>\n <ScrollBarY />\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmByB;AAjBhD,mBAA2C;AAC3C,0BAA6B;AAC7B,mCAAoC;AACpC,2BAA8B;AAC9B,wBAA2B;AAC3B,sBAAyB;AACzB,8BAAiC;AACjC,sBAAyB;AAClB,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAC3B,QAAM,yBAAqB,kDAAoB,CAAC,UAAU,MAAM,kBAAkB;AAElF,QAAM,gBAAY,sBAAQ,MAAM;AAC9B,QAAI,UAAU,SAAS,aAAc,QAAO,4CAAC,4BAAS;AACtD,QAAI,UAAU,SAAS,WAAY,QAAO,4CAAC,4CAAiB;AAC5D,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,IAAI,CAAC;AAInB,QAAM,cAAU;AAAA,IACd,MACE,4EACE;AAAA,kDAAC,sCAAc;AAAA,MACd;AAAA,MACD,4CAAC,4BAAS;AAAA,OACZ;AAAA,IAEF,CAAC,SAAS;AAAA,EACZ;AAEA,SACE,6CAAC,OAAE,WAAU,0BACX;AAAA,gDAAC,OAAE,MAAM,eAAe,OAAO,KAC7B,sDAAC,OAAE,WAAW,eAAe,CAAC,qBAAqB,cAAc,KAAM,mBAAQ,GACjF;AAAA,IACA,4CAAC,gCAAW;AAAA,KACd;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -38,42 +38,51 @@ var import_ChartContext = require("../ChartContext.js");
38
38
  var import_series = require("../series/index.js");
39
39
  var import_helpers = require("../helpers/index.js");
40
40
  var import_useVirtualizedSeries = require("../helpers/useVirtualizedSeries.js");
41
+ var import_HoverBand = require("./HoverBand.js");
42
+ var import_ZeroLine = require("./ZeroLine.js");
43
+ var import_useEntranceAnimation = require("../config/useEntranceAnimation.js");
44
+ var import_useValueAxisTransition = require("../config/useValueAxisTransition.js");
45
+ const getSerieComponent = (serie, { groups, types, isHorizontal }) => {
46
+ const isStacked = Boolean(groups) && (0, import_helpers.getStackedIndex)(groups, serie.name) > -1;
47
+ if (serie.type === "bar" && isStacked) return isHorizontal ? import_series.HorizontalStackedBars : import_series.StackedBar;
48
+ if (serie.type === "bar") return isHorizontal ? import_series.HorizontalBars : import_series.Bars;
49
+ if (types === "scatter" && !serie.type || serie.type === "point") return import_series.Points;
50
+ if (serie.type === "line") return import_series.Line;
51
+ if (serie.type === "area") return import_series.Area;
52
+ return null;
53
+ };
41
54
  const SeriesFactory = () => {
42
55
  const {
43
- props: { groups, types },
56
+ props: { groups, types, y2Axis },
44
57
  isHorizontal
45
58
  } = (0, import_react.useContext)(import_ChartContext.ChartContext);
46
59
  const virtualizedSeries = (0, import_useVirtualizedSeries.useVirtualizedSeries)();
60
+ const { setSeriesGroup, seriesGroup, withAnimation, transformOrigin } = (0, import_useEntranceAnimation.useEntranceAnimation)();
61
+ (0, import_useValueAxisTransition.useValueAxisTransition)(seriesGroup);
62
+ const eases = !isHorizontal;
47
63
  return (0, import_react.useMemo)(
48
- () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { className: "content", children: virtualizedSeries.map((serie) => {
49
- const serieProps = {
50
- key: serie.key,
51
- serie
52
- };
53
- if (serie.type === "bar" && groups && (0, import_helpers.getStackedIndex)(groups, serie.name) > -1 && isHorizontal) {
54
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.HorizontalStackedBars, { ...serieProps });
55
- }
56
- if (serie.type === "bar" && groups && (0, import_helpers.getStackedIndex)(groups, serie.name) > -1) {
57
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.StackedBar, { ...serieProps });
58
- }
59
- if (serie.type === "bar" && isHorizontal) {
60
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.HorizontalBars, { ...serieProps });
61
- }
62
- if (serie.type === "bar") {
63
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.Bars, { ...serieProps });
64
- }
65
- if (types === "scatter" && !serie.type || serie.type === "point") {
66
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.Points, { ...serieProps });
67
- }
68
- if (serie.type === "line") {
69
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.Line, { ...serieProps });
70
- }
71
- if (serie.type === "area") {
72
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.Area, { ...serieProps });
73
- }
74
- return null;
75
- }) }),
76
- [groups, isHorizontal, types, virtualizedSeries]
64
+ () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { className: "content", ref: setSeriesGroup, children: [
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_HoverBand.HoverBand, {}),
66
+ eases ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { ...{ [import_useValueAxisTransition.VALUE_AXIS_TRANSITION.ATTRIBUTE]: "y" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ZeroLine.ZeroLine, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ZeroLine.ZeroLine, {}),
67
+ virtualizedSeries.map((serie) => {
68
+ const Serie = getSerieComponent(serie, { groups, types, isHorizontal });
69
+ if (!Serie) return null;
70
+ const valueAxis = serie.scale === "y2" && y2Axis ? "y2" : "y";
71
+ const drawn = (key) => eases ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { ...{ [import_useValueAxisTransition.VALUE_AXIS_TRANSITION.ATTRIBUTE]: valueAxis }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Serie, { serie }) }, key) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Serie, { serie }, key);
72
+ if (!withAnimation) return drawn(serie.key);
73
+ const entrance = (0, import_useEntranceAnimation.getSerieEntrance)(serie);
74
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
+ "g",
76
+ {
77
+ ...{ [import_useEntranceAnimation.ENTRANCE_ATTRIBUTE]: entrance },
78
+ style: entrance === "grow" ? { transformOrigin } : void 0,
79
+ children: drawn()
80
+ },
81
+ serie.key
82
+ );
83
+ })
84
+ ] }),
85
+ [eases, groups, isHorizontal, setSeriesGroup, transformOrigin, types, virtualizedSeries, withAnimation, y2Axis]
77
86
  );
78
87
  };
79
88
  //# sourceMappingURL=SeriesFactory.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/graphs/Chart/parts/SeriesFactory.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { Line, Points, Bars, StackedBar, Area, HorizontalBars, HorizontalStackedBars } from '../series/index.js';\nimport { getStackedIndex } from '../helpers/index.js';\nimport { useVirtualizedSeries } from '../helpers/useVirtualizedSeries.js';\n\nexport const SeriesFactory = () => {\n const {\n props: { groups, types },\n isHorizontal,\n } = useContext(ChartContext);\n\n const virtualizedSeries = useVirtualizedSeries();\n\n return useMemo(\n () => (\n <g className=\"content\">\n {/* <g className=\"content\"> */}\n {virtualizedSeries.map((serie) => {\n const serieProps = {\n key: serie.key,\n serie,\n };\n if (serie.type === 'bar' && groups && getStackedIndex(groups, serie.name) > -1 && isHorizontal) {\n return <HorizontalStackedBars {...serieProps} />;\n }\n if (serie.type === 'bar' && groups && getStackedIndex(groups, serie.name) > -1) {\n return <StackedBar {...serieProps} />;\n }\n if (serie.type === 'bar' && isHorizontal) {\n return <HorizontalBars {...serieProps} />;\n }\n if (serie.type === 'bar') {\n return <Bars {...serieProps} />;\n }\n if ((types === 'scatter' && !serie.type) || serie.type === 'point') {\n return <Points {...serieProps} />;\n }\n if (serie.type === 'line') {\n return <Line {...serieProps} />;\n }\n if (serie.type === 'area') {\n return <Area {...serieProps} />;\n }\n return null;\n })}\n </g>\n ),\n [groups, isHorizontal, types, virtualizedSeries],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2BJ;AAxBnB,mBAA2C;AAC3C,0BAA6B;AAC7B,oBAA4F;AAC5F,qBAAgC;AAChC,kCAAqC;AAE9B,MAAM,gBAAgB,MAAM;AACjC,QAAM;AAAA,IACJ,OAAO,EAAE,QAAQ,MAAM;AAAA,IACvB;AAAA,EACF,QAAI,yBAAW,gCAAY;AAE3B,QAAM,wBAAoB,kDAAqB;AAE/C,aAAO;AAAA,IACL,MACE,4CAAC,OAAE,WAAU,WAEV,4BAAkB,IAAI,CAAC,UAAU;AAChC,YAAM,aAAa;AAAA,QACjB,KAAK,MAAM;AAAA,QACX;AAAA,MACF;AACA,UAAI,MAAM,SAAS,SAAS,cAAU,gCAAgB,QAAQ,MAAM,IAAI,IAAI,MAAM,cAAc;AAC9F,eAAO,4CAAC,uCAAuB,GAAG,YAAY;AAAA,MAChD;AACA,UAAI,MAAM,SAAS,SAAS,cAAU,gCAAgB,QAAQ,MAAM,IAAI,IAAI,IAAI;AAC9E,eAAO,4CAAC,4BAAY,GAAG,YAAY;AAAA,MACrC;AACA,UAAI,MAAM,SAAS,SAAS,cAAc;AACxC,eAAO,4CAAC,gCAAgB,GAAG,YAAY;AAAA,MACzC;AACA,UAAI,MAAM,SAAS,OAAO;AACxB,eAAO,4CAAC,sBAAM,GAAG,YAAY;AAAA,MAC/B;AACA,UAAK,UAAU,aAAa,CAAC,MAAM,QAAS,MAAM,SAAS,SAAS;AAClE,eAAO,4CAAC,wBAAQ,GAAG,YAAY;AAAA,MACjC;AACA,UAAI,MAAM,SAAS,QAAQ;AACzB,eAAO,4CAAC,sBAAM,GAAG,YAAY;AAAA,MAC/B;AACA,UAAI,MAAM,SAAS,QAAQ;AACzB,eAAO,4CAAC,sBAAM,GAAG,YAAY;AAAA,MAC/B;AACA,aAAO;AAAA,IACT,CAAC,GACH;AAAA,IAEF,CAAC,QAAQ,cAAc,OAAO,iBAAiB;AAAA,EACjD;AACF;",
4
+ "sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { Line, Points, Bars, StackedBar, Area, HorizontalBars, HorizontalStackedBars } from '../series/index.js';\nimport { getStackedIndex } from '../helpers/index.js';\nimport { useVirtualizedSeries } from '../helpers/useVirtualizedSeries.js';\nimport { HoverBand } from './HoverBand.js';\nimport { ZeroLine } from './ZeroLine.js';\nimport { ENTRANCE_ATTRIBUTE, getSerieEntrance, useEntranceAnimation } from '../config/useEntranceAnimation.js';\nimport { VALUE_AXIS_TRANSITION, useValueAxisTransition } from '../config/useValueAxisTransition.js';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\n\ntype SerieComponentT = React.ComponentType<{ serie: DSChartT.InternalSerie }>;\n\nconst getSerieComponent = (\n serie: DSChartT.InternalSerie,\n { groups, types, isHorizontal }: { groups?: string[][]; types?: string; isHorizontal: boolean },\n): SerieComponentT | null => {\n const isStacked = Boolean(groups) && getStackedIndex(groups as string[][], serie.name) > -1;\n if (serie.type === 'bar' && isStacked) return isHorizontal ? HorizontalStackedBars : StackedBar;\n if (serie.type === 'bar') return isHorizontal ? HorizontalBars : Bars;\n if ((types === 'scatter' && !serie.type) || serie.type === 'point') return Points;\n if (serie.type === 'line') return Line;\n if (serie.type === 'area') return Area;\n return null;\n};\n\nexport const SeriesFactory = () => {\n const {\n props: { groups, types, y2Axis },\n isHorizontal,\n } = useContext(ChartContext);\n\n const virtualizedSeries = useVirtualizedSeries();\n const { setSeriesGroup, seriesGroup, withAnimation, transformOrigin } = useEntranceAnimation();\n useValueAxisTransition(seriesGroup);\n // on a vertical chart, the series of each vertical axis, and the zero line, have a group that eases them to a new\n // domain of the axis (see useValueAxisTransition)\n const eases = !isHorizontal;\n\n return useMemo(\n () => (\n <g className=\"content\" ref={setSeriesGroup}>\n <HoverBand />\n {eases ? (\n <g {...{ [VALUE_AXIS_TRANSITION.ATTRIBUTE]: 'y' }}>\n <ZeroLine />\n </g>\n ) : (\n <ZeroLine />\n )}\n {virtualizedSeries.map((serie) => {\n const Serie = getSerieComponent(serie, { groups, types, isHorizontal });\n if (!Serie) return null;\n const valueAxis = serie.scale === 'y2' && y2Axis ? 'y2' : 'y';\n const drawn = (key?: string) =>\n eases ? (\n <g key={key} {...{ [VALUE_AXIS_TRANSITION.ATTRIBUTE]: valueAxis }}>\n <Serie serie={serie} />\n </g>\n ) : (\n <Serie key={key} serie={serie} />\n );\n if (!withAnimation) return drawn(serie.key);\n // with withAnimation, each series has a group that tells how it enters (see useEntranceAnimation)\n const entrance = getSerieEntrance(serie);\n return (\n <g\n key={serie.key}\n {...{ [ENTRANCE_ATTRIBUTE]: entrance }}\n style={entrance === 'grow' ? { transformOrigin } : undefined}\n >\n {drawn()}\n </g>\n );\n })}\n </g>\n ),\n [eases, groups, isHorizontal, setSeriesGroup, transformOrigin, types, virtualizedSeries, withAnimation, y2Axis],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4CjB;AAzCN,mBAA2C;AAC3C,0BAA6B;AAC7B,oBAA4F;AAC5F,qBAAgC;AAChC,kCAAqC;AACrC,uBAA0B;AAC1B,sBAAyB;AACzB,kCAA2E;AAC3E,oCAA8D;AAK9D,MAAM,oBAAoB,CACxB,OACA,EAAE,QAAQ,OAAO,aAAa,MACH;AAC3B,QAAM,YAAY,QAAQ,MAAM,SAAK,gCAAgB,QAAsB,MAAM,IAAI,IAAI;AACzF,MAAI,MAAM,SAAS,SAAS,UAAW,QAAO,eAAe,sCAAwB;AACrF,MAAI,MAAM,SAAS,MAAO,QAAO,eAAe,+BAAiB;AACjE,MAAK,UAAU,aAAa,CAAC,MAAM,QAAS,MAAM,SAAS,QAAS,QAAO;AAC3E,MAAI,MAAM,SAAS,OAAQ,QAAO;AAClC,MAAI,MAAM,SAAS,OAAQ,QAAO;AAClC,SAAO;AACT;AAEO,MAAM,gBAAgB,MAAM;AACjC,QAAM;AAAA,IACJ,OAAO,EAAE,QAAQ,OAAO,OAAO;AAAA,IAC/B;AAAA,EACF,QAAI,yBAAW,gCAAY;AAE3B,QAAM,wBAAoB,kDAAqB;AAC/C,QAAM,EAAE,gBAAgB,aAAa,eAAe,gBAAgB,QAAI,kDAAqB;AAC7F,4DAAuB,WAAW;AAGlC,QAAM,QAAQ,CAAC;AAEf,aAAO;AAAA,IACL,MACE,6CAAC,OAAE,WAAU,WAAU,KAAK,gBAC1B;AAAA,kDAAC,8BAAU;AAAA,MACV,QACC,4CAAC,OAAG,GAAG,EAAE,CAAC,oDAAsB,SAAS,GAAG,IAAI,GAC9C,sDAAC,4BAAS,GACZ,IAEA,4CAAC,4BAAS;AAAA,MAEX,kBAAkB,IAAI,CAAC,UAAU;AAChC,cAAM,QAAQ,kBAAkB,OAAO,EAAE,QAAQ,OAAO,aAAa,CAAC;AACtE,YAAI,CAAC,MAAO,QAAO;AACnB,cAAM,YAAY,MAAM,UAAU,QAAQ,SAAS,OAAO;AAC1D,cAAM,QAAQ,CAAC,QACb,QACE,4CAAC,OAAa,GAAG,EAAE,CAAC,oDAAsB,SAAS,GAAG,UAAU,GAC9D,sDAAC,SAAM,OAAc,KADf,GAER,IAEA,4CAAC,SAAgB,SAAL,GAAmB;AAEnC,YAAI,CAAC,cAAe,QAAO,MAAM,MAAM,GAAG;AAE1C,cAAM,eAAW,8CAAiB,KAAK;AACvC,eACE;AAAA,UAAC;AAAA;AAAA,YAEE,GAAG,EAAE,CAAC,8CAAkB,GAAG,SAAS;AAAA,YACrC,OAAO,aAAa,SAAS,EAAE,gBAAgB,IAAI;AAAA,YAElD,gBAAM;AAAA;AAAA,UAJF,MAAM;AAAA,QAKb;AAAA,MAEJ,CAAC;AAAA,OACH;AAAA,IAEF,CAAC,OAAO,QAAQ,cAAc,gBAAgB,iBAAiB,OAAO,mBAAmB,eAAe,MAAM;AAAA,EAChH;AACF;",
6
6
  "names": []
7
7
  }
@@ -34,26 +34,64 @@ module.exports = __toCommonJS(TrendHighlight_exports);
34
34
  var React = __toESM(require("react"));
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = require("react");
37
+ var import_ds_system = require("@elliemae/ds-system");
37
38
  var import_ChartContext = require("../ChartContext.js");
38
- const TrendHighlight = ({ currentDatum }) => {
39
- const { currentData, getXScaleValue, getY2ScaleValue, getYScaleValue } = (0, import_react.useContext)(import_ChartContext.ChartContext);
40
- const prevPoint = currentData?.find((serie) => serie.name === currentDatum.serie && serie.type === "line")?.data?.find((datum) => datum.position === currentDatum.position - 1);
41
- const currentYScale = prevPoint?.scale === "y2" ? getY2ScaleValue : getYScaleValue;
42
- if (!prevPoint) return null;
43
- const xCurrentPosition = getXScaleValue(currentDatum);
44
- const yCurrentPosition = currentYScale(currentDatum);
45
- const xPreviousPosition = getXScaleValue(prevPoint);
46
- const yPreviousPosition = currentYScale(prevPoint);
47
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48
- "line",
49
- {
50
- strokeWidth: "4",
51
- stroke: (yPreviousPosition ?? 0) > (yCurrentPosition ?? 0) ? "green" : "red",
52
- x1: xPreviousPosition,
53
- x2: xCurrentPosition,
54
- y1: yPreviousPosition,
55
- y2: yCurrentPosition
39
+ var import_chartInteractionStore = require("../config/chartInteractionStore.js");
40
+ var import_trend = require("../helpers/trend.js");
41
+ var import_constants = require("../../constants.js");
42
+ const TREND_STROKE_WIDTH = 3;
43
+ const TrendHighlight = ({ serie, linePath }) => {
44
+ const {
45
+ props: { withTrendHighlight, scrapper },
46
+ getXScaleValue,
47
+ getYValue,
48
+ innerHeight,
49
+ chartId
50
+ } = (0, import_react.useContext)(import_ChartContext.ChartContext);
51
+ const theme = (0, import_react.useContext)(import_ds_system.ThemeContext);
52
+ const focusedIndex = (0, import_chartInteractionStore.useChartInteraction)((state) => {
53
+ if (!withTrendHighlight) return -1;
54
+ if (state.activePoint?.serie === serie.name) {
55
+ return serie.data.findIndex((datum) => datum.key === state.activePoint?.key);
56
56
  }
57
- );
57
+ if (scrapper?.type !== import_constants.SCRAPPER.TYPE_VERTICAL) return -1;
58
+ const scrapperX = state.activePoint ? getXScaleValue(state.activePoint) : (0, import_chartInteractionStore.getPointerScrapperPosX)(state);
59
+ return serie.data.findIndex((datum) => getXScaleValue(datum) === scrapperX);
60
+ });
61
+ if (focusedIndex < 1 || !linePath) return null;
62
+ const previous = serie.data[focusedIndex - 1];
63
+ const current = serie.data[focusedIndex];
64
+ const trend = (0, import_trend.getTrend)(getYValue(previous), getYValue(current), serie.higherIsBetter);
65
+ const colors = {
66
+ good: theme?.colors?.success?.["900"] ?? "#207E56",
67
+ bad: theme?.colors?.danger?.["900"] ?? "#C64252",
68
+ flat: theme?.colors?.neutral?.["500"] ?? "#697489"
69
+ };
70
+ const previousX = getXScaleValue(previous) ?? 0;
71
+ const currentX = getXScaleValue(current) ?? 0;
72
+ const clipId = `trend-highlight-${chartId}-${serie.key.replace(/[^\w-]/g, "_")}`;
73
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { className: "trend-highlight", "data-trend": trend, children: [
74
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
+ "rect",
76
+ {
77
+ x: Math.min(previousX, currentX) - TREND_STROKE_WIDTH / 2,
78
+ y: -TREND_STROKE_WIDTH,
79
+ width: Math.abs(currentX - previousX) + TREND_STROKE_WIDTH,
80
+ height: innerHeight + TREND_STROKE_WIDTH * 2
81
+ }
82
+ ) }) }),
83
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
+ "path",
85
+ {
86
+ d: linePath,
87
+ clipPath: `url(#${clipId})`,
88
+ fill: "none",
89
+ stroke: colors[trend],
90
+ strokeWidth: TREND_STROKE_WIDTH,
91
+ strokeLinecap: "round",
92
+ strokeLinejoin: "round"
93
+ }
94
+ )
95
+ ] });
58
96
  };
59
97
  //# sourceMappingURL=TrendHighlight.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/graphs/Chart/parts/TrendHighlight.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useContext } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { type DSChartT } from '../react-desc-prop-types.js';\ninterface TrendHighlightProps {\n currentDatum: DSChartT.InternalDatum;\n}\n\nexport const TrendHighlight: React.ComponentType<TrendHighlightProps> = ({ currentDatum }) => {\n const { currentData, getXScaleValue, getY2ScaleValue, getYScaleValue } = useContext(ChartContext);\n\n const prevPoint = currentData\n ?.find((serie) => serie.name === currentDatum.serie && serie.type === 'line')\n ?.data?.find((datum) => datum.position === currentDatum.position - 1);\n\n const currentYScale = prevPoint?.scale === 'y2' ? getY2ScaleValue : getYScaleValue;\n if (!prevPoint) return null;\n const xCurrentPosition = getXScaleValue(currentDatum);\n const yCurrentPosition = currentYScale(currentDatum);\n const xPreviousPosition = getXScaleValue(prevPoint);\n const yPreviousPosition = currentYScale(prevPoint);\n return (\n <line\n strokeWidth=\"4\"\n stroke={(yPreviousPosition ?? 0) > (yCurrentPosition ?? 0) ? 'green' : 'red'}\n x1={xPreviousPosition}\n x2={xCurrentPosition}\n y1={yPreviousPosition}\n y2={yCurrentPosition}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqBnB;AArBJ,mBAAkC;AAClC,0BAA6B;AAMtB,MAAM,iBAA2D,CAAC,EAAE,aAAa,MAAM;AAC5F,QAAM,EAAE,aAAa,gBAAgB,iBAAiB,eAAe,QAAI,yBAAW,gCAAY;AAEhG,QAAM,YAAY,aACd,KAAK,CAAC,UAAU,MAAM,SAAS,aAAa,SAAS,MAAM,SAAS,MAAM,GAC1E,MAAM,KAAK,CAAC,UAAU,MAAM,aAAa,aAAa,WAAW,CAAC;AAEtE,QAAM,gBAAgB,WAAW,UAAU,OAAO,kBAAkB;AACpE,MAAI,CAAC,UAAW,QAAO;AACvB,QAAM,mBAAmB,eAAe,YAAY;AACpD,QAAM,mBAAmB,cAAc,YAAY;AACnD,QAAM,oBAAoB,eAAe,SAAS;AAClD,QAAM,oBAAoB,cAAc,SAAS;AACjD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAY;AAAA,MACZ,SAAS,qBAAqB,MAAM,oBAAoB,KAAK,UAAU;AAAA,MACvE,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA;AAAA,EACN;AAEJ;",
4
+ "sourcesContent": ["import React, { useContext } from 'react';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../ChartContext.js';\nimport { getPointerScrapperPosX, useChartInteraction } from '../config/chartInteractionStore.js';\nimport { getTrend, type TrendT } from '../helpers/trend.js';\nimport { SCRAPPER } from '../../constants.js';\nimport { type DSChartT } from '../../../react-desc-prop-types.js';\n\ninterface TrendHighlightProps {\n serie: DSChartT.InternalSerie;\n // the path of the line of the series, which the highlight follows\n linePath: string | null;\n}\n\nconst TREND_STROKE_WIDTH = 3;\n\n// With withTrendHighlight, the stretch of a line (or of the top of an area) that leads to its focused point, from the\n// previous point the line joins, is drawn over in the color of its trend: success when it goes the good way, danger\n// when it goes the bad way, neutral when the value does not change. The focused point is the active point of the\n// keyboard or of the pointer, or the point under the vertical scrapper. The stretch is the line itself, clipped between\n// the two points, so it follows a spline as well, and it is drawn under the markers.\nexport const TrendHighlight: React.ComponentType<TrendHighlightProps> = ({ serie, linePath }) => {\n const {\n props: { withTrendHighlight, scrapper },\n getXScaleValue,\n getYValue,\n innerHeight,\n chartId,\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n\n // the index of the focused point in the series, -1 when it has none\n const focusedIndex = useChartInteraction((state) => {\n if (!withTrendHighlight) return -1;\n if (state.activePoint?.serie === serie.name) {\n return serie.data.findIndex((datum) => datum.key === state.activePoint?.key);\n }\n if (scrapper?.type !== SCRAPPER.TYPE_VERTICAL) return -1;\n const scrapperX = state.activePoint ? getXScaleValue(state.activePoint) : getPointerScrapperPosX(state);\n return serie.data.findIndex((datum) => getXScaleValue(datum) === scrapperX);\n });\n\n // the first point has no stretch before it; the data has no gaps, as the line joins the points around a missing value\n if (focusedIndex < 1 || !linePath) return null;\n const previous = serie.data[focusedIndex - 1];\n const current = serie.data[focusedIndex];\n const trend = getTrend(getYValue(previous) as number, getYValue(current) as number, serie.higherIsBetter);\n const colors: Record<TrendT, string> = {\n good: theme?.colors?.success?.['900'] ?? '#207E56',\n bad: theme?.colors?.danger?.['900'] ?? '#C64252',\n flat: theme?.colors?.neutral?.['500'] ?? '#697489',\n };\n\n const previousX = getXScaleValue(previous) ?? 0;\n const currentX = getXScaleValue(current) ?? 0;\n const clipId = `trend-highlight-${chartId}-${serie.key.replace(/[^\\w-]/g, '_')}`;\n return (\n <g className=\"trend-highlight\" data-trend={trend}>\n <defs>\n <clipPath id={clipId}>\n {/* the round caps of the stroke reach a bit past each point */}\n <rect\n x={Math.min(previousX, currentX) - TREND_STROKE_WIDTH / 2}\n y={-TREND_STROKE_WIDTH}\n width={Math.abs(currentX - previousX) + TREND_STROKE_WIDTH}\n height={innerHeight + TREND_STROKE_WIDTH * 2}\n />\n </clipPath>\n </defs>\n <path\n d={linePath}\n clipPath={`url(#${clipId})`}\n fill=\"none\"\n stroke={colors[trend]}\n strokeWidth={TREND_STROKE_WIDTH}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADyDnB;AAzDJ,mBAAkC;AAClC,uBAA6B;AAC7B,0BAA6B;AAC7B,mCAA4D;AAC5D,mBAAsC;AACtC,uBAAyB;AASzB,MAAM,qBAAqB;AAOpB,MAAM,iBAA2D,CAAC,EAAE,OAAO,SAAS,MAAM;AAC/F,QAAM;AAAA,IACJ,OAAO,EAAE,oBAAoB,SAAS;AAAA,IACtC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAC3B,QAAM,YAAQ,yBAAW,6BAAY;AAGrC,QAAM,mBAAe,kDAAoB,CAAC,UAAU;AAClD,QAAI,CAAC,mBAAoB,QAAO;AAChC,QAAI,MAAM,aAAa,UAAU,MAAM,MAAM;AAC3C,aAAO,MAAM,KAAK,UAAU,CAAC,UAAU,MAAM,QAAQ,MAAM,aAAa,GAAG;AAAA,IAC7E;AACA,QAAI,UAAU,SAAS,0BAAS,cAAe,QAAO;AACtD,UAAM,YAAY,MAAM,cAAc,eAAe,MAAM,WAAW,QAAI,qDAAuB,KAAK;AACtG,WAAO,MAAM,KAAK,UAAU,CAAC,UAAU,eAAe,KAAK,MAAM,SAAS;AAAA,EAC5E,CAAC;AAGD,MAAI,eAAe,KAAK,CAAC,SAAU,QAAO;AAC1C,QAAM,WAAW,MAAM,KAAK,eAAe,CAAC;AAC5C,QAAM,UAAU,MAAM,KAAK,YAAY;AACvC,QAAM,YAAQ,uBAAS,UAAU,QAAQ,GAAa,UAAU,OAAO,GAAa,MAAM,cAAc;AACxG,QAAM,SAAiC;AAAA,IACrC,MAAM,OAAO,QAAQ,UAAU,KAAK,KAAK;AAAA,IACzC,KAAK,OAAO,QAAQ,SAAS,KAAK,KAAK;AAAA,IACvC,MAAM,OAAO,QAAQ,UAAU,KAAK,KAAK;AAAA,EAC3C;AAEA,QAAM,YAAY,eAAe,QAAQ,KAAK;AAC9C,QAAM,WAAW,eAAe,OAAO,KAAK;AAC5C,QAAM,SAAS,mBAAmB,OAAO,IAAI,MAAM,IAAI,QAAQ,WAAW,GAAG,CAAC;AAC9E,SACE,6CAAC,OAAE,WAAU,mBAAkB,cAAY,OACzC;AAAA,gDAAC,UACC,sDAAC,cAAS,IAAI,QAEZ;AAAA,MAAC;AAAA;AAAA,QACC,GAAG,KAAK,IAAI,WAAW,QAAQ,IAAI,qBAAqB;AAAA,QACxD,GAAG,CAAC;AAAA,QACJ,OAAO,KAAK,IAAI,WAAW,SAAS,IAAI;AAAA,QACxC,QAAQ,cAAc,qBAAqB;AAAA;AAAA,IAC7C,GACF,GACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,GAAG;AAAA,QACH,UAAU,QAAQ,MAAM;AAAA,QACxB,MAAK;AAAA,QACL,QAAQ,OAAO,KAAK;AAAA,QACpB,aAAa;AAAA,QACb,eAAc;AAAA,QACd,gBAAe;AAAA;AAAA,IACjB;AAAA,KACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var ZeroLine_exports = {};
30
+ __export(ZeroLine_exports, {
31
+ ZeroLine: () => ZeroLine
32
+ });
33
+ module.exports = __toCommonJS(ZeroLine_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = require("react");
37
+ var import_ds_system = require("@elliemae/ds-system");
38
+ var import_ChartContext = require("../ChartContext.js");
39
+ var import_zeroLine = require("../helpers/zeroLine.js");
40
+ const ZeroLine = () => {
41
+ const {
42
+ xScale,
43
+ yScale,
44
+ innerWidth,
45
+ innerHeight,
46
+ containerRatio,
47
+ props: { xScroll, yScroll }
48
+ } = (0, import_react.useContext)(import_ChartContext.ChartContext);
49
+ const theme = (0, import_react.useContext)(import_ds_system.ThemeContext);
50
+ const yZero = (0, import_zeroLine.getZeroLinePosition)(yScale);
51
+ const xZero = (0, import_zeroLine.getZeroLinePosition)(xScale);
52
+ if (yZero === null && xZero === null) return null;
53
+ const width = innerWidth * (xScroll ? containerRatio : 1);
54
+ const height = innerHeight * (yScroll ? containerRatio : 1);
55
+ const lineProps = {
56
+ stroke: theme?.colors?.neutral?.["500"] ?? "#697489",
57
+ strokeWidth: 1,
58
+ shapeRendering: "crispEdges",
59
+ pointerEvents: "none"
60
+ };
61
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { className: "zero-line", children: [
62
+ yZero !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: 0, x2: width, y1: yZero, y2: yZero, ...lineProps }) : null,
63
+ xZero !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: xZero, x2: xZero, y1: 0, y2: height, ...lineProps }) : null
64
+ ] });
65
+ };
66
+ //# sourceMappingURL=ZeroLine.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/graphs/Chart/parts/ZeroLine.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React, { useContext } from 'react';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../ChartContext.js';\nimport { getZeroLinePosition } from '../helpers/zeroLine.js';\n\n// The zero of the axes that go below it (see getZeroLinePosition): a hairline across the plot, stronger than the grid\n// and than the domain line of the axis, drawn under the series. A horizontal line for the vertical axis, a vertical one\n// for the horizontal axis, so a scatter plot with negative values on both axes shows its four quadrants. It spans the\n// whole content of a scrollable chart, as it scrolls with the series.\nexport const ZeroLine = () => {\n const {\n xScale,\n yScale,\n innerWidth,\n innerHeight,\n containerRatio,\n props: { xScroll, yScroll },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n\n const yZero = getZeroLinePosition(yScale);\n const xZero = getZeroLinePosition(xScale);\n if (yZero === null && xZero === null) return null;\n\n const width = innerWidth * (xScroll ? containerRatio : 1);\n const height = innerHeight * (yScroll ? containerRatio : 1);\n const lineProps = {\n stroke: theme?.colors?.neutral?.['500'] ?? '#697489',\n strokeWidth: 1,\n shapeRendering: 'crispEdges',\n pointerEvents: 'none',\n } as const;\n\n return (\n <g className=\"zero-line\">\n {yZero !== null ? <line x1={0} x2={width} y1={yZero} y2={yZero} {...lineProps} /> : null}\n {xZero !== null ? <line x1={xZero} x2={xZero} y1={0} y2={height} {...lineProps} /> : null}\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkCnB;AAlCJ,mBAAkC;AAClC,uBAA6B;AAC7B,0BAA6B;AAC7B,sBAAoC;AAM7B,MAAM,WAAW,MAAM;AAC5B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,SAAS,QAAQ;AAAA,EAC5B,QAAI,yBAAW,gCAAY;AAC3B,QAAM,YAAQ,yBAAW,6BAAY;AAErC,QAAM,YAAQ,qCAAoB,MAAM;AACxC,QAAM,YAAQ,qCAAoB,MAAM;AACxC,MAAI,UAAU,QAAQ,UAAU,KAAM,QAAO;AAE7C,QAAM,QAAQ,cAAc,UAAU,iBAAiB;AACvD,QAAM,SAAS,eAAe,UAAU,iBAAiB;AACzD,QAAM,YAAY;AAAA,IAChB,QAAQ,OAAO,QAAQ,UAAU,KAAK,KAAK;AAAA,IAC3C,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,eAAe;AAAA,EACjB;AAEA,SACE,6CAAC,OAAE,WAAU,aACV;AAAA,cAAU,OAAO,4CAAC,UAAK,IAAI,GAAG,IAAI,OAAO,IAAI,OAAO,IAAI,OAAQ,GAAG,WAAW,IAAK;AAAA,IACnF,UAAU,OAAO,4CAAC,UAAK,IAAI,OAAO,IAAI,OAAO,IAAI,GAAG,IAAI,QAAS,GAAG,WAAW,IAAK;AAAA,KACvF;AAEJ;",
6
+ "names": []
7
+ }
@@ -38,26 +38,15 @@ __export(scales_exports, {
38
38
  module.exports = __toCommonJS(scales_exports);
39
39
  var React = __toESM(require("react"));
40
40
  var import_d3 = require("d3");
41
+ var import_constants = require("../../constants.js");
42
+ var import_timeTicks = require("../helpers/timeTicks.js");
41
43
  const AXIS_TYPE = {
42
44
  BAND: "BAND",
43
45
  LINEAR: "LINEAR",
44
46
  DATETIME: "DATETIME",
45
47
  LOG: "LOG"
46
48
  };
47
- const getInterval = (interval) => {
48
- switch (interval) {
49
- case "DAY":
50
- return import_d3.utcDay;
51
- case "MONTH":
52
- return import_d3.utcMonth;
53
- case "WEEK":
54
- return import_d3.utcWeek;
55
- case "YEAR":
56
- return import_d3.utcYear;
57
- default:
58
- return null;
59
- }
60
- };
49
+ const getInterval = (interval) => interval && interval in import_constants.TIME_INTERVALS ? import_constants.TIME_INTERVALS[interval] : null;
61
50
  class Scale {
62
51
  scale;
63
52
  type;
@@ -99,16 +88,23 @@ class BandScale extends Scale {
99
88
  getBandwidth() {
100
89
  return this.scale.bandwidth();
101
90
  }
91
+ // the distance from the start of a band to the start of the next one: the band and the padding after it
92
+ getStep() {
93
+ return this.scale.step();
94
+ }
102
95
  }
103
96
  class LinearScale extends Scale {
104
97
  type;
105
98
  scale;
106
99
  axisProps;
107
- constructor(scale, axisProps) {
100
+ // the ticks of an axis aligned with another one (see getAlignedTicks), instead of the ones of its own count
101
+ alignedTicks;
102
+ constructor(scale, axisProps, alignedTicks = null) {
108
103
  super(scale);
109
104
  this.scale = scale;
110
105
  this.type = "LINEAR";
111
106
  this.axisProps = axisProps;
107
+ this.alignedTicks = alignedTicks;
112
108
  }
113
109
  get(value) {
114
110
  if (typeof value !== "number") return 0;
@@ -124,8 +120,15 @@ class LinearScale extends Scale {
124
120
  }
125
121
  return t.toString();
126
122
  }
123
+ getTickCount(dimension) {
124
+ return this.axisProps?.tick?.tickCount ?? Math.ceil(dimension / 80);
125
+ }
127
126
  getTicks(dimension) {
128
- const ticks = this.scale.ticks?.(this.axisProps?.tick?.tickCount ?? Math.ceil(dimension / 80));
127
+ if (this.alignedTicks) return this.withTickValues([...this.alignedTicks]);
128
+ return this.withTickValues(this.scale.ticks?.(this.getTickCount(dimension)));
129
+ }
130
+ // the ticks given through tick.tickValues: instead of the computed ones with overwriteTicks, added to them otherwise
131
+ withTickValues(ticks) {
129
132
  if (this.axisProps?.tick?.tickValues) {
130
133
  if (this.axisProps?.tick?.overwriteTicks) return this.axisProps?.tick?.tickValues;
131
134
  this.axisProps?.tick?.tickValues.forEach((t) => {
@@ -142,6 +145,7 @@ class LinearScale extends Scale {
142
145
  return ticks.map((t) => typeof t === "number" ? this.get(t) : 0);
143
146
  }
144
147
  }
148
+ const LOG_TICK_DIGITS = [[1], [1, 2, 5], [1, 2, 3, 4, 5, 6, 7, 8, 9]];
145
149
  class LogScale extends LinearScale {
146
150
  type;
147
151
  scale;
@@ -152,6 +156,18 @@ class LogScale extends LinearScale {
152
156
  this.type = "LOG";
153
157
  this.axisProps = axisProps;
154
158
  }
159
+ // When the domain spans few powers of ten, d3 places a tick on every 1 to 9 of each one, and on a regular axis their
160
+ // labels overlap. Of those ticks, the axis keeps the densest set that fits its tick count: the powers of ten, then 1,
161
+ // 2 and 5 of each power, then all of them. A domain that holds no power of ten keeps 1, 2 and 5 of its own.
162
+ getTicks(dimension) {
163
+ const count = Math.max(1, this.getTickCount(dimension));
164
+ const candidates = this.scale.ticks();
165
+ const leadingDigit = (tick) => Math.round(Math.abs(tick) / 10 ** Math.floor(Math.log10(Math.abs(tick))));
166
+ const tickSets = LOG_TICK_DIGITS.map((digits) => candidates.filter((tick) => digits.includes(leadingDigit(tick))));
167
+ const fitting = tickSets.filter((ticks2) => ticks2.length > 0 && ticks2.length <= count);
168
+ const ticks = fitting[fitting.length - 1] ?? tickSets.find((set) => set.length > 0) ?? candidates;
169
+ return this.withTickValues([...ticks]);
170
+ }
155
171
  getTickFormatted(t) {
156
172
  if (typeof t !== "number") return t.toString();
157
173
  if (typeof this.axisProps?.tick?.tickFormat === "function") {
@@ -167,11 +183,14 @@ class TimeLinearScale extends Scale {
167
183
  type;
168
184
  scale;
169
185
  axisProps;
170
- constructor(scale, axisProps) {
186
+ // the smallest step between the dates of the axis, in milliseconds (see getMinTimeStep), 0 when unknown
187
+ minTimeStep;
188
+ constructor(scale, axisProps, minTimeStep = 0) {
171
189
  super(scale);
172
190
  this.scale = scale;
173
191
  this.type = "DATETIME";
174
192
  this.axisProps = axisProps;
193
+ this.minTimeStep = minTimeStep;
175
194
  }
176
195
  get(value) {
177
196
  if (typeof value !== "object") return 0;
@@ -183,13 +202,24 @@ class TimeLinearScale extends Scale {
183
202
  return this.axisProps?.tick?.tickFormat(t);
184
203
  }
185
204
  if (typeof this.axisProps?.tick?.tickFormat === "string") {
186
- return (0, import_d3.timeFormat)(this.axisProps?.tick?.tickFormat)(t);
205
+ return (0, import_d3.utcFormat)(this.axisProps?.tick?.tickFormat)(t);
187
206
  }
188
- return t.toString();
207
+ return (0, import_timeTicks.formatTimeTick)(t);
208
+ }
209
+ // Without intervalType, a tick about every 80px of the plot: the plot grows with the zoom, so zooming in turns the
210
+ // ticks from months to weeks, days and hours. They are never closer than the dates of the data, so a daily series
211
+ // gets no ticks on the hours between its days; a tickCount the consumer sets is kept as it is.
212
+ getTickCount(dimension) {
213
+ const { tickCount } = this.axisProps?.tick ?? {};
214
+ if (tickCount !== void 0) return tickCount;
215
+ const count = Math.ceil(dimension / 80);
216
+ const [start, end] = this.scale.domain();
217
+ if (!this.minTimeStep || !start || !end) return count;
218
+ return Math.max(1, Math.min(count, Math.floor((+end - +start) / this.minTimeStep)));
189
219
  }
190
220
  getTicks(dimension, intervalType) {
191
221
  const interval = getInterval(intervalType);
192
- const finalTickConfig = interval || (this.axisProps?.tick?.tickCount ?? Math.ceil(dimension / 80));
222
+ const finalTickConfig = interval || this.getTickCount(dimension);
193
223
  const ticks = this.scale.ticks?.(finalTickConfig);
194
224
  const ticksValues = this.axisProps?.tick?.tickValues;
195
225
  if (ticksValues) {