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
@@ -1,5 +1,4 @@
1
- import { addOrdinalStringAxis, AxisLocation, defaultAxesFont, defaultAxisTickStyle, labelIdFor } from "./axes";
2
- import * as d3 from "d3";
1
+ import { AxisLocation, defaultAxesFont, defaultAxisTickStyle, addOrdinalStringAxis, removeOrdinalXAxis, removeOrdinalYAxis } from "./axes";
3
2
  import { useChart } from "../hooks/useChart";
4
3
  import { useEffect, useRef } from "react";
5
4
  import { usePlotDimensions } from "../hooks/usePlotDimensions";
@@ -9,12 +8,13 @@ import { AxisInterval } from "./AxisInterval";
9
8
  * Category axis that represents the x-axis when its location is either on the bottom or the top.
10
9
  * When the axis location is left or right, then the category axis represents the y-axis. The category
11
10
  * axis requires a set of categories that will form the axis. Generally, these categories should
12
- * be the name of the series used to represent each category.
11
+ * be the name of the series used to represent each category. This component returns null, meaning
12
+ * React won't render it because we are drawing directly onto the chart's shared canvas.
13
13
  * @param props The properties for the component
14
14
  * @return null
15
15
  */
16
16
  export function OrdinalAxis(props) {
17
- const { chartId, container, axes, color, } = useChart();
17
+ const { chartId, canvasContext, axes, color, } = useChart();
18
18
  const { xAxesState, yAxesState, addXAxis, addYAxis, setAxisIntervalFor, axisRangeFor, addAxesRangesUpdateHandler, removeAxesRangesUpdateHandler, setOriginalAxisIntervalFor, } = axes;
19
19
  const { plotDimensions, margin, registerPlotDimensionChangeHandler, unregisterPlotDimensionChangeHandler } = usePlotDimensions();
20
20
  const { axisId, location, categories, updateAxisBasedOnDomainValues = true, label, } = props;
@@ -24,16 +24,15 @@ export function OrdinalAxis(props) {
24
24
  yAxesState.axisFor(axisId).getOrUndefined();
25
25
  // handles plot size changes by updating the range of the axis and the original range of the axis
26
26
  useEffect(() => {
27
- if (container) {
28
- const svg = d3.select(container);
29
- const font = Object.assign(Object.assign(Object.assign({}, defaultAxesFont()), { color }), props.font);
30
- const axisTickStyle = Object.assign(Object.assign({}, defaultAxisTickStyle()), props.axisTickStyle);
27
+ if (canvasContext) {
28
+ const font = { ...defaultAxesFont(), color, ...props.font };
29
+ const axisTickStyle = { ...defaultAxisTickStyle(), ...props.axisTickStyle };
31
30
  // lambda that gets called when the axes need to be updated
32
31
  const handleRangeUpdates = (updates, plotDim) => {
33
32
  if (rangeUpdateHandlerIdRef.current && axis) {
34
33
  const range = updates.get(axisId);
35
34
  if (range) {
36
- axis.update(range.current, range.original, plotDim, margin);
35
+ axis.update(categories, range.current, range.original, plotDim, margin);
37
36
  }
38
37
  }
39
38
  };
@@ -43,7 +42,7 @@ export function OrdinalAxis(props) {
43
42
  switch (location) {
44
43
  case AxisLocation.Top:
45
44
  case AxisLocation.Bottom: {
46
- const xAxis = addOrdinalStringAxis(chartId, axisId, svg, location, categories, label, font, axisTickStyle, plotDimensions, margin, setAxisIntervalFor, setOriginalAxisIntervalFor);
45
+ const xAxis = addOrdinalStringAxis(canvasContext, axisId, location, categories, label, font, axisTickStyle, plotDimensions, margin, setAxisIntervalFor, setOriginalAxisIntervalFor);
47
46
  // add the x-axis to the chart context
48
47
  const [start, end] = AxisInterval.as(xAxis.scale.range()).asTuple();
49
48
  addXAxis(xAxis, axisId, OrdinalAxisRange.from(start, end));
@@ -54,7 +53,7 @@ export function OrdinalAxis(props) {
54
53
  }
55
54
  case AxisLocation.Left:
56
55
  case AxisLocation.Right: {
57
- const yAxis = addOrdinalStringAxis(chartId, axisId, svg, location, categories, label, font, axisTickStyle, plotDimensions, margin, setAxisIntervalFor, setOriginalAxisIntervalFor);
56
+ const yAxis = addOrdinalStringAxis(canvasContext, axisId, location, categories, label, font, axisTickStyle, plotDimensions, margin, setAxisIntervalFor, setOriginalAxisIntervalFor);
58
57
  // add the y-axis to the chart context
59
58
  const [start, end] = AxisInterval.as(yAxis.scale.range()).asTuple();
60
59
  addYAxis(yAxis, axisId, OrdinalAxisRange.from(start, end));
@@ -69,13 +68,18 @@ export function OrdinalAxis(props) {
69
68
  .map(range => ([range.current, range.original]))
70
69
  .getOrElse([AxisInterval.empty(), AxisInterval.empty()]);
71
70
  if (range && originalRange) {
72
- axis.update(range, originalRange, plotDimensions, margin);
71
+ axis.update(categories, range, originalRange, plotDimensions, margin);
73
72
  }
74
- svg.select(`#${labelIdFor(chartId, location)}`).attr('fill', color);
73
+ // keep the axis *label's* color in sync with the chart's color (e.g. on theme
74
+ // change), without recreating the axis or touching its domain. Note: tick label
75
+ // color is intentionally NOT touched here -- it stays fixed at whatever
76
+ // axisTickStyle.font was at creation, matching the original SVG version, which
77
+ // only ever updated the label's `fill`, not the ticks'.
78
+ axis.updateFont(font);
75
79
  }
76
80
  }
77
81
  }, [
78
- container,
82
+ canvasContext,
79
83
  axis,
80
84
  addXAxis, addYAxis,
81
85
  addAxesRangesUpdateHandler,
@@ -96,7 +100,10 @@ export function OrdinalAxis(props) {
96
100
  const { current, original } = OrdinalAxisRange
97
101
  .from(start, end, 0, oldDimension.width)
98
102
  .zoom(oldDimension.width, newDimension.width);
99
- axis.update(current, original, plotDimensions, margin);
103
+ // a resize never changes the set of categories -- read the axis's own
104
+ // current domain rather than `categories` from props, since `categories`
105
+ // isn't in this effect's dependency array and so may be stale here
106
+ axis.update(axis.scale.domain(), current, original, plotDimensions, margin);
100
107
  }
101
108
  if (location === AxisLocation.Left || location === AxisLocation.Right) {
102
109
  const [start, end] = axisRangeFor(axisId)
@@ -105,7 +112,7 @@ export function OrdinalAxis(props) {
105
112
  const { current, original } = OrdinalAxisRange
106
113
  .from(start, end, 0, oldDimension.height)
107
114
  .zoom(oldDimension.height, newDimension.height);
108
- axis.update(current, original, plotDimensions, margin);
115
+ axis.update(axis.scale.domain(), current, original, plotDimensions, margin);
109
116
  }
110
117
  }
111
118
  });
@@ -125,6 +132,22 @@ export function OrdinalAxis(props) {
125
132
  }
126
133
  };
127
134
  }, [removeAxesRangesUpdateHandler]);
135
+ // unregister the axis' draw function when the axis unmounts
136
+ useEffect(() => {
137
+ return () => {
138
+ if (canvasContext) {
139
+ switch (location) {
140
+ case AxisLocation.Top:
141
+ case AxisLocation.Bottom:
142
+ removeOrdinalXAxis(canvasContext, axisId);
143
+ break;
144
+ case AxisLocation.Left:
145
+ case AxisLocation.Right:
146
+ removeOrdinalYAxis(canvasContext, axisId);
147
+ }
148
+ }
149
+ };
150
+ }, [canvasContext, axisId, location]);
128
151
  return null;
129
152
  }
130
153
  //# sourceMappingURL=OrdinalAxis.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrdinalAxis.js","sourceRoot":"","sources":["../../../../src/app/charts/axes/OrdinalAxis.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EAEpB,YAAY,EAEZ,eAAe,EACf,oBAAoB,EACpB,UAAU,EAEb,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAExC,OAAO,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAoC5C;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY;IACpC,MAAM,EACF,OAAO,EACP,SAAS,EACT,IAAI,EACJ,KAAK,GACR,GAAG,QAAQ,EAAwD,CAAA;IAEpE,MAAM,EACF,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,YAAY,EACZ,0BAA0B,EAC1B,6BAA6B,EAC7B,0BAA0B,GAC7B,GAAG,IAAI,CAAA;IAER,MAAM,EACF,cAAc,EACd,MAAM,EACN,kCAAkC,EAClC,oCAAoC,EACvC,GAAG,iBAAiB,EAAE,CAAA;IAEvB,MAAM,EACF,MAAM,EACN,QAAQ,EACR,UAAU,EACV,6BAA6B,GAAG,IAAI,EACpC,KAAK,GACR,GAAG,KAAK,CAAA;IAET,MAAM,uBAAuB,GAAG,MAAM,CAAS,SAAS,CAAC,CAAA;IACzD,MAAM,IAAI,GA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AAK;wBACnB,kBAAkB,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;gBACjD,CAAC;YACL,CAAC;QACL,CAAC,CAAA;IACL,CAAC,EACD,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,CAAC,CACpC,CAAA;IAED,OAAO,IAAI,CAAA;AACf,CAAC"}
@@ -4,6 +4,13 @@ import { BaseAxisRange } from "./BaseAxisRange";
4
4
  * Create an instance using the {@link OrdinalAxisRange.from} factory method.
5
5
  */
6
6
  export declare class OrdinalAxisRange extends BaseAxisRange {
7
+ /**
8
+ * Use {@link OrdinalAxisRange.from} to create an instance
9
+ * @param start The start of the axis-range
10
+ * @param end The end of the axis-range
11
+ * @param [originalStart=start] The original start of the axis-range
12
+ * @param [originalEnd=end] The original end of the axis-range
13
+ */
7
14
  private constructor();
8
15
  /**
9
16
  * Factory function for creating a new ordinal-axis range instance.
@@ -13,33 +20,88 @@ export declare class OrdinalAxisRange extends BaseAxisRange {
13
20
  * Defaults to the start value if not specified.)
14
21
  * @param [originalEnd=end] The optional original end of the axis-range (e.g. before any zooming or panning.
15
22
  * Defaults to the end value if not specified.)
16
- * @return A new continuous-axis range instance.
23
+ * @return A new ordinal-axis range instance.
17
24
  */
18
25
  static from(start: number, end: number, originalStart?: number, originalEnd?: number): OrdinalAxisRange;
19
26
  /**
20
- * Scales the axis-range by the specified scale factor from the specified value. The equations
21
- * are written so that the zooming (scaling) occurs at the specified value, and expands/contracts equally
22
- * from that value. This operation does not modify the original range.
23
- * @param factor The scale factor
27
+ * Scales the axis-range by the specified *cumulative* scale factor (d3-zoom's own
28
+ * `event.transform.k`, taken as-is -- NOT converted to an incremental, relative-to-the-
29
+ * previous-event factor), pivoting on `value`.
30
+ *
31
+ * Two cases, because neither a purely incremental nor a purely cumulative-from-`.original`
32
+ * formula is correct on its own for a bounded ordinal domain:
33
+ *
34
+ * - `factor === 1` (fully zoomed out): returns `.original` directly, bypassing the pivot math
35
+ * entirely. An ordinal axis's domain (the fixed set of categories) is bounded, so "zoomed all
36
+ * the way back out" has exactly one correct answer -- `.current` must equal `.original`
37
+ * *exactly*, regardless of how many different pivots were used to get there. d3-zoom's own
38
+ * `.scaleExtent` clamps `k` to *exactly* 1 at the zoom floor (not just asymptotically close),
39
+ * so this equality check reliably detects that boundary.
40
+ * - Otherwise: scales from `.current` using the *incremental* step implied by the cumulative
41
+ * factor (`factor` divided by the range's own current/original width ratio) -- the same
42
+ * pivot-preserving composition `ContinuousAxisRange` uses (see `BaseAxisRange.scaledRange`).
43
+ * This composes correctly across any sequence of differing pivots without jumping.
44
+ *
45
+ * Why not just always scale from `.original` by the cumulative factor (a prior version of this
46
+ * method did exactly that)? Composing pivot-preserving zooms at *different* pivots is not
47
+ * itself position-preserving -- zooming in at one spot and back out at another nets a
48
+ * translation, same as any pinch-zoom or map UI, verified live: zoom in at pivot A to k=5, then
49
+ * zoom out at a different pivot B to k=1, lands `.current` at `[400, 1400]` instead of
50
+ * `[0, 1000]` even under the mathematically-correct incremental composition. Scaling
51
+ * `.original` directly by the raw cumulative factor "fixes" that only by recomputing the
52
+ * *entire* zoom from scratch at the current pivot on every single event -- which is correct
53
+ * only when the pivot never changes since the last identity reset, and otherwise discards all
54
+ * zoom history, producing a visible jump the moment the pivot changes at any *non-identity* zoom
55
+ * level (confirmed live: continuing to zoom in from k=5 at pivot A to k=6 at a different pivot B
56
+ * jumped from the correct, continuous `[-1600, 4400]` to `[-4000, 2000]`). The `factor === 1`
57
+ * special case gets the position-preserving guarantee only where it's actually needed -- the
58
+ * one canonical "fully zoomed out" state -- without sacrificing composability everywhere else.
59
+ * A continuous/scrolling axis (`ContinuousAxisRange`) never needs the equivalent of this special
60
+ * case, since it has no fixed domain edge for translational drift to visibly clip against.
61
+ * @param factor The cumulative scale factor (`event.transform.k`, unmodified)
62
+ * @param value The value from which to scale the interval
63
+ * @return The new range, as a plain {start, end} pair
64
+ */
65
+ private scaledCumulative;
66
+ /**
67
+ * Scales the axis-range by the specified *cumulative* scale factor (see
68
+ * `scaledCumulative` for why this must be cumulative, not incremental) from the
69
+ * specified value. The equations are written so that the zooming (scaling) occurs at the
70
+ * specified value, and expands/contracts equally from that value. This operation does not
71
+ * modify the original range.
72
+ * @param factor The cumulative scale factor
24
73
  * @param value The value from which to scale the interval
25
- * @return A new continuous-axis range with updated values
74
+ * @return A new ordinal-axis range with updated values
26
75
  */
27
76
  scale(factor: number, value: number): OrdinalAxisRange;
28
77
  /**
29
- * Scales the axis-range by the specified scale factor from the specified value, while keeping
30
- * the range within the constraints (start, end). The equations are written so that the zooming
31
- * (scaling) occurs at the specified value, and expands/contracts equally from that value.
32
- * @param factor The scale factor
78
+ * Scales the axis-range by the specified *cumulative* scale factor (see
79
+ * `scaledCumulative` for why this must be cumulative, not incremental) from the
80
+ * specified value, while keeping the range within the constraints (start, end). The equations
81
+ * are written so that the zooming (scaling) occurs at the specified value, and
82
+ * expands/contracts equally from that value.
83
+ *
84
+ * Widens the scaled result to *cover* `constraint` (never narrower than it) -- `constraint`
85
+ * is the domain that must be fully visible once zoomed all the way out, and widening rather
86
+ * than clamping is exactly what fixes the pivot-drift bug described on
87
+ * `scaledCumulative` (zooming in at one pivot and back out at another must never leave
88
+ * part of the domain clipped). This is the opposite direction from
89
+ * {@link ContinuousAxisRange.constrainedScale}, which *clamps* its result inside `constraint`
90
+ * instead -- see that method's doc comment for why a continuous axis needs the opposite
91
+ * behavior. Do not "fix" this difference without reading both.
92
+ * @param factor The cumulative scale factor
33
93
  * @param value The value from which to scale the interval
34
94
  * @param constraint The minimum and maximum values that range bounds can be
35
- * @return A new continuous-axis range with updated values
95
+ * @return A new ordinal-axis range with updated values
36
96
  */
37
97
  constrainedScale(factor: number, value: number, constraint: [min: number, max: number]): OrdinalAxisRange;
38
98
  /**
39
- * Translates the axis-range by the specified amount
99
+ * Translates the axis-range by the specified amount, unless that would take it outside the
100
+ * constraint interval (when both ends of the constraint are infinite, there's no constraint)
40
101
  * @param amount The amount by which to translate the axis-range
41
102
  * @param [constraint=[-Infinity, Infinity]] Optional constraint interval in which the axis range must be within
42
- * @return An updated {@link OrdinalAxisRange} that has been translated by the specified amount
103
+ * @return An updated {@link OrdinalAxisRange} that has been translated by the specified amount (or an
104
+ * unchanged copy, when the translation would leave the constraint interval)
43
105
  */
44
106
  translate(amount: number, constraint?: [start: number, end: number]): OrdinalAxisRange;
45
107
  /**
@@ -67,3 +129,4 @@ export declare class OrdinalAxisRange extends BaseAxisRange {
67
129
  */
68
130
  updateOriginal(start: number, end: number): BaseAxisRange;
69
131
  }
132
+ //# sourceMappingURL=OrdinalAxisRange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrdinalAxisRange.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/axes/OrdinalAxisRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,aAAa;IAE/C;;;;;;OAMG;IACH,OAAO;IAIP;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,GAAE,MAAc,EAAE,WAAW,GAAE,MAAY,GAAG,gBAAgB;IAInH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,OAAO,CAAC,gBAAgB;IAYxB;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAKtD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,gBAAgB;IAUzG;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,GAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAyB,GAAG,gBAAgB;IAW7G;;;;;;;;OAQG;IACH,IAAI,CAAC,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,gBAAgB;IAevE;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,gBAAgB;IAIpD;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa;CAG5D"}
@@ -4,6 +4,13 @@ import { BaseAxisRange } from "./BaseAxisRange";
4
4
  * Create an instance using the {@link OrdinalAxisRange.from} factory method.
5
5
  */
6
6
  export class OrdinalAxisRange extends BaseAxisRange {
7
+ /**
8
+ * Use {@link OrdinalAxisRange.from} to create an instance
9
+ * @param start The start of the axis-range
10
+ * @param end The end of the axis-range
11
+ * @param [originalStart=start] The original start of the axis-range
12
+ * @param [originalEnd=end] The original end of the axis-range
13
+ */
7
14
  constructor(start, end, originalStart = start, originalEnd = end) {
8
15
  super(start, end, originalStart, originalEnd);
9
16
  }
@@ -15,46 +22,111 @@ export class OrdinalAxisRange extends BaseAxisRange {
15
22
  * Defaults to the start value if not specified.)
16
23
  * @param [originalEnd=end] The optional original end of the axis-range (e.g. before any zooming or panning.
17
24
  * Defaults to the end value if not specified.)
18
- * @return A new continuous-axis range instance.
25
+ * @return A new ordinal-axis range instance.
19
26
  */
20
27
  static from(start, end, originalStart = start, originalEnd = end) {
21
28
  return new OrdinalAxisRange(start, end, originalStart, originalEnd);
22
29
  }
23
30
  /**
24
- * Scales the axis-range by the specified scale factor from the specified value. The equations
25
- * are written so that the zooming (scaling) occurs at the specified value, and expands/contracts equally
26
- * from that value. This operation does not modify the original range.
27
- * @param factor The scale factor
31
+ * Scales the axis-range by the specified *cumulative* scale factor (d3-zoom's own
32
+ * `event.transform.k`, taken as-is -- NOT converted to an incremental, relative-to-the-
33
+ * previous-event factor), pivoting on `value`.
34
+ *
35
+ * Two cases, because neither a purely incremental nor a purely cumulative-from-`.original`
36
+ * formula is correct on its own for a bounded ordinal domain:
37
+ *
38
+ * - `factor === 1` (fully zoomed out): returns `.original` directly, bypassing the pivot math
39
+ * entirely. An ordinal axis's domain (the fixed set of categories) is bounded, so "zoomed all
40
+ * the way back out" has exactly one correct answer -- `.current` must equal `.original`
41
+ * *exactly*, regardless of how many different pivots were used to get there. d3-zoom's own
42
+ * `.scaleExtent` clamps `k` to *exactly* 1 at the zoom floor (not just asymptotically close),
43
+ * so this equality check reliably detects that boundary.
44
+ * - Otherwise: scales from `.current` using the *incremental* step implied by the cumulative
45
+ * factor (`factor` divided by the range's own current/original width ratio) -- the same
46
+ * pivot-preserving composition `ContinuousAxisRange` uses (see `BaseAxisRange.scaledRange`).
47
+ * This composes correctly across any sequence of differing pivots without jumping.
48
+ *
49
+ * Why not just always scale from `.original` by the cumulative factor (a prior version of this
50
+ * method did exactly that)? Composing pivot-preserving zooms at *different* pivots is not
51
+ * itself position-preserving -- zooming in at one spot and back out at another nets a
52
+ * translation, same as any pinch-zoom or map UI, verified live: zoom in at pivot A to k=5, then
53
+ * zoom out at a different pivot B to k=1, lands `.current` at `[400, 1400]` instead of
54
+ * `[0, 1000]` even under the mathematically-correct incremental composition. Scaling
55
+ * `.original` directly by the raw cumulative factor "fixes" that only by recomputing the
56
+ * *entire* zoom from scratch at the current pivot on every single event -- which is correct
57
+ * only when the pivot never changes since the last identity reset, and otherwise discards all
58
+ * zoom history, producing a visible jump the moment the pivot changes at any *non-identity* zoom
59
+ * level (confirmed live: continuing to zoom in from k=5 at pivot A to k=6 at a different pivot B
60
+ * jumped from the correct, continuous `[-1600, 4400]` to `[-4000, 2000]`). The `factor === 1`
61
+ * special case gets the position-preserving guarantee only where it's actually needed -- the
62
+ * one canonical "fully zoomed out" state -- without sacrificing composability everywhere else.
63
+ * A continuous/scrolling axis (`ContinuousAxisRange`) never needs the equivalent of this special
64
+ * case, since it has no fixed domain edge for translational drift to visibly clip against.
65
+ * @param factor The cumulative scale factor (`event.transform.k`, unmodified)
66
+ * @param value The value from which to scale the interval
67
+ * @return The new range, as a plain {start, end} pair
68
+ */
69
+ scaledCumulative(factor, value) {
70
+ // when the factor is 1 or the original measure is 0, return the original range
71
+ if (factor === 1 || this.original.measure() === 0) {
72
+ return { start: this.original.start, end: this.original.end };
73
+ }
74
+ const scaleFactor = this.current.measure() / this.original.measure();
75
+ const incrementalFactor = factor / scaleFactor;
76
+ const dtStart = value - this.current.start;
77
+ const dtEnd = this.current.end - value;
78
+ return { start: value - dtStart * incrementalFactor, end: value + dtEnd * incrementalFactor };
79
+ }
80
+ /**
81
+ * Scales the axis-range by the specified *cumulative* scale factor (see
82
+ * `scaledCumulative` for why this must be cumulative, not incremental) from the
83
+ * specified value. The equations are written so that the zooming (scaling) occurs at the
84
+ * specified value, and expands/contracts equally from that value. This operation does not
85
+ * modify the original range.
86
+ * @param factor The cumulative scale factor
28
87
  * @param value The value from which to scale the interval
29
- * @return A new continuous-axis range with updated values
88
+ * @return A new ordinal-axis range with updated values
30
89
  */
31
90
  scale(factor, value) {
32
- const scaledInterval = this.scaledRange(factor, value);
91
+ const scaledInterval = this.scaledCumulative(factor, value);
33
92
  return new OrdinalAxisRange(scaledInterval.start, scaledInterval.end, this.original.start, this.original.end);
34
93
  }
35
94
  /**
36
- * Scales the axis-range by the specified scale factor from the specified value, while keeping
37
- * the range within the constraints (start, end). The equations are written so that the zooming
38
- * (scaling) occurs at the specified value, and expands/contracts equally from that value.
39
- * @param factor The scale factor
95
+ * Scales the axis-range by the specified *cumulative* scale factor (see
96
+ * `scaledCumulative` for why this must be cumulative, not incremental) from the
97
+ * specified value, while keeping the range within the constraints (start, end). The equations
98
+ * are written so that the zooming (scaling) occurs at the specified value, and
99
+ * expands/contracts equally from that value.
100
+ *
101
+ * Widens the scaled result to *cover* `constraint` (never narrower than it) -- `constraint`
102
+ * is the domain that must be fully visible once zoomed all the way out, and widening rather
103
+ * than clamping is exactly what fixes the pivot-drift bug described on
104
+ * `scaledCumulative` (zooming in at one pivot and back out at another must never leave
105
+ * part of the domain clipped). This is the opposite direction from
106
+ * {@link ContinuousAxisRange.constrainedScale}, which *clamps* its result inside `constraint`
107
+ * instead -- see that method's doc comment for why a continuous axis needs the opposite
108
+ * behavior. Do not "fix" this difference without reading both.
109
+ * @param factor The cumulative scale factor
40
110
  * @param value The value from which to scale the interval
41
111
  * @param constraint The minimum and maximum values that range bounds can be
42
- * @return A new continuous-axis range with updated values
112
+ * @return A new ordinal-axis range with updated values
43
113
  */
44
114
  constrainedScale(factor, value, constraint) {
45
- const scaledInterval = this.scaledRange(factor, value);
115
+ const scaledInterval = this.scaledCumulative(factor, value);
46
116
  const [min, max] = constraint;
47
117
  return new OrdinalAxisRange(Math.min(min, scaledInterval.start), Math.max(max, scaledInterval.end), this.original.start, this.original.end);
48
118
  }
49
119
  /**
50
- * Translates the axis-range by the specified amount
120
+ * Translates the axis-range by the specified amount, unless that would take it outside the
121
+ * constraint interval (when both ends of the constraint are infinite, there's no constraint)
51
122
  * @param amount The amount by which to translate the axis-range
52
123
  * @param [constraint=[-Infinity, Infinity]] Optional constraint interval in which the axis range must be within
53
- * @return An updated {@link OrdinalAxisRange} that has been translated by the specified amount
124
+ * @return An updated {@link OrdinalAxisRange} that has been translated by the specified amount (or an
125
+ * unchanged copy, when the translation would leave the constraint interval)
54
126
  */
55
127
  translate(amount, constraint = [-Infinity, Infinity]) {
56
128
  const [cs, ce] = constraint;
57
- // when either of the constraints is infinite, or the pan keeps the new axis range
129
+ // when both of the constraints are infinite, or the pan keeps the new axis range
58
130
  // within the origin axis range (i.e. zoomed in and the panned), then allow the pan,
59
131
  // otherwise don't update
60
132
  if ((!isFinite(cs) && !isFinite(ce)) || (this.current.start + amount >= cs && this.current.end + amount <= ce)) {
@@ -72,6 +144,13 @@ export class OrdinalAxisRange extends BaseAxisRange {
72
144
  * the dimensions.
73
145
  */
74
146
  zoom(beforeDimension, afterDimension) {
147
+ // a zero `beforeDimension` (e.g. a chart mounted inside a collapsed/hidden container that
148
+ // later becomes visible) would otherwise divide by zero below, producing a NaN/Infinity
149
+ // range that corrupts this axis until remount. There's no proportional "before" range to
150
+ // scale from in that case, so just take the new dimension as the fresh, un-zoomed range.
151
+ if (beforeDimension === 0) {
152
+ return new OrdinalAxisRange(0, afterDimension, 0, afterDimension);
153
+ }
75
154
  const [start, end] = this.current.asTuple();
76
155
  const delta = (end - start) * (afterDimension - beforeDimension) / beforeDimension;
77
156
  const lowerBound = start / (end - start) * delta + start;
@@ -1 +1 @@
1
- {"version":3,"file":"OrdinalAxisRange.js","sourceRoot":"","sources":["../../../../src/app/charts/axes/OrdinalAxisRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,aAAa;IAE/C,YAAoB,KAAa,EAAE,GAAW,EAAE,gBAAwB,KAAK,EAAE,cAAsB,GAAG;QACpG,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,WAAW,CAAC,CAAA;IACjD,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,CAAC,KAAa,EAAE,GAAW,EAAE,gBAAwB,KAAK,EAAE,cAAsB,GAAG;QAC5F,OAAO,IAAI,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,WAAW,CAAC,CAAA;IACvE,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,MAAc,EAAE,KAAa;QAC/B,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACtD,OAAO,IAAI,gBAAgB,CAAC,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IACjH,CAAC;IAED;;;;;;;;OA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,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IACnF,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,KAAa,EAAE,GAAW;QACrC,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;IACjF,CAAC;CACJ"}
@@ -0,0 +1,111 @@
1
+ import type { ScaleContinuousNumeric } from "d3";
2
+ /**
3
+ * The auto-scaling settings of a (y-) axis whose domain grows to fit the data plotted against it
4
+ * (see `ContinuousAxis`'s `autoScale`, `autoScaleMin`, `autoScaleMax`, and `autoScalePadding` props)
5
+ */
6
+ export type AutoScale = {
7
+ /**
8
+ * Where the axis' domain starts out: its `domain` prop, clamped to the limits. It's what the
9
+ * domain is restored to when its plot's data is replaced (e.g. on a reset).
10
+ */
11
+ domain: [min: number, max: number];
12
+ /**
13
+ * The smallest value the axis' domain may reach
14
+ */
15
+ min: number;
16
+ /**
17
+ * The largest value the axis' domain may reach
18
+ */
19
+ max: number;
20
+ /**
21
+ * The fraction of the axis' length left beyond the data's extreme on a side that grows (so
22
+ * the extreme point isn't drawn right on the edge), from 0 to 0.45
23
+ */
24
+ padding: number;
25
+ };
26
+ /**
27
+ * Clamps a domain to the auto-scaling limits, so that an auto-scaling axis never starts out past
28
+ * them. (When the domain lies entirely beyond a limit, it collapses onto that limit.)
29
+ * @param domain The domain
30
+ * @param min The smallest value the domain may reach
31
+ * @param max The largest value the domain may reach
32
+ * @return The domain, clamped to the limits
33
+ */
34
+ export declare function clampedDomain(domain: [min: number, max: number], min: number, max: number): [min: number, max: number];
35
+ /**
36
+ * Whether two auto-scaling settings are the same (`undefined` means "not auto-scaling")
37
+ * @param a The first settings
38
+ * @param b The second settings
39
+ * @return `true` when they're the same; `false` otherwise
40
+ */
41
+ export declare function sameAutoScale(a: AutoScale | undefined, b: AutoScale | undefined): boolean;
42
+ /**
43
+ * Grows an axis' domain to include the specified extent of the data, with the padding beyond it,
44
+ * without going past the auto-scaling limits. A side grows when the data reaches into its padding
45
+ * (not only when the data goes past the edge), so that the data always has the padding's room to
46
+ * spare (until a limit is reached), and it grows so that the data's extreme sits exactly the
47
+ * padding from the edge. The domain only ever grows: an extent that's within the domain, and
48
+ * clear of its padding, leaves the domain as it is.
49
+ *
50
+ * The padding is applied in the scale's own space (e.g. logarithmically, for a log scale), as a
51
+ * fraction of the axis' length.
52
+ * @param domain The axis' current domain
53
+ * @param extent The [min, max] of the data plotted against the axis, or `undefined` when there's
54
+ * no data
55
+ * @param autoScale The auto-scaling settings (the limits, and the padding)
56
+ * @param scale The axis' scale (only its kind matters: linear, log, ...)
57
+ * @return The grown domain (or the current domain, when there's nothing to grow for)
58
+ */
59
+ export declare function grownDomain(domain: [min: number, max: number], extent: [min: number, max: number] | undefined, autoScale: Pick<AutoScale, 'min' | 'max' | 'padding'>, scale: ScaleContinuousNumeric<number, number>): [min: number, max: number];
60
+ /**
61
+ * Extends an extent to include the specified value
62
+ * @param extent The extent so far, or `undefined` when there's none yet
63
+ * @param value The value to include
64
+ * @return The extent, including the value
65
+ */
66
+ export declare function extentWith(extent: [min: number, max: number] | undefined, value: number): [min: number, max: number];
67
+ /**
68
+ * Calculates the extent (the [min, max]) of the specified values, skipping those the y-scale
69
+ * can't show (e.g. values <= 0 on a log scale, or NaN)
70
+ * @param values The values
71
+ * @param yScale The y-axis' scale
72
+ * @return The extent of the values, or `undefined` when there are none (that can be shown)
73
+ */
74
+ export declare function extentOf(values: Iterable<number>, yScale: ScaleContinuousNumeric<number, number>): [min: number, max: number] | undefined;
75
+ /**
76
+ * Calculates the extent (the [min, max] of the y-values) of a series' data that's visible within
77
+ * the x-axis' window: the values of the points within the window, and -- when the series is drawn
78
+ * with lines -- the lines' heights where they cross the window's left and right edges (a line from
79
+ * a point just off screen can reach higher, or lower, within the window than any point that's on
80
+ * screen). Values the y-scale can't show (e.g. values <= 0 on a log scale) are skipped.
81
+ *
82
+ * A point can have several values, each drawn as its own line across the points (e.g. an outlier
83
+ * series' value, and its bands' lower and upper bounds), so the crossings are calculated for each.
84
+ * They're calculated in the y-scale's own space (as the lines are drawn), so they're exact for
85
+ * straight lines, on any kind of scale.
86
+ * @param data The series' data, ordered by x
87
+ * @param window The x-axis' [start, end]
88
+ * @param yScale The y-axis' scale
89
+ * @param withLines Whether the series is drawn with lines (rather than just points)
90
+ * @param xOf The point's x-value (defaults to its `x`)
91
+ * @param valuesOf The point's y-values, each drawn as its own line (defaults to its `y`)
92
+ * @return The extent of the visible data, or `undefined` when nothing is visible
93
+ * @template P The type of the data's points
94
+ */
95
+ export declare function visibleExtent<P>(data: {
96
+ length: number;
97
+ [index: number]: P;
98
+ }, window: [start: number, end: number], yScale: ScaleContinuousNumeric<number, number>, withLines: boolean, xOf?: (point: P) => number, valuesOf?: (point: P) => Array<number>): [min: number, max: number] | undefined;
99
+ /**
100
+ * Issues a warning to the console, once (e.g. about auto-scaling settings that are ignored)
101
+ * @param message The warning
102
+ */
103
+ export declare function warnOnce(message: string): void;
104
+ /**
105
+ * Warns (once per axis) about the auto-scaling y-axes of a plot that doesn't support auto-scaling,
106
+ * whose `autoScale` setting is therefore ignored
107
+ * @param plotName The name of the plot (e.g. "BarPlot")
108
+ * @param yAxes The plot's y-axes, by their IDs
109
+ */
110
+ export declare function warnAboutIgnoredAutoScale(plotName: string, yAxes: Map<string, object>): void;
111
+ //# sourceMappingURL=autoScale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoScale.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/axes/autoScale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,IAAI,CAAC;AAG/C;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACpB;;;OAGG;IACH,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;IAClC;;O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