stream-charts 1.2.0 → 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 +40 -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
@@ -1,12 +1,16 @@
1
1
  import { Optional } from "result-fn";
2
2
  /**
3
- * Holds the information to allow mapping axes names to the underlying axes objects.
4
- * These objects hold the axis ID, its location on the chart (i.e. left, right, bottom, upper)
5
- * and the underlying d3 selection objects for managing the axes. Axis objects that extend
6
- * the `BaseAxis` class may have additional properties.
3
+ * Holds the information to allow mapping axes IDs to the underlying axes objects (of either the
4
+ * x-axes or the y-axes). These objects hold the axis ID, its location on the chart (i.e. left,
5
+ * right, bottom, top), its type, and (for the axis types that extend `BaseAxis`) its scale and the
6
+ * functions for updating and drawing it.
7
7
  * @typeParam A The type of the axes (must extend `BaseAxis`)
8
8
  */
9
9
  export class AxesState {
10
+ /**
11
+ * Use {@link from} or {@link empty} to create an axes state
12
+ * @param axes Mapping of the axes IDs to the axes
13
+ */
10
14
  constructor(axes) {
11
15
  this.axes = axes;
12
16
  }
@@ -32,15 +36,8 @@ export class AxesState {
32
36
  return this.axes.size === 0;
33
37
  }
34
38
  /**
35
- * Creates a deep copy of the current axes state.
36
- * @return A deep copy of the current axes state.
37
- */
38
- copy() {
39
- return new AxesState(new Map(Array.from(this.axes.entries())
40
- .map(([id, axis]) => [id, Object.assign({}, axis)])));
41
- }
42
- /**
43
- * Adds an axis to the current axis state and returns a new axis state. This is an internal state
39
+ * Adds an axis to this axes state's map of axes (in place), and returns a new axes state holding
40
+ * that same map (a new object, so that React sees the change). This is an internal state
44
41
  * management function. This should generally not be used. Instead, use the {@link UseAxesValues.addXAxis}
45
42
  * and {@link UseAxesValues.addYAxis} functions to add axes.
46
43
  * @param axis The axis to add
@@ -54,22 +51,26 @@ export class AxesState {
54
51
  return new AxesState(updatedAxes);
55
52
  }
56
53
  /**
57
- * Attempts to retrieve the x-axis for the specified ID
58
- * @param axisId The unique ID of the axis
59
- * @return The axis, or undefined if no axis with the specified ID is found
54
+ * Attempts to retrieve the axis for the specified ID.
55
+ * @param axisId The unique ID of the axis, or `""` to request the default axis (the
56
+ * convention used throughout this library wherever a series has no explicit axis
57
+ * assignment -- see e.g. each plot component's own `axesFor` helper).
58
+ * @return The axis matching `axisId`; the default axis (see {@link defaultAxis}) if
59
+ * `axisId` is `""` and at least one axis exists; otherwise an empty `Optional`. A non-empty
60
+ * `axisId` that doesn't match any axis is deliberately treated as "not found" rather than
61
+ * silently substituting an unrelated axis -- that used to happen for *any* unmatched ID,
62
+ * which masked stale/mistyped axis IDs as if they'd resolved correctly.
60
63
  */
61
64
  axisFor(axisId) {
62
65
  const axis = this.axes.get(axisId);
63
- // when there is no axis for the specified ID and there is at least
64
- // one axis, then just use that...it is the default axis
65
- if (axis === undefined && this.axes.size >= 1) {
66
- return Optional.of(Array.from(this.axes.values())[0]);
66
+ if (axis === undefined && axisId === "" && this.axes.size >= 1) {
67
+ return this.defaultAxis();
67
68
  }
68
69
  return Optional.ofNullable(axis);
69
70
  }
70
71
  /**
71
- * Returns the default axis
72
- * @return The default axis
72
+ * Returns the default axis: the first axis added
73
+ * @return The default axis, or an empty `Optional` when there are no axes
73
74
  * @see axisDefaultId
74
75
  */
75
76
  defaultAxis() {
@@ -79,13 +80,14 @@ export class AxesState {
79
80
  Optional.empty();
80
81
  }
81
82
  /**
82
- * @return An array holding all existing the x-axis IDs
83
+ * @return An array holding the IDs of all the axes
83
84
  */
84
85
  axisIds() {
85
86
  return Array.from(this.axes.keys());
86
87
  }
87
88
  /**
88
- * @return The default name of the x-axis (in case only on default axis was added)
89
+ * @return The ID of the default axis (the first axis added), or an empty `Optional` when there
90
+ * are no axes
89
91
  */
90
92
  axisDefaultId() {
91
93
  const ids = Array.from(this.axes.keys());
@@ -1 +1 @@
1
- {"version":3,"file":"AxesState.js","sourceRoot":"","sources":["../../../../src/app/charts/axes/AxesState.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,OAAO,SAAS;IAGlB,YAAoB,IAAoB;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACpB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAqB,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AAC,CAAC,CAAC,CAAC,CAAC;YACrB,QAAQ,CAAC,KAAK,EAAE,CAAA;IACxB,CAAC;CACJ"}
@@ -1,14 +1,31 @@
1
1
  /**
2
- * The range of an axis is the physical (start, end) pixels on the screen for the axis.
3
- * This is the pixel-space of the axis (where as the domain is the data-space of the axis,
4
- * for example, the tick values).
2
+ * An immutable (start, end) interval, with `start <= end`, used both for an axis' domain (its
3
+ * data-space, for example, the range of the tick values) and for an axis' range (its pixel-space,
4
+ * the physical start and end pixels on the screen). An interval whose start or end is `NaN` is
5
+ * empty.
5
6
  */
6
7
  export declare class AxisInterval {
7
8
  readonly start: number;
8
9
  readonly end: number;
10
+ /**
11
+ * Use {@link from}, {@link as}, or {@link empty} to create an axis interval
12
+ * @param start The interval's start
13
+ * @param end The interval's end
14
+ */
9
15
  private constructor();
10
16
  /**
11
- * Creates an axis interval from the specified start and end values
17
+ * Creates an axis interval from the specified start and end values. The values are normalized
18
+ * so that `start <= end` regardless of the order they're passed in -- callers never need to
19
+ * worry about which endpoint ended up larger (e.g. after a pan/zoom delta pushes one endpoint
20
+ * past the other).
21
+ *
22
+ * If exactly one of `start`/`end` is `NaN`, both endpoints of the result collapse to `NaN`
23
+ * (`Math.min`/`Math.max` propagate `NaN` unconditionally) -- the same representation as an
24
+ * intentionally-empty interval (see {@link empty}). That's indistinguishable from genuinely
25
+ * wanting an empty interval, and silently discards which of the two inputs was actually bad,
26
+ * so this logs a warning for that specific mixed case (one real number, one `NaN`) to surface
27
+ * what's almost always an upstream computation error -- `from(NaN, NaN)` (a deliberate empty
28
+ * interval) is not warned about.
12
29
  * @param start The axis-range start value
13
30
  * @param end The axis-range end value
14
31
  * @return The axis-interval
@@ -34,7 +51,11 @@ export declare class AxisInterval {
34
51
  */
35
52
  isNotEmpty(): boolean;
36
53
  /**
37
- * @return `true` if the specified axis interval is equal to this one, `false` otherwise
54
+ * Determines whether this axis interval's start and end are the specified ones (two empty
55
+ * intervals are equal)
56
+ * @param start The start to compare to
57
+ * @param end The end to compare to
58
+ * @return `true` if this axis interval's start and end are the specified ones, `false` otherwise
38
59
  */
39
60
  equalsInterval(start: number, end: number): boolean;
40
61
  /**
@@ -44,8 +65,8 @@ export declare class AxisInterval {
44
65
  */
45
66
  equals(other: AxisInterval): boolean;
46
67
  /**
47
- * Creates a copy of the specified axis interval
48
- * @return A copy of the specified axis interval
68
+ * Creates a copy of this axis interval
69
+ * @return A copy of this axis interval
49
70
  */
50
71
  copy(): AxisInterval;
51
72
  /**
@@ -54,39 +75,36 @@ export declare class AxisInterval {
54
75
  */
55
76
  asTuple(): [start: number, end: number];
56
77
  /**
57
- * Applies the specified function to the axis interval and returns the result
58
- * @param fn The function to apply to the axis interval
59
- * @return The result of the function application
78
+ * Applies the specified function to this axis interval's start and end, and returns the
79
+ * resulting interval
80
+ * @param fn The function to apply to the axis interval's start and end
81
+ * @return A new axis interval holding the function's result
60
82
  */
61
83
  map(fn: (start: number, end: number) => [start: number, end: number]): AxisInterval;
62
84
  /**
63
- * Calculates the measure (end - start) of the specified axis interval.
85
+ * Calculates the measure (end - start) of this axis interval.
64
86
  * The measure of an empty axis interval is 0.
65
- * @return The measure (end - start) of the specified axis interval
87
+ * @return The measure (end - start) of this axis interval
66
88
  */
67
89
  measure(): number;
68
90
  /**
69
- * Updates the start value of the specified axis interval
70
- * @param delta The amount by which to update the start value
71
- * @return A new axis interval
91
+ * Creates an axis interval whose start is moved by the specified amount (and whose end isn't)
92
+ * @param delta The amount by which to move the start
93
+ * @return A new axis interval (empty when this one is)
72
94
  */
73
95
  translateStart(delta: number): AxisInterval;
74
96
  /**
75
- * Updates the end value of the specified axis interval
76
- * @param delta The amount by which to update the end value
77
- * @return The new axis interval
97
+ * Creates an axis interval whose end is moved by the specified amount (and whose start isn't)
98
+ * @param delta The amount by which to move the end
99
+ * @return A new axis interval (empty when this one is)
78
100
  */
79
101
  translateEnd(delta: number): AxisInterval;
80
102
  /**
81
- * Translates the specified axis interval by the specified delta.
103
+ * Creates an axis interval that's this one translated (both its start and its end moved) by the
104
+ * specified amount
82
105
  * @param delta The amount by which to translate the axis interval
83
- * @return The new axis interval
106
+ * @return A new axis interval (empty when this one is)
84
107
  */
85
108
  translate(delta: number): AxisInterval;
86
109
  }
87
- /**
88
- * Creates a copy of the specified map(axis_id, (start, end))
89
- * @param ranges The ranges map to copy
90
- * @return A copy of the specified map(axis_id, (start, end))
91
- */
92
- export declare function copyRangeMap(ranges: Map<string, AxisInterval>): Map<string, AxisInterval>;
110
+ //# sourceMappingURL=AxisInterval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AxisInterval.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/axes/AxisInterval.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,YAAY;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IAEpB;;;;OAIG;IACH,OAAO;IAKP;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY;IAWrD;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,YAAY;IAI5D;;;OAGG;IACH,MAAM,CAAC,KAAK,IAAI,YAAY;IAI5B;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,UAAU,IAAI,OAAO;IAIrB;;;;;;OAMG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAInD;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIpC;;;OAGG;IACH,IAAI,IAAI,YAAY;IAIpB;;;OAGG;IACH,OAAO,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC;IAIvC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,YAAY;IAKnF;;;;OAIG;IACH,OAAO,IAAI,MAAM;IAIjB;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAI3C;;;;OAIG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAIzC;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;CAGzC"}
@@ -1,20 +1,42 @@
1
1
  /**
2
- * The range of an axis is the physical (start, end) pixels on the screen for the axis.
3
- * This is the pixel-space of the axis (where as the domain is the data-space of the axis,
4
- * for example, the tick values).
2
+ * An immutable (start, end) interval, with `start <= end`, used both for an axis' domain (its
3
+ * data-space, for example, the range of the tick values) and for an axis' range (its pixel-space,
4
+ * the physical start and end pixels on the screen). An interval whose start or end is `NaN` is
5
+ * empty.
5
6
  */
6
7
  export class AxisInterval {
8
+ /**
9
+ * Use {@link from}, {@link as}, or {@link empty} to create an axis interval
10
+ * @param start The interval's start
11
+ * @param end The interval's end
12
+ */
7
13
  constructor(start, end) {
8
14
  this.start = start;
9
15
  this.end = end;
10
16
  }
11
17
  /**
12
- * Creates an axis interval from the specified start and end values
18
+ * Creates an axis interval from the specified start and end values. The values are normalized
19
+ * so that `start <= end` regardless of the order they're passed in -- callers never need to
20
+ * worry about which endpoint ended up larger (e.g. after a pan/zoom delta pushes one endpoint
21
+ * past the other).
22
+ *
23
+ * If exactly one of `start`/`end` is `NaN`, both endpoints of the result collapse to `NaN`
24
+ * (`Math.min`/`Math.max` propagate `NaN` unconditionally) -- the same representation as an
25
+ * intentionally-empty interval (see {@link empty}). That's indistinguishable from genuinely
26
+ * wanting an empty interval, and silently discards which of the two inputs was actually bad,
27
+ * so this logs a warning for that specific mixed case (one real number, one `NaN`) to surface
28
+ * what's almost always an upstream computation error -- `from(NaN, NaN)` (a deliberate empty
29
+ * interval) is not warned about.
13
30
  * @param start The axis-range start value
14
31
  * @param end The axis-range end value
15
32
  * @return The axis-interval
16
33
  */
17
34
  static from(start, end) {
35
+ if ((isNaN(start) || isNaN(end)) && !(isNaN(start) && isNaN(end))) {
36
+ console.warn(`AxisInterval.from received exactly one NaN endpoint -- this usually indicates an ` +
37
+ `upstream computation error, not an intentional empty interval (use AxisInterval.empty() ` +
38
+ `for that); start: ${start}, end: ${end}`);
39
+ }
18
40
  return new AxisInterval(Math.min(start, end), Math.max(start, end));
19
41
  }
20
42
  /**
@@ -45,7 +67,11 @@ export class AxisInterval {
45
67
  return !this.isEmpty();
46
68
  }
47
69
  /**
48
- * @return `true` if the specified axis interval is equal to this one, `false` otherwise
70
+ * Determines whether this axis interval's start and end are the specified ones (two empty
71
+ * intervals are equal)
72
+ * @param start The start to compare to
73
+ * @param end The end to compare to
74
+ * @return `true` if this axis interval's start and end are the specified ones, `false` otherwise
49
75
  */
50
76
  equalsInterval(start, end) {
51
77
  return (this.start === start && this.end === end) || (this.isEmpty() && isNaN(start) && isNaN(end));
@@ -59,8 +85,8 @@ export class AxisInterval {
59
85
  return this.equalsInterval(other.start, other.end);
60
86
  }
61
87
  /**
62
- * Creates a copy of the specified axis interval
63
- * @return A copy of the specified axis interval
88
+ * Creates a copy of this axis interval
89
+ * @return A copy of this axis interval
64
90
  */
65
91
  copy() {
66
92
  return AxisInterval.from(this.start, this.end);
@@ -73,54 +99,47 @@ export class AxisInterval {
73
99
  return [this.start, this.end];
74
100
  }
75
101
  /**
76
- * Applies the specified function to the axis interval and returns the result
77
- * @param fn The function to apply to the axis interval
78
- * @return The result of the function application
102
+ * Applies the specified function to this axis interval's start and end, and returns the
103
+ * resulting interval
104
+ * @param fn The function to apply to the axis interval's start and end
105
+ * @return A new axis interval holding the function's result
79
106
  */
80
107
  map(fn) {
81
108
  const [start, end] = fn(this.start, this.end);
82
109
  return AxisInterval.from(start, end);
83
110
  }
84
111
  /**
85
- * Calculates the measure (end - start) of the specified axis interval.
112
+ * Calculates the measure (end - start) of this axis interval.
86
113
  * The measure of an empty axis interval is 0.
87
- * @return The measure (end - start) of the specified axis interval
114
+ * @return The measure (end - start) of this axis interval
88
115
  */
89
116
  measure() {
90
117
  return this.isNotEmpty() ? this.end - this.start : 0;
91
118
  }
92
119
  /**
93
- * Updates the start value of the specified axis interval
94
- * @param delta The amount by which to update the start value
95
- * @return A new axis interval
120
+ * Creates an axis interval whose start is moved by the specified amount (and whose end isn't)
121
+ * @param delta The amount by which to move the start
122
+ * @return A new axis interval (empty when this one is)
96
123
  */
97
124
  translateStart(delta) {
98
125
  return this.isNotEmpty() ? AxisInterval.from(this.start + delta, this.end) : AxisInterval.empty();
99
126
  }
100
127
  /**
101
- * Updates the end value of the specified axis interval
102
- * @param delta The amount by which to update the end value
103
- * @return The new axis interval
128
+ * Creates an axis interval whose end is moved by the specified amount (and whose start isn't)
129
+ * @param delta The amount by which to move the end
130
+ * @return A new axis interval (empty when this one is)
104
131
  */
105
132
  translateEnd(delta) {
106
133
  return this.isNotEmpty() ? AxisInterval.from(this.start, this.end + delta) : AxisInterval.empty();
107
134
  }
108
135
  /**
109
- * Translates the specified axis interval by the specified delta.
136
+ * Creates an axis interval that's this one translated (both its start and its end moved) by the
137
+ * specified amount
110
138
  * @param delta The amount by which to translate the axis interval
111
- * @return The new axis interval
139
+ * @return A new axis interval (empty when this one is)
112
140
  */
113
141
  translate(delta) {
114
142
  return this.isNotEmpty() ? AxisInterval.from(this.start + delta, this.end + delta) : AxisInterval.empty();
115
143
  }
116
144
  }
117
- /**
118
- * Creates a copy of the specified map(axis_id, (start, end))
119
- * @param ranges The ranges map to copy
120
- * @return A copy of the specified map(axis_id, (start, end))
121
- */
122
- export function copyRangeMap(ranges) {
123
- return new Map(Array.from(ranges.entries())
124
- .map(([id, range]) => [id, range.copy()]));
125
- }
126
145
  //# sourceMappingURL=AxisInterval.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AxisInterval.js","sourceRoot":"","sources":["../../../../src/app/charts/axes/AxisInterval.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,YAAY;IACrB,YAA6B,KAAa,EAAW,GAAW;QAAnC,UAAK,GAAL,KAAK,CAAQ;QAAW,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAEpE;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAAa,EAAE,GAAW;QAClC,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;IACvE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,KAAmC;QACzC,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAChD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,KAAK;QACR,OAAO,IAAI,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IACH,OAAO;QACH,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/C,CAAC;IAED;;OAEG;IACH,UAAU;QACN,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,KAAa,EAAE,GAAW;QACrC,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;IACvG,CAAC;I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;;;;;OAKG;IACH,GAAG,CAAC,EAAgE;QAChE,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;QAC7C,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACxC,CAAC;IAED;;;;OAIG;IACH,OAAO;QACH,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IACxD,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,KAAa;QACxB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,CAAA;IACrG,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,CAAA;IACrG,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,KAAa;QACnB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,CAAA;IAC7G,CAAC;CACJ"}
@@ -21,49 +21,72 @@ export declare abstract class BaseAxisRange {
21
21
  */
22
22
  matchesOriginal(start: number, end: number): boolean;
23
23
  /**
24
- * Returns the current distance between the start and end of the range.
24
+ * The current distance between the start and end of the range
25
+ * @return The current range's measure (0 when it's empty)
25
26
  */
26
27
  get currentDistance(): number;
27
28
  /**
28
- * Returns the original (e.g. before any zooming or panning) distance between the start and end of the range.
29
+ * The original (e.g. before any zooming or panning) distance between the start and end of the range
30
+ * @return The original range's measure (0 when it's empty)
29
31
  */
30
32
  get originalDistance(): number;
31
33
  /**
32
- * The ratio between the current and original distance.
33
- */
34
- get scaleFactor(): number;
35
- /**
36
- * Scales the range using the current scale-factor (closure on `scaleFactor`)
37
- * @param factor The factor used to update the range
34
+ * Scales the range by the specified *incremental* factor -- i.e. relative to `.current`, not
35
+ * relative to `.original`. d3-zoom's own `transform.k` is cumulative from wherever `__zoom` was
36
+ * last reset to identity, so callers must first convert it to an incremental factor (this
37
+ * event's `k` divided by the previously-applied `k`, tracked in a ref that survives across
38
+ * zoom events -- see `useCanvasZoomPan`) before calling this. Scaling relative
39
+ * to `.current` this way means `.original` no longer needs to be preserved/shifted for the
40
+ * zoom math to stay correct -- unlike the previous design, where `factor` was the *cumulative*
41
+ * `transform.k` applied against `.original`, which broke the moment anything (e.g. a fresh
42
+ * subscription on Run) rebuilt `.original` to match a since-zoomed `.current` mid-session.
43
+ * @param factor The incremental scale factor (this event's change in scale, not the cumulative
44
+ * scale since the axis was last at identity)
38
45
  * @param value The current value being scaled
39
46
  * @return The new range, represented by an array holding the start and end value
40
47
  */
41
48
  protected scaledRange(factor: number, value: number): AxisInterval;
42
49
  /**
43
- *
44
- * Scales the axis-range by the specified scale factor from the specified {@link value}. The equations
45
- * are written so that the zooming (scaling) occurs at the specified {@link value}, and expands/contracts equally
46
- * from that {@link value}.
47
- * @param factor The scale factor
48
- * @param value The time from which to scale the interval
49
- * @return A new continuous-axis range with updated values
50
+ * Scales the axis-range by the specified factor from the specified `value` (see
51
+ * {@link scaledRange} for what "incremental" means for a continuous axis range). The equations are written so
52
+ * that the zooming (scaling) occurs at the specified `value`, and expands/contracts
53
+ * equally from that `value`.
54
+ * @param factor The scale factor -- incremental for a {@link ContinuousAxisRange}, but cumulative
55
+ * for an {@link OrdinalAxisRange} (see its {@link OrdinalAxisRange.scale})
56
+ * @param value The value from which to scale the interval
57
+ * @return A new axis range with updated values
50
58
  */
51
59
  abstract scale(factor: number, value: number): BaseAxisRange;
52
60
  /**
53
- * Scales the axis-range by the specified scale factor, but constrains the range to the specified
54
- * {@link constraint} min and max. The equations are written so that the zooming (scaling) occurs
55
- * at the specified {@link value}, and expands/contracts equally from that {@link value}.
56
- * @param factor The scale factor
61
+ * Scales the axis-range from the specified `value`, honoring the specified
62
+ * `constraint` min and max. The equations are written so that the zooming (scaling)
63
+ * occurs at the specified `value`, and expands/contracts equally from that
64
+ * `value`.
65
+ *
66
+ * IMPORTANT: the two concrete subclasses give `constraint` opposite meanings, and neither
67
+ * uses the same kind of `factor` -- this base signature is shared for convenience, not
68
+ * because the implementations are interchangeable:
69
+ * - {@link ContinuousAxisRange.constrainedScale} takes an *incremental* factor and *clamps*
70
+ * the result to stay inside `constraint` -- `constraint` is a hard viewport edge the range
71
+ * is not allowed to scroll/zoom past.
72
+ * - {@link OrdinalAxisRange.constrainedScale} takes a *cumulative* factor and *widens* the
73
+ * result to guarantee it fully covers `constraint` -- `constraint` is the domain that must
74
+ * be entirely visible once zoomed all the way out, and widening (rather than clamping) is
75
+ * what fixes the pivot-drift bug documented on `OrdinalAxisRange.scaledCumulative`.
76
+ * Do not port logic between the two without re-reading both subclasses' own doc comments.
77
+ * @param factor The scale factor -- incremental or cumulative, depending on the concrete subclass
57
78
  * @param value The value at which the zoom is initiated
58
79
  * @param constraint The min and max range
59
- * @return A new continuous-axis range with updated values
80
+ * @return A new axis range with updated values
60
81
  */
61
82
  abstract constrainedScale(factor: number, value: number, constraint: [min: number, max: number]): BaseAxisRange;
62
83
  /**
63
- * Translates the axis-range by the specified amount
84
+ * Translates the axis-range by the specified amount, unless that would take it outside the
85
+ * constraint interval
64
86
  * @param amount The amount by which to translate the axis-range
65
87
  * @param [constraints] Optional constraint interval in which the axis range must be within
66
- * @return An updated {@link ContinuousAxisRange} that has been translated by the specified amount
88
+ * @return An updated axis range that has been translated by the specified amount (or an
89
+ * unchanged copy, when the translation would leave the constraint interval)
67
90
  */
68
91
  abstract translate(amount: number, constraints?: [start: number, end: number]): BaseAxisRange;
69
92
  /**
@@ -81,3 +104,4 @@ export declare abstract class BaseAxisRange {
81
104
  */
82
105
  abstract updateOriginal(start: number, end: number): BaseAxisRange;
83
106
  }
107
+ //# sourceMappingURL=BaseAxisRange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseAxisRange.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/axes/BaseAxisRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,8BAAsB,aAAa;IAC/B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;IAE9B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;IAE/B;;;;;;OAMG;IACH,SAAS,aAAa,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,GAAE,MAAc,EAAE,WAAW,GAAE,MAAY;IAK1G;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAIpD;;;OAGG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED;;;OAGG;IACH,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY;IAQlE;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa;IAE5D;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,aAAa;IAE/G;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,aAAa;IAE7F;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa;IAE1D;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa;CACrE"}
@@ -24,34 +24,39 @@ export class BaseAxisRange {
24
24
  return this.original.equalsInterval(start, end);
25
25
  }
26
26
  /**
27
- * Returns the current distance between the start and end of the range.
27
+ * The current distance between the start and end of the range
28
+ * @return The current range's measure (0 when it's empty)
28
29
  */
29
30
  get currentDistance() {
30
31
  return this.current.measure();
31
32
  }
32
33
  /**
33
- * Returns the original (e.g. before any zooming or panning) distance between the start and end of the range.
34
+ * The original (e.g. before any zooming or panning) distance between the start and end of the range
35
+ * @return The original range's measure (0 when it's empty)
34
36
  */
35
37
  get originalDistance() {
36
38
  return this.original.measure();
37
39
  }
38
40
  /**
39
- * The ratio between the current and original distance.
40
- */
41
- get scaleFactor() {
42
- return this.currentDistance / this.originalDistance;
43
- }
44
- /**
45
- * Scales the range using the current scale-factor (closure on `scaleFactor`)
46
- * @param factor The factor used to update the range
41
+ * Scales the range by the specified *incremental* factor -- i.e. relative to `.current`, not
42
+ * relative to `.original`. d3-zoom's own `transform.k` is cumulative from wherever `__zoom` was
43
+ * last reset to identity, so callers must first convert it to an incremental factor (this
44
+ * event's `k` divided by the previously-applied `k`, tracked in a ref that survives across
45
+ * zoom events -- see `useCanvasZoomPan`) before calling this. Scaling relative
46
+ * to `.current` this way means `.original` no longer needs to be preserved/shifted for the
47
+ * zoom math to stay correct -- unlike the previous design, where `factor` was the *cumulative*
48
+ * `transform.k` applied against `.original`, which broke the moment anything (e.g. a fresh
49
+ * subscription on Run) rebuilt `.original` to match a since-zoomed `.current` mid-session.
50
+ * @param factor The incremental scale factor (this event's change in scale, not the cumulative
51
+ * scale since the axis was last at identity)
47
52
  * @param value The current value being scaled
48
53
  * @return The new range, represented by an array holding the start and end value
49
54
  */
50
55
  scaledRange(factor, value) {
51
56
  const dtStart = value - this.current.start;
52
57
  const dtEnd = this.current.end - value;
53
- const start = value - dtStart * factor / this.scaleFactor;
54
- const end = value + dtEnd * factor / this.scaleFactor;
58
+ const start = value - dtStart * factor;
59
+ const end = value + dtEnd * factor;
55
60
  return AxisInterval.from(start, end);
56
61
  }
57
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BaseAxisRange.js","sourceRoot":"","sources":["../../../../src/app/charts/axes/BaseAxisRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAgB,aAAa;IAK/B;;;;;;OAMG;IACH,YAAsB,KAAa,EAAE,GAAW,EAAE,gBAAwB,KAAK,EAAE,cAAsB,GAAG;QACtG,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;QAC5C,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;IACjE,CAAC;IAED;;;;;OAKG;IACH,eAAe,CAAC,KAAa,EAAE,GAAW;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACnD,CAAC;IAED;;OAEG;IACH,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAA;IACjC,CAAC;IAED;;OAEG;I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AAC;IAED;;;OAGG;IACH,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAA;IACjC,CAAC;IAED;;;OAGG;IACH,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;IAClC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACO,WAAW,CAAC,MAAc,EAAE,KAAa;QAC/C,MAAM,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAA;QAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,KAAK,CAAA;QACtC,MAAM,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;QACtC,MAAM,GAAG,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAA;QAClC,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACxC,CAAC;CA+DJ"}
@@ -1,5 +1,5 @@
1
- import { AxesFont, AxisLocation } from "./axes";
2
- import { ScaleContinuousNumeric } from "d3";
1
+ import { type AxesFont, AxisLocation } from "./axes";
2
+ import type { ScaleContinuousNumeric } from "d3";
3
3
  export interface Props {
4
4
  axisId: string;
5
5
  location: AxisLocation;
@@ -8,13 +8,54 @@ export interface Props {
8
8
  font?: Partial<AxesFont>;
9
9
  label: string;
10
10
  updateAxisBasedOnDomainValues?: boolean;
11
+ /**
12
+ * When `true`, the axis' domain grows to fit the data plotted against it: when the data on
13
+ * screen goes above (or below) the domain, the domain grows to include it (plus the
14
+ * `autoScalePadding`), but never past `autoScaleMax` (or `autoScaleMin`). The axis starts out
15
+ * at the `domain` prop, clamped to those limits. The domain only ever grows -- it's restored
16
+ * to its start when the plot's data is replaced (e.g. on a reset), or when the `domain` prop
17
+ * or the limits change. When `false` (the default), the domain is exactly the `domain` prop.
18
+ *
19
+ * For y-axes only (an x-axis' domain follows time, and its zooming and panning), in the plots
20
+ * that support it (the scatter, bar, and outlier plots). Elsewhere, it's ignored, with a warning.
21
+ */
22
+ autoScale?: boolean;
23
+ /**
24
+ * The smallest value an auto-scaling axis' domain may reach. Defaults to `-Infinity` (no
25
+ * limit).
26
+ */
27
+ autoScaleMin?: number;
28
+ /**
29
+ * The largest value an auto-scaling axis' domain may reach. Defaults to `Infinity` (no limit).
30
+ */
31
+ autoScaleMax?: number;
32
+ /**
33
+ * The fraction of the axis' length left beyond the data's extreme when the axis grows, so the
34
+ * extreme point isn't drawn right on the edge (in the scale's own space, e.g. logarithmically
35
+ * for a log scale). From 0 to 0.45 (a larger value is treated as 0.45); defaults to 0.05.
36
+ */
37
+ autoScalePadding?: number;
38
+ /**
39
+ * The auto-scaled domain to start from when auto-scaling starts (e.g. when the axis is
40
+ * created), instead of the `domain` prop -- for keeping the axis' growth across remounts (e.g.
41
+ * navigating away from the chart and back), along with `onAutoScale`. Clamped to the limits.
42
+ */
43
+ autoScaledDomain?: [min: number, max: number];
44
+ /**
45
+ * Called with the axis' new domain whenever an auto-scaling axis grows, or is restored to its
46
+ * start (e.g. on a reset), so that it can be kept (see `autoScaledDomain`)
47
+ * @param domain The axis' new domain
48
+ */
49
+ onAutoScale?: (domain: [min: number, max: number]) => void;
11
50
  }
12
51
  /**
13
- * Represents a continuous numeric axis (x or y) that can be place on the top, bottom,
52
+ * Represents a continuous numeric axis (x or y) that can be placed on the top, bottom,
14
53
  * left, or right of the chart. The domain (axis range) can be managed by this axis
15
- * component or managed externally (i.e. deferred). This component returns null, meaning
16
- * React won't render it because we are updating the SVG element and don't want React
17
- * involved, except to call this function if the props change.
54
+ * component or managed externally (i.e. deferred). This component returns null, meaning
55
+ * React won't render it because we are drawing directly onto the chart's shared canvas and
56
+ * don't want React involved, except to call this function if the props change.
18
57
  * @param props The properties for the axis
58
+ * @return `null` (the axis draws onto the chart's canvas)
19
59
  */
20
60
  export declare function ContinuousAxis(props: Props): null;
61
+ //# sourceMappingURL=ContinuousAxis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContinuousAxis.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/axes/ContinuousAxis.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,QAAQ,EACb,YAAY,EAQf,MAAM,QAAQ,CAAC;AAIhB,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,IAAI,CAAC;AAQ/C,MAAM,WAAW,KAAK;IAElB,MAAM,EAAE,MAAM,CAAA;IAGd,QAAQ,EAAE,YAAY,CAAA;IAEtB,KAAK,CAAC,EAAE,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAE9C,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;IAElC,IAAI,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IAExB,KAAK,EAAE,MAAM,CAAA;IAiBb,6BAA6B,CAAC,EAAE,OAAO,CAAA;IACvC;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;IAC7C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,IAAI,CAAA;CAC7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CA2RjD"}