react-native-chart-kit 7.0.0-next.1 → 7.0.0-next.3

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 (427) hide show
  1. package/README.md +89 -521
  2. package/dist/charts/line/LineChart.d.ts +3 -3
  3. package/dist/charts/line/LineChart.js +1 -1
  4. package/dist/v2/core/data/index.d.ts +3 -0
  5. package/dist/v2/core/data/index.d.ts.map +1 -0
  6. package/dist/v2/core/data/index.js +1 -0
  7. package/dist/v2/core/data/normalize.d.ts +8 -0
  8. package/dist/v2/core/data/normalize.d.ts.map +1 -0
  9. package/dist/v2/core/data/normalize.js +229 -0
  10. package/dist/v2/core/data/normalizeValues.d.ts +16 -0
  11. package/dist/v2/core/data/normalizeValues.d.ts.map +1 -0
  12. package/dist/v2/core/data/normalizeValues.js +96 -0
  13. package/dist/v2/core/data/types.d.ts +161 -0
  14. package/dist/v2/core/data/types.d.ts.map +1 -0
  15. package/dist/v2/core/data/types.js +1 -0
  16. package/dist/v2/core/geometry/areaPath.d.ts +3 -0
  17. package/dist/v2/core/geometry/areaPath.d.ts.map +1 -0
  18. package/dist/v2/core/geometry/areaPath.js +36 -0
  19. package/dist/v2/core/geometry/barRects.d.ts +44 -0
  20. package/dist/v2/core/geometry/barRects.d.ts.map +1 -0
  21. package/dist/v2/core/geometry/barRects.js +201 -0
  22. package/dist/v2/core/geometry/contributionHeatmap.d.ts +49 -0
  23. package/dist/v2/core/geometry/contributionHeatmap.d.ts.map +1 -0
  24. package/dist/v2/core/geometry/contributionHeatmap.js +107 -0
  25. package/dist/v2/core/geometry/horizontalBarRects.d.ts +27 -0
  26. package/dist/v2/core/geometry/horizontalBarRects.d.ts.map +1 -0
  27. package/dist/v2/core/geometry/horizontalBarRects.js +202 -0
  28. package/dist/v2/core/geometry/index.d.ts +12 -0
  29. package/dist/v2/core/geometry/index.d.ts.map +1 -0
  30. package/dist/v2/core/geometry/index.js +11 -0
  31. package/dist/v2/core/geometry/lineDecimation.d.ts +8 -0
  32. package/dist/v2/core/geometry/lineDecimation.d.ts.map +1 -0
  33. package/dist/v2/core/geometry/lineDecimation.js +110 -0
  34. package/dist/v2/core/geometry/linePath.d.ts +5 -0
  35. package/dist/v2/core/geometry/linePath.d.ts.map +1 -0
  36. package/dist/v2/core/geometry/linePath.js +98 -0
  37. package/dist/v2/core/geometry/lineSeries.d.ts +29 -0
  38. package/dist/v2/core/geometry/lineSeries.d.ts.map +1 -0
  39. package/dist/v2/core/geometry/lineSeries.js +51 -0
  40. package/dist/v2/core/geometry/path.d.ts +6 -0
  41. package/dist/v2/core/geometry/path.d.ts.map +1 -0
  42. package/dist/v2/core/geometry/path.js +24 -0
  43. package/dist/v2/core/geometry/pieArcs.d.ts +29 -0
  44. package/dist/v2/core/geometry/pieArcs.d.ts.map +1 -0
  45. package/dist/v2/core/geometry/pieArcs.js +142 -0
  46. package/dist/v2/core/geometry/progressRings.d.ts +30 -0
  47. package/dist/v2/core/geometry/progressRings.d.ts.map +1 -0
  48. package/dist/v2/core/geometry/progressRings.js +104 -0
  49. package/dist/v2/core/geometry/types.d.ts +32 -0
  50. package/dist/v2/core/geometry/types.d.ts.map +1 -0
  51. package/dist/v2/core/geometry/types.js +1 -0
  52. package/dist/v2/core/index.d.ts +6 -0
  53. package/dist/v2/core/index.d.ts.map +1 -0
  54. package/dist/v2/core/index.js +6 -0
  55. package/dist/v2/core/interaction/index.d.ts +5 -0
  56. package/dist/v2/core/interaction/index.d.ts.map +1 -0
  57. package/dist/v2/core/interaction/index.js +2 -0
  58. package/dist/v2/core/interaction/viewport.d.ts +71 -0
  59. package/dist/v2/core/interaction/viewport.d.ts.map +1 -0
  60. package/dist/v2/core/interaction/viewport.js +216 -0
  61. package/dist/v2/core/interaction/viewportTransform.d.ts +17 -0
  62. package/dist/v2/core/interaction/viewportTransform.d.ts.map +1 -0
  63. package/dist/v2/core/interaction/viewportTransform.js +70 -0
  64. package/dist/v2/core/layout/autoPadding.d.ts +3 -0
  65. package/dist/v2/core/layout/autoPadding.d.ts.map +1 -0
  66. package/dist/v2/core/layout/autoPadding.js +33 -0
  67. package/dist/v2/core/layout/chartBox.d.ts +5 -0
  68. package/dist/v2/core/layout/chartBox.d.ts.map +1 -0
  69. package/dist/v2/core/layout/chartBox.js +22 -0
  70. package/dist/v2/core/layout/debugLayout.d.ts +3 -0
  71. package/dist/v2/core/layout/debugLayout.d.ts.map +1 -0
  72. package/dist/v2/core/layout/debugLayout.js +20 -0
  73. package/dist/v2/core/layout/index.d.ts +8 -0
  74. package/dist/v2/core/layout/index.d.ts.map +1 -0
  75. package/dist/v2/core/layout/index.js +6 -0
  76. package/dist/v2/core/layout/labelCollision.d.ts +3 -0
  77. package/dist/v2/core/layout/labelCollision.d.ts.map +1 -0
  78. package/dist/v2/core/layout/labelCollision.js +90 -0
  79. package/dist/v2/core/layout/legendLayout.d.ts +3 -0
  80. package/dist/v2/core/layout/legendLayout.d.ts.map +1 -0
  81. package/dist/v2/core/layout/legendLayout.js +39 -0
  82. package/dist/v2/core/layout/tooltipPlacement.d.ts +3 -0
  83. package/dist/v2/core/layout/tooltipPlacement.d.ts.map +1 -0
  84. package/dist/v2/core/layout/tooltipPlacement.js +76 -0
  85. package/dist/v2/core/layout/types.d.ts +114 -0
  86. package/dist/v2/core/layout/types.d.ts.map +1 -0
  87. package/dist/v2/core/layout/types.js +1 -0
  88. package/dist/v2/core/scales/band.d.ts +15 -0
  89. package/dist/v2/core/scales/band.d.ts.map +1 -0
  90. package/dist/v2/core/scales/band.js +34 -0
  91. package/dist/v2/core/scales/domain.d.ts +6 -0
  92. package/dist/v2/core/scales/domain.d.ts.map +1 -0
  93. package/dist/v2/core/scales/domain.js +109 -0
  94. package/dist/v2/core/scales/index.d.ts +7 -0
  95. package/dist/v2/core/scales/index.d.ts.map +1 -0
  96. package/dist/v2/core/scales/index.js +5 -0
  97. package/dist/v2/core/scales/linear.d.ts +8 -0
  98. package/dist/v2/core/scales/linear.d.ts.map +1 -0
  99. package/dist/v2/core/scales/linear.js +22 -0
  100. package/dist/v2/core/scales/ticks.d.ts +4 -0
  101. package/dist/v2/core/scales/ticks.d.ts.map +1 -0
  102. package/dist/v2/core/scales/ticks.js +111 -0
  103. package/dist/v2/core/scales/time.d.ts +8 -0
  104. package/dist/v2/core/scales/time.d.ts.map +1 -0
  105. package/dist/v2/core/scales/time.js +23 -0
  106. package/dist/v2/core/scales/types.d.ts +46 -0
  107. package/dist/v2/core/scales/types.d.ts.map +1 -0
  108. package/dist/v2/core/scales/types.js +1 -0
  109. package/dist/v2/index.d.ts +1 -0
  110. package/dist/v2/index.js +1 -0
  111. package/dist/v2/react-native/charts/bar/BarChart.d.ts +6 -0
  112. package/dist/v2/react-native/charts/bar/BarChart.d.ts.map +1 -0
  113. package/dist/v2/react-native/charts/bar/BarChart.js +199 -0
  114. package/dist/v2/react-native/charts/bar/BarChartSurface.d.ts +36 -0
  115. package/dist/v2/react-native/charts/bar/BarChartSurface.d.ts.map +1 -0
  116. package/dist/v2/react-native/charts/bar/BarChartSurface.js +134 -0
  117. package/dist/v2/react-native/charts/bar/StackedBarChart.d.ts +4 -0
  118. package/dist/v2/react-native/charts/bar/StackedBarChart.d.ts.map +1 -0
  119. package/dist/v2/react-native/charts/bar/StackedBarChart.js +9 -0
  120. package/dist/v2/react-native/charts/bar/accessibility.d.ts +31 -0
  121. package/dist/v2/react-native/charts/bar/accessibility.d.ts.map +1 -0
  122. package/dist/v2/react-native/charts/bar/accessibility.js +87 -0
  123. package/dist/v2/react-native/charts/bar/interaction.d.ts +18 -0
  124. package/dist/v2/react-native/charts/bar/interaction.d.ts.map +1 -0
  125. package/dist/v2/react-native/charts/bar/interaction.js +62 -0
  126. package/dist/v2/react-native/charts/bar/model.d.ts +3 -0
  127. package/dist/v2/react-native/charts/bar/model.d.ts.map +1 -0
  128. package/dist/v2/react-native/charts/bar/model.js +326 -0
  129. package/dist/v2/react-native/charts/bar/modelUtils.d.ts +27 -0
  130. package/dist/v2/react-native/charts/bar/modelUtils.d.ts.map +1 -0
  131. package/dist/v2/react-native/charts/bar/modelUtils.js +58 -0
  132. package/dist/v2/react-native/charts/bar/options.d.ts +7 -0
  133. package/dist/v2/react-native/charts/bar/options.d.ts.map +1 -0
  134. package/dist/v2/react-native/charts/bar/options.js +49 -0
  135. package/dist/v2/react-native/charts/bar/rendererSafety.d.ts +12 -0
  136. package/dist/v2/react-native/charts/bar/rendererSafety.d.ts.map +1 -0
  137. package/dist/v2/react-native/charts/bar/rendererSafety.js +31 -0
  138. package/dist/v2/react-native/charts/bar/selectionAnimation.d.ts +42 -0
  139. package/dist/v2/react-native/charts/bar/selectionAnimation.d.ts.map +1 -0
  140. package/dist/v2/react-native/charts/bar/selectionAnimation.js +158 -0
  141. package/dist/v2/react-native/charts/bar/stackedCompat.d.ts +55 -0
  142. package/dist/v2/react-native/charts/bar/stackedCompat.d.ts.map +1 -0
  143. package/dist/v2/react-native/charts/bar/stackedCompat.js +105 -0
  144. package/dist/v2/react-native/charts/bar/tooltip.d.ts +11 -0
  145. package/dist/v2/react-native/charts/bar/tooltip.d.ts.map +1 -0
  146. package/dist/v2/react-native/charts/bar/tooltip.js +18 -0
  147. package/dist/v2/react-native/charts/bar/tooltipModel.d.ts +33 -0
  148. package/dist/v2/react-native/charts/bar/tooltipModel.d.ts.map +1 -0
  149. package/dist/v2/react-native/charts/bar/tooltipModel.js +46 -0
  150. package/dist/v2/react-native/charts/bar/tooltipPlacement.d.ts +9 -0
  151. package/dist/v2/react-native/charts/bar/tooltipPlacement.d.ts.map +1 -0
  152. package/dist/v2/react-native/charts/bar/tooltipPlacement.js +9 -0
  153. package/dist/v2/react-native/charts/bar/types.d.ts +211 -0
  154. package/dist/v2/react-native/charts/bar/types.d.ts.map +1 -0
  155. package/dist/v2/react-native/charts/bar/types.js +1 -0
  156. package/dist/v2/react-native/charts/bar/useAnimatedTooltipModel.d.ts +10 -0
  157. package/dist/v2/react-native/charts/bar/useAnimatedTooltipModel.d.ts.map +1 -0
  158. package/dist/v2/react-native/charts/bar/useAnimatedTooltipModel.js +87 -0
  159. package/dist/v2/react-native/charts/bar/viewport.d.ts +20 -0
  160. package/dist/v2/react-native/charts/bar/viewport.d.ts.map +1 -0
  161. package/dist/v2/react-native/charts/bar/viewport.js +47 -0
  162. package/dist/v2/react-native/charts/contribution/ContributionGraph.d.ts +13 -0
  163. package/dist/v2/react-native/charts/contribution/ContributionGraph.d.ts.map +1 -0
  164. package/dist/v2/react-native/charts/contribution/ContributionGraph.js +159 -0
  165. package/dist/v2/react-native/charts/contribution/accessibility.d.ts +25 -0
  166. package/dist/v2/react-native/charts/contribution/accessibility.d.ts.map +1 -0
  167. package/dist/v2/react-native/charts/contribution/accessibility.js +50 -0
  168. package/dist/v2/react-native/charts/contribution/interaction.d.ts +23 -0
  169. package/dist/v2/react-native/charts/contribution/interaction.d.ts.map +1 -0
  170. package/dist/v2/react-native/charts/contribution/interaction.js +75 -0
  171. package/dist/v2/react-native/charts/contribution/model.d.ts +17 -0
  172. package/dist/v2/react-native/charts/contribution/model.d.ts.map +1 -0
  173. package/dist/v2/react-native/charts/contribution/model.js +102 -0
  174. package/dist/v2/react-native/charts/contribution/types.d.ts +71 -0
  175. package/dist/v2/react-native/charts/contribution/types.d.ts.map +1 -0
  176. package/dist/v2/react-native/charts/contribution/types.js +1 -0
  177. package/dist/v2/react-native/charts/line/AreaChart.d.ts +3 -0
  178. package/dist/v2/react-native/charts/line/AreaChart.d.ts.map +1 -0
  179. package/dist/v2/react-native/charts/line/AreaChart.js +3 -0
  180. package/dist/v2/react-native/charts/line/ChartSurface.d.ts +16 -0
  181. package/dist/v2/react-native/charts/line/ChartSurface.d.ts.map +1 -0
  182. package/dist/v2/react-native/charts/line/ChartSurface.js +151 -0
  183. package/dist/v2/react-native/charts/line/LineChart.d.ts +6 -0
  184. package/dist/v2/react-native/charts/line/LineChart.d.ts.map +1 -0
  185. package/dist/v2/react-native/charts/line/LineChart.js +294 -0
  186. package/dist/v2/react-native/charts/line/StickyYAxis.d.ts +15 -0
  187. package/dist/v2/react-native/charts/line/StickyYAxis.d.ts.map +1 -0
  188. package/dist/v2/react-native/charts/line/StickyYAxis.js +26 -0
  189. package/dist/v2/react-native/charts/line/accessibility.d.ts +34 -0
  190. package/dist/v2/react-native/charts/line/accessibility.d.ts.map +1 -0
  191. package/dist/v2/react-native/charts/line/accessibility.js +103 -0
  192. package/dist/v2/react-native/charts/line/axisLabels.d.ts +37 -0
  193. package/dist/v2/react-native/charts/line/axisLabels.d.ts.map +1 -0
  194. package/dist/v2/react-native/charts/line/axisLabels.js +55 -0
  195. package/dist/v2/react-native/charts/line/debugLayout.d.ts +26 -0
  196. package/dist/v2/react-native/charts/line/debugLayout.d.ts.map +1 -0
  197. package/dist/v2/react-native/charts/line/debugLayout.js +77 -0
  198. package/dist/v2/react-native/charts/line/debugOverlay.d.ts +9 -0
  199. package/dist/v2/react-native/charts/line/debugOverlay.d.ts.map +1 -0
  200. package/dist/v2/react-native/charts/line/debugOverlay.js +30 -0
  201. package/dist/v2/react-native/charts/line/defaultTooltip.d.ts +3 -0
  202. package/dist/v2/react-native/charts/line/defaultTooltip.d.ts.map +1 -0
  203. package/dist/v2/react-native/charts/line/defaultTooltip.js +17 -0
  204. package/dist/v2/react-native/charts/line/interaction.d.ts +82 -0
  205. package/dist/v2/react-native/charts/line/interaction.d.ts.map +1 -0
  206. package/dist/v2/react-native/charts/line/interaction.js +94 -0
  207. package/dist/v2/react-native/charts/line/legend.d.ts +35 -0
  208. package/dist/v2/react-native/charts/line/legend.d.ts.map +1 -0
  209. package/dist/v2/react-native/charts/line/legend.js +95 -0
  210. package/dist/v2/react-native/charts/line/markers.d.ts +11 -0
  211. package/dist/v2/react-native/charts/line/markers.d.ts.map +1 -0
  212. package/dist/v2/react-native/charts/line/markers.js +52 -0
  213. package/dist/v2/react-native/charts/line/options.d.ts +172 -0
  214. package/dist/v2/react-native/charts/line/options.d.ts.map +1 -0
  215. package/dist/v2/react-native/charts/line/options.js +168 -0
  216. package/dist/v2/react-native/charts/line/outsidePressSurfaces.d.ts +15 -0
  217. package/dist/v2/react-native/charts/line/outsidePressSurfaces.d.ts.map +1 -0
  218. package/dist/v2/react-native/charts/line/outsidePressSurfaces.js +37 -0
  219. package/dist/v2/react-native/charts/line/overviewProps.d.ts +45 -0
  220. package/dist/v2/react-native/charts/line/overviewProps.d.ts.map +1 -0
  221. package/dist/v2/react-native/charts/line/overviewProps.js +4 -0
  222. package/dist/v2/react-native/charts/line/rangeSelector.d.ts +19 -0
  223. package/dist/v2/react-native/charts/line/rangeSelector.d.ts.map +1 -0
  224. package/dist/v2/react-native/charts/line/rangeSelector.js +185 -0
  225. package/dist/v2/react-native/charts/line/rangeSelectorConfig.d.ts +38 -0
  226. package/dist/v2/react-native/charts/line/rangeSelectorConfig.d.ts.map +1 -0
  227. package/dist/v2/react-native/charts/line/rangeSelectorConfig.js +41 -0
  228. package/dist/v2/react-native/charts/line/referenceLabelPlacement.d.ts +21 -0
  229. package/dist/v2/react-native/charts/line/referenceLabelPlacement.d.ts.map +1 -0
  230. package/dist/v2/react-native/charts/line/referenceLabelPlacement.js +113 -0
  231. package/dist/v2/react-native/charts/line/references.d.ts +62 -0
  232. package/dist/v2/react-native/charts/line/references.d.ts.map +1 -0
  233. package/dist/v2/react-native/charts/line/references.js +156 -0
  234. package/dist/v2/react-native/charts/line/renderer.d.ts +4 -0
  235. package/dist/v2/react-native/charts/line/renderer.d.ts.map +1 -0
  236. package/dist/v2/react-native/charts/line/renderer.js +23 -0
  237. package/dist/v2/react-native/charts/line/responders.d.ts +13 -0
  238. package/dist/v2/react-native/charts/line/responders.d.ts.map +1 -0
  239. package/dist/v2/react-native/charts/line/responders.js +62 -0
  240. package/dist/v2/react-native/charts/line/selection.d.ts +31 -0
  241. package/dist/v2/react-native/charts/line/selection.d.ts.map +1 -0
  242. package/dist/v2/react-native/charts/line/selection.js +26 -0
  243. package/dist/v2/react-native/charts/line/seriesInput.d.ts +4 -0
  244. package/dist/v2/react-native/charts/line/seriesInput.d.ts.map +1 -0
  245. package/dist/v2/react-native/charts/line/seriesInput.js +13 -0
  246. package/dist/v2/react-native/charts/line/seriesStyles.d.ts +20 -0
  247. package/dist/v2/react-native/charts/line/seriesStyles.d.ts.map +1 -0
  248. package/dist/v2/react-native/charts/line/seriesStyles.js +33 -0
  249. package/dist/v2/react-native/charts/line/stickyYAxisLayout.d.ts +6 -0
  250. package/dist/v2/react-native/charts/line/stickyYAxisLayout.d.ts.map +1 -0
  251. package/dist/v2/react-native/charts/line/stickyYAxisLayout.js +2 -0
  252. package/dist/v2/react-native/charts/line/text.d.ts +7 -0
  253. package/dist/v2/react-native/charts/line/text.d.ts.map +1 -0
  254. package/dist/v2/react-native/charts/line/text.js +7 -0
  255. package/dist/v2/react-native/charts/line/thresholdRendering.d.ts +28 -0
  256. package/dist/v2/react-native/charts/line/thresholdRendering.d.ts.map +1 -0
  257. package/dist/v2/react-native/charts/line/thresholdRendering.js +145 -0
  258. package/dist/v2/react-native/charts/line/tooltip.d.ts +70 -0
  259. package/dist/v2/react-native/charts/line/tooltip.d.ts.map +1 -0
  260. package/dist/v2/react-native/charts/line/tooltip.js +87 -0
  261. package/dist/v2/react-native/charts/line/types.d.ts +371 -0
  262. package/dist/v2/react-native/charts/line/types.d.ts.map +1 -0
  263. package/dist/v2/react-native/charts/line/types.js +1 -0
  264. package/dist/v2/react-native/charts/line/useAnimatedTooltipModel.d.ts +13 -0
  265. package/dist/v2/react-native/charts/line/useAnimatedTooltipModel.d.ts.map +1 -0
  266. package/dist/v2/react-native/charts/line/useAnimatedTooltipModel.js +84 -0
  267. package/dist/v2/react-native/charts/line/useAnimatedYAxisLabels.d.ts +5 -0
  268. package/dist/v2/react-native/charts/line/useAnimatedYAxisLabels.d.ts.map +1 -0
  269. package/dist/v2/react-native/charts/line/useAnimatedYAxisLabels.js +141 -0
  270. package/dist/v2/react-native/charts/line/useChartModel.d.ts +103 -0
  271. package/dist/v2/react-native/charts/line/useChartModel.d.ts.map +1 -0
  272. package/dist/v2/react-native/charts/line/useChartModel.js +367 -0
  273. package/dist/v2/react-native/charts/line/useDebugLayout.d.ts +16 -0
  274. package/dist/v2/react-native/charts/line/useDebugLayout.d.ts.map +1 -0
  275. package/dist/v2/react-native/charts/line/useDebugLayout.js +35 -0
  276. package/dist/v2/react-native/charts/line/utils.d.ts +10 -0
  277. package/dist/v2/react-native/charts/line/utils.d.ts.map +1 -0
  278. package/dist/v2/react-native/charts/line/utils.js +40 -0
  279. package/dist/v2/react-native/charts/line/viewportInteraction.d.ts +3 -0
  280. package/dist/v2/react-native/charts/line/viewportInteraction.d.ts.map +1 -0
  281. package/dist/v2/react-native/charts/line/viewportInteraction.js +1 -0
  282. package/dist/v2/react-native/charts/line/viewportPinchZoom.d.ts +2 -0
  283. package/dist/v2/react-native/charts/line/viewportPinchZoom.d.ts.map +1 -0
  284. package/dist/v2/react-native/charts/line/viewportPinchZoom.js +1 -0
  285. package/dist/v2/react-native/charts/line/xLabelCandidates.d.ts +13 -0
  286. package/dist/v2/react-native/charts/line/xLabelCandidates.d.ts.map +1 -0
  287. package/dist/v2/react-native/charts/line/xLabelCandidates.js +23 -0
  288. package/dist/v2/react-native/charts/line/xLabels.d.ts +39 -0
  289. package/dist/v2/react-native/charts/line/xLabels.d.ts.map +1 -0
  290. package/dist/v2/react-native/charts/line/xLabels.js +289 -0
  291. package/dist/v2/react-native/charts/line/xScale.d.ts +6 -0
  292. package/dist/v2/react-native/charts/line/xScale.d.ts.map +1 -0
  293. package/dist/v2/react-native/charts/line/xScale.js +25 -0
  294. package/dist/v2/react-native/charts/line/yAxisModel.d.ts +29 -0
  295. package/dist/v2/react-native/charts/line/yAxisModel.d.ts.map +1 -0
  296. package/dist/v2/react-native/charts/line/yAxisModel.js +39 -0
  297. package/dist/v2/react-native/charts/pie/PieChart.d.ts +7 -0
  298. package/dist/v2/react-native/charts/pie/PieChart.d.ts.map +1 -0
  299. package/dist/v2/react-native/charts/pie/PieChart.js +253 -0
  300. package/dist/v2/react-native/charts/pie/accessibility.d.ts +28 -0
  301. package/dist/v2/react-native/charts/pie/accessibility.d.ts.map +1 -0
  302. package/dist/v2/react-native/charts/pie/accessibility.js +49 -0
  303. package/dist/v2/react-native/charts/pie/activeSlice.d.ts +15 -0
  304. package/dist/v2/react-native/charts/pie/activeSlice.d.ts.map +1 -0
  305. package/dist/v2/react-native/charts/pie/activeSlice.js +26 -0
  306. package/dist/v2/react-native/charts/pie/arcLabels.d.ts +32 -0
  307. package/dist/v2/react-native/charts/pie/arcLabels.d.ts.map +1 -0
  308. package/dist/v2/react-native/charts/pie/arcLabels.js +191 -0
  309. package/dist/v2/react-native/charts/pie/interaction.d.ts +26 -0
  310. package/dist/v2/react-native/charts/pie/interaction.d.ts.map +1 -0
  311. package/dist/v2/react-native/charts/pie/interaction.js +66 -0
  312. package/dist/v2/react-native/charts/pie/model.d.ts +15 -0
  313. package/dist/v2/react-native/charts/pie/model.d.ts.map +1 -0
  314. package/dist/v2/react-native/charts/pie/model.js +157 -0
  315. package/dist/v2/react-native/charts/pie/selectionAnimation.d.ts +33 -0
  316. package/dist/v2/react-native/charts/pie/selectionAnimation.d.ts.map +1 -0
  317. package/dist/v2/react-native/charts/pie/selectionAnimation.js +121 -0
  318. package/dist/v2/react-native/charts/pie/sliceSeparator.d.ts +7 -0
  319. package/dist/v2/react-native/charts/pie/sliceSeparator.d.ts.map +1 -0
  320. package/dist/v2/react-native/charts/pie/sliceSeparator.js +26 -0
  321. package/dist/v2/react-native/charts/pie/slices.d.ts +20 -0
  322. package/dist/v2/react-native/charts/pie/slices.d.ts.map +1 -0
  323. package/dist/v2/react-native/charts/pie/slices.js +54 -0
  324. package/dist/v2/react-native/charts/pie/types.d.ts +165 -0
  325. package/dist/v2/react-native/charts/pie/types.d.ts.map +1 -0
  326. package/dist/v2/react-native/charts/pie/types.js +1 -0
  327. package/dist/v2/react-native/charts/progress/ProgressChart.d.ts +7 -0
  328. package/dist/v2/react-native/charts/progress/ProgressChart.d.ts.map +1 -0
  329. package/dist/v2/react-native/charts/progress/ProgressChart.js +111 -0
  330. package/dist/v2/react-native/charts/progress/accessibility.d.ts +26 -0
  331. package/dist/v2/react-native/charts/progress/accessibility.d.ts.map +1 -0
  332. package/dist/v2/react-native/charts/progress/accessibility.js +71 -0
  333. package/dist/v2/react-native/charts/progress/animation.d.ts +36 -0
  334. package/dist/v2/react-native/charts/progress/animation.d.ts.map +1 -0
  335. package/dist/v2/react-native/charts/progress/animation.js +103 -0
  336. package/dist/v2/react-native/charts/progress/model.d.ts +14 -0
  337. package/dist/v2/react-native/charts/progress/model.d.ts.map +1 -0
  338. package/dist/v2/react-native/charts/progress/model.js +133 -0
  339. package/dist/v2/react-native/charts/progress/types.d.ts +72 -0
  340. package/dist/v2/react-native/charts/progress/types.d.ts.map +1 -0
  341. package/dist/v2/react-native/charts/progress/types.js +1 -0
  342. package/dist/v2/react-native/index.d.ts +24 -0
  343. package/dist/v2/react-native/index.d.ts.map +1 -0
  344. package/dist/v2/react-native/index.js +14 -0
  345. package/dist/v2/react-native/selection/ChartSelectionProvider.d.ts +27 -0
  346. package/dist/v2/react-native/selection/ChartSelectionProvider.d.ts.map +1 -0
  347. package/dist/v2/react-native/selection/ChartSelectionProvider.js +92 -0
  348. package/dist/v2/react-native/selection/index.d.ts +2 -0
  349. package/dist/v2/react-native/selection/index.d.ts.map +1 -0
  350. package/dist/v2/react-native/selection/index.js +1 -0
  351. package/dist/v2/react-native/selection/scope.d.ts +16 -0
  352. package/dist/v2/react-native/selection/scope.d.ts.map +1 -0
  353. package/dist/v2/react-native/selection/scope.js +18 -0
  354. package/dist/v2/react-native/theme/index.d.ts +4 -0
  355. package/dist/v2/react-native/theme/index.d.ts.map +1 -0
  356. package/dist/v2/react-native/theme/index.js +2 -0
  357. package/dist/v2/react-native/theme/presets.d.ts +84 -0
  358. package/dist/v2/react-native/theme/presets.d.ts.map +1 -0
  359. package/dist/v2/react-native/theme/presets.js +298 -0
  360. package/dist/v2/react-native/theme/provider.d.ts +20 -0
  361. package/dist/v2/react-native/theme/provider.d.ts.map +1 -0
  362. package/dist/v2/react-native/theme/provider.js +27 -0
  363. package/dist/v2/react-native/viewport/bounds.d.ts +7 -0
  364. package/dist/v2/react-native/viewport/bounds.d.ts.map +1 -0
  365. package/dist/v2/react-native/viewport/bounds.js +7 -0
  366. package/dist/v2/react-native/viewport/config.d.ts +13 -0
  367. package/dist/v2/react-native/viewport/config.d.ts.map +1 -0
  368. package/dist/v2/react-native/viewport/config.js +64 -0
  369. package/dist/v2/react-native/viewport/pan.d.ts +23 -0
  370. package/dist/v2/react-native/viewport/pan.d.ts.map +1 -0
  371. package/dist/v2/react-native/viewport/pan.js +110 -0
  372. package/dist/v2/react-native/viewport/pinchZoom.d.ts +17 -0
  373. package/dist/v2/react-native/viewport/pinchZoom.d.ts.map +1 -0
  374. package/dist/v2/react-native/viewport/pinchZoom.js +131 -0
  375. package/dist/v2/react-native/viewport/types.d.ts +55 -0
  376. package/dist/v2/react-native/viewport/types.d.ts.map +1 -0
  377. package/dist/v2/react-native/viewport/types.js +1 -0
  378. package/dist/v2/svg-renderer/capabilities.d.ts +3 -0
  379. package/dist/v2/svg-renderer/capabilities.d.ts.map +1 -0
  380. package/dist/v2/svg-renderer/capabilities.js +12 -0
  381. package/dist/v2/svg-renderer/clipPath.d.ts +4 -0
  382. package/dist/v2/svg-renderer/clipPath.d.ts.map +1 -0
  383. package/dist/v2/svg-renderer/clipPath.js +35 -0
  384. package/dist/v2/svg-renderer/defs.d.ts +6 -0
  385. package/dist/v2/svg-renderer/defs.d.ts.map +1 -0
  386. package/dist/v2/svg-renderer/defs.js +18 -0
  387. package/dist/v2/svg-renderer/ensureConsole.d.ts +4 -0
  388. package/dist/v2/svg-renderer/ensureConsole.d.ts.map +1 -0
  389. package/dist/v2/svg-renderer/ensureConsole.js +54 -0
  390. package/dist/v2/svg-renderer/hitRegions.d.ts +3 -0
  391. package/dist/v2/svg-renderer/hitRegions.d.ts.map +1 -0
  392. package/dist/v2/svg-renderer/hitRegions.js +6 -0
  393. package/dist/v2/svg-renderer/index.d.ts +14 -0
  394. package/dist/v2/svg-renderer/index.d.ts.map +1 -0
  395. package/dist/v2/svg-renderer/index.js +13 -0
  396. package/dist/v2/svg-renderer/layerOrder.d.ts +19 -0
  397. package/dist/v2/svg-renderer/layerOrder.d.ts.map +1 -0
  398. package/dist/v2/svg-renderer/layerOrder.js +18 -0
  399. package/dist/v2/svg-renderer/layers.d.ts +3 -0
  400. package/dist/v2/svg-renderer/layers.d.ts.map +1 -0
  401. package/dist/v2/svg-renderer/layers.js +4 -0
  402. package/dist/v2/svg-renderer/primitives.d.ts +12 -0
  403. package/dist/v2/svg-renderer/primitives.d.ts.map +1 -0
  404. package/dist/v2/svg-renderer/primitives.js +13 -0
  405. package/dist/v2/svg-renderer/renderer.d.ts +4 -0
  406. package/dist/v2/svg-renderer/renderer.d.ts.map +1 -0
  407. package/dist/v2/svg-renderer/renderer.js +24 -0
  408. package/dist/v2/svg-renderer/symbolGeometry.d.ts +6 -0
  409. package/dist/v2/svg-renderer/symbolGeometry.d.ts.map +1 -0
  410. package/dist/v2/svg-renderer/symbolGeometry.js +10 -0
  411. package/dist/v2/svg-renderer/symbols.d.ts +3 -0
  412. package/dist/v2/svg-renderer/symbols.d.ts.map +1 -0
  413. package/dist/v2/svg-renderer/symbols.js +23 -0
  414. package/dist/v2/svg-renderer/testIds.d.ts +2 -0
  415. package/dist/v2/svg-renderer/testIds.d.ts.map +1 -0
  416. package/dist/v2/svg-renderer/testIds.js +10 -0
  417. package/dist/v2/svg-renderer/textMeasurement.d.ts +4 -0
  418. package/dist/v2/svg-renderer/textMeasurement.d.ts.map +1 -0
  419. package/dist/v2/svg-renderer/textMeasurement.js +37 -0
  420. package/dist/v2/svg-renderer/types.d.ts +134 -0
  421. package/dist/v2/svg-renderer/types.d.ts.map +1 -0
  422. package/dist/v2/svg-renderer/types.js +1 -0
  423. package/package.json +56 -50
  424. package/v2/index.d.ts +1 -0
  425. package/v2/index.js +1 -0
  426. package/v2/package.json +6 -0
  427. package/scripts/chartkit-codemod.mjs +0 -256
@@ -0,0 +1,107 @@
1
+ const daysInWeek = 7;
2
+ const defaultMonthLabelHeight = 18;
3
+ const defaultWeekdayLabelWidth = 28;
4
+ const millisecondsInOneDay = 24 * 60 * 60 * 1000;
5
+ const clampInteger = (value, min, max) => {
6
+ if (!Number.isFinite(value)) {
7
+ return min;
8
+ }
9
+ return Math.min(Math.max(Math.floor(value), min), max);
10
+ };
11
+ const shiftDate = (date, numDays) => {
12
+ const shiftedDate = new Date(date);
13
+ shiftedDate.setDate(shiftedDate.getDate() + numDays);
14
+ return shiftedDate;
15
+ };
16
+ const getDayOffset = (date, weekStartsOn) => (date.getDay() - weekStartsOn + daysInWeek) % daysInWeek;
17
+ const getDayIndex = (date, startDate) => Math.round((date.valueOf() - startDate.valueOf()) / millisecondsInOneDay);
18
+ export const buildContributionHeatmap = ({ data, cellSize, gutterSize = 3, weekStartsOn = 0, showOutOfRangeDays = false, monthLabelHeight = defaultMonthLabelHeight, weekdayLabelWidth = defaultWeekdayLabelWidth }) => {
19
+ const safeCellSize = Number.isFinite(cellSize) && cellSize > 0 ? cellSize : 0;
20
+ const safeGutterSize = Number.isFinite(gutterSize) && gutterSize >= 0 ? gutterSize : 0;
21
+ const safeWeekStartsOn = clampInteger(weekStartsOn, 0, daysInWeek - 1);
22
+ const safeMonthLabelHeight = Number.isFinite(monthLabelHeight) && monthLabelHeight > 0
23
+ ? monthLabelHeight
24
+ : 0;
25
+ const safeWeekdayLabelWidth = Number.isFinite(weekdayLabelWidth) && weekdayLabelWidth > 0
26
+ ? weekdayLabelWidth
27
+ : 0;
28
+ const startOffset = getDayOffset(data.startDate, safeWeekStartsOn);
29
+ const totalSlots = startOffset + data.days.length;
30
+ const endOffset = totalSlots % daysInWeek === 0 ? 0 : daysInWeek - (totalSlots % daysInWeek);
31
+ const weekCount = Math.ceil((totalSlots + endOffset) / daysInWeek);
32
+ const step = safeCellSize + safeGutterSize;
33
+ const firstSlotDate = shiftDate(data.startDate, -startOffset);
34
+ const daysByIndex = new Map(data.days.map((day) => [day.index, day]));
35
+ const cells = Array.from({ length: weekCount * daysInWeek }, (_, slotIndex) => {
36
+ const weekIndex = Math.floor(slotIndex / daysInWeek);
37
+ const weekdayIndex = slotIndex % daysInWeek;
38
+ const date = shiftDate(firstSlotDate, slotIndex);
39
+ const inRangeIndex = getDayIndex(date, data.startDate);
40
+ const day = inRangeIndex >= 0 && inRangeIndex < data.days.length
41
+ ? daysByIndex.get(inRangeIndex)
42
+ : undefined;
43
+ const outOfRange = day === undefined;
44
+ const cell = {
45
+ index: day?.index ?? -1,
46
+ date,
47
+ value: day?.value ?? null,
48
+ defined: day?.defined ?? false,
49
+ outOfRange,
50
+ weekIndex,
51
+ weekdayIndex,
52
+ x: safeWeekdayLabelWidth + weekIndex * step,
53
+ y: safeMonthLabelHeight + weekdayIndex * step,
54
+ size: safeCellSize
55
+ };
56
+ if (day?.raw !== undefined) {
57
+ cell.raw = day.raw;
58
+ }
59
+ return cell;
60
+ }).filter((cell) => showOutOfRangeDays || !cell.outOfRange);
61
+ const visibleValues = cells
62
+ .map((cell) => cell.value)
63
+ .filter((value) => value !== null && Number.isFinite(value));
64
+ const valueMin = visibleValues.length > 0 ? Math.min(...visibleValues) : 0;
65
+ const valueMax = visibleValues.length > 0 ? Math.max(...visibleValues) : 0;
66
+ const monthLabels = [];
67
+ const seenMonths = new Set();
68
+ data.days.forEach((day) => {
69
+ if (day.date.getDate() !== 1 && day.index !== 0) {
70
+ return;
71
+ }
72
+ const slotIndex = startOffset + day.index;
73
+ const weekIndex = Math.floor(slotIndex / daysInWeek);
74
+ const key = `${day.date.getFullYear()}-${day.date.getMonth()}`;
75
+ if (seenMonths.has(key)) {
76
+ return;
77
+ }
78
+ seenMonths.add(key);
79
+ monthLabels.push({
80
+ key,
81
+ date: day.date,
82
+ monthIndex: day.date.getMonth(),
83
+ x: safeWeekdayLabelWidth + weekIndex * step,
84
+ y: Math.max(10, safeMonthLabelHeight - 6)
85
+ });
86
+ });
87
+ const weekdayLabels = [1, 3, 5].map((weekdayIndex) => {
88
+ const dayIndex = (safeWeekStartsOn + weekdayIndex) % daysInWeek;
89
+ return {
90
+ key: `weekday-${weekdayIndex}`,
91
+ weekdayIndex,
92
+ dayIndex,
93
+ x: 0,
94
+ y: safeMonthLabelHeight + weekdayIndex * step + safeCellSize * 0.75
95
+ };
96
+ });
97
+ return {
98
+ cells,
99
+ monthLabels,
100
+ weekdayLabels,
101
+ width: safeWeekdayLabelWidth + Math.max(0, weekCount * step - safeGutterSize),
102
+ height: safeMonthLabelHeight + Math.max(0, daysInWeek * step - safeGutterSize),
103
+ weekCount,
104
+ valueMin,
105
+ valueMax
106
+ };
107
+ };
@@ -0,0 +1,27 @@
1
+ import type { ChartXValue, NormalizedSeries } from "../data";
2
+ import type { BarGeometryMode, ProjectBarValueScale, ProjectedBarRect } from "./barRects";
3
+ export type ProjectedHorizontalBarBand<TData = unknown> = {
4
+ y: number;
5
+ height: number;
6
+ raw?: TData;
7
+ };
8
+ export type ProjectHorizontalBarBand<TData = unknown> = (value: ChartXValue, dataIndex: number, raw: TData | undefined) => ProjectedHorizontalBarBand<TData> | undefined;
9
+ export type ProjectedHorizontalBarRect<TData = unknown> = ProjectedBarRect<TData> & {
10
+ baselineX: number;
11
+ };
12
+ export type HorizontalBarGeometry<TData = unknown> = {
13
+ mode: BarGeometryMode;
14
+ bars: Array<ProjectedHorizontalBarRect<TData>>;
15
+ };
16
+ export type BuildHorizontalBarGeometryOptions<TData = unknown> = {
17
+ series: Array<NormalizedSeries<TData>>;
18
+ yBand: ProjectHorizontalBarBand<TData>;
19
+ xScale: ProjectBarValueScale;
20
+ mode?: BarGeometryMode;
21
+ baselineValue?: number;
22
+ barWidthRatio?: number;
23
+ barGapRatio?: number;
24
+ dataIndexOffset?: number;
25
+ };
26
+ export declare const buildHorizontalBarGeometry: <TData = unknown>({ series, yBand, xScale, mode, baselineValue, barWidthRatio: rawBarWidthRatio, barGapRatio: rawBarGapRatio, dataIndexOffset }: BuildHorizontalBarGeometryOptions<TData>) => HorizontalBarGeometry<TData>;
27
+ //# sourceMappingURL=horizontalBarRects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"horizontalBarRects.d.ts","sourceRoot":"","sources":["../../src/geometry/horizontalBarRects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,0BAA0B,CAAC,KAAK,GAAG,OAAO,IAAI;IACxD,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,KAAK,GAAG,OAAO,IAAI,CACtD,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,KAAK,GAAG,SAAS,KACnB,0BAA0B,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;AAEnD,MAAM,MAAM,0BAA0B,CAAC,KAAK,GAAG,OAAO,IACpD,gBAAgB,CAAC,KAAK,CAAC,GAAG;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEJ,MAAM,MAAM,qBAAqB,CAAC,KAAK,GAAG,OAAO,IAAI;IACnD,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,iCAAiC,CAAC,KAAK,GAAG,OAAO,IAAI;IAC/D,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AA8SF,eAAO,MAAM,0BAA0B,GAAI,KAAK,GAAG,OAAO,EAAE,+HASzD,iCAAiC,CAAC,KAAK,CAAC,KAAG,qBAAqB,CAAC,KAAK,CAkCxE,CAAC"}
@@ -0,0 +1,202 @@
1
+ const defaultBarWidthRatio = 0.72;
2
+ const defaultBarGapRatio = 0.12;
3
+ const clampRatio = (value, fallback) => typeof value === "number" && Number.isFinite(value)
4
+ ? Math.max(0, Math.min(1, value))
5
+ : fallback;
6
+ const isFinitePosition = (value) => typeof value === "number" && Number.isFinite(value);
7
+ const getSeriesPoint = (series, rowIndex) => series.points[rowIndex];
8
+ const getSeriesRowCount = (series) => Math.max(0, ...series.map((item) => item.points.length));
9
+ const getStackTotals = (series, rowIndex) => {
10
+ let positive = 0;
11
+ let negative = 0;
12
+ series.forEach((item) => {
13
+ const value = getSeriesPoint(item, rowIndex)?.value;
14
+ if (typeof value !== "number" || !Number.isFinite(value)) {
15
+ return;
16
+ }
17
+ if (value >= 0) {
18
+ positive += value;
19
+ }
20
+ else {
21
+ negative += Math.abs(value);
22
+ }
23
+ });
24
+ return { negative, positive };
25
+ };
26
+ const getStackedScaledValue = ({ mode, rowIndex, series, value }) => {
27
+ if (mode !== "stacked100") {
28
+ return value;
29
+ }
30
+ const totals = getStackTotals(series, rowIndex);
31
+ if (value >= 0) {
32
+ return totals.positive > 0 ? (value / totals.positive) * 100 : 0;
33
+ }
34
+ return totals.negative > 0 ? (value / totals.negative) * 100 : 0;
35
+ };
36
+ const buildRect = ({ baselineX, dataIndex, height, raw, scaledValue, series, seriesIndex, value, widthValue, xScale, xValue, y }) => {
37
+ const valueX = xScale(widthValue);
38
+ if (!isFinitePosition(valueX)) {
39
+ return undefined;
40
+ }
41
+ return {
42
+ key: `${series.key}-${dataIndex}`,
43
+ seriesKey: series.key,
44
+ seriesLabel: series.label,
45
+ seriesIndex,
46
+ dataIndex,
47
+ xValue,
48
+ value,
49
+ scaledValue,
50
+ x: Math.min(valueX, baselineX),
51
+ y,
52
+ width: Math.abs(valueX - baselineX),
53
+ height,
54
+ baselineX,
55
+ baselineY: y + height / 2,
56
+ defined: true,
57
+ raw
58
+ };
59
+ };
60
+ const buildGroupedHorizontalBars = ({ baselineX, barGapRatio, barWidthRatio, dataIndexOffset, series, xScale, yBand }) => {
61
+ const rowCount = getSeriesRowCount(series);
62
+ const bars = [];
63
+ const seriesCount = Math.max(1, series.length);
64
+ for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
65
+ const referencePoint = series[0]?.points[rowIndex];
66
+ if (!referencePoint) {
67
+ continue;
68
+ }
69
+ const band = yBand(referencePoint.x, rowIndex + dataIndexOffset, referencePoint.raw);
70
+ if (!band || !Number.isFinite(band.y) || !Number.isFinite(band.height)) {
71
+ continue;
72
+ }
73
+ const groupHeight = band.height * barWidthRatio;
74
+ const groupY = band.y + (band.height - groupHeight) / 2;
75
+ const totalGapHeight = groupHeight * barGapRatio * Math.max(0, seriesCount - 1);
76
+ const barHeight = Math.max(0, (groupHeight - totalGapHeight) / seriesCount);
77
+ const gapHeight = seriesCount > 1 ? groupHeight * barGapRatio : 0;
78
+ series.forEach((item, seriesIndex) => {
79
+ const point = getSeriesPoint(item, rowIndex);
80
+ if (!point ||
81
+ typeof point.value !== "number" ||
82
+ !Number.isFinite(point.value)) {
83
+ return;
84
+ }
85
+ const rect = buildRect({
86
+ baselineX,
87
+ dataIndex: rowIndex + dataIndexOffset,
88
+ height: barHeight,
89
+ raw: point.raw,
90
+ scaledValue: point.value,
91
+ series: item,
92
+ seriesIndex,
93
+ value: point.value,
94
+ widthValue: point.value,
95
+ xScale,
96
+ xValue: point.x,
97
+ y: groupY + seriesIndex * (barHeight + gapHeight)
98
+ });
99
+ if (rect) {
100
+ bars.push(rect);
101
+ }
102
+ });
103
+ }
104
+ return bars;
105
+ };
106
+ const buildStackedHorizontalBars = ({ baselineX, barWidthRatio, dataIndexOffset, mode, series, xScale, yBand }) => {
107
+ const rowCount = getSeriesRowCount(series);
108
+ const bars = [];
109
+ for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
110
+ const referencePoint = series[0]?.points[rowIndex];
111
+ if (!referencePoint) {
112
+ continue;
113
+ }
114
+ const band = yBand(referencePoint.x, rowIndex + dataIndexOffset, referencePoint.raw);
115
+ if (!band || !Number.isFinite(band.y) || !Number.isFinite(band.height)) {
116
+ continue;
117
+ }
118
+ let positiveStart = 0;
119
+ let negativeStart = 0;
120
+ const barHeight = band.height * barWidthRatio;
121
+ const y = band.y + (band.height - barHeight) / 2;
122
+ series.forEach((item, seriesIndex) => {
123
+ const point = getSeriesPoint(item, rowIndex);
124
+ if (!point ||
125
+ typeof point.value !== "number" ||
126
+ !Number.isFinite(point.value)) {
127
+ return;
128
+ }
129
+ const scaledValue = getStackedScaledValue({
130
+ mode,
131
+ rowIndex,
132
+ series,
133
+ value: point.value
134
+ });
135
+ const stackStart = scaledValue >= 0 ? positiveStart : negativeStart;
136
+ const stackEnd = stackStart + scaledValue;
137
+ const stackStartX = xScale(stackStart);
138
+ const stackEndX = xScale(stackEnd);
139
+ if (!isFinitePosition(stackStartX) || !isFinitePosition(stackEndX)) {
140
+ return;
141
+ }
142
+ bars.push({
143
+ key: `${item.key}-${rowIndex + dataIndexOffset}`,
144
+ seriesKey: item.key,
145
+ seriesLabel: item.label,
146
+ seriesIndex,
147
+ dataIndex: rowIndex + dataIndexOffset,
148
+ xValue: point.x,
149
+ value: point.value,
150
+ scaledValue,
151
+ x: Math.min(stackStartX, stackEndX),
152
+ y,
153
+ width: Math.abs(stackEndX - stackStartX),
154
+ height: barHeight,
155
+ baselineX,
156
+ baselineY: y + barHeight / 2,
157
+ defined: true,
158
+ raw: point.raw,
159
+ stackStart,
160
+ stackEnd
161
+ });
162
+ if (scaledValue >= 0) {
163
+ positiveStart = stackEnd;
164
+ }
165
+ else {
166
+ negativeStart = stackEnd;
167
+ }
168
+ });
169
+ }
170
+ return bars;
171
+ };
172
+ export const buildHorizontalBarGeometry = ({ series, yBand, xScale, mode = "grouped", baselineValue = 0, barWidthRatio: rawBarWidthRatio, barGapRatio: rawBarGapRatio, dataIndexOffset = 0 }) => {
173
+ const baselineX = xScale(baselineValue);
174
+ if (!isFinitePosition(baselineX) || series.length === 0) {
175
+ return { mode, bars: [] };
176
+ }
177
+ const barWidthRatio = clampRatio(rawBarWidthRatio, defaultBarWidthRatio);
178
+ const barGapRatio = clampRatio(rawBarGapRatio, defaultBarGapRatio);
179
+ const bars = mode === "grouped"
180
+ ? buildGroupedHorizontalBars({
181
+ baselineX,
182
+ barGapRatio,
183
+ barWidthRatio,
184
+ dataIndexOffset,
185
+ series,
186
+ xScale,
187
+ yBand
188
+ })
189
+ : buildStackedHorizontalBars({
190
+ baselineX,
191
+ barWidthRatio,
192
+ dataIndexOffset,
193
+ mode,
194
+ series,
195
+ xScale,
196
+ yBand
197
+ });
198
+ return {
199
+ mode,
200
+ bars
201
+ };
202
+ };
@@ -0,0 +1,12 @@
1
+ export * from "./areaPath";
2
+ export * from "./barRects";
3
+ export * from "./contributionHeatmap";
4
+ export * from "./horizontalBarRects";
5
+ export * from "./lineDecimation";
6
+ export * from "./linePath";
7
+ export * from "./lineSeries";
8
+ export * from "./path";
9
+ export * from "./pieArcs";
10
+ export * from "./progressRings";
11
+ export * from "./types";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ export * from "./areaPath";
2
+ export * from "./barRects";
3
+ export * from "./contributionHeatmap";
4
+ export * from "./horizontalBarRects";
5
+ export * from "./lineDecimation";
6
+ export * from "./linePath";
7
+ export * from "./lineSeries";
8
+ export * from "./path";
9
+ export * from "./pieArcs";
10
+ export * from "./progressRings";
11
+ export * from "./types";
@@ -0,0 +1,8 @@
1
+ import type { GeometryPoint, LinePathDecimationConfig } from "./types";
2
+ export declare const splitLinePathSegments: <TPoint extends GeometryPoint = GeometryPoint>(points: TPoint[], connectNulls?: boolean) => TPoint[][];
3
+ export declare const getDecimatedLinePathSegments: <TPoint extends GeometryPoint = GeometryPoint>({ connectNulls, decimation, points }: {
4
+ connectNulls?: boolean;
5
+ decimation?: false | LinePathDecimationConfig | undefined;
6
+ points: TPoint[];
7
+ }) => TPoint[][];
8
+ //# sourceMappingURL=lineDecimation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineDecimation.d.ts","sourceRoot":"","sources":["../../src/geometry/lineDecimation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAiBvE,eAAO,MAAM,qBAAqB,GAChC,MAAM,SAAS,aAAa,GAAG,aAAa,EAE5C,QAAQ,MAAM,EAAE,EAChB,sBAAoB,KACnB,MAAM,EAAE,EAyBV,CAAC;AA4GF,eAAO,MAAM,4BAA4B,GACvC,MAAM,SAAS,aAAa,GAAG,aAAa,EAC5C,sCAIC;IACD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,GAAG,wBAAwB,GAAG,SAAS,CAAC;IAC1D,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,KAAG,MAAM,EAAE,EA4BX,CAAC"}
@@ -0,0 +1,110 @@
1
+ const isFiniteGeometryPoint = (point) => {
2
+ return point.defined && Number.isFinite(point.x) && Number.isFinite(point.y);
3
+ };
4
+ const appendUniquePoint = (points, point) => {
5
+ if (points[points.length - 1] !== point) {
6
+ points.push(point);
7
+ }
8
+ };
9
+ export const splitLinePathSegments = (points, connectNulls = false) => {
10
+ if (connectNulls) {
11
+ return [points.filter(isFiniteGeometryPoint)];
12
+ }
13
+ const segments = [];
14
+ let current = [];
15
+ points.forEach((point) => {
16
+ if (isFiniteGeometryPoint(point)) {
17
+ current.push(point);
18
+ return;
19
+ }
20
+ if (current.length > 0) {
21
+ segments.push(current);
22
+ current = [];
23
+ }
24
+ });
25
+ if (current.length > 0) {
26
+ segments.push(current);
27
+ }
28
+ return segments;
29
+ };
30
+ const getSegmentMinimumBudget = (segment) => {
31
+ return segment.length > 1 ? 2 : segment.length;
32
+ };
33
+ const decimateMinMaxSegment = (segment, maxPoints) => {
34
+ if (segment.length <= maxPoints) {
35
+ return segment;
36
+ }
37
+ if (maxPoints <= 1) {
38
+ return segment.slice(0, 1);
39
+ }
40
+ const first = segment[0];
41
+ const last = segment[segment.length - 1];
42
+ const interior = segment.slice(1, -1);
43
+ const selected = [first];
44
+ const interiorBudget = Math.max(0, maxPoints - 2);
45
+ const bucketCount = Math.max(1, Math.ceil(interiorBudget / 2));
46
+ const bucketSize = interior.length / bucketCount;
47
+ for (let bucketIndex = 0; bucketIndex < bucketCount; bucketIndex++) {
48
+ const bucketStart = Math.floor(bucketIndex * bucketSize);
49
+ const bucketEnd = bucketIndex === bucketCount - 1
50
+ ? interior.length
51
+ : Math.floor((bucketIndex + 1) * bucketSize);
52
+ const bucket = interior.slice(bucketStart, bucketEnd);
53
+ if (bucket.length === 0) {
54
+ continue;
55
+ }
56
+ let minIndex = 0;
57
+ let maxIndex = 0;
58
+ bucket.forEach((point, index) => {
59
+ if (point.y < bucket[minIndex].y) {
60
+ minIndex = index;
61
+ }
62
+ if (point.y > bucket[maxIndex].y) {
63
+ maxIndex = index;
64
+ }
65
+ });
66
+ const extrema = minIndex <= maxIndex
67
+ ? [bucket[minIndex], bucket[maxIndex]]
68
+ : [bucket[maxIndex], bucket[minIndex]];
69
+ for (const point of extrema) {
70
+ if (selected.length >= maxPoints - 1) {
71
+ break;
72
+ }
73
+ appendUniquePoint(selected, point);
74
+ }
75
+ }
76
+ appendUniquePoint(selected, last);
77
+ return selected;
78
+ };
79
+ const allocateSegmentBudgets = (segments, maxPoints) => {
80
+ const minimumRequired = segments.reduce((sum, segment) => sum + getSegmentMinimumBudget(segment), 0);
81
+ const effectiveMaxPoints = Math.max(maxPoints, minimumRequired);
82
+ let remainingBudget = effectiveMaxPoints;
83
+ let remainingPoints = segments.reduce((sum, segment) => sum + segment.length, 0);
84
+ return segments.map((segment, index) => {
85
+ if (index === segments.length - 1) {
86
+ return Math.min(segment.length, remainingBudget);
87
+ }
88
+ const minimumBudget = getSegmentMinimumBudget(segment);
89
+ const proportionalBudget = Math.round((segment.length / remainingPoints) * remainingBudget);
90
+ const budget = Math.min(segment.length, Math.max(minimumBudget, proportionalBudget));
91
+ remainingBudget -= budget;
92
+ remainingPoints -= segment.length;
93
+ return budget;
94
+ });
95
+ };
96
+ export const getDecimatedLinePathSegments = ({ connectNulls = false, decimation, points }) => {
97
+ const segments = splitLinePathSegments(points, connectNulls).filter((segment) => segment.length > 0);
98
+ if (!decimation ||
99
+ !Number.isFinite(decimation.maxPoints) ||
100
+ decimation.maxPoints <= 0) {
101
+ return segments;
102
+ }
103
+ const totalPointCount = segments.reduce((sum, segment) => sum + segment.length, 0);
104
+ const maxPoints = Math.floor(decimation.maxPoints);
105
+ if (totalPointCount <= maxPoints) {
106
+ return segments;
107
+ }
108
+ const budgets = allocateSegmentBudgets(segments, maxPoints);
109
+ return segments.map((segment, index) => decimateMinMaxSegment(segment, budgets[index] ?? segment.length));
110
+ };
@@ -0,0 +1,5 @@
1
+ import type { BuildLinePathOptions, GeometryPoint, LinePathModel } from "./types";
2
+ export declare const splitDefinedSegments: <TPoint extends GeometryPoint = GeometryPoint>(points: TPoint[], connectNulls?: boolean) => TPoint[][];
3
+ export declare const buildLineSegmentPath: <TPoint extends GeometryPoint>(points: TPoint[], curve?: BuildLinePathOptions<TPoint>["curve"]) => string;
4
+ export declare const buildLinePath: <TPoint extends GeometryPoint = GeometryPoint>({ points, curve, connectNulls, decimation }: BuildLinePathOptions<TPoint>) => LinePathModel<TPoint>;
5
+ //# sourceMappingURL=linePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linePath.d.ts","sourceRoot":"","sources":["../../src/geometry/linePath.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EAEb,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,oBAAoB,GAC/B,MAAM,SAAS,aAAa,GAAG,aAAa,EAE5C,QAAQ,MAAM,EAAE,EAChB,sBAAoB,KACnB,MAAM,EAAE,EAAiD,CAAC;AAgH7D,eAAO,MAAM,oBAAoB,GAAI,MAAM,SAAS,aAAa,EAC/D,QAAQ,MAAM,EAAE,EAChB,QAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAY,WAexD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,MAAM,SAAS,aAAa,GAAG,aAAa,EAAE,6CAKzE,oBAAoB,CAAC,MAAM,CAAC,KAAG,aAAa,CAAC,MAAM,CAcrD,CAAC"}
@@ -0,0 +1,98 @@
1
+ import { cubicCommand, horizontalCommand, pointCommand, verticalCommand } from "./path";
2
+ import { getDecimatedLinePathSegments, splitLinePathSegments } from "./lineDecimation";
3
+ export const splitDefinedSegments = (points, connectNulls = false) => splitLinePathSegments(points, connectNulls);
4
+ const buildLinearSegmentPath = (points) => {
5
+ return points
6
+ .map((point, index) => pointCommand(index === 0 ? "M" : "L", point.x, point.y))
7
+ .join(" ");
8
+ };
9
+ const buildStepSegmentPath = (points) => {
10
+ if (points.length === 0) {
11
+ return "";
12
+ }
13
+ const first = points[0];
14
+ if (!first) {
15
+ return "";
16
+ }
17
+ const rest = points.slice(1);
18
+ let path = pointCommand("M", first.x, first.y);
19
+ let previous = first;
20
+ rest.forEach((point) => {
21
+ const midpoint = previous.x + (point.x - previous.x) / 2;
22
+ path = [
23
+ path,
24
+ horizontalCommand(midpoint),
25
+ verticalCommand(point.y),
26
+ horizontalCommand(point.x)
27
+ ].join(" ");
28
+ previous = point;
29
+ });
30
+ return path;
31
+ };
32
+ const isStrictlyIncreasingX = (points) => {
33
+ return points.every((point, index) => {
34
+ return index === 0 || point.x > points[index - 1].x;
35
+ });
36
+ };
37
+ const buildMonotoneSegmentPath = (points) => {
38
+ if (points.length < 3 || !isStrictlyIncreasingX(points)) {
39
+ return buildLinearSegmentPath(points);
40
+ }
41
+ const slopes = points.slice(0, -1).map((point, index) => {
42
+ const next = points[index + 1];
43
+ return (next.y - point.y) / (next.x - point.x);
44
+ });
45
+ const tangents = points.map((_, index) => {
46
+ if (index === 0) {
47
+ return slopes[0];
48
+ }
49
+ if (index === points.length - 1) {
50
+ return slopes[slopes.length - 1];
51
+ }
52
+ const previousSlope = slopes[index - 1];
53
+ const nextSlope = slopes[index];
54
+ if (previousSlope * nextSlope <= 0) {
55
+ return 0;
56
+ }
57
+ const sign = Math.sign(previousSlope);
58
+ return (sign *
59
+ Math.min(Math.abs(previousSlope), Math.abs(nextSlope), Math.abs((previousSlope + nextSlope) / 2)));
60
+ });
61
+ let path = pointCommand("M", points[0].x, points[0].y);
62
+ for (let index = 0; index < points.length - 1; index++) {
63
+ const point = points[index];
64
+ const next = points[index + 1];
65
+ const deltaX = next.x - point.x;
66
+ path = [
67
+ path,
68
+ cubicCommand(point.x + deltaX / 3, point.y + (tangents[index] * deltaX) / 3, next.x - deltaX / 3, next.y - (tangents[index + 1] * deltaX) / 3, next.x, next.y)
69
+ ].join(" ");
70
+ }
71
+ return path;
72
+ };
73
+ export const buildLineSegmentPath = (points, curve = "linear") => {
74
+ if (points.length === 0) {
75
+ return "";
76
+ }
77
+ if (curve === "step") {
78
+ return buildStepSegmentPath(points);
79
+ }
80
+ if (curve === "monotone") {
81
+ return buildMonotoneSegmentPath(points);
82
+ }
83
+ return buildLinearSegmentPath(points);
84
+ };
85
+ export const buildLinePath = ({ points, curve = "linear", connectNulls = false, decimation }) => {
86
+ const segments = getDecimatedLinePathSegments({
87
+ points,
88
+ connectNulls,
89
+ decimation
90
+ }).map((segment) => ({
91
+ points: segment,
92
+ path: buildLineSegmentPath(segment, curve)
93
+ }));
94
+ return {
95
+ segments,
96
+ path: segments.map((segment) => segment.path).join(" ")
97
+ };
98
+ };
@@ -0,0 +1,29 @@
1
+ import type { ChartXValue, NormalizedDataPoint, NormalizedSeries } from "../data";
2
+ import type { BuildAreaPathOptions, GeometryPoint, LineCurve, LinePathModel } from "./types";
3
+ export type ProjectedLinePoint<TData = unknown> = GeometryPoint<TData> & {
4
+ dataIndex: number;
5
+ seriesKey: string;
6
+ xValue: ChartXValue;
7
+ };
8
+ export type ProjectScale<TData = unknown> = (value: ChartXValue, point: NormalizedDataPoint<TData>) => number | undefined;
9
+ export type ProjectValueScale<TData = unknown> = (value: number, point: NormalizedDataPoint<TData>) => number | undefined;
10
+ export type BuildLineSeriesGeometryOptions<TData = unknown> = {
11
+ series: NormalizedSeries<TData>;
12
+ xScale: ProjectScale<TData>;
13
+ yScale: ProjectValueScale<TData>;
14
+ curve?: LineCurve;
15
+ connectNulls?: boolean;
16
+ dataIndexOffset?: number;
17
+ pathDecimation?: BuildAreaPathOptions<ProjectedLinePoint<TData>>["decimation"];
18
+ areaBaselineY?: BuildAreaPathOptions<ProjectedLinePoint<TData>>["baselineY"];
19
+ };
20
+ export type LineSeriesGeometry<TData = unknown> = {
21
+ key: string;
22
+ label: string;
23
+ color?: string;
24
+ points: Array<ProjectedLinePoint<TData>>;
25
+ line: LinePathModel<ProjectedLinePoint<TData>>;
26
+ area?: LinePathModel<ProjectedLinePoint<TData>>;
27
+ };
28
+ export declare const buildLineSeriesGeometry: <TData = unknown>({ series, xScale, yScale, curve, connectNulls, dataIndexOffset, pathDecimation, areaBaselineY }: BuildLineSeriesGeometryOptions<TData>) => LineSeriesGeometry<TData>;
29
+ //# sourceMappingURL=lineSeries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineSeries.d.ts","sourceRoot":"","sources":["../../src/geometry/lineSeries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,kBAAkB,CAAC,KAAK,GAAG,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,GAAG;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,KAAK,GAAG,OAAO,IAAI,CAC1C,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC,KAC9B,MAAM,GAAG,SAAS,CAAC;AAExB,MAAM,MAAM,iBAAiB,CAAC,KAAK,GAAG,OAAO,IAAI,CAC/C,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC,KAC9B,MAAM,GAAG,SAAS,CAAC;AAExB,MAAM,MAAM,8BAA8B,CAAC,KAAK,GAAG,OAAO,IAAI;IAC5D,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC5B,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,oBAAoB,CACnC,kBAAkB,CAAC,KAAK,CAAC,CAC1B,CAAC,YAAY,CAAC,CAAC;IAChB,aAAa,CAAC,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;CAC9E,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,KAAK,GAAG,OAAO,IAAI;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,IAAI,EAAE,aAAa,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,IAAI,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;CACjD,CAAC;AAkCF,eAAO,MAAM,uBAAuB,GAAI,KAAK,GAAG,OAAO,EAAE,iGAStD,8BAA8B,CAAC,KAAK,CAAC,KAAG,kBAAkB,CAAC,KAAK,CAgClE,CAAC"}