stream-charts 1.2.1 → 2.0.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 (463) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +809 -1022
  3. package/changes.md +36 -0
  4. package/dist/app/charts/Chart.d.ts +35 -139
  5. package/dist/app/charts/Chart.d.ts.map +1 -0
  6. package/dist/app/charts/Chart.js +74 -65
  7. package/dist/app/charts/Chart.js.map +1 -1
  8. package/dist/app/charts/axes/AxesState.d.ts +26 -18
  9. package/dist/app/charts/axes/AxesState.d.ts.map +1 -0
  10. package/dist/app/charts/axes/AxesState.js +26 -24
  11. package/dist/app/charts/axes/AxesState.js.map +1 -1
  12. package/dist/app/charts/axes/AxisInterval.d.ts +44 -26
  13. package/dist/app/charts/axes/AxisInterval.d.ts.map +1 -0
  14. package/dist/app/charts/axes/AxisInterval.js +48 -29
  15. package/dist/app/charts/axes/AxisInterval.js.map +1 -1
  16. package/dist/app/charts/axes/BaseAxisRange.d.ts +46 -22
  17. package/dist/app/charts/axes/BaseAxisRange.d.ts.map +1 -0
  18. package/dist/app/charts/axes/BaseAxisRange.js +17 -12
  19. package/dist/app/charts/axes/BaseAxisRange.js.map +1 -1
  20. package/dist/app/charts/axes/ContinuousAxis.d.ts +47 -6
  21. package/dist/app/charts/axes/ContinuousAxis.d.ts.map +1 -0
  22. package/dist/app/charts/axes/ContinuousAxis.js +160 -27
  23. package/dist/app/charts/axes/ContinuousAxis.js.map +1 -1
  24. package/dist/app/charts/axes/ContinuousAxisRange.d.ts +29 -10
  25. package/dist/app/charts/axes/ContinuousAxisRange.d.ts.map +1 -0
  26. package/dist/app/charts/axes/ContinuousAxisRange.js +29 -11
  27. package/dist/app/charts/axes/ContinuousAxisRange.js.map +1 -1
  28. package/dist/app/charts/axes/EmptyAxis.d.ts +5 -2
  29. package/dist/app/charts/axes/EmptyAxis.d.ts.map +1 -0
  30. package/dist/app/charts/axes/EmptyAxis.js +30 -9
  31. package/dist/app/charts/axes/EmptyAxis.js.map +1 -1
  32. package/dist/app/charts/axes/OrdinalAxis.d.ts +5 -3
  33. package/dist/app/charts/axes/OrdinalAxis.d.ts.map +1 -0
  34. package/dist/app/charts/axes/OrdinalAxis.js +39 -16
  35. package/dist/app/charts/axes/OrdinalAxis.js.map +1 -1
  36. package/dist/app/charts/axes/OrdinalAxisRange.d.ts +76 -13
  37. package/dist/app/charts/axes/OrdinalAxisRange.d.ts.map +1 -0
  38. package/dist/app/charts/axes/OrdinalAxisRange.js +95 -16
  39. package/dist/app/charts/axes/OrdinalAxisRange.js.map +1 -1
  40. package/dist/app/charts/axes/autoScale.d.ts +111 -0
  41. package/dist/app/charts/axes/autoScale.d.ts.map +1 -0
  42. package/dist/app/charts/axes/autoScale.js +188 -0
  43. package/dist/app/charts/axes/autoScale.js.map +1 -0
  44. package/dist/app/charts/axes/axes.d.ts +273 -150
  45. package/dist/app/charts/axes/axes.d.ts.map +1 -0
  46. package/dist/app/charts/axes/axes.js +808 -583
  47. package/dist/app/charts/axes/axes.js.map +1 -1
  48. package/dist/app/charts/d3types.d.ts +40 -11
  49. package/dist/app/charts/d3types.d.ts.map +1 -0
  50. package/dist/app/charts/d3types.js +3 -0
  51. package/dist/app/charts/d3types.js.map +1 -1
  52. package/dist/app/charts/datasources/StreamingDataSource.d.ts +149 -0
  53. package/dist/app/charts/datasources/StreamingDataSource.d.ts.map +1 -0
  54. package/dist/app/charts/datasources/StreamingDataSource.js +110 -0
  55. package/dist/app/charts/datasources/StreamingDataSource.js.map +1 -0
  56. package/dist/app/charts/datasources/iteratesDataSource.d.ts +73 -0
  57. package/dist/app/charts/datasources/iteratesDataSource.d.ts.map +1 -0
  58. package/dist/app/charts/datasources/iteratesDataSource.js +87 -0
  59. package/dist/app/charts/datasources/iteratesDataSource.js.map +1 -0
  60. package/dist/app/charts/datasources/ordinalDataSource.d.ts +75 -0
  61. package/dist/app/charts/datasources/ordinalDataSource.d.ts.map +1 -0
  62. package/dist/app/charts/datasources/ordinalDataSource.js +135 -0
  63. package/dist/app/charts/datasources/ordinalDataSource.js.map +1 -0
  64. package/dist/app/charts/datasources/outlierDataSource.d.ts +53 -0
  65. package/dist/app/charts/datasources/outlierDataSource.d.ts.map +1 -0
  66. package/dist/app/charts/datasources/outlierDataSource.js +57 -0
  67. package/dist/app/charts/datasources/outlierDataSource.js.map +1 -0
  68. package/dist/app/charts/datasources/timeSeriesDataSource.d.ts +77 -0
  69. package/dist/app/charts/datasources/timeSeriesDataSource.d.ts.map +1 -0
  70. package/dist/app/charts/datasources/timeSeriesDataSource.js +85 -0
  71. package/dist/app/charts/datasources/timeSeriesDataSource.js.map +1 -0
  72. package/dist/app/charts/filters/regexFilter.d.ts +31 -4
  73. package/dist/app/charts/filters/regexFilter.d.ts.map +1 -0
  74. package/dist/app/charts/filters/regexFilter.js +38 -4
  75. package/dist/app/charts/filters/regexFilter.js.map +1 -1
  76. package/dist/app/charts/hooks/AxesProvider.d.ts +21 -0
  77. package/dist/app/charts/hooks/AxesProvider.d.ts.map +1 -0
  78. package/dist/app/charts/hooks/AxesProvider.js +213 -0
  79. package/dist/app/charts/hooks/AxesProvider.js.map +1 -0
  80. package/dist/app/charts/hooks/CanvasSurfaceProvider.d.ts +25 -0
  81. package/dist/app/charts/hooks/CanvasSurfaceProvider.d.ts.map +1 -0
  82. package/dist/app/charts/hooks/CanvasSurfaceProvider.js +76 -0
  83. package/dist/app/charts/hooks/CanvasSurfaceProvider.js.map +1 -0
  84. package/dist/app/charts/hooks/ChartProvider.d.ts +40 -0
  85. package/dist/app/charts/hooks/ChartProvider.d.ts.map +1 -0
  86. package/dist/app/charts/hooks/ChartProvider.js +33 -0
  87. package/dist/app/charts/hooks/ChartProvider.js.map +1 -0
  88. package/dist/app/charts/hooks/InteractionProvider.d.ts +23 -0
  89. package/dist/app/charts/hooks/InteractionProvider.d.ts.map +1 -0
  90. package/dist/app/charts/hooks/InteractionProvider.js +60 -0
  91. package/dist/app/charts/hooks/InteractionProvider.js.map +1 -0
  92. package/dist/app/charts/hooks/PlotDimensionsProvider.d.ts +16 -0
  93. package/dist/app/charts/hooks/PlotDimensionsProvider.d.ts.map +1 -0
  94. package/dist/app/charts/hooks/PlotDimensionsProvider.js +76 -0
  95. package/dist/app/charts/hooks/PlotDimensionsProvider.js.map +1 -0
  96. package/dist/app/charts/hooks/defaultAxesValues.d.ts +11 -0
  97. package/dist/app/charts/hooks/defaultAxesValues.d.ts.map +1 -0
  98. package/dist/app/charts/hooks/defaultAxesValues.js +36 -0
  99. package/dist/app/charts/hooks/defaultAxesValues.js.map +1 -0
  100. package/dist/app/charts/hooks/defaultMouseValues.d.ts +9 -0
  101. package/dist/app/charts/hooks/defaultMouseValues.d.ts.map +1 -0
  102. package/dist/app/charts/hooks/defaultMouseValues.js +23 -0
  103. package/dist/app/charts/hooks/defaultMouseValues.js.map +1 -0
  104. package/dist/app/charts/hooks/defaultPlotDimensions.d.ts +13 -0
  105. package/dist/app/charts/hooks/defaultPlotDimensions.d.ts.map +1 -0
  106. package/dist/app/charts/hooks/defaultPlotDimensions.js +23 -0
  107. package/dist/app/charts/hooks/defaultPlotDimensions.js.map +1 -0
  108. package/dist/app/charts/hooks/defaultTooltipValues.d.ts +9 -0
  109. package/dist/app/charts/hooks/defaultTooltipValues.d.ts.map +1 -0
  110. package/dist/app/charts/hooks/defaultTooltipValues.js +21 -0
  111. package/dist/app/charts/hooks/defaultTooltipValues.js.map +1 -0
  112. package/dist/app/charts/hooks/defaultUseChartValues.d.ts +14 -0
  113. package/dist/app/charts/hooks/defaultUseChartValues.d.ts.map +1 -0
  114. package/dist/app/charts/hooks/defaultUseChartValues.js +30 -0
  115. package/dist/app/charts/hooks/defaultUseChartValues.js.map +1 -0
  116. package/dist/app/charts/hooks/useAxes.d.ts +49 -36
  117. package/dist/app/charts/hooks/useAxes.d.ts.map +1 -0
  118. package/dist/app/charts/hooks/useAxes.js +16 -176
  119. package/dist/app/charts/hooks/useAxes.js.map +1 -1
  120. package/dist/app/charts/hooks/useCanvasSurface.d.ts +25 -0
  121. package/dist/app/charts/hooks/useCanvasSurface.d.ts.map +1 -0
  122. package/dist/app/charts/hooks/useCanvasSurface.js +18 -0
  123. package/dist/app/charts/hooks/useCanvasSurface.js.map +1 -0
  124. package/dist/app/charts/hooks/useChart.d.ts +30 -44
  125. package/dist/app/charts/hooks/useChart.d.ts.map +1 -0
  126. package/dist/app/charts/hooks/useChart.js +26 -48
  127. package/dist/app/charts/hooks/useChart.js.map +1 -1
  128. package/dist/app/charts/hooks/useDataSource.d.ts +68 -0
  129. package/dist/app/charts/hooks/useDataSource.d.ts.map +1 -0
  130. package/dist/app/charts/hooks/useDataSource.js +63 -0
  131. package/dist/app/charts/hooks/useDataSource.js.map +1 -0
  132. package/dist/app/charts/hooks/useHoveredSeries.d.ts +25 -0
  133. package/dist/app/charts/hooks/useHoveredSeries.d.ts.map +1 -0
  134. package/dist/app/charts/hooks/useHoveredSeries.js +15 -0
  135. package/dist/app/charts/hooks/useHoveredSeries.js.map +1 -0
  136. package/dist/app/charts/hooks/useMouse.d.ts +46 -22
  137. package/dist/app/charts/hooks/useMouse.d.ts.map +1 -0
  138. package/dist/app/charts/hooks/useMouse.js +12 -56
  139. package/dist/app/charts/hooks/useMouse.js.map +1 -1
  140. package/dist/app/charts/hooks/usePlotDimensions.d.ts +25 -13
  141. package/dist/app/charts/hooks/usePlotDimensions.d.ts.map +1 -0
  142. package/dist/app/charts/hooks/usePlotDimensions.js +6 -62
  143. package/dist/app/charts/hooks/usePlotDimensions.js.map +1 -1
  144. package/dist/app/charts/hooks/useTooltip.d.ts +24 -26
  145. package/dist/app/charts/hooks/useTooltip.d.ts.map +1 -0
  146. package/dist/app/charts/hooks/useTooltip.js +12 -42
  147. package/dist/app/charts/hooks/useTooltip.js.map +1 -1
  148. package/dist/app/charts/index.d.ts +66 -0
  149. package/dist/app/charts/index.d.ts.map +1 -0
  150. package/dist/app/charts/index.js +87 -0
  151. package/dist/app/charts/index.js.map +1 -0
  152. package/dist/app/charts/legends/Legend.d.ts +33 -12
  153. package/dist/app/charts/legends/Legend.d.ts.map +1 -0
  154. package/dist/app/charts/legends/Legend.js +138 -379
  155. package/dist/app/charts/legends/Legend.js.map +1 -1
  156. package/dist/app/charts/legends/constants.d.ts +19 -0
  157. package/dist/app/charts/legends/constants.d.ts.map +1 -0
  158. package/dist/app/charts/legends/constants.js +34 -0
  159. package/dist/app/charts/legends/constants.js.map +1 -0
  160. package/dist/app/charts/observables/ChartData.d.ts +1 -0
  161. package/dist/app/charts/observables/ChartData.d.ts.map +1 -0
  162. package/dist/app/charts/observables/iterates.d.ts +13 -7
  163. package/dist/app/charts/observables/iterates.d.ts.map +1 -0
  164. package/dist/app/charts/observables/iterates.js +42 -9
  165. package/dist/app/charts/observables/iterates.js.map +1 -1
  166. package/dist/app/charts/observables/ordinals.d.ts +70 -12
  167. package/dist/app/charts/observables/ordinals.d.ts.map +1 -0
  168. package/dist/app/charts/observables/ordinals.js +127 -48
  169. package/dist/app/charts/observables/ordinals.js.map +1 -1
  170. package/dist/app/charts/observables/outliers.d.ts +18 -0
  171. package/dist/app/charts/observables/outliers.d.ts.map +1 -0
  172. package/dist/app/charts/observables/outliers.js +2 -0
  173. package/dist/app/charts/observables/outliers.js.map +1 -0
  174. package/dist/app/charts/plots/BarPlot.d.ts +87 -13
  175. package/dist/app/charts/plots/BarPlot.d.ts.map +1 -0
  176. package/dist/app/charts/plots/BarPlot.js +603 -356
  177. package/dist/app/charts/plots/BarPlot.js.map +1 -1
  178. package/dist/app/charts/plots/OutlierPlot.d.ts +123 -0
  179. package/dist/app/charts/plots/OutlierPlot.d.ts.map +1 -0
  180. package/dist/app/charts/plots/OutlierPlot.js +430 -0
  181. package/dist/app/charts/plots/OutlierPlot.js.map +1 -0
  182. package/dist/app/charts/plots/PoincarePlot.d.ts +92 -14
  183. package/dist/app/charts/plots/PoincarePlot.d.ts.map +1 -0
  184. package/dist/app/charts/plots/PoincarePlot.js +523 -364
  185. package/dist/app/charts/plots/PoincarePlot.js.map +1 -1
  186. package/dist/app/charts/plots/RasterPlot.d.ts +31 -10
  187. package/dist/app/charts/plots/RasterPlot.d.ts.map +1 -0
  188. package/dist/app/charts/plots/RasterPlot.js +198 -306
  189. package/dist/app/charts/plots/RasterPlot.js.map +1 -1
  190. package/dist/app/charts/plots/ScatterPlot.d.ts +77 -21
  191. package/dist/app/charts/plots/ScatterPlot.d.ts.map +1 -0
  192. package/dist/app/charts/plots/ScatterPlot.js +359 -302
  193. package/dist/app/charts/plots/ScatterPlot.js.map +1 -1
  194. package/dist/app/charts/plots/autoScaleYAxes.d.ts +43 -0
  195. package/dist/app/charts/plots/autoScaleYAxes.d.ts.map +1 -0
  196. package/dist/app/charts/plots/autoScaleYAxes.js +71 -0
  197. package/dist/app/charts/plots/autoScaleYAxes.js.map +1 -0
  198. package/dist/app/charts/plots/colorizedLine.d.ts +61 -0
  199. package/dist/app/charts/plots/colorizedLine.d.ts.map +1 -0
  200. package/dist/app/charts/plots/colorizedLine.js +157 -0
  201. package/dist/app/charts/plots/colorizedLine.js.map +1 -0
  202. package/dist/app/charts/plots/constants.d.ts +7 -0
  203. package/dist/app/charts/plots/constants.d.ts.map +1 -0
  204. package/dist/app/charts/plots/constants.js +11 -0
  205. package/dist/app/charts/plots/constants.js.map +1 -0
  206. package/dist/app/charts/plots/hitTesting.d.ts +88 -0
  207. package/dist/app/charts/plots/hitTesting.d.ts.map +1 -0
  208. package/dist/app/charts/plots/hitTesting.js +136 -0
  209. package/dist/app/charts/plots/hitTesting.js.map +1 -0
  210. package/dist/app/charts/plots/plot.d.ts +52 -16
  211. package/dist/app/charts/plots/plot.d.ts.map +1 -0
  212. package/dist/app/charts/plots/plot.js +108 -35
  213. package/dist/app/charts/plots/plot.js.map +1 -1
  214. package/dist/app/charts/plots/useCanvasZoomPan.d.ts +119 -0
  215. package/dist/app/charts/plots/useCanvasZoomPan.d.ts.map +1 -0
  216. package/dist/app/charts/plots/useCanvasZoomPan.js +113 -0
  217. package/dist/app/charts/plots/useCanvasZoomPan.js.map +1 -0
  218. package/dist/app/charts/plots/useStreamingTimeAxes.d.ts +103 -0
  219. package/dist/app/charts/plots/useStreamingTimeAxes.d.ts.map +1 -0
  220. package/dist/app/charts/plots/useStreamingTimeAxes.js +257 -0
  221. package/dist/app/charts/plots/useStreamingTimeAxes.js.map +1 -0
  222. package/dist/app/charts/series/baseSeries.d.ts +60 -8
  223. package/dist/app/charts/series/baseSeries.d.ts.map +1 -0
  224. package/dist/app/charts/series/baseSeries.js +53 -8
  225. package/dist/app/charts/series/baseSeries.js.map +1 -1
  226. package/dist/app/charts/series/iterateSeries.d.ts +9 -8
  227. package/dist/app/charts/series/iterateSeries.d.ts.map +1 -0
  228. package/dist/app/charts/series/iterateSeries.js +7 -7
  229. package/dist/app/charts/series/iterateSeries.js.map +1 -1
  230. package/dist/app/charts/series/ordinalSeries.d.ts +27 -13
  231. package/dist/app/charts/series/ordinalSeries.d.ts.map +1 -0
  232. package/dist/app/charts/series/ordinalSeries.js +29 -15
  233. package/dist/app/charts/series/ordinalSeries.js.map +1 -1
  234. package/dist/app/charts/series/outlierSeries.d.ts +142 -0
  235. package/dist/app/charts/series/outlierSeries.d.ts.map +1 -0
  236. package/dist/app/charts/series/outlierSeries.js +82 -0
  237. package/dist/app/charts/series/outlierSeries.js.map +1 -0
  238. package/dist/app/charts/series/timeSeries.d.ts +13 -9
  239. package/dist/app/charts/series/timeSeries.d.ts.map +1 -0
  240. package/dist/app/charts/series/timeSeries.js +6 -3
  241. package/dist/app/charts/series/timeSeries.js.map +1 -1
  242. package/dist/app/charts/series/timeSeriesChartData.d.ts +18 -10
  243. package/dist/app/charts/series/timeSeriesChartData.d.ts.map +1 -0
  244. package/dist/app/charts/series/timeSeriesChartData.js +28 -14
  245. package/dist/app/charts/series/timeSeriesChartData.js.map +1 -1
  246. package/dist/app/charts/styling/barPlotStyle.d.ts +46 -2
  247. package/dist/app/charts/styling/barPlotStyle.d.ts.map +1 -0
  248. package/dist/app/charts/styling/barPlotStyle.js +37 -3
  249. package/dist/app/charts/styling/barPlotStyle.js.map +1 -1
  250. package/dist/app/charts/styling/canvasStyle.d.ts +53 -0
  251. package/dist/app/charts/styling/canvasStyle.d.ts.map +1 -0
  252. package/dist/app/charts/styling/canvasStyle.js +71 -0
  253. package/dist/app/charts/styling/canvasStyle.js.map +1 -0
  254. package/dist/app/charts/styling/margins.d.ts +21 -2
  255. package/dist/app/charts/styling/margins.d.ts.map +1 -0
  256. package/dist/app/charts/styling/margins.js +25 -4
  257. package/dist/app/charts/styling/margins.js.map +1 -1
  258. package/dist/app/charts/styling/svgStyle.d.ts +10 -56
  259. package/dist/app/charts/styling/svgStyle.d.ts.map +1 -0
  260. package/dist/app/charts/styling/svgStyle.js +3 -78
  261. package/dist/app/charts/styling/svgStyle.js.map +1 -1
  262. package/dist/app/charts/subscriptions/viewDrivers.d.ts +124 -0
  263. package/dist/app/charts/subscriptions/viewDrivers.d.ts.map +1 -0
  264. package/dist/app/charts/subscriptions/viewDrivers.js +338 -0
  265. package/dist/app/charts/subscriptions/viewDrivers.js.map +1 -0
  266. package/dist/app/charts/tooltips/BarPlotTooltipContent.d.ts +12 -78
  267. package/dist/app/charts/tooltips/BarPlotTooltipContent.d.ts.map +1 -0
  268. package/dist/app/charts/tooltips/BarPlotTooltipContent.js +65 -257
  269. package/dist/app/charts/tooltips/BarPlotTooltipContent.js.map +1 -1
  270. package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.d.ts +9 -0
  271. package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.d.ts.map +1 -0
  272. package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.js +16 -0
  273. package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.js.map +1 -0
  274. package/dist/app/charts/tooltips/OutlierPlotTooltipContent.d.ts +30 -0
  275. package/dist/app/charts/tooltips/OutlierPlotTooltipContent.d.ts.map +1 -0
  276. package/dist/app/charts/tooltips/OutlierPlotTooltipContent.js +26 -0
  277. package/dist/app/charts/tooltips/OutlierPlotTooltipContent.js.map +1 -0
  278. package/dist/app/charts/tooltips/PoincarePlotTooltipContent.d.ts +22 -72
  279. package/dist/app/charts/tooltips/PoincarePlotTooltipContent.d.ts.map +1 -0
  280. package/dist/app/charts/tooltips/PoincarePlotTooltipContent.js +104 -171
  281. package/dist/app/charts/tooltips/PoincarePlotTooltipContent.js.map +1 -1
  282. package/dist/app/charts/tooltips/RasterPlotTooltipContent.d.ts +32 -8
  283. package/dist/app/charts/tooltips/RasterPlotTooltipContent.d.ts.map +1 -0
  284. package/dist/app/charts/tooltips/RasterPlotTooltipContent.js +62 -115
  285. package/dist/app/charts/tooltips/RasterPlotTooltipContent.js.map +1 -1
  286. package/dist/app/charts/tooltips/ScatterPlotTooltipContent.d.ts +39 -12
  287. package/dist/app/charts/tooltips/ScatterPlotTooltipContent.d.ts.map +1 -0
  288. package/dist/app/charts/tooltips/ScatterPlotTooltipContent.js +162 -134
  289. package/dist/app/charts/tooltips/ScatterPlotTooltipContent.js.map +1 -1
  290. package/dist/app/charts/tooltips/Tooltip.d.ts +27 -32
  291. package/dist/app/charts/tooltips/Tooltip.d.ts.map +1 -0
  292. package/dist/app/charts/tooltips/Tooltip.js +37 -81
  293. package/dist/app/charts/tooltips/Tooltip.js.map +1 -1
  294. package/dist/app/charts/tooltips/TooltipContent.d.ts +81 -0
  295. package/dist/app/charts/tooltips/TooltipContent.d.ts.map +1 -0
  296. package/dist/app/charts/tooltips/TooltipContent.js +99 -0
  297. package/dist/app/charts/tooltips/TooltipContent.js.map +1 -0
  298. package/dist/app/charts/tooltips/tooltipUtils.d.ts +186 -36
  299. package/dist/app/charts/tooltips/tooltipUtils.d.ts.map +1 -0
  300. package/dist/app/charts/tooltips/tooltipUtils.js +277 -48
  301. package/dist/app/charts/tooltips/tooltipUtils.js.map +1 -1
  302. package/dist/app/charts/tooltips/useOutlierTooltip.d.ts +59 -0
  303. package/dist/app/charts/tooltips/useOutlierTooltip.d.ts.map +1 -0
  304. package/dist/app/charts/tooltips/useOutlierTooltip.js +16 -0
  305. package/dist/app/charts/tooltips/useOutlierTooltip.js.map +1 -0
  306. package/dist/app/charts/tooltips/useTooltipPlacement.d.ts +51 -0
  307. package/dist/app/charts/tooltips/useTooltipPlacement.d.ts.map +1 -0
  308. package/dist/app/charts/tooltips/useTooltipPlacement.js +52 -0
  309. package/dist/app/charts/tooltips/useTooltipPlacement.js.map +1 -0
  310. package/dist/app/charts/tooltips/useTooltipStyle.d.ts +11 -0
  311. package/dist/app/charts/tooltips/useTooltipStyle.d.ts.map +1 -0
  312. package/dist/app/charts/tooltips/useTooltipStyle.js +14 -0
  313. package/dist/app/charts/tooltips/useTooltipStyle.js.map +1 -0
  314. package/dist/app/charts/trackers/Tracker.d.ts +22 -6
  315. package/dist/app/charts/trackers/Tracker.d.ts.map +1 -0
  316. package/dist/app/charts/trackers/Tracker.js +36 -22
  317. package/dist/app/charts/trackers/Tracker.js.map +1 -1
  318. package/dist/app/charts/trackers/trackerUtils.d.ts +40 -18
  319. package/dist/app/charts/trackers/trackerUtils.d.ts.map +1 -0
  320. package/dist/app/charts/trackers/trackerUtils.js +213 -300
  321. package/dist/app/charts/trackers/trackerUtils.js.map +1 -1
  322. package/dist/app/charts/utils.d.ts +72 -33
  323. package/dist/app/charts/utils.d.ts.map +1 -0
  324. package/dist/app/charts/utils.js +87 -42
  325. package/dist/app/charts/utils.js.map +1 -1
  326. package/dist/index.d.ts +2 -45
  327. package/dist/index.d.ts.map +1 -0
  328. package/dist/index.js +2 -72
  329. package/dist/index.js.map +1 -1
  330. package/package.json +87 -46
  331. package/src/app/charts/Chart.tsx +132 -168
  332. package/src/app/charts/axes/AxesState.ts +27 -29
  333. package/src/app/charts/axes/AxisInterval.ts +57 -32
  334. package/src/app/charts/axes/BaseAxisRange.ts +47 -27
  335. package/src/app/charts/axes/ContinuousAxis.tsx +235 -39
  336. package/src/app/charts/axes/ContinuousAxisRange.ts +29 -11
  337. package/src/app/charts/axes/EmptyAxis.tsx +52 -17
  338. package/src/app/charts/axes/OrdinalAxis.tsx +54 -28
  339. package/src/app/charts/axes/OrdinalAxisRange.ts +96 -16
  340. package/src/app/charts/axes/autoScale.ts +244 -0
  341. package/src/app/charts/axes/axes.ts +954 -735
  342. package/src/app/charts/d3types.ts +42 -13
  343. package/src/app/charts/datasources/StreamingDataSource.ts +214 -0
  344. package/src/app/charts/datasources/iteratesDataSource.ts +122 -0
  345. package/src/app/charts/datasources/ordinalDataSource.ts +205 -0
  346. package/src/app/charts/datasources/outlierDataSource.ts +90 -0
  347. package/src/app/charts/datasources/timeSeriesDataSource.ts +133 -0
  348. package/src/app/charts/filters/regexFilter.ts +45 -5
  349. package/src/app/charts/hooks/AxesProvider.tsx +301 -0
  350. package/src/app/charts/hooks/CanvasSurfaceProvider.tsx +117 -0
  351. package/src/app/charts/hooks/ChartProvider.tsx +79 -0
  352. package/src/app/charts/hooks/InteractionProvider.tsx +88 -0
  353. package/src/app/charts/hooks/PlotDimensionsProvider.tsx +109 -0
  354. package/src/app/charts/hooks/defaultAxesValues.ts +40 -0
  355. package/src/app/charts/hooks/defaultMouseValues.ts +24 -0
  356. package/src/app/charts/hooks/defaultPlotDimensions.ts +27 -0
  357. package/src/app/charts/hooks/defaultTooltipValues.tsx +23 -0
  358. package/src/app/charts/hooks/defaultUseChartValues.tsx +36 -0
  359. package/src/app/charts/hooks/useAxes.tsx +60 -228
  360. package/src/app/charts/hooks/useCanvasSurface.tsx +35 -0
  361. package/src/app/charts/hooks/useChart.tsx +47 -106
  362. package/src/app/charts/hooks/useDataSource.tsx +106 -0
  363. package/src/app/charts/hooks/useHoveredSeries.tsx +33 -0
  364. package/src/app/charts/hooks/useMouse.tsx +58 -82
  365. package/src/app/charts/hooks/usePlotDimensions.tsx +25 -89
  366. package/src/app/charts/hooks/useTooltip.tsx +32 -63
  367. package/src/app/charts/index.ts +213 -0
  368. package/src/app/charts/legends/Legend.tsx +198 -479
  369. package/src/app/charts/legends/constants.ts +37 -0
  370. package/src/app/charts/observables/iterates.ts +32 -12
  371. package/src/app/charts/observables/ordinals.ts +141 -67
  372. package/src/app/charts/observables/outliers.ts +20 -0
  373. package/src/app/charts/plots/BarPlot.tsx +784 -666
  374. package/src/app/charts/plots/OutlierPlot.tsx +685 -0
  375. package/src/app/charts/plots/PoincarePlot.tsx +707 -489
  376. package/src/app/charts/plots/RasterPlot.tsx +253 -445
  377. package/src/app/charts/plots/ScatterPlot.tsx +480 -463
  378. package/src/app/charts/plots/autoScaleYAxes.ts +102 -0
  379. package/src/app/charts/plots/colorizedLine.ts +185 -0
  380. package/src/app/charts/plots/constants.ts +16 -0
  381. package/src/app/charts/plots/hitTesting.ts +198 -0
  382. package/src/app/charts/plots/plot.ts +138 -44
  383. package/src/app/charts/plots/useCanvasZoomPan.ts +240 -0
  384. package/src/app/charts/plots/useStreamingTimeAxes.ts +384 -0
  385. package/src/app/charts/series/baseSeries.ts +81 -14
  386. package/src/app/charts/series/iterateSeries.ts +8 -8
  387. package/src/app/charts/series/ordinalSeries.ts +35 -20
  388. package/src/app/charts/series/outlierSeries.ts +188 -0
  389. package/src/app/charts/series/timeSeries.ts +14 -12
  390. package/src/app/charts/series/timeSeriesChartData.ts +31 -17
  391. package/src/app/charts/styling/barPlotStyle.ts +48 -5
  392. package/src/app/charts/styling/canvasStyle.ts +86 -0
  393. package/src/app/charts/styling/margins.ts +28 -4
  394. package/src/app/charts/styling/svgStyle.ts +10 -91
  395. package/src/app/charts/subscriptions/viewDrivers.ts +447 -0
  396. package/src/app/charts/tooltips/BarPlotTooltipContent.tsx +156 -380
  397. package/src/app/charts/tooltips/DefaultOutlierTooltipContent.tsx +40 -0
  398. package/src/app/charts/tooltips/OutlierPlotTooltipContent.tsx +67 -0
  399. package/src/app/charts/tooltips/PoincarePlotTooltipContent.tsx +229 -292
  400. package/src/app/charts/tooltips/RasterPlotTooltipContent.tsx +164 -217
  401. package/src/app/charts/tooltips/ScatterPlotTooltipContent.tsx +373 -236
  402. package/src/app/charts/tooltips/Tooltip.tsx +58 -124
  403. package/src/app/charts/tooltips/TooltipContent.tsx +177 -0
  404. package/src/app/charts/tooltips/tooltipUtils.ts +359 -61
  405. package/src/app/charts/tooltips/useOutlierTooltip.tsx +68 -0
  406. package/src/app/charts/tooltips/useTooltipPlacement.ts +86 -0
  407. package/src/app/charts/tooltips/useTooltipStyle.ts +15 -0
  408. package/src/app/charts/trackers/Tracker.tsx +68 -33
  409. package/src/app/charts/trackers/trackerUtils.ts +263 -376
  410. package/src/app/charts/utils.ts +90 -48
  411. package/src/index.ts +2 -322
  412. package/dist/app/charts/axes/AxesState.test.d.ts +0 -1
  413. package/dist/app/charts/axes/AxesState.test.js +0 -30
  414. package/dist/app/charts/axes/AxesState.test.js.map +0 -1
  415. package/dist/app/charts/axes/AxisInterval.test.d.ts +0 -1
  416. package/dist/app/charts/axes/AxisInterval.test.js +0 -120
  417. package/dist/app/charts/axes/AxisInterval.test.js.map +0 -1
  418. package/dist/app/charts/axes/ContinuousAxisRange.test.d.ts +0 -1
  419. package/dist/app/charts/axes/ContinuousAxisRange.test.js +0 -47
  420. package/dist/app/charts/axes/ContinuousAxisRange.test.js.map +0 -1
  421. package/dist/app/charts/axes/OrdinalAxisRange.test.d.ts +0 -1
  422. package/dist/app/charts/axes/OrdinalAxisRange.test.js +0 -48
  423. package/dist/app/charts/axes/OrdinalAxisRange.test.js.map +0 -1
  424. package/dist/app/charts/filters/regexFilter.test.d.ts +0 -1
  425. package/dist/app/charts/filters/regexFilter.test.js +0 -11
  426. package/dist/app/charts/filters/regexFilter.test.js.map +0 -1
  427. package/dist/app/charts/hooks/useDataObservable.d.ts +0 -72
  428. package/dist/app/charts/hooks/useDataObservable.js +0 -74
  429. package/dist/app/charts/hooks/useDataObservable.js.map +0 -1
  430. package/dist/app/charts/hooks/useInitialData.d.ts +0 -36
  431. package/dist/app/charts/hooks/useInitialData.js +0 -28
  432. package/dist/app/charts/hooks/useInitialData.js.map +0 -1
  433. package/dist/app/charts/observables/iterates.test.d.ts +0 -1
  434. package/dist/app/charts/observables/iterates.test.js +0 -180
  435. package/dist/app/charts/observables/iterates.test.js.map +0 -1
  436. package/dist/app/charts/observables/ordinals.test.d.ts +0 -1
  437. package/dist/app/charts/observables/ordinals.test.js +0 -102
  438. package/dist/app/charts/observables/ordinals.test.js.map +0 -1
  439. package/dist/app/charts/series/datumSeries.test.d.ts +0 -1
  440. package/dist/app/charts/series/datumSeries.test.js +0 -50
  441. package/dist/app/charts/series/datumSeries.test.js.map +0 -1
  442. package/dist/app/charts/styling/margins.test.d.ts +0 -1
  443. package/dist/app/charts/styling/margins.test.js +0 -19
  444. package/dist/app/charts/styling/margins.test.js.map +0 -1
  445. package/dist/app/charts/subscriptions/subscription.test.d.ts +0 -1
  446. package/dist/app/charts/subscriptions/subscription.test.js +0 -395
  447. package/dist/app/charts/subscriptions/subscription.test.js.map +0 -1
  448. package/dist/app/charts/subscriptions/subscriptions.d.ts +0 -100
  449. package/dist/app/charts/subscriptions/subscriptions.js +0 -449
  450. package/dist/app/charts/subscriptions/subscriptions.js.map +0 -1
  451. package/src/app/charts/axes/AxesState.test.ts +0 -34
  452. package/src/app/charts/axes/AxisInterval.test.ts +0 -143
  453. package/src/app/charts/axes/ContinuousAxisRange.test.ts +0 -55
  454. package/src/app/charts/axes/OrdinalAxisRange.test.ts +0 -55
  455. package/src/app/charts/filters/regexFilter.test.ts +0 -13
  456. package/src/app/charts/hooks/useDataObservable.tsx +0 -170
  457. package/src/app/charts/hooks/useInitialData.tsx +0 -64
  458. package/src/app/charts/observables/iterates.test.ts +0 -201
  459. package/src/app/charts/observables/ordinals.test.ts +0 -135
  460. package/src/app/charts/series/datumSeries.test.ts +0 -60
  461. package/src/app/charts/styling/margins.test.ts +0 -22
  462. package/src/app/charts/subscriptions/subscription.test.ts +0 -499
  463. package/src/app/charts/subscriptions/subscriptions.ts +0 -635
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo, useRef, useState } from "react";
3
+ import { MouseContext } from "./useMouse";
4
+ import { TooltipContext } from "./useTooltip";
5
+ import { HoveredSeriesContext } from "./useHoveredSeries";
6
+ /**
7
+ * Provides the chart's interactions: the mouse-over and mouse-leave handlers (see {@link useMouse}),
8
+ * the tooltip's content provider and visibility (see {@link useTooltip}), and the hovered series
9
+ * (see {@link useHoveredSeries}).
10
+ *
11
+ * The plots hit-test the mouse, and call the mouse handlers: a mouse-over sets the hovered series,
12
+ * and then calls every registered mouse-over handler (e.g. the tooltip's); a mouse-leave clears the
13
+ * hovered series, and calls every registered mouse-leave handler.
14
+ *
15
+ * The handler registries live in refs, so the mouse and tooltip values never change identity (the
16
+ * tooltip's changes only with its visibility), and registering a handler never re-renders anything.
17
+ * @param props The children
18
+ * @return The children, wrapped in the interaction contexts
19
+ * @template D The type of the data object for the series
20
+ * @template TM The type of the metadata object for the series
21
+ */
22
+ export default function InteractionProvider(props) {
23
+ const { children } = props;
24
+ const mouseOverHandlersRef = useRef(new Map());
25
+ const mouseLeaveHandlersRef = useRef(new Map());
26
+ const tooltipContentProviderRef = useRef(undefined);
27
+ const [hoveredSeriesName, setHoveredSeriesName] = useState(null);
28
+ const [tooltipVisible, setTooltipVisible] = useState(false);
29
+ const mouse = useMemo(() => ({
30
+ registerMouseOverHandler: (handlerId, handler) => {
31
+ mouseOverHandlersRef.current.set(handlerId, handler);
32
+ return handlerId;
33
+ },
34
+ unregisterMouseOverHandler: handlerId => mouseOverHandlersRef.current.delete(handlerId),
35
+ mouseOverHandlerFor: (_handlerId, providerId) => (seriesName, time, tooltipData, mouseCoords) => {
36
+ setHoveredSeriesName(seriesName);
37
+ mouseOverHandlersRef.current.forEach(handler => handler(seriesName, time, tooltipData, mouseCoords, providerId));
38
+ },
39
+ registerMouseLeaveHandler: (handlerId, handler) => {
40
+ mouseLeaveHandlersRef.current.set(handlerId, handler);
41
+ return handlerId;
42
+ },
43
+ unregisterMouseLeaveHandler: handlerId => mouseLeaveHandlersRef.current.delete(handlerId),
44
+ mouseLeaveHandlerFor: (_handlerId, providerId) => seriesName => {
45
+ setHoveredSeriesName(null);
46
+ mouseLeaveHandlersRef.current.forEach(handler => handler(seriesName, providerId));
47
+ },
48
+ }), []);
49
+ const tooltip = useMemo(() => ({
50
+ registerTooltipContentProvider: provider => {
51
+ tooltipContentProviderRef.current = provider;
52
+ },
53
+ tooltipContentProvider: () => tooltipContentProviderRef.current,
54
+ setVisibilityState: setTooltipVisible,
55
+ visibilityState: tooltipVisible,
56
+ }), [tooltipVisible]);
57
+ const hovered = useMemo(() => ({ hoveredSeriesName, setHoveredSeriesName }), [hoveredSeriesName]);
58
+ return (_jsx(MouseContext.Provider, { value: mouse, children: _jsx(TooltipContext.Provider, { value: tooltip, children: _jsx(HoveredSeriesContext.Provider, { value: hovered, children: children }) }) }));
59
+ }
60
+ //# sourceMappingURL=InteractionProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InteractionProvider.js","sourceRoot":"","sources":["../../../../src/app/charts/hooks/InteractionProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAW,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAC,YAAY,EAAuF,MAAM,YAAY,CAAC;AAC9H,OAAO,EAA8B,cAAc,EAAwB,MAAM,cAAc,CAAC;AAChG,OAAO,EAAC,oBAAoB,EAA2B,MAAM,oBAAoB,CAAC;AAMlF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAQ,KAAY;IAC3D,MAAM,EAAC,QAAQ,EAAC,GAAG,KAAK,CAAA;IAExB,MAAM,oBAAoB,GAAG,MAAM,CAAgD,IAAI,GAAG,EAAE,CAAC,CAAA;IAC7F,MAAM,qBAAqB,GAAG,MAAM,CAAiE,IAAI,GAAG,EAAE,CAAC,CAAA;IAC/G,MAAM,yBAAyB,GAAG,MAAM,CAAgC,SAAS,CAAC,CAAA;IA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OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAA;QACrF,CAAC;KACR,CAAC,EACF,EAAE,CACL,CAAA;IAED,MAAM,OAAO,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACH,8BAA8B,EAAE,QAAQ,CAAC,EAAE;YACvC,yBAAyB,CAAC,OAAO,GAAG,QAAQ,CAAA;QAChD,CAAC;QACD,sBAAsB,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,OAAO;QAC/D,kBAAkB,EAAE,iBAAiB;QACrC,eAAe,EAAE,cAAc;KAClC,CAAC,EACF,CAAC,cAAc,CAAC,CACnB,CAAA;IAED,MAAM,OAAO,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,CAAC,EACjD,CAAC,iBAAiB,CAAC,CACtB,CAAA;IAED,OAAO,CACH,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC/B,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,YACnC,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,YACxC,QAAQ,GACmB,GACV,GACN,CAC3B,CAAA;AACL,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { type JSX } from "react";
2
+ import { type Dimensions, type Margin } from "../styling/margins";
3
+ export type Props = {
4
+ containerDimensions: Dimensions;
5
+ margin: Margin;
6
+ children: JSX.Element | Array<JSX.Element>;
7
+ };
8
+ /**
9
+ * Provides the plot's dimensions and margins (see {@link usePlotDimensions}): the plot dimensions
10
+ * are the container's dimensions less the margins, and are updated (and the registered change
11
+ * handlers called) when the container's dimensions or the margins change.
12
+ * @param props The properties
13
+ * @return The children wrapped in this provider
14
+ */
15
+ export default function PlotDimensionsProvider(props: Props): JSX.Element;
16
+ //# sourceMappingURL=PlotDimensionsProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlotDimensionsProvider.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/hooks/PlotDimensionsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,GAAG,EAAoD,MAAM,OAAO,CAAC;AAClF,OAAO,EAAC,KAAK,UAAU,EAAsB,KAAK,MAAM,EAAqB,MAAM,oBAAoB,CAAC;AAIxG,MAAM,MAAM,KAAK,GAAG;IAChB,mBAAmB,EAAE,UAAU,CAAA;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;CAC7C,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CA0FxE"}
@@ -0,0 +1,76 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
+ import { dimensionsNotEqual, plotDimensionsFrom } from "../styling/margins";
4
+ import { defaultPlotDimensions } from "./defaultPlotDimensions";
5
+ import { PlotDimensionsContext } from "./usePlotDimensions";
6
+ /**
7
+ * Provides the plot's dimensions and margins (see {@link usePlotDimensions}): the plot dimensions
8
+ * are the container's dimensions less the margins, and are updated (and the registered change
9
+ * handlers called) when the container's dimensions or the margins change.
10
+ * @param props The properties
11
+ * @return The children wrapped in this provider
12
+ */
13
+ export default function PlotDimensionsProvider(props) {
14
+ const { containerDimensions, margin, children } = props;
15
+ const [dimensions, setDimensions] = useState(defaultPlotDimensions().plotDimensions);
16
+ // holds the latest committed dimensions so the change handlers can be fired from the effect body
17
+ const dimensionsRef = useRef(dimensions);
18
+ const plotDimensionChangeHandlersRef = useRef(new Map());
19
+ // update the plot dimensions when the container size or margin change
20
+ useEffect(() => {
21
+ const newDimensions = plotDimensionsFrom(containerDimensions.width, containerDimensions.height, margin);
22
+ if (dimensionsNotEqual(dimensionsRef.current, newDimensions)) {
23
+ for (const handler of plotDimensionChangeHandlersRef.current.values()) {
24
+ handler(dimensionsRef.current, newDimensions);
25
+ }
26
+ dimensionsRef.current = newDimensions;
27
+ setDimensions(newDimensions);
28
+ }
29
+ }, [containerDimensions, margin]);
30
+ /**
31
+ * Updates the plot dimensions and fires any registered change handlers. Wrapped in
32
+ * `useCallback` (empty deps -- closes only over refs and the stable `setDimensions` setter) so
33
+ * its identity is stable across renders, which in turn lets the context `value` below be
34
+ * memoized instead of being a fresh object on every render.
35
+ * @param newDimensions The new plot dimensions.
36
+ */
37
+ const updateDimensions = useCallback((newDimensions) => {
38
+ if (dimensionsNotEqual(dimensionsRef.current, newDimensions)) {
39
+ for (const handler of plotDimensionChangeHandlersRef.current.values()) {
40
+ handler(dimensionsRef.current, newDimensions);
41
+ }
42
+ dimensionsRef.current = newDimensions;
43
+ setDimensions(newDimensions);
44
+ }
45
+ }, []);
46
+ /**
47
+ * Registers a plot dimension change handler.
48
+ * @param handler The handler to register.
49
+ * @returns The handler ID.
50
+ */
51
+ const registerPlotDimensionChangeHandler = useCallback((handler) => {
52
+ const handlerId = crypto.randomUUID();
53
+ plotDimensionChangeHandlersRef.current.set(handlerId, handler);
54
+ return handlerId;
55
+ }, []);
56
+ /**
57
+ * Unregisters a plot dimension change handler.
58
+ * @param handlerId The handler ID.
59
+ * @returns True if the handler was unregistered, false if it was not found.
60
+ */
61
+ const unregisterPlotDimensionChangeHandler = useCallback((handlerId) => plotDimensionChangeHandlersRef.current.delete(handlerId), []);
62
+ // memoized so consumers relying on context value identity (e.g. a useMemo/effect keyed on this
63
+ // context's value) don't re-run on every render of anything above this provider -- previously
64
+ // a fresh object literal every render, which is exactly the same class of bug already
65
+ // documented/worked-around for AxesProvider's context value (see e.g. ScatterPlot.tsx's note
66
+ // on `axesRanges` never being memoized there).
67
+ const value = useMemo(() => ({
68
+ plotDimensions: dimensions,
69
+ margin,
70
+ updateDimensions,
71
+ registerPlotDimensionChangeHandler,
72
+ unregisterPlotDimensionChangeHandler
73
+ }), [dimensions, margin, updateDimensions, registerPlotDimensionChangeHandler, unregisterPlotDimensionChangeHandler]);
74
+ return _jsx(PlotDimensionsContext.Provider, { value: value, children: children });
75
+ }
76
+ //# sourceMappingURL=PlotDimensionsProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlotDimensionsProvider.js","sourceRoot":"","sources":["../../../../src/app/charts/hooks/PlotDimensionsProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAW,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClF,OAAO,EAAkB,kBAAkB,EAAe,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACxG,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAkC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAQ3F;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,KAAY;IACvD,MAAM,EACF,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACX,GAAG,KAAK,CAAA;IAET,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAa,qBAAqB,EAAE,CAAC,cAAc,CAAC,CAAA;IAChG,iGAAiG;IACjG,MAAM,aAAa,GAAG,MAAM,CAAa,UAAU,CAAC,CAAA;IACpD,MAAM,8BAA8B,GAAG,MAAM,CAA0C,IAAI,GAAG,EAAE,CAAC,CAAA;IAEjG,sEAAsE;IACtE,SAAS,CACL,GAAG,EAAE;QACD,MAAM,aAAa,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACvG,IAAI,kBAAkB,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE,CAAC;YAC3D,KAAK,MAAM,OAAO,IAAI,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CACjB,GAAG,EAAE,CAAC,CAAC;QACH,cAAc,EAAE,UAAU;QAC1B,MAAM;QACN,gBAAgB;QAChB,kCAAkC;QAClC,oCAAoC;KACvC,CAAC,EACF,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,kCAAkC,EAAE,oCAAoC,CAAC,CACnH,CAAA;IAED,OAAO,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC9C,QAAQ,GACoB,CAAA;AACrC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { BaseAxisRange } from "../axes/BaseAxisRange";
2
+ import type { BaseAxis } from "../axes/axes";
3
+ import type { UseAxesValues } from "./useAxes";
4
+ /**
5
+ * Default axes value
6
+ * @return The default values for the {@link UseAxesValues}
7
+ * @template AR The type of the axis range (e.g. {@link ContinuousAxisRange} or {@link OrdinalAxisRange})
8
+ * @template A The axis type
9
+ */
10
+ export declare function defaultAxesValues<AR extends BaseAxisRange, A extends BaseAxis>(): UseAxesValues<AR, A>;
11
+ //# sourceMappingURL=defaultAxesValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultAxesValues.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/hooks/defaultAxesValues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAS7C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC,SAAS,QAAQ,KAAK,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC,CAoBtG"}
@@ -0,0 +1,36 @@
1
+ import { AxesState } from "../axes/AxesState";
2
+ import { Optional } from "result-fn";
3
+ /**
4
+ * No operation function for use when a default function is needed
5
+ */
6
+ const noop = () => {
7
+ /* empty on purpose */
8
+ };
9
+ /**
10
+ * Default axes value
11
+ * @return The default values for the {@link UseAxesValues}
12
+ * @template AR The type of the axis range (e.g. {@link ContinuousAxisRange} or {@link OrdinalAxisRange})
13
+ * @template A The axis type
14
+ */
15
+ export function defaultAxesValues() {
16
+ return ({
17
+ xAxesState: AxesState.empty(),
18
+ yAxesState: AxesState.empty(),
19
+ addXAxis: noop,
20
+ addYAxis: noop,
21
+ setAxisAssignments: noop,
22
+ axisAssignmentsFor: () => ({ xAxis: "", yAxis: "" }),
23
+ updateAxisRanges: noop,
24
+ axesRanges: () => new Map(),
25
+ axisRangeFor: () => Optional.empty(),
26
+ setAxesRanges: noop,
27
+ setAxisRangeFor: noop,
28
+ setAxisIntervalFor: noop,
29
+ setOriginalAxisIntervalFor: noop,
30
+ resetAxisIntervalFor: noop,
31
+ resetAxesRanges: noop,
32
+ addAxesRangesUpdateHandler: () => noop,
33
+ removeAxesRangesUpdateHandler: () => noop,
34
+ });
35
+ }
36
+ //# sourceMappingURL=defaultAxesValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultAxesValues.js","sourceRoot":"","sources":["../../../../src/app/charts/hooks/defaultAxesValues.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAGnC;;GAEG;AACH,MAAM,IAAI,GAAG,GAAG,EAAE;IACd,sBAAsB;AAC1B,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB;IAC7B,OAAO,CAAC;QACJ,UAAU,EAAE,SAAS,CAAC,KAAK,EAAE;QAC7B,UAAU,EAAE,SAAS,CAAC,KAAK,EAAE;QAC7B,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;QACd,kBAAkB,EAAE,IAAI;QACxB,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAC,CAAC;QAClD,gBAAgB,EAAE,IAAI;QACtB,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,GAAG,EAAc;QACvC,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE;QACpC,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,IAAI;QACrB,kBAAkB,EAAE,IAAI;QACxB,0BAA0B,EAAE,IAAI;QAChC,oBAAoB,EAAE,IAAI;QAC1B,eAAe,EAAE,IAAI;QACrB,0BAA0B,EAAE,GAAG,EAAE,CAAC,IAAI;QACtC,6BAA6B,EAAE,GAAG,EAAE,CAAC,IAAI;KAC5C,CAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { UseMouseValues } from "./useMouse";
2
+ /**
3
+ * The default values for the {@link UseMouseValues}
4
+ * @return The default values for the {@link UseMouseValues}
5
+ * @template D The type of the data object for the series
6
+ * @template TM The type of the metadata object for the series
7
+ */
8
+ export declare function defaultMouseValues<D, TM>(): UseMouseValues<D, TM>;
9
+ //# sourceMappingURL=defaultMouseValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultMouseValues.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/hooks/defaultMouseValues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAQ/C;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,EAAE,KAAK,cAAc,CAAC,CAAC,EAAE,EAAE,CAAC,CASjE"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * No operation function for use when a default function is needed
3
+ */
4
+ const noop = () => {
5
+ /* empty on purpose */
6
+ };
7
+ /**
8
+ * The default values for the {@link UseMouseValues}
9
+ * @return The default values for the {@link UseMouseValues}
10
+ * @template D The type of the data object for the series
11
+ * @template TM The type of the metadata object for the series
12
+ */
13
+ export function defaultMouseValues() {
14
+ return {
15
+ registerMouseOverHandler: () => '',
16
+ unregisterMouseOverHandler: noop,
17
+ mouseOverHandlerFor: () => noop,
18
+ registerMouseLeaveHandler: () => '',
19
+ unregisterMouseLeaveHandler: noop,
20
+ mouseLeaveHandlerFor: () => noop,
21
+ };
22
+ }
23
+ //# sourceMappingURL=defaultMouseValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultMouseValues.js","sourceRoot":"","sources":["../../../../src/app/charts/hooks/defaultMouseValues.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,IAAI,GAAG,GAAG,EAAE;IACd,sBAAsB;AAC1B,CAAC,CAAA;AACD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB;IAC9B,OAAO;QACH,wBAAwB,EAAE,GAAG,EAAE,CAAC,EAAE;QAClC,0BAA0B,EAAE,IAAI;QAChC,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAI;QAC/B,yBAAyB,EAAE,GAAG,EAAE,CAAC,EAAE;QACnC,2BAA2B,EAAE,IAAI;QACjC,oBAAoB,EAAE,GAAG,EAAE,CAAC,IAAI;KACnC,CAAA;AACL,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Margin } from "../styling/margins";
2
+ import type { UsePlotDimensionsValues } from "./usePlotDimensions";
3
+ /**
4
+ * The default values for the {@link UsePlotDimensionsValues}: zero-sized plot dimensions, the
5
+ * {@link defaultMargin}, and no-op functions
6
+ * @return The default plot-dimension values
7
+ */
8
+ export declare const defaultPlotDimensions: () => UsePlotDimensionsValues;
9
+ /**
10
+ * The default margins between the edges of the chart and the plot area
11
+ */
12
+ export declare const defaultMargin: Margin;
13
+ //# sourceMappingURL=defaultPlotDimensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultPlotDimensions.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/hooks/defaultPlotDimensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AASjE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAO,uBAMvC,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAAmD,CAAA"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * No operation function for use when a default function is needed
3
+ */
4
+ const noop = () => {
5
+ /* empty on purpose */
6
+ };
7
+ /**
8
+ * The default values for the {@link UsePlotDimensionsValues}: zero-sized plot dimensions, the
9
+ * {@link defaultMargin}, and no-op functions
10
+ * @return The default plot-dimension values
11
+ */
12
+ export const defaultPlotDimensions = () => ({
13
+ plotDimensions: { width: 0, height: 0 },
14
+ margin: defaultMargin,
15
+ updateDimensions: noop,
16
+ registerPlotDimensionChangeHandler: () => "",
17
+ unregisterPlotDimensionChangeHandler: noop
18
+ });
19
+ /**
20
+ * The default margins between the edges of the chart and the plot area
21
+ */
22
+ export const defaultMargin = { top: 30, right: 20, bottom: 30, left: 50 };
23
+ //# sourceMappingURL=defaultPlotDimensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultPlotDimensions.js","sourceRoot":"","sources":["../../../../src/app/charts/hooks/defaultPlotDimensions.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,IAAI,GAAG,GAAG,EAAE;IACd,sBAAsB;AAC1B,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAA4B,EAAE,CAAC,CAAC;IACjE,cAAc,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC;IACrC,MAAM,EAAE,aAAa;IACrB,gBAAgB,EAAE,IAAI;IACtB,kCAAkC,EAAE,GAAG,EAAE,CAAC,EAAE;IAC5C,oCAAoC,EAAE,IAAI;CAC7C,CAAC,CAAA;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAW,EAAC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { UseTooltipValues } from "./useTooltip";
2
+ /**
3
+ * The default values for the {@link UseTooltipValues}
4
+ * @return The default values for the {@link UseTooltipValues}
5
+ * @template D The type of the data object for the series
6
+ * @template M The type of the metadata object for the series
7
+ */
8
+ export declare function defaultTooltipValues<D, M>(): UseTooltipValues<D, M>;
9
+ //# sourceMappingURL=defaultTooltipValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultTooltipValues.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/hooks/defaultTooltipValues.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AASnD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,CAAC,KAAK,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAOnE"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * No operation function for use when a default function is needed
3
+ */
4
+ const noop = () => {
5
+ /* empty on purpose */
6
+ };
7
+ /**
8
+ * The default values for the {@link UseTooltipValues}
9
+ * @return The default values for the {@link UseTooltipValues}
10
+ * @template D The type of the data object for the series
11
+ * @template M The type of the metadata object for the series
12
+ */
13
+ export function defaultTooltipValues() {
14
+ return {
15
+ registerTooltipContentProvider: noop,
16
+ tooltipContentProvider: () => undefined,
17
+ setVisibilityState: noop,
18
+ visibilityState: false,
19
+ };
20
+ }
21
+ //# sourceMappingURL=defaultTooltipValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultTooltipValues.js","sourceRoot":"","sources":["../../../../src/app/charts/hooks/defaultTooltipValues.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,IAAI,GAAG,GAAG,EAAE;IACd,sBAAsB;AAC1B,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB;IAChC,OAAO;QACH,8BAA8B,EAAE,IAAI;QACpC,sBAAsB,EAAE,GAAG,EAAE,CAAC,SAAS;QACvC,kBAAkB,EAAE,IAAI;QACxB,eAAe,EAAE,KAAK;KACzB,CAAA;AACL,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { BaseAxis, SeriesStyle } from "../axes/axes";
2
+ import { BaseAxisRange } from "../axes/BaseAxisRange";
3
+ import type { UseChartValues } from "./useChart";
4
+ /**
5
+ * The default values for the {@link UseChartValues}
6
+ * @return The default values for the {@link UseChartValues}
7
+ * @template D The type of the series' datum
8
+ * @template S The type of the series style
9
+ * @template TM The type of the tooltip's metadata (data about the series data)
10
+ * @template AR The type of the axis range
11
+ * @template A The type of the axis
12
+ */
13
+ export declare function defaultUseChartValues<D, S extends SeriesStyle, TM, AR extends BaseAxisRange, A extends BaseAxis>(): UseChartValues<D, S, TM, AR, A>;
14
+ //# sourceMappingURL=defaultUseChartValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultUseChartValues.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/hooks/defaultUseChartValues.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AACxD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAIpD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE/C;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,EAAE,EAAE,EAAE,EAAE,SAAS,aAAa,EAAE,CAAC,SAAS,QAAQ,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAmBnJ"}
@@ -0,0 +1,30 @@
1
+ import { defaultAxesValues } from "./defaultAxesValues";
2
+ import { defaultMouseValues } from "./defaultMouseValues";
3
+ import { defaultTooltipValues } from "./defaultTooltipValues";
4
+ /**
5
+ * The default values for the {@link UseChartValues}
6
+ * @return The default values for the {@link UseChartValues}
7
+ * @template D The type of the series' datum
8
+ * @template S The type of the series style
9
+ * @template TM The type of the tooltip's metadata (data about the series data)
10
+ * @template AR The type of the axis range
11
+ * @template A The type of the axis
12
+ */
13
+ export function defaultUseChartValues() {
14
+ return {
15
+ chartId: NaN,
16
+ canvas: null,
17
+ canvasContext: null,
18
+ color: '#d2933f',
19
+ backgroundColor: '#EEE',
20
+ seriesStyles: new Map(),
21
+ // axes
22
+ axes: defaultAxesValues(),
23
+ // data
24
+ seriesFilter: /./,
25
+ // internal chart-interaction event handlers
26
+ mouse: defaultMouseValues(),
27
+ tooltip: defaultTooltipValues(),
28
+ };
29
+ }
30
+ //# sourceMappingURL=defaultUseChartValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultUseChartValues.js","sourceRoot":"","sources":["../../../../src/app/charts/hooks/defaultUseChartValues.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAG5D;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB;IACjC,OAAO;QACH,OAAO,EAAE,GAAG;QACZ,MAAM,EAAE,IAAI;QACZ,aAAa,EAAE,IAAI;QACnB,KAAK,EAAE,SAAS;QAChB,eAAe,EAAE,MAAM;QACvB,YAAY,EAAE,IAAI,GAAG,EAAa;QAElC,OAAO;QACP,IAAI,EAAE,iBAAiB,EAAE;QAEzB,OAAO;QACP,YAAY,EAAE,GAAG;QAEjB,4CAA4C;QAC5C,KAAK,EAAE,kBAAkB,EAAE;QAC3B,OAAO,EAAE,oBAAoB,EAAE;KAClC,CAAA;AACL,CAAC"}
@@ -1,14 +1,14 @@
1
1
  import { AxesState } from "../axes/AxesState";
2
- import { BaseAxis } from "../axes/axes";
3
- import { AxesAssignment } from "../plots/plot";
4
- import { JSX } from "react";
5
- import { Dimensions } from "../styling/margins";
2
+ import type { BaseAxis } from "../axes/axes";
3
+ import type { AxesAssignment } from "../plots/plot";
4
+ import type { Dimensions } from "../styling/margins";
6
5
  import { BaseAxisRange } from "../axes/BaseAxisRange";
7
6
  import { AxisInterval } from "../axes/AxisInterval";
8
7
  import { Optional } from "result-fn";
9
8
  /**
10
9
  * The values exposed by the hook
11
10
  * @template AR The type of the axis range (e.g. {@link ContinuousAxisRange} or {@link OrdinalAxisRange})
11
+ * @template A The axis type
12
12
  */
13
13
  export type UseAxesValues<AR extends BaseAxisRange, A extends BaseAxis> = {
14
14
  /**
@@ -23,7 +23,7 @@ export type UseAxesValues<AR extends BaseAxisRange, A extends BaseAxis> = {
23
23
  */
24
24
  addXAxis: (axis: A, id: string, range?: AR) => void;
25
25
  /**
26
- * The y-axes state holds the currently set x-axes, manipulation and accessor functions
26
+ * The y-axes state holds the currently set y-axes, manipulation and accessor functions
27
27
  */
28
28
  yAxesState: AxesState<A>;
29
29
  /**
@@ -40,17 +40,20 @@ export type UseAxesValues<AR extends BaseAxisRange, A extends BaseAxis> = {
40
40
  */
41
41
  setAxisAssignments: (assignments: Map<string, AxesAssignment>) => void;
42
42
  /**
43
- * Retrieves the axis assigned to the specified series
43
+ * Retrieves the axes assigned to the specified series (the default x- and y-axes, when the
44
+ * series has no assignment)
45
+ * @param seriesName The name of the series
44
46
  * @return The axes assigned to the specified series
45
47
  */
46
48
  axisAssignmentsFor: (seriesName: string) => AxesAssignment;
47
49
  /**
48
- * Sets the axis ranges specified in the input map
50
+ * Sets the axis ranges specified in the input map (without dispatching them to the update
51
+ * handlers -- see {@link updateAxisRanges} for that)
49
52
  * @param ranges A map holding the axis ID to the axis range
50
53
  */
51
54
  setAxesRanges: (ranges: Map<string, AR>) => void;
52
55
  /**
53
- * Sets the axis range for the specified axis ID
56
+ * Sets the axis range for the specified axis ID (without dispatching it to the update handlers)
54
57
  * @param axisId The ID of the axis for which to set the range
55
58
  * @param range The new axis range
56
59
  */
@@ -59,42 +62,52 @@ export type UseAxesValues<AR extends BaseAxisRange, A extends BaseAxis> = {
59
62
  * Retrieves the current axis range for the specified axis ID
60
63
  * @param axisId The ID of the axis for which to retrieve the range
61
64
  * @return The current axis range for the specified axis ID wrapped
62
- * in a n {@link Optional}, or an empty {@link Optional} if the axis
65
+ * in an {@link Optional}, or an empty {@link Optional} if the axis
63
66
  * ID is not found
64
67
  */
65
68
  axisRangeFor: (axisId: string) => Optional<AR>;
66
69
  /**
67
- * Sets the domain (interval) for the specified axis ID to the specified range
70
+ * Sets the domain (interval) of the specified axis' current range, leaving its original range
71
+ * as it is (does nothing when the axis has no range yet; doesn't dispatch the change to the
72
+ * update handlers)
68
73
  * @param axisId The ID of the axis for which to set the range
69
- * @param domain The new domain as a `[start: number, end: number]` tuple
74
+ * @param domain The new domain
70
75
  */
71
76
  setAxisIntervalFor: (axisId: string, domain: AxisInterval) => void;
72
77
  /**
73
- * Sets the original axis bounds for the specified axis ID to the specified range
78
+ * Sets the original axis bounds for the specified axis ID to the specified range (does nothing
79
+ * when the axis has no range yet)
74
80
  * @param axisId The ID of the axis for which to set the range
75
- * @param range The new range as a `[start, end]` tuple
81
+ * @param range The new original range
76
82
  */
77
83
  setOriginalAxisIntervalFor: (axisId: string, range: AxisInterval) => void;
78
84
  /**
79
- * Callback function that is called when the time ranges change. The time ranges could
80
- * change because of a zoom action, a pan action, or as new data is streamed in.
85
+ * Updates the ranges of the specified axes, and dispatches the updates to every registered
86
+ * update handler (see {@link addAxesRangesUpdateHandler}) -- e.g. the axes, which redraw with
87
+ * their new domains. Called when the ranges change because of a zoom action, a pan action, or
88
+ * as new data is streamed in.
81
89
  * @param domains A `map(axis_id -> domain)` that associates the axis ID with the
82
90
  * current time range.
83
91
  */
84
92
  updateAxisRanges: (domains: Map<string, AR>) => void;
85
93
  /**
86
- * Retrieves the current axis bounds for the specified axis ID
87
- * @return The current axis bounds as a map(axis_id, (start, end))
94
+ * Retrieves the current ranges of all the axes
95
+ * @return A copy of the current axis ranges, as a map(axis_id, range)
88
96
  */
89
97
  axesRanges: () => Map<string, AR>;
90
98
  /**
91
- * Resets the axis bounds to its original bounds
99
+ * Re-applies the specified axis' stored range: dispatches it, unchanged, to the update handlers
100
+ * (so that the axis redraws with it). Note that, despite its name, this does *not* restore the
101
+ * axis' original range, and the `<AxesProvider>`'s implementation ignores `axisBounds`.
92
102
  * @param axisId The ID of the axis
93
- * @param [axisBounds] An optional bounds that resets the original bounds
103
+ * @param [axisBounds] Unused
94
104
  */
95
105
  resetAxisIntervalFor: (axisId: string, axisBounds?: AxisInterval) => void;
96
106
  /**
97
- * Resets all the axes bound to the original bounds
107
+ * Sets the ranges of the axes in the specified map, and dispatches them to the update handlers
108
+ * (the same as {@link updateAxisRanges}). Axes that aren't in the map are left as they are, so
109
+ * calling this without a map changes nothing -- despite its name, it doesn't restore the axes'
110
+ * original ranges.
98
111
  * @param [axesBounds] An optional map holds the new bounds for specified axes. The map
99
112
  * associates an axis ID with the new bounds.
100
113
  */
@@ -110,6 +123,15 @@ export type UseAxesValues<AR extends BaseAxisRange, A extends BaseAxis> = {
110
123
  /**
111
124
  * Adds a handler for when the axes are updated. An axis domain/range could change because of a zoom action,
112
125
  * a pan action, or as new data is streamed in.
126
+ *
127
+ * Throws if `handlerId` is already registered, rather than silently replacing or ignoring the
128
+ * new one -- a custom axis/plot component that could ever remount (not just re-render) with
129
+ * the same `handlerId` (e.g. one derived from a stable chart/axis ID) must call
130
+ * {@link removeAxesRangesUpdateHandler} in its own unmount cleanup before this would ever be
131
+ * called again for that ID, or the remount will throw here. See {@link ContinuousAxis}/
132
+ * {@link OrdinalAxis} for the reference pattern: a `useEffect` whose only job is calling
133
+ * `removeAxesRangesUpdateHandler` on unmount, kept separate from whatever other effect(s)
134
+ * register the handler.
113
135
  * @param handlerId The unique ID of the handler to register/add
114
136
  * @param handler The handler function that accepts a map of updates and a plot dimension
115
137
  */
@@ -120,23 +142,14 @@ export type UseAxesValues<AR extends BaseAxisRange, A extends BaseAxis> = {
120
142
  */
121
143
  removeAxesRangesUpdateHandler: (handlerId: string) => void;
122
144
  };
123
- export declare const defaultAxesValues: () => UseAxesValues<any, any>;
124
- export type Props = {
125
- /**y
126
- * Callback when axes bounds change.
127
- * @param ranges The ranges (start, end) for each axis in the plot
128
- */
129
- onUpdateAxesInterval?: (ranges: Map<string, AxisInterval>) => void;
130
- children: JSX.Element | Array<JSX.Element>;
131
- };
132
- /**
133
- * The React context provider for the {@link UseAxesValues}
134
- * @param props The properties
135
- * @return The children wrapped in this provider
136
- */
137
- export default function AxesProvider<AR extends BaseAxisRange, A extends BaseAxis>(props: Props): JSX.Element;
145
+ export declare const AxesContext: import("react").Context<unknown>;
138
146
  /**
139
- * React hook that sets up the React context for the chart values.
147
+ * React hook for the chart's axes: their state, ranges, and the functions for updating them.
148
+ * Must be used within an {@link AxesProvider} (i.e. within a `<Chart>`).
140
149
  * @return The {@link UseAxesValues} held in the React context.
150
+ * @throws Error when used outside an `<AxesProvider>`
151
+ * @template AR The type of the axis range (e.g. {@link ContinuousAxisRange} or {@link OrdinalAxisRange})
152
+ * @template A The axis type
141
153
  */
142
154
  export declare function useAxes<AR extends BaseAxisRange, A extends BaseAxis>(): UseAxesValues<AR, A>;
155
+ //# sourceMappingURL=useAxes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAxes.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/hooks/useAxes.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,E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