p1-charts 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (444) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +334 -2
  3. package/dist/CategoryBarChart-YEJ9VB8h.js +453 -0
  4. package/dist/CategoryBarChart-YEJ9VB8h.js.map +1 -0
  5. package/dist/Heatmap-C1XcTUg1.js +777 -0
  6. package/dist/Heatmap-C1XcTUg1.js.map +1 -0
  7. package/dist/PieLegend-BZsv9IbF.js +729 -0
  8. package/dist/PieLegend-BZsv9IbF.js.map +1 -0
  9. package/dist/PolarChart-BUEhn3CI.js +334 -0
  10. package/dist/PolarChart-BUEhn3CI.js.map +1 -0
  11. package/dist/Sparkline-DtNhxGVo.js +67 -0
  12. package/dist/Sparkline-DtNhxGVo.js.map +1 -0
  13. package/dist/TimeSeriesChart-BIwJxgnD.js +1917 -0
  14. package/dist/TimeSeriesChart-BIwJxgnD.js.map +1 -0
  15. package/dist/bin.utils-Ch1y7YDn.js +40 -0
  16. package/dist/bin.utils-Ch1y7YDn.js.map +1 -0
  17. package/dist/category.d.ts +7 -0
  18. package/dist/category.d.ts.map +1 -0
  19. package/dist/category.js +4 -0
  20. package/dist/charts/BarChart/index.d.ts +3 -0
  21. package/dist/charts/BarChart/index.d.ts.map +1 -0
  22. package/dist/charts/CandlestickChart/index.d.ts +3 -0
  23. package/dist/charts/CandlestickChart/index.d.ts.map +1 -0
  24. package/dist/charts/CategoryBarChart/index.d.ts +3 -0
  25. package/dist/charts/CategoryBarChart/index.d.ts.map +1 -0
  26. package/dist/charts/ChartPanes/index.d.ts +3 -0
  27. package/dist/charts/ChartPanes/index.d.ts.map +1 -0
  28. package/dist/charts/Heatmap/index.d.ts +3 -0
  29. package/dist/charts/Heatmap/index.d.ts.map +1 -0
  30. package/dist/charts/HistogramChart/index.d.ts +3 -0
  31. package/dist/charts/HistogramChart/index.d.ts.map +1 -0
  32. package/dist/charts/HistogramPane/index.d.ts +3 -0
  33. package/dist/charts/HistogramPane/index.d.ts.map +1 -0
  34. package/dist/charts/LineChart/index.d.ts +3 -0
  35. package/dist/charts/LineChart/index.d.ts.map +1 -0
  36. package/dist/charts/PieChart/index.d.ts +8 -0
  37. package/dist/charts/PieChart/index.d.ts.map +1 -0
  38. package/dist/charts/PolarChart/index.d.ts +3 -0
  39. package/dist/charts/PolarChart/index.d.ts.map +1 -0
  40. package/dist/charts/ScatterChart/index.d.ts +3 -0
  41. package/dist/charts/ScatterChart/index.d.ts.map +1 -0
  42. package/dist/charts/SeriesChart/index.d.ts +7 -0
  43. package/dist/charts/SeriesChart/index.d.ts.map +1 -0
  44. package/dist/charts/Sparkline/index.d.ts +4 -0
  45. package/dist/charts/Sparkline/index.d.ts.map +1 -0
  46. package/dist/charts/TimeSeriesChart/index.d.ts +3 -0
  47. package/dist/charts/TimeSeriesChart/index.d.ts.map +1 -0
  48. package/dist/charts/TimelineChart/index.d.ts +4 -0
  49. package/dist/charts/TimelineChart/index.d.ts.map +1 -0
  50. package/dist/charts/TimelinePane/index.d.ts +3 -0
  51. package/dist/charts/TimelinePane/index.d.ts.map +1 -0
  52. package/dist/components/BandLegend/index.d.ts +3 -0
  53. package/dist/components/BandLegend/index.d.ts.map +1 -0
  54. package/dist/components/ChartThemeProvider/index.d.ts +8 -0
  55. package/dist/components/ChartThemeProvider/index.d.ts.map +1 -0
  56. package/dist/components/HeatmapAxis/index.d.ts +3 -0
  57. package/dist/components/HeatmapAxis/index.d.ts.map +1 -0
  58. package/dist/components/HeatmapCells/index.d.ts +3 -0
  59. package/dist/components/HeatmapCells/index.d.ts.map +1 -0
  60. package/dist/components/HeatmapLegend/index.d.ts +3 -0
  61. package/dist/components/HeatmapLegend/index.d.ts.map +1 -0
  62. package/dist/components/HeatmapMarks/index.d.ts +3 -0
  63. package/dist/components/HeatmapMarks/index.d.ts.map +1 -0
  64. package/dist/components/HeatmapTooltip/index.d.ts +3 -0
  65. package/dist/components/HeatmapTooltip/index.d.ts.map +1 -0
  66. package/dist/components/InteractionSlots/index.d.ts +3 -0
  67. package/dist/components/InteractionSlots/index.d.ts.map +1 -0
  68. package/dist/components/PieCenter/index.d.ts +4 -0
  69. package/dist/components/PieCenter/index.d.ts.map +1 -0
  70. package/dist/components/PieLabels/index.d.ts +4 -0
  71. package/dist/components/PieLabels/index.d.ts.map +1 -0
  72. package/dist/components/PieLegend/index.d.ts +4 -0
  73. package/dist/components/PieLegend/index.d.ts.map +1 -0
  74. package/dist/components/PieRails/index.d.ts +4 -0
  75. package/dist/components/PieRails/index.d.ts.map +1 -0
  76. package/dist/components/PieSlices/index.d.ts +4 -0
  77. package/dist/components/PieSlices/index.d.ts.map +1 -0
  78. package/dist/components/PieTooltip/index.d.ts +4 -0
  79. package/dist/components/PieTooltip/index.d.ts.map +1 -0
  80. package/dist/css-C-rsk7-l.js +475 -0
  81. package/dist/css-C-rsk7-l.js.map +1 -0
  82. package/dist/dom.utils-CKMWLto-.js +14 -0
  83. package/dist/dom.utils-CKMWLto-.js.map +1 -0
  84. package/dist/heatmap-CIBukkjS.js +17 -0
  85. package/dist/heatmap-CIBukkjS.js.map +1 -0
  86. package/dist/heatmap.d.ts +7 -0
  87. package/dist/heatmap.d.ts.map +1 -0
  88. package/dist/heatmap.js +3 -0
  89. package/dist/hooks/useAnchor.d.ts +6 -0
  90. package/dist/hooks/useAnchor.d.ts.map +1 -0
  91. package/dist/hooks/useAutoBucket.d.ts +6 -0
  92. package/dist/hooks/useAutoBucket.d.ts.map +1 -0
  93. package/dist/hooks/useBands.d.ts +12 -0
  94. package/dist/hooks/useBands.d.ts.map +1 -0
  95. package/dist/hooks/useChart.d.ts +5 -0
  96. package/dist/hooks/useChart.d.ts.map +1 -0
  97. package/dist/hooks/useChartEvents.d.ts +17 -0
  98. package/dist/hooks/useChartEvents.d.ts.map +1 -0
  99. package/dist/hooks/useChartTheme.d.ts +3 -0
  100. package/dist/hooks/useChartTheme.d.ts.map +1 -0
  101. package/dist/hooks/useControllable.d.ts +2 -0
  102. package/dist/hooks/useControllable.d.ts.map +1 -0
  103. package/dist/hooks/useCrosshairBand.d.ts +6 -0
  104. package/dist/hooks/useCrosshairBand.d.ts.map +1 -0
  105. package/dist/hooks/useHeatmap.d.ts +26 -0
  106. package/dist/hooks/useHeatmap.d.ts.map +1 -0
  107. package/dist/hooks/useHeatmapInteraction.d.ts +24 -0
  108. package/dist/hooks/useHeatmapInteraction.d.ts.map +1 -0
  109. package/dist/hooks/useHeatmapSelection.d.ts +16 -0
  110. package/dist/hooks/useHeatmapSelection.d.ts.map +1 -0
  111. package/dist/hooks/useHeatmapState.d.ts +18 -0
  112. package/dist/hooks/useHeatmapState.d.ts.map +1 -0
  113. package/dist/hooks/useHeatmapSteps.d.ts +7 -0
  114. package/dist/hooks/useHeatmapSteps.d.ts.map +1 -0
  115. package/dist/hooks/useInteractions.d.ts +9 -0
  116. package/dist/hooks/useInteractions.d.ts.map +1 -0
  117. package/dist/hooks/useKeyboardNav.d.ts +9 -0
  118. package/dist/hooks/useKeyboardNav.d.ts.map +1 -0
  119. package/dist/hooks/useLiveFollow.d.ts +8 -0
  120. package/dist/hooks/useLiveFollow.d.ts.map +1 -0
  121. package/dist/hooks/useNowLine.d.ts +4 -0
  122. package/dist/hooks/useNowLine.d.ts.map +1 -0
  123. package/dist/hooks/useOverlays.d.ts +6 -0
  124. package/dist/hooks/useOverlays.d.ts.map +1 -0
  125. package/dist/hooks/usePaneRanges.d.ts +5 -0
  126. package/dist/hooks/usePaneRanges.d.ts.map +1 -0
  127. package/dist/hooks/usePaneSeries.d.ts +19 -0
  128. package/dist/hooks/usePaneSeries.d.ts.map +1 -0
  129. package/dist/hooks/usePieChart.d.ts +112 -0
  130. package/dist/hooks/usePieChart.d.ts.map +1 -0
  131. package/dist/hooks/usePieDrill.d.ts +9 -0
  132. package/dist/hooks/usePieDrill.d.ts.map +1 -0
  133. package/dist/hooks/usePieState.d.ts +91 -0
  134. package/dist/hooks/usePieState.d.ts.map +1 -0
  135. package/dist/hooks/usePieTween.d.ts +3 -0
  136. package/dist/hooks/usePieTween.d.ts.map +1 -0
  137. package/dist/hooks/usePriceFlash.d.ts +6 -0
  138. package/dist/hooks/usePriceFlash.d.ts.map +1 -0
  139. package/dist/hooks/usePriceLines.d.ts +4 -0
  140. package/dist/hooks/usePriceLines.d.ts.map +1 -0
  141. package/dist/hooks/useRangePreset.d.ts +6 -0
  142. package/dist/hooks/useRangePreset.d.ts.map +1 -0
  143. package/dist/hooks/useRangeSelect.d.ts +7 -0
  144. package/dist/hooks/useRangeSelect.d.ts.map +1 -0
  145. package/dist/hooks/useSeriesData.d.ts +6 -0
  146. package/dist/hooks/useSeriesData.d.ts.map +1 -0
  147. package/dist/hooks/useSeriesTheme.d.ts +9 -0
  148. package/dist/hooks/useSeriesTheme.d.ts.map +1 -0
  149. package/dist/hooks/useVisibleStats.d.ts +6 -0
  150. package/dist/hooks/useVisibleStats.d.ts.map +1 -0
  151. package/dist/hooks/useWheelZoom.d.ts +5 -0
  152. package/dist/hooks/useWheelZoom.d.ts.map +1 -0
  153. package/dist/index.d.ts +63 -0
  154. package/dist/index.d.ts.map +1 -0
  155. package/dist/index.js +455 -0
  156. package/dist/index.js.map +1 -0
  157. package/dist/motion.utils-C1eaZJdQ.js +9 -0
  158. package/dist/motion.utils-C1eaZJdQ.js.map +1 -0
  159. package/dist/pie.d.ts +7 -0
  160. package/dist/pie.d.ts.map +1 -0
  161. package/dist/pie.js +3 -0
  162. package/dist/primitives/RibbonPrimitive.d.ts +28 -0
  163. package/dist/primitives/RibbonPrimitive.d.ts.map +1 -0
  164. package/dist/primitives/TimeRangePrimitive.d.ts +17 -0
  165. package/dist/primitives/TimeRangePrimitive.d.ts.map +1 -0
  166. package/dist/scatter.d.ts +7 -0
  167. package/dist/scatter.d.ts.map +1 -0
  168. package/dist/scatter.js +3 -0
  169. package/dist/series.d.ts +13 -0
  170. package/dist/series.d.ts.map +1 -0
  171. package/dist/series.js +4 -0
  172. package/dist/sparkline.d.ts +5 -0
  173. package/dist/sparkline.d.ts.map +1 -0
  174. package/dist/sparkline.js +3 -0
  175. package/dist/styles/heatmap.d.ts +6 -0
  176. package/dist/styles/heatmap.d.ts.map +1 -0
  177. package/dist/styles/pieChart.d.ts +15 -0
  178. package/dist/styles/pieChart.d.ts.map +1 -0
  179. package/dist/styles/seriesChart.d.ts +12 -0
  180. package/dist/styles/seriesChart.d.ts.map +1 -0
  181. package/dist/styles/shared.d.ts +4 -0
  182. package/dist/styles/shared.d.ts.map +1 -0
  183. package/dist/theme.d.ts +6 -0
  184. package/dist/theme.d.ts.map +1 -0
  185. package/dist/theme.js +4 -0
  186. package/dist/theme.utils-CP1XtGIe.js +316 -0
  187. package/dist/theme.utils-CP1XtGIe.js.map +1 -0
  188. package/dist/themes/css.d.ts +33 -0
  189. package/dist/themes/css.d.ts.map +1 -0
  190. package/dist/themes/p1.d.ts +13 -0
  191. package/dist/themes/p1.d.ts.map +1 -0
  192. package/dist/themes/p1.tokens.d.ts +259 -0
  193. package/dist/themes/p1.tokens.d.ts.map +1 -0
  194. package/dist/tooltip.utils-D7xaBSUK.js +24 -0
  195. package/dist/tooltip.utils-D7xaBSUK.js.map +1 -0
  196. package/dist/types/bands.d.ts +43 -0
  197. package/dist/types/bands.d.ts.map +1 -0
  198. package/dist/types/candlestick.d.ts +18 -0
  199. package/dist/types/candlestick.d.ts.map +1 -0
  200. package/dist/types/category.d.ts +65 -0
  201. package/dist/types/category.d.ts.map +1 -0
  202. package/dist/types/chart.d.ts +41 -0
  203. package/dist/types/chart.d.ts.map +1 -0
  204. package/dist/types/heatmap.d.ts +136 -0
  205. package/dist/types/heatmap.d.ts.map +1 -0
  206. package/dist/types/heatmapParts.d.ts +68 -0
  207. package/dist/types/heatmapParts.d.ts.map +1 -0
  208. package/dist/types/interaction.d.ts +94 -0
  209. package/dist/types/interaction.d.ts.map +1 -0
  210. package/dist/types/layout.d.ts +40 -0
  211. package/dist/types/layout.d.ts.map +1 -0
  212. package/dist/types/panes.d.ts +46 -0
  213. package/dist/types/panes.d.ts.map +1 -0
  214. package/dist/types/pie.d.ts +120 -0
  215. package/dist/types/pie.d.ts.map +1 -0
  216. package/dist/types/pieParts.d.ts +75 -0
  217. package/dist/types/pieParts.d.ts.map +1 -0
  218. package/dist/types/polar.d.ts +49 -0
  219. package/dist/types/polar.d.ts.map +1 -0
  220. package/dist/types/scatter.d.ts +40 -0
  221. package/dist/types/scatter.d.ts.map +1 -0
  222. package/dist/types/series.d.ts +124 -0
  223. package/dist/types/series.d.ts.map +1 -0
  224. package/dist/types/sparkline.d.ts +11 -0
  225. package/dist/types/sparkline.d.ts.map +1 -0
  226. package/dist/types/theme.d.ts +125 -0
  227. package/dist/types/theme.d.ts.map +1 -0
  228. package/dist/types/timeSeries.d.ts +105 -0
  229. package/dist/types/timeSeries.d.ts.map +1 -0
  230. package/dist/types/timeline.d.ts +67 -0
  231. package/dist/types/timeline.d.ts.map +1 -0
  232. package/dist/useChartTheme-B06p_jvu.js +26 -0
  233. package/dist/useChartTheme-B06p_jvu.js.map +1 -0
  234. package/dist/utils/bands.utils.d.ts +12 -0
  235. package/dist/utils/bands.utils.d.ts.map +1 -0
  236. package/dist/utils/bin.utils.d.ts +17 -0
  237. package/dist/utils/bin.utils.d.ts.map +1 -0
  238. package/dist/utils/bucket.utils.d.ts +3 -0
  239. package/dist/utils/bucket.utils.d.ts.map +1 -0
  240. package/dist/utils/candlestick.utils.d.ts +4 -0
  241. package/dist/utils/candlestick.utils.d.ts.map +1 -0
  242. package/dist/utils/canvas.utils.d.ts +7 -0
  243. package/dist/utils/canvas.utils.d.ts.map +1 -0
  244. package/dist/utils/category.utils.d.ts +69 -0
  245. package/dist/utils/category.utils.d.ts.map +1 -0
  246. package/dist/utils/color.utils.d.ts +12 -0
  247. package/dist/utils/color.utils.d.ts.map +1 -0
  248. package/dist/utils/data.utils.d.ts +10 -0
  249. package/dist/utils/data.utils.d.ts.map +1 -0
  250. package/dist/utils/dom.utils.d.ts +3 -0
  251. package/dist/utils/dom.utils.d.ts.map +1 -0
  252. package/dist/utils/editorial.utils.d.ts +18 -0
  253. package/dist/utils/editorial.utils.d.ts.map +1 -0
  254. package/dist/utils/heatmap.utils.d.ts +25 -0
  255. package/dist/utils/heatmap.utils.d.ts.map +1 -0
  256. package/dist/utils/histogram.utils.d.ts +8 -0
  257. package/dist/utils/histogram.utils.d.ts.map +1 -0
  258. package/dist/utils/interaction.utils.d.ts +6 -0
  259. package/dist/utils/interaction.utils.d.ts.map +1 -0
  260. package/dist/utils/layout.utils.d.ts +9 -0
  261. package/dist/utils/layout.utils.d.ts.map +1 -0
  262. package/dist/utils/line.utils.d.ts +8 -0
  263. package/dist/utils/line.utils.d.ts.map +1 -0
  264. package/dist/utils/live.utils.d.ts +12 -0
  265. package/dist/utils/live.utils.d.ts.map +1 -0
  266. package/dist/utils/merge.utils.d.ts +7 -0
  267. package/dist/utils/merge.utils.d.ts.map +1 -0
  268. package/dist/utils/motion.utils.d.ts +2 -0
  269. package/dist/utils/motion.utils.d.ts.map +1 -0
  270. package/dist/utils/ordinal.utils.d.ts +7 -0
  271. package/dist/utils/ordinal.utils.d.ts.map +1 -0
  272. package/dist/utils/pie.utils.d.ts +13 -0
  273. package/dist/utils/pie.utils.d.ts.map +1 -0
  274. package/dist/utils/pieRails.utils.d.ts +7 -0
  275. package/dist/utils/pieRails.utils.d.ts.map +1 -0
  276. package/dist/utils/pieTooltip.utils.d.ts +3 -0
  277. package/dist/utils/pieTooltip.utils.d.ts.map +1 -0
  278. package/dist/utils/pieTween.utils.d.ts +7 -0
  279. package/dist/utils/pieTween.utils.d.ts.map +1 -0
  280. package/dist/utils/pieVisibility.utils.d.ts +3 -0
  281. package/dist/utils/pieVisibility.utils.d.ts.map +1 -0
  282. package/dist/utils/polar.utils.d.ts +7 -0
  283. package/dist/utils/polar.utils.d.ts.map +1 -0
  284. package/dist/utils/range.utils.d.ts +6 -0
  285. package/dist/utils/range.utils.d.ts.map +1 -0
  286. package/dist/utils/scatter.utils.d.ts +25 -0
  287. package/dist/utils/scatter.utils.d.ts.map +1 -0
  288. package/dist/utils/sparkline.utils.d.ts +8 -0
  289. package/dist/utils/sparkline.utils.d.ts.map +1 -0
  290. package/dist/utils/squarify.utils.d.ts +3 -0
  291. package/dist/utils/squarify.utils.d.ts.map +1 -0
  292. package/dist/utils/stats.utils.d.ts +12 -0
  293. package/dist/utils/stats.utils.d.ts.map +1 -0
  294. package/dist/utils/theme.utils.d.ts +18 -0
  295. package/dist/utils/theme.utils.d.ts.map +1 -0
  296. package/dist/utils/time.utils.d.ts +3 -0
  297. package/dist/utils/time.utils.d.ts.map +1 -0
  298. package/dist/utils/timeScale.utils.d.ts +4 -0
  299. package/dist/utils/timeScale.utils.d.ts.map +1 -0
  300. package/dist/utils/timeSeries.utils.d.ts +16 -0
  301. package/dist/utils/timeSeries.utils.d.ts.map +1 -0
  302. package/dist/utils/timeline.utils.d.ts +8 -0
  303. package/dist/utils/timeline.utils.d.ts.map +1 -0
  304. package/dist/utils/tooltip.utils.d.ts +3 -0
  305. package/dist/utils/tooltip.utils.d.ts.map +1 -0
  306. package/dist/utils/visibility.utils.d.ts +2 -0
  307. package/dist/utils/visibility.utils.d.ts.map +1 -0
  308. package/dist/visibility.utils-nMI5a_Et.js +85 -0
  309. package/dist/visibility.utils-nMI5a_Et.js.map +1 -0
  310. package/package.json +94 -4
  311. package/src/category.ts +18 -0
  312. package/src/charts/BarChart/index.tsx +54 -0
  313. package/src/charts/CandlestickChart/index.tsx +44 -0
  314. package/src/charts/CategoryBarChart/index.tsx +373 -0
  315. package/src/charts/ChartPanes/index.tsx +325 -0
  316. package/src/charts/Heatmap/index.tsx +167 -0
  317. package/src/charts/HistogramChart/index.tsx +102 -0
  318. package/src/charts/HistogramPane/index.tsx +5 -0
  319. package/src/charts/LineChart/index.tsx +103 -0
  320. package/src/charts/PieChart/index.tsx +146 -0
  321. package/src/charts/PolarChart/index.tsx +203 -0
  322. package/src/charts/ScatterChart/index.tsx +145 -0
  323. package/src/charts/SeriesChart/index.tsx +229 -0
  324. package/src/charts/Sparkline/index.tsx +40 -0
  325. package/src/charts/TimeSeriesChart/index.tsx +489 -0
  326. package/src/charts/TimelineChart/index.tsx +36 -0
  327. package/src/charts/TimelinePane/index.tsx +5 -0
  328. package/src/components/BandLegend/index.tsx +47 -0
  329. package/src/components/ChartThemeProvider/index.tsx +20 -0
  330. package/src/components/HeatmapAxis/index.tsx +95 -0
  331. package/src/components/HeatmapCells/index.tsx +138 -0
  332. package/src/components/HeatmapLegend/index.tsx +76 -0
  333. package/src/components/HeatmapMarks/index.tsx +75 -0
  334. package/src/components/HeatmapTooltip/index.tsx +84 -0
  335. package/src/components/InteractionSlots/index.tsx +35 -0
  336. package/src/components/PieCenter/index.tsx +80 -0
  337. package/src/components/PieLabels/index.tsx +83 -0
  338. package/src/components/PieLegend/index.tsx +56 -0
  339. package/src/components/PieRails/index.tsx +56 -0
  340. package/src/components/PieSlices/index.tsx +64 -0
  341. package/src/components/PieTooltip/index.tsx +81 -0
  342. package/src/heatmap.ts +13 -0
  343. package/src/hooks/useAnchor.ts +38 -0
  344. package/src/hooks/useAutoBucket.ts +77 -0
  345. package/src/hooks/useBands.ts +99 -0
  346. package/src/hooks/useChart.ts +121 -0
  347. package/src/hooks/useChartEvents.ts +108 -0
  348. package/src/hooks/useChartTheme.ts +13 -0
  349. package/src/hooks/useControllable.ts +7 -0
  350. package/src/hooks/useCrosshairBand.ts +53 -0
  351. package/src/hooks/useHeatmap.ts +109 -0
  352. package/src/hooks/useHeatmapInteraction.ts +51 -0
  353. package/src/hooks/useHeatmapSelection.ts +124 -0
  354. package/src/hooks/useHeatmapState.ts +99 -0
  355. package/src/hooks/useHeatmapSteps.ts +53 -0
  356. package/src/hooks/useInteractions.ts +151 -0
  357. package/src/hooks/useKeyboardNav.ts +121 -0
  358. package/src/hooks/useLiveFollow.ts +110 -0
  359. package/src/hooks/useNowLine.ts +36 -0
  360. package/src/hooks/useOverlays.ts +66 -0
  361. package/src/hooks/usePaneRanges.ts +62 -0
  362. package/src/hooks/usePaneSeries.ts +194 -0
  363. package/src/hooks/usePieChart.ts +138 -0
  364. package/src/hooks/usePieDrill.ts +33 -0
  365. package/src/hooks/usePieState.ts +191 -0
  366. package/src/hooks/usePieTween.ts +56 -0
  367. package/src/hooks/usePriceFlash.ts +53 -0
  368. package/src/hooks/usePriceLines.ts +19 -0
  369. package/src/hooks/useRangePreset.ts +45 -0
  370. package/src/hooks/useRangeSelect.ts +123 -0
  371. package/src/hooks/useSeriesData.ts +47 -0
  372. package/src/hooks/useSeriesTheme.ts +65 -0
  373. package/src/hooks/useVisibleStats.ts +42 -0
  374. package/src/hooks/useWheelZoom.ts +51 -0
  375. package/src/index.ts +240 -0
  376. package/src/pie.ts +13 -0
  377. package/src/primitives/RibbonPrimitive.ts +119 -0
  378. package/src/primitives/TimeRangePrimitive.ts +180 -0
  379. package/src/scatter.ts +7 -0
  380. package/src/series.ts +29 -0
  381. package/src/sparkline.ts +5 -0
  382. package/src/styles/heatmap.ts +16 -0
  383. package/src/styles/pieChart.ts +28 -0
  384. package/src/styles/seriesChart.ts +73 -0
  385. package/src/styles/shared.ts +17 -0
  386. package/src/theme.ts +19 -0
  387. package/src/themes/css.ts +60 -0
  388. package/src/themes/p1.tokens.ts +258 -0
  389. package/src/themes/p1.ts +134 -0
  390. package/src/types/bands.ts +50 -0
  391. package/src/types/candlestick.ts +20 -0
  392. package/src/types/category.ts +76 -0
  393. package/src/types/chart.ts +68 -0
  394. package/src/types/heatmap.ts +193 -0
  395. package/src/types/heatmapParts.ts +84 -0
  396. package/src/types/interaction.ts +104 -0
  397. package/src/types/layout.ts +47 -0
  398. package/src/types/panes.ts +66 -0
  399. package/src/types/pie.ts +163 -0
  400. package/src/types/pieParts.ts +91 -0
  401. package/src/types/polar.ts +50 -0
  402. package/src/types/scatter.ts +42 -0
  403. package/src/types/series.ts +205 -0
  404. package/src/types/sparkline.ts +11 -0
  405. package/src/types/theme.ts +119 -0
  406. package/src/types/timeSeries.ts +114 -0
  407. package/src/types/timeline.ts +81 -0
  408. package/src/utils/bands.utils.ts +85 -0
  409. package/src/utils/bin.utils.ts +82 -0
  410. package/src/utils/bucket.utils.ts +29 -0
  411. package/src/utils/candlestick.utils.ts +19 -0
  412. package/src/utils/canvas.utils.ts +39 -0
  413. package/src/utils/category.utils.ts +437 -0
  414. package/src/utils/color.utils.ts +142 -0
  415. package/src/utils/data.utils.ts +126 -0
  416. package/src/utils/dom.utils.ts +10 -0
  417. package/src/utils/editorial.utils.ts +85 -0
  418. package/src/utils/heatmap.utils.ts +168 -0
  419. package/src/utils/histogram.utils.ts +88 -0
  420. package/src/utils/interaction.utils.ts +48 -0
  421. package/src/utils/layout.utils.ts +147 -0
  422. package/src/utils/line.utils.ts +43 -0
  423. package/src/utils/live.utils.ts +92 -0
  424. package/src/utils/merge.utils.ts +87 -0
  425. package/src/utils/motion.utils.ts +6 -0
  426. package/src/utils/ordinal.utils.ts +38 -0
  427. package/src/utils/pie.utils.ts +193 -0
  428. package/src/utils/pieRails.utils.ts +15 -0
  429. package/src/utils/pieTooltip.utils.ts +18 -0
  430. package/src/utils/pieTween.utils.ts +47 -0
  431. package/src/utils/pieVisibility.utils.ts +18 -0
  432. package/src/utils/polar.utils.ts +61 -0
  433. package/src/utils/range.utils.ts +54 -0
  434. package/src/utils/scatter.utils.ts +98 -0
  435. package/src/utils/sparkline.utils.ts +87 -0
  436. package/src/utils/squarify.utils.ts +85 -0
  437. package/src/utils/stats.utils.ts +43 -0
  438. package/src/utils/theme.utils.ts +277 -0
  439. package/src/utils/time.utils.ts +30 -0
  440. package/src/utils/timeScale.utils.ts +76 -0
  441. package/src/utils/timeSeries.utils.ts +91 -0
  442. package/src/utils/timeline.utils.ts +98 -0
  443. package/src/utils/tooltip.utils.ts +15 -0
  444. package/src/utils/visibility.utils.ts +18 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 mathematiques ltd
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,335 @@
1
- # Temporary Holding Version
1
+ # p1-charts
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Reusable chart components for React.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install p1-charts lightweight-charts
9
+ ```
10
+
11
+ Peer dependencies: `react` and `react-dom` (>= 18), and `lightweight-charts` (^5.2.1).
12
+
13
+ ## Usage
14
+
15
+ ```tsx
16
+ import { TimeSeriesChart } from "p1-charts";
17
+ ```
18
+
19
+ Subpath imports keep a page from loading charts it does not draw:
20
+
21
+ | Import | What it contains |
22
+ | --- | --- |
23
+ | `p1-charts/series` | `TimeSeriesChart`, line, bar, histogram, candlestick, ribbons |
24
+ | `p1-charts/pie` | `PieChart` |
25
+ | `p1-charts/heatmap` | `Heatmap` |
26
+ | `p1-charts/scatter` | `ScatterChart`, `PolarChart` |
27
+ | `p1-charts/category` | `CategoryBarChart`, `bin` |
28
+ | `p1-charts/sparkline` | `Sparkline` |
29
+ | `p1-charts/theme` | `p1Theme`, `p1ThemeFromCss`, `createTheme` |
30
+
31
+ Peer dependencies: `react`, `react-dom` (>= 18), and `lightweight-charts` (^5.2.1). The sparkline, pie, heatmap, scatter, and category entries do not mount a Lightweight Charts instance. `lightweight-charts` stays a peer so the app and this package share one copy.
32
+
33
+ ## Publishing
34
+
35
+ ```bash
36
+ npm run build # also runs on prepack
37
+ npm publish
38
+ ```
39
+
40
+ The package is unscoped (`p1-charts`). `prepack` builds `dist/` before the tarball is packed. Do not commit `dist/`.
41
+
42
+ ## Charts
43
+
44
+ | Job | Component |
45
+ | --- | --- |
46
+ | Several series, two scales, lines, areas, columns | `TimeSeriesChart` |
47
+ | Fill between two value lines (P10–P90) | `TimeSeriesChart` `ribbons` |
48
+ | Full-height tint over a time range (a regime) | `LineChart` `bands` |
49
+ | One series, terminal chrome | `LineChart`, `BarChart`, `HistogramChart`, `CandlestickChart` |
50
+ | Grouped, stacked, or overlaid category columns, horizontal or on two axes | `CategoryBarChart` |
51
+ | Statistical histogram | `bin()`, then `CategoryBarChart` |
52
+ | Columns on a time axis | `BarChart` or `HistogramChart` |
53
+ | Numeric x and y | `ScatterChart` |
54
+ | Wind rose | `PolarChart` (default `mode="bar"`) |
55
+ | Radar polygon | `PolarChart` `mode="line"` |
56
+ | Angle and radius points | `PolarChart` `mode="scatter"` |
57
+ | Two categorical axes | `Heatmap` |
58
+ | Shares of a whole | `PieChart` |
59
+ | Tile-sized trend | `Sparkline` |
60
+
61
+ Three-dimensional scatters, maps, and diagrams stay in the app. `Sparkline` is an SVG and is the chart for a stat tile.
62
+
63
+ `TimeSeriesChart` defaults to the editorial profile: normal crosshair, wheel zoom off (including ctrl-wheel), square axis and crosshair labels, transparent canvas, hairline grid, attribution off, left edge fixed. Pass `profile="terminal"` for a magnet crosshair and the shared wheel hook (scroll on wheel, zoom on ctrl-wheel). That profile does not add price flash, follow-live, range presets, or jump-to-live. Those stay on line, bar, histogram, and candlestick, which keep the terminal surface: magnet crosshair, price flash on a live tick, follow-live, ctrl-wheel zoom, range presets, auto-bucket on zoom, anchor, visible stats, opt-in legend, tooltip, pin on click, keyboard navigation, and the jump-to-live button.
64
+
65
+ ### Time series
66
+
67
+ ```tsx
68
+ <TimeSeriesChart
69
+ ariaLabel="Daily traffic"
70
+ series={[
71
+ { id: "visitors", name: "Visitors", kind: "histogram", priceScale: "left", data: visitors },
72
+ { id: "new", name: "New", kind: "line", priceScale: "left", lineStyle: "dashed", data: newcomers },
73
+ { id: "revenue", name: "Revenue", kind: "line", priceScale: "right", data: revenue },
74
+ ]}
75
+ ribbons={[{ upper: p90, lower: p10, opacity: 0.16 }]}
76
+ markers={[{ seriesId: "median", time: "2026-02-01", shape: "circle", text: "model" }]}
77
+ formatValue={(id, value) => (id === "revenue" ? `€${value}` : String(value))}
78
+ />
79
+ ```
80
+
81
+ Points are `{ time, value }`. `time` is a unix timestamp in seconds, an ISO string, or a `Date`. Rows are sorted by time. A repeated time keeps the last finite value. A non-finite value is dropped.
82
+
83
+ | Field | Meaning |
84
+ | --- | --- |
85
+ | `series[].kind` | `"line"` (default), `"area"`, or `"histogram"` |
86
+ | `series[].priceScale` | `"right"` (default) or `"left"`. A scale is shown when a series or a ribbon uses it |
87
+ | `series[].lineStyle` | `"solid"` (default), `"dashed"`, or `"dotted"`. Line and area only |
88
+ | `series[].lineWidth` | `1` to `4`. Line defaults to `2`, area and histogram to `1` |
89
+ | `series[].color` | Falls back to `palette.categorical` in series order |
90
+ | `series[].includeInTooltip` | `false` keeps the series on the chart and out of the tooltip |
91
+ | `series[].lastValueVisible` | Default `false`. The price line stays off |
92
+ | `ribbons[]` | Fill between `upper` and `lower` where both have the same time. `opacity` defaults to `0.16`. The ribbon attaches to a series on the same scale, or to the first series |
93
+ | `markers[]` | `seriesId` must match a series. `shape` is `circle` (default), `square`, `arrowUp`, or `arrowDown`. `position` is `inBar` (default), `aboveBar`, or `belowBar` |
94
+ | `profile` | `"editorial"` (default) or `"terminal"` |
95
+ | `axis` | `"time"` (default) or `"ordinal"` |
96
+ | `height` | Default `340` |
97
+ | `timeVisible` | Default `false`, so the scale prints the date. `true` prints the time of day as well |
98
+ | `formatTime` | `(unixSeconds) => string`. The default label is `YYYY-MM-DD` |
99
+ | `formatValue` | `(seriesId, value) => string` |
100
+ | `extraTooltipRows` | `(unixSeconds) => rows` appended after the series rows |
101
+ | `renderTooltip` | Replaces the row list. The time heading still renders |
102
+ | `chartOptions` | Deep-merged on top of the profile options, after `autoSize: true` |
103
+ | `ranges` | Full-height bands. `hatch` is a colour, or `false` for a fill only. This is the forecast region, not a ribbon between two lines. Endpoints are times. On an ordinal axis pass the unix-day number (`index * 86400`), because the band does not look up category labels |
104
+ | `guides` | Dashed horizontal lines at a value, on the series that shares `scale`. The price scale includes them, so a threshold above the series stays visible |
105
+ | `onPointClick` | `{ time, points }` for the series that have a value at that time |
106
+ | `ariaLabel` | Default `"Time series chart"`. The canvas is `role="img"` |
107
+
108
+ The time scale is fitted to the data after the series are drawn. A short series fills the frame.
109
+
110
+ The root carries `data-profile` and `data-axis`. The tooltip carries `data-part="tooltip"`, `tooltip-time`, `tooltip-row`, and `swatch` (`data-swatch` is `bar` for a histogram and `line` otherwise). `formatTime`, `formatValue`, `extraTooltipRows`, and `renderTooltip` update without rebuilding the chart.
111
+
112
+ An ordinal axis takes category labels. Point `time` is the label or a 0-based index. Each step is one unix day (`86400` seconds) so the scale can place them. Tick marks and the crosshair both print the category label.
113
+
114
+ ```tsx
115
+ <TimeSeriesChart
116
+ axis="ordinal"
117
+ categories={["Mon", "Tue"]}
118
+ series={[{ id: "mae", name: "MAE", data: [{ time: "Mon", value: 1 }, { time: "Tue", value: 2 }] }]}
119
+ />
120
+ ```
121
+
122
+ Square axis and crosshair labels are a `roundRect` patch scoped to the chart element, installed only for the editorial profile and only in a browser that provides `CanvasRenderingContext2D`. `editorialChartOptions` and `patchSquareCanvasLabels` are exported for a chart built outside this component. Pass `typography.axis.family` from `next/font` or from `p1ThemeFromCss`. The fallback family is `ui-sans-serif, system-ui, sans-serif`.
123
+
124
+ ### Category bars
125
+
126
+ ```tsx
127
+ <CategoryBarChart
128
+ mode="group"
129
+ categories={["Temp", "Wind"]}
130
+ series={[
131
+ { id: "mae", name: "Avg MAE", data: [1.2, 0.4] },
132
+ { id: "bias", name: "Bias", data: [0.1, -0.2] },
133
+ ]}
134
+ />
135
+ ```
136
+
137
+ `series[].data[i]` is the value for `categories[i]`. A missing or non-finite value is left out of that column and out of the tooltip. The SVG viewBox is 640×320.
138
+
139
+ | Behaviour | Detail |
140
+ | --- | --- |
141
+ | `mode` | `"group"` (default), `"stack"`, or `"overlay"`. Overlay bars share a slot at opacity `0.72`. Stack separates positive and negative runs |
142
+ | `orientation` | `"vertical"` (default) or `"horizontal"`. Horizontal puts the categories on the vertical axis. Arrow keys follow that axis |
143
+ | `series[].scale` | `"left"` (default) or `"right"`. A right scale is a second value axis. Each scale has its own extent |
144
+ | `series[].data` | A number, or `{ value, color?, label? }`. `label` is drawn outside that bar |
145
+ | `domain`, `rightDomain` | `{ min?, max? }` fixes an extent instead of fitting the data |
146
+ | `reference`, `references` | Dashed lines across the plot at `value`, with an optional `label`. Both are drawn |
147
+ | `bands` | A tint between `from` and `to`, behind the bars |
148
+ | `activeIndex` | Category marked when the pointer is not over a bar |
149
+ | `onSelect` | Called with the category label and its index when a bar is clicked or chosen from the keyboard |
150
+ | Keyboard | Left and right move the active category and stop at the ends |
151
+ | Pointer | Entering a bar selects its category |
152
+ | Tooltip | Always shows the active category. `formatValue(seriesId, value)` formats each row. `renderTooltip(category, rows)` replaces the default |
153
+ | Parts | Root `data-mode`. Bars are `data-part="bar"` with `data-series`, `data-category`, and `data-active`. Also `axis`, `tick`, `tooltip`, `tooltip-time`, `tooltip-row` |
154
+ | Label | `ariaLabel` defaults to `"Bar chart"` |
155
+
156
+ `bin(samples, options?)` turns raw observations into `{ from, to, count, label }[]`. The count defaults to Sturges' rule. `bins` sets an equal-width count. `min` and `max` set the domain. `edges` are explicit boundaries: a value lands in `[edge[i], edge[i + 1])`, and the last edge is inclusive. An empty sample list returns `[]`. `HistogramChart` draws columns on a time axis.
157
+
158
+ ```tsx
159
+ const counts = bin(samples, { bins: 12 });
160
+
161
+ <CategoryBarChart
162
+ categories={counts.map((item) => item.label)}
163
+ series={[{ id: "n", name: "Count", data: counts.map((item) => item.count) }]}
164
+ />
165
+ ```
166
+
167
+ ### Scatter, polar, sparkline
168
+
169
+ ```tsx
170
+ <ScatterChart
171
+ ariaLabel="Wind components"
172
+ xLabel="U"
173
+ yLabel="V"
174
+ series={[{ id: "obs", name: "Observed", data: [{ x: 1, y: 2 }] }]}
175
+ />
176
+ <PolarChart
177
+ ariaLabel="Wind rose"
178
+ categories={["N", "NE", "E", "SE", "S", "SW", "W", "NW"]}
179
+ direction="clockwise"
180
+ unit="%"
181
+ series={[{ id: "obs", name: "Observed", data: frequencies }]}
182
+ />
183
+ <Sparkline data={[1, 2, null, 4]} area />
184
+ ```
185
+
186
+ `ScatterChart` plots numeric `{ x, y }` points. The viewBox is 640×360. Arrow keys walk the points in series order and stop at the ends. The active point is the larger mark. `renderTooltip({ series, point, index })` replaces the default `"name x, y"` line. Parts: `grid`, `tick`, `axis-label`, `point` (`data-series`, `data-active`), `tooltip`. `ariaLabel` defaults to `"Scatter chart"`.
187
+
188
+ `PolarChart` defaults to a wind rose. Angle `0` is north. `direction` defaults to `"clockwise"` (`"counterclockwise"` turns the other way). In bar mode each category is one wedge and each series paints that wedge; a value that is not greater than zero is omitted. Sector opacity is `0.72`. `mode="scatter"` plots `{ angle, radius }` with `angle` in degrees. Arrow keys wrap. Parts: root `data-mode` (`bar` or `scatter`), `ring`, `tick`, `unit`, `sector` or `point`, `tooltip`. `renderTooltip({ series, label, value })` replaces the default text. `ariaLabel` defaults to `"Polar chart"`.
189
+
190
+ `Sparkline` is one SVG, 80×22 by default, stroke `currentColor`, width `1.5`. It does not import `lightweight-charts`. `data` accepts `number`, `null`, `undefined`, or `{ value }`. A null, a missing value, or a non-finite number breaks the line into separate `data-part="line"` paths. `area` adds a `data-part="area"` fill at opacity `0.12`. `ariaLabel` defaults to `"Sparkline"`.
191
+
192
+ ### Theme
193
+
194
+ `defaultTheme` stays the neutral Lightweight Charts palette. Pass `theme` on a chart, or wrap a tree in `ChartThemeProvider`. `unstyled` skips the theme fills on the SVG charts.
195
+
196
+ ```tsx
197
+ p1Theme("light");
198
+ p1Theme("dark", { colourBlind: true });
199
+ p1ThemeFromCss();
200
+ p1ThemeFromCss(document.documentElement);
201
+ ```
202
+
203
+ `p1Theme` is the static brand palette. `colourBlind` swaps the up and down colours for the blue and amber pair. `p1ThemeFromCss(element?)` reads computed custom properties (`document.documentElement` when the element is omitted). Outside a browser it resolves to `defaultTheme`. A missing variable keeps the `defaultTheme` value. `var()` chains are followed. `hex`, `rgb()`, `rgba()`, and `oklch()` are resolved to sRGB before they reach a canvas. A `#rrggbb` value stays hex. `withAlpha` and `toSrgb` are exported for the same parsing.
204
+
205
+ | Theme field | Custom property |
206
+ | --- | --- |
207
+ | `palette.background` | `--p1-surface` |
208
+ | `palette.text`, `palette.up`, `palette.now` | `--p1-ink` |
209
+ | `palette.down`, `line.color` | `--p1-primary` |
210
+ | `palette.grid`, `palette.border` | `--p1-line` |
211
+ | `palette.crosshair`, `palette.neutral` | `--p1-ash-shadow` |
212
+ | `typography.axis.family`, `typography.label.family`, `typography.title.family` | `--p1-font-sans` |
213
+ | `typography.value.family` | `--p1-font-mono` |
214
+ | `palette.categorical` | `--p1-primary`, `--p1-blue`, `--p1-amber`, `--p1-ash-shadow`, `--p1-ink` |
215
+
216
+ Set `typography.axis.family` from `next/font` when that family is not published as a custom property on the element yet. The full map is `p1CssVariables`.
217
+
218
+ ### Candlestick
219
+
220
+ Bars are always filled. Color shows the hollow or filled state.
221
+
222
+ | Color | Meaning |
223
+ | ----- | -------------------------------------- |
224
+ | Green | Hollow candle, up bar (Close > Open) |
225
+ | Red | Filled candle, down bar (Close < Open) |
226
+ | Gray | Wick above and/or below the body |
227
+
228
+ ### Candlestick with Trend
229
+
230
+ Body shows bar direction, color shows bar-to-bar trend.
231
+
232
+ | Body | Meaning |
233
+ | ------ | ----------------------- |
234
+ | Hollow | Up bar (Close > Open) |
235
+ | Filled | Down bar (Close < Open) |
236
+
237
+ | Color | Meaning |
238
+ | ----- | ---------------------------------------- |
239
+ | Green | Up trend (Close > previous Close) |
240
+ | Red | Down trend (Close < previous Close) |
241
+ | Gray | No change in Close from the previous bar |
242
+
243
+ Reference: [TradeStation candlestick chart docs](https://help.tradestation.com/10_00/eng/tradestationhelp/charting/candlestick_chart.htm)
244
+
245
+ ### Line
246
+
247
+ `<LineChart data={points} />` plots one value per time. Points are `{ time, value,color? }`; colour drives the flash fallback.
248
+
249
+ ### Bands
250
+
251
+ Full-height tints behind the series, one per time range, coloured by key (for example market regimes). Available on every series chart; edges sit halfway between bars and adjacent bands share an edge.
252
+
253
+ ```tsx
254
+ <LineChart data={prices} bands={regimes} />
255
+ <LineChart data={prices} bands={regimes} bandStyles={{ riskOff: "#c33" }} />
256
+ <LineChart data={prices} bands={regimes} bandStyles={{ riskOff: { fill, label, legendColor } }} />
257
+ ```
258
+
259
+ `regimes` is `{ from, to, key }[]`; a band covers `from` up to, not including, `to`. Colours resolve per key: `palette.categorical[i]` at `theme.bands.opacity` (default `0.15`), then `theme.bands.styles[key]`, then `bandStyles[key]` (a string sets the fill). A legend for the keys present renders top-right; replace it with `renderBandLegend`, or pass `null` to hide it. The hovered band reaches `renderLegend`, `renderTooltip`, `onPointHover` and `onPointClick` as `summary.band` (`{ key, label, from, to, bars }`).
260
+
261
+ ### Range select, reset and log scale
262
+
263
+ Shift-drag selects a time range, zooms to it and calls `onRangeSelect({ from, to, high, low, change, bars, ... })`; Esc cancels. Double-click fits the content and calls `onReset`. Turn them off with `rangeSelect={false}` and `doubleClickReset={false}`. `range` also takes `"3Y"` and `"5Y"`. For a log price scale pass `chartOptions={{ rightPriceScale: { mode: PriceScaleMode.Logarithmic } }}`; removing it restores the linear scale.
264
+
265
+ ### Bar
266
+
267
+ `<BarChart data={points} />` draws the standard bar graph: solid columns from abaseline (default `0`, set with `seriesOptions.base`) to each value, using the samepoints as `<LineChart>` (`{ time, value, color? }`). Columns above the base use`seriesOptions.upColor`, columns at or below use `seriesOptions.downColor` (defaults`#26a69a` / `#ef5350`); a colour on the point itself, or a series-level`seriesOptions.color`, wins over both.
268
+
269
+ ### Pie
270
+
271
+ `<PieChart data={parts} />` draws a pie, or a donut with `innerRadius` (0 to 0.95). Parts are `{ label, value, color? }`, sorted largest first; `maxSlices` folds the tail into one Other slice. A donut shows the total in its hole.
272
+
273
+ ### Pie interactions
274
+
275
+ Every prop is optional and each piece of state is controlled (`x` + `onXChange`) or uncontrolled (`defaultX`). Slices are keyed by label; Other's key is `"other"`.
276
+
277
+ ```tsx
278
+ <PieChart data={cargo} selectionMode="multiple" onSelectionChange={(keys, slices) => {}} />
279
+ <PieChart data={cargo} renderLegend={(entries) => <PieLegend entries={entries} />} />
280
+ <PieChart data={cargo} renderTooltip={(slice, { source, x, y }) => <Tip slice={slice} />} />
281
+ <PieChart data={cargo} maxSlices={5} drillOther renderBreadcrumb={({ other, back }) => <Crumb />} />
282
+ ```
283
+
284
+ | Behaviour | Trigger | Props |
285
+ | --------- | ------- | ----- |
286
+ | Active | Hover a slice or its label, keyboard focus, legend hover | `activeKey`, `onActiveChange(slice, source)`, `emphasis` (`"dim"` default, `"none"`) |
287
+ | Selection | Click, Enter or Space; Esc clears | `selectionMode` (`"none"` default, `"single"`, `"multiple"`), `selectedKeys`, `defaultSelectedKeys`, `onSelectionChange` |
288
+ | Visibility | Legend click hides, Shift+click shows only that slice; the last visible slice cannot be hidden | `hiddenKeys`, `defaultHiddenKeys`, `onHiddenChange` |
289
+ | Legend | Renders only what you return | `renderLegend(entries)`, optional unstyled `PieLegend` |
290
+ | Tooltip | Follows the pointer, sits at the slice centre for keyboard, flips at the edges | `renderTooltip(slice, { source, x, y })` |
291
+ | Drill | Click or Enter on Other opens its parts; Esc (after clearing the selection) or `back` returns | `drillOther`, `onDrill(other \| null)`, `renderBreadcrumb({ other, back })` |
292
+ | Motion | Data, visibility and level changes sweep the angles over 240 ms; off for reduced motion | `animate` (`true`, `false` or `{ duration, easing }`) |
293
+
294
+ Selection props do nothing until `selectionMode` is set, the same as React Aria. Shares renormalise to the visible total; each slice also keeps `shareOfAll`. The library ships behaviour, positions, `data-part` and `data-*` attributes and ARIA only: style the parts (`slice`, `label`, `leader`, `center`, `selection`, `focus`, `legend`, `legend-item`, `tooltip`, `breadcrumb`) with the theme's `pie` slot (`dimOpacity`, `selection`, `focus`), `classNames` / `styles`, or CSS on `data-active`, `data-dimmed`, `data-selected`, `data-hidden`, `data-other` and `data-focus-visible`. `usePieState` exposes the same state for a fully custom renderer.
295
+
296
+ ### Heatmap
297
+
298
+ `<Heatmap rows={days} cols={hours} value={(day, hour, r, c) => price[r][c]} />` draws one value over two categorical axes as square cells coloured by a quantised step, not a gradient, so the legend can state each range. `value` may return `null` for a gap: the cell is hatched, still focusable, announced as "no data" and left out of the scale and the stats.
299
+
300
+ ```tsx
301
+ <Heatmap rows={days} cols={hours} value={v} steps={[50, 75, 100, 125]} unit="€/MWh" markExtreme="max" />
302
+ <Heatmap rows={days} cols={hours} value={v} scale="quantile" showValues />
303
+ <Heatmap rows={days} cols={hours} value={v} selectionMode="range" onSelectionChange={(range, stats) => {}} renderTooltip={(cell) => <Tip {...cell} />} />
304
+ ```
305
+
306
+ | Behaviour | Trigger | Props |
307
+ | --------- | ------- | ----- |
308
+ | Steps | Equal-width bins of the data (default), equal-count bins, or your thresholds | `steps` (count or thresholds), `scale` (`"equal"`, `"quantile"`), `colors` |
309
+ | Active | Hover a cell (hit-tested from coordinates), keyboard focus | `activeCell`, `onActiveChange(cell, source)`, `emphasis` (`"crosshair"` default, `"cell"`, `"none"`) |
310
+ | Selection | Click; in range mode also drag, Shift+click, a row label, the strip under a column tick, Shift+arrows; Esc clears | `selectionMode` (`"none"` default, `"single"`, `"range"`), `selection`, `defaultSelection`, `onSelectionChange(range, stats)` |
311
+ | Step filter | Legend click hides a step, Shift+click shows only that step, hover previews it; the last visible step cannot be hidden | `hiddenSteps`, `defaultHiddenSteps`, `onHiddenStepsChange` |
312
+ | Legend | A default `HeatmapLegend` (unit, one entry per step, extreme marks); `null` hides it | `renderLegend(entries, marks)` |
313
+ | Tooltip | Follows the pointer, sits below right of the focused cell, flips at the edges, hidden while dragging | `renderTooltip(cell, { source, x, y })` |
314
+ | Keyboard | One tab stop; arrows clamp at the edges, Home / End in the row, Ctrl or Cmd + Home / End to the corners, Enter or Space selects | |
315
+
316
+ Cells carry `data-step` (1 to N, 0 for a gap), `data-missing`, `data-dimmed`, `data-filtered`, `data-selected` and `data-extreme`; the root carries `data-emphasis`. Style them with the theme's `heatmap` slot (`gap`, `dimOpacity`, `filteredOpacity`, `missing`, `active`, `focus`, `selection`, `extreme`, `valueInk`), `classNames` / `styles`, or CSS on those attributes; `unstyled` emits no fills at all. Below 14px per cell the grid scrolls sideways inside its root instead of shrinking. `rangeStats`, `normaliseRange`, `extremes`, `heatmapLayout`, `useHeatmapState`, `useHeatmapSelection` and `useHeatmapSteps` are exported for a custom renderer.
317
+
318
+ ## Development
319
+
320
+ ```bash
321
+ npm install
322
+ npm run dev
323
+ ```
324
+
325
+ | Script | Description |
326
+ | -------------------- | ------------------------------- |
327
+ | `npm run dev` | Rebuild on file changes |
328
+ | `npm run build` | Build ESM and type declarations |
329
+ | `npm test` | Run tests once |
330
+ | `npm run test:watch` | Run tests in watch mode |
331
+ | `npm run typecheck` | Type-check without emitting |
332
+
333
+ ## License
334
+
335
+ [Apache-2.0](LICENSE)