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,76 +1,30 @@
1
- import * as d3 from "d3";
2
- import { BaseType } from "d3";
1
+ /**
2
+ * CSS style properties for the chart's container element (the canvas -- named for the SVG
3
+ * element it used to be)
4
+ */
3
5
  export interface SvgStyle {
4
6
  height?: string | number;
5
7
  width?: string | number;
6
8
  outline?: string;
7
- [propName: string]: any;
9
+ [propName: string]: string | number | undefined;
8
10
  }
9
- export declare const initialSvgStyle: SvgStyle;
10
11
  /**
11
- * Grabs the client-width of the svg element, or 1 if the svg element hasn't yet
12
- * been initialized. The client-width is a read-only property returns the width of
13
- * the html element, including horizontal padding and borders, as an integer. The reason
14
- * that we return 1 when the svg element hasn't yet been initialized, is so that the
15
- * aspect (width / height) is 1.
16
- * @param {SVGElement | null} svg The svg element
17
- * @return {number} The client width of the svg
12
+ * The default container style: full width, anchored at the top left
18
13
  */
19
- export declare function grabWidth(svg: SVGElement | null): number;
14
+ export declare const initialSvgStyle: SvgStyle;
20
15
  /**
21
- * Grabs the client-height of the svg element, or 1 if the svg element hasn't yet
22
- * been initialized. The client-height is a read-only property returns the height of
23
- * the html element, including vertical padding and borders, as an integer. The reason
24
- * that we return 1 when the svg element hasn't yet been initialized, is so that the
25
- * aspect (width / height) is 1.
26
- * @param {SVGElement | null} svg The svg element
27
- * @return {number} The client height of the svg
16
+ * The style of a stroke (used by the bar plot's styles)
28
17
  */
29
- export declare function grabHeight(svg: SVGElement | null): number;
30
- export declare const STROKE_COLOR: string;
31
- export declare const STROKE_WIDTH: string;
32
- export declare const STROKE_OPACITY: string;
33
18
  export interface SvgStrokeStyle {
34
19
  readonly color: string;
35
20
  readonly width: number;
36
21
  readonly opacity: number;
37
22
  }
38
- export declare function updateSvgStrokeColor(current: SvgStrokeStyle, color: string): {
39
- color: string;
40
- width: number;
41
- opacity: number;
42
- };
43
- export declare function updateSvgStrokeWidth(current: SvgStrokeStyle, width: number): {
44
- width: number;
45
- color: string;
46
- opacity: number;
47
- };
48
- export declare function updateSvgStrokeOpacity(current: SvgStrokeStyle, opacity: number): {
49
- opacity: number;
50
- color: string;
51
- width: number;
52
- };
53
23
  /**
54
- *
55
- * @param style
56
- * @param selection
57
- * @template E The SVG element (e.g. SVGRectElement, SVGLineElement, etc)
58
- * @template D The datum type
59
- * @template The SVG G element
24
+ * The style of a fill (used by the bar plot's styles)
60
25
  */
61
- export declare function applyStrokeStylesTo<E extends BaseType, D, G extends BaseType = SVGGElement>(selection: d3.Selection<E, D, G, any>, style: Partial<SvgStrokeStyle>): d3.Selection<E, D, G, any>;
62
26
  export interface SvgFillStyle {
63
27
  readonly color: string;
64
28
  readonly opacity: number;
65
29
  }
66
- export declare function updateSvgFillColor(current: SvgFillStyle, color: string): SvgFillStyle;
67
- export declare function updateSvgFillOpacity(current: SvgFillStyle, opacity: number): SvgFillStyle;
68
- /**
69
- *
70
- * @param style
71
- * @param selection
72
- * @template E The SVG element (e.g. SVGRectElement, SVGLineElement, etc)
73
- * @template D The datum type
74
- * @template The SVG G element
75
- */
76
- export declare function applyFillStylesTo<E extends BaseType, D, G extends BaseType = SVGGElement>(selection: d3.Selection<E, D, G, any>, style: Partial<SvgFillStyle>): d3.Selection<E, D, G, any>;
30
+ //# sourceMappingURL=svgStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgStyle.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/styling/svgStyle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnD;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAI7B,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAC3B"}
@@ -1,84 +1,9 @@
1
+ /**
2
+ * The default container style: full width, anchored at the top left
3
+ */
1
4
  export const initialSvgStyle = {
2
5
  width: '100%',
3
- // display: "inline-block",
4
- // position: "floating",
5
6
  top: 0,
6
7
  left: 0
7
8
  };
8
- /**
9
- * Grabs the client-width of the svg element, or 1 if the svg element hasn't yet
10
- * been initialized. The client-width is a read-only property returns the width of
11
- * the html element, including horizontal padding and borders, as an integer. The reason
12
- * that we return 1 when the svg element hasn't yet been initialized, is so that the
13
- * aspect (width / height) is 1.
14
- * @param {SVGElement | null} svg The svg element
15
- * @return {number} The client width of the svg
16
- */
17
- export function grabWidth(svg) {
18
- return svg !== null ? svg.clientWidth : 1;
19
- }
20
- /**
21
- * Grabs the client-height of the svg element, or 1 if the svg element hasn't yet
22
- * been initialized. The client-height is a read-only property returns the height of
23
- * the html element, including vertical padding and borders, as an integer. The reason
24
- * that we return 1 when the svg element hasn't yet been initialized, is so that the
25
- * aspect (width / height) is 1.
26
- * @param {SVGElement | null} svg The svg element
27
- * @return {number} The client height of the svg
28
- */
29
- export function grabHeight(svg) {
30
- return svg !== null ? svg.clientHeight : 1;
31
- }
32
- export const STROKE_COLOR = "stroke";
33
- export const STROKE_WIDTH = "stroke-width";
34
- export const STROKE_OPACITY = "stroke-opacity";
35
- export function updateSvgStrokeColor(current, color) {
36
- return Object.assign(Object.assign({}, current), { color });
37
- }
38
- export function updateSvgStrokeWidth(current, width) {
39
- return Object.assign(Object.assign({}, current), { width });
40
- }
41
- export function updateSvgStrokeOpacity(current, opacity) {
42
- return Object.assign(Object.assign({}, current), { opacity });
43
- }
44
- /**
45
- *
46
- * @param style
47
- * @param selection
48
- * @template E The SVG element (e.g. SVGRectElement, SVGLineElement, etc)
49
- * @template D The datum type
50
- * @template The SVG G element
51
- */
52
- export function applyStrokeStylesTo(selection, style) {
53
- if (style.color !== undefined)
54
- selection.style(STROKE_COLOR, style.color);
55
- if (style.width !== undefined)
56
- selection.style(STROKE_WIDTH, style.width);
57
- if (style.opacity !== undefined)
58
- selection.style(STROKE_OPACITY, style.opacity);
59
- return selection;
60
- }
61
- const FILL_COLOR = "fill";
62
- const FILL_OPACITY = "fill-opacity";
63
- export function updateSvgFillColor(current, color) {
64
- return Object.assign(Object.assign({}, current), { color });
65
- }
66
- export function updateSvgFillOpacity(current, opacity) {
67
- return Object.assign(Object.assign({}, current), { opacity });
68
- }
69
- /**
70
- *
71
- * @param style
72
- * @param selection
73
- * @template E The SVG element (e.g. SVGRectElement, SVGLineElement, etc)
74
- * @template D The datum type
75
- * @template The SVG G element
76
- */
77
- export function applyFillStylesTo(selection, style) {
78
- if (style.color !== undefined)
79
- selection.style(FILL_COLOR, style.color);
80
- if (style.opacity !== undefined)
81
- selection.style(FILL_OPACITY, style.opacity);
82
- return selection;
83
- }
84
9
  //# sourceMappingURL=svgStyle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"svgStyle.js","sourceRoot":"","sources":["../../../../src/app/charts/styling/svgStyle.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,eAAe,GAAa;IACrC,KAAK,EAAE,MAAM;IACb,2BAA2B;IAC3B,wBAAwB;IACxB,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;CACV,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,GAAsB;IAC5C,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,GAAsB;IAC7C,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAGD,MAAM,CAAC,MAAM,YAAY,GAAW,QAAQ,CAAA;AAC5C,MAAM,CAAC,MAAM,YAAY,GAAW,cAAc,CAAA;AAClD,MAAM,CAAC,MAAM,cAAc,GAAW,gBAAgB,CAAA;AAQtD,MAAM,UAAU,oBAAoB,CAAC,OAAuB,EAAE,KAAa;IACvE,uCAAW,OAAO,KAAE,KAAK,IAAE;AAC/B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAuB,EAAE,KAAa;IACvE,uCAAW,OAAO,KAAE,KAAK,IAAE;AAC/B,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAuB,EAAE,OAAe;IAC3E,uCAAW,OAAO,KAAE,OAAO,IAAE;AACjC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAC/B,SAAqC,EACrC,KAA8B;IAE9B,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,SAAS,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACzE,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,SAAS,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACzE,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAAE,SAAS,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAC/E,OAAO,SAAS,CAAA;AACpB,CAAC;AAED,MAAM,UAAU,GAAW,MAAM,CAAA;AACjC,MAAM,YAAY,GAAW,cAAc,CAAA;AAO3C,MAAM,UAAU,kBAAkB,CAAC,OAAqB,EAAE,KAAa;IACnE,uCAAW,OAAO,KAAE,KAAK,IAAC;AAC9B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAqB,EAAE,OAAe;IACvE,uCAAW,OAAO,KAAE,OAAO,IAAC;AAChC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC7B,SAAqC,EACrC,KAA4B;IAE5B,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACvE,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAAE,SAAS,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAC7E,OAAO,SAAS,CAAA;AACpB,CAAC"}
1
+ {"version":3,"file":"svgStyle.js","sourceRoot":"","sources":["../../../../src/app/charts/styling/svgStyle.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAa;IACrC,KAAK,EAAE,MAAM;IACb,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;CACV,CAAA"}
@@ -0,0 +1,124 @@
1
+ import { Subscription } from "rxjs";
2
+ import { type ContinuousNumericAxis } from "../axes/axes";
3
+ import { AxesState } from "../axes/AxesState";
4
+ import { ContinuousAxisRange } from "../axes/ContinuousAxisRange";
5
+ import type { AxesAssignment } from "../plots/plot";
6
+ import type { ChartData } from "../observables/ChartData";
7
+ import type { TimeSeriesChartData } from "../series/timeSeriesChartData";
8
+ import type { OutlierChartData } from "../observables/outliers";
9
+ import type { OrdinalChartData } from "../observables/ordinals";
10
+ import type { IterateChartData } from "../observables/iterates";
11
+ import type { StreamingDataSource } from "../datasources/StreamingDataSource";
12
+ /**
13
+ * The behavior of the time window when data is added to the chart: `SCROLL` slides the window
14
+ * forward (keeping its width) as new data passes its end; `SQUEEZE` keeps the window's start
15
+ * pinned and widens it instead.
16
+ * Note: a const object rather than an enum, to support `erasableSyntaxOnly`
17
+ */
18
+ export declare const TimeWindowBehavior: {
19
+ readonly SCROLL: "SCROLL";
20
+ readonly SQUEEZE: "SQUEEZE";
21
+ };
22
+ export type TimeWindowBehavior = (typeof TimeWindowBehavior)[keyof typeof TimeWindowBehavior];
23
+ /**
24
+ * The part of a data source a view driver needs
25
+ */
26
+ export type ViewDriverSource<CD extends ChartData> = Pick<StreamingDataSource<CD, unknown>, 'chartDataUpdatesObservable' | 'latestTime'>;
27
+ /**
28
+ * Gives the current time ("now") of each x-axis that a chunk of chart data has new points for
29
+ * @template CD The type of the chart data
30
+ */
31
+ export type AxisTimesFor<CD> = (data: CD) => Map<string, number>;
32
+ /**
33
+ * The x-axes' times for time-series chart data: each axis's time is the latest time of the
34
+ * series assigned to it (see {@link currentTimesByGroup}), falling back to the chunk's latest time
35
+ * @param axisAssignments The assignment of the series to their x- and y-axes
36
+ * @param xAxesState The current state of the x-axes (for the default x-axis)
37
+ * @return The x-axes' times for a chunk of chart data
38
+ */
39
+ export declare function timeSeriesAxisTimes(axisAssignments: Map<string, AxesAssignment>, xAxesState: AxesState<ContinuousNumericAxis>): AxisTimesFor<TimeSeriesChartData>;
40
+ /**
41
+ * The x-axes' times for outlier chart data: each axis's time is the time of the newest datum, of
42
+ * the series assigned to it, in the chunk
43
+ * @param axisAssignments The assignment of the series to their x- and y-axes
44
+ * @param xAxesState The current state of the x-axes (for the default x-axis)
45
+ * @return The x-axes' times for a chunk of chart data
46
+ * @template M The type of the outlier series' measures
47
+ */
48
+ export declare function outlierAxisTimes<M extends readonly number[]>(axisAssignments: Map<string, AxesAssignment>, xAxesState: AxesState<ContinuousNumericAxis>): AxisTimesFor<OutlierChartData<M>>;
49
+ /**
50
+ * The options of a time-axis view driver (see {@link timeAxisViewDriverFor})
51
+ */
52
+ export interface TimeAxisViewDriverOptions {
53
+ /**
54
+ * The time (ms) over which updates are batched before redrawing
55
+ */
56
+ windowingTime: number;
57
+ /**
58
+ * The period (ms) at which the source emits, when known (see {@link renderBatching}); not
59
+ * used with cadence
60
+ */
61
+ dataUpdatePeriod?: number;
62
+ /**
63
+ * The time (ms) between cadence ticks, which advance the axes smoothly between data arrivals.
64
+ * Without one, the axes only advance as data arrives.
65
+ */
66
+ cadencePeriod?: number;
67
+ /**
68
+ * Whether the time axes scroll or squeeze as data passes their ends (without cadence).
69
+ * Defaults to SCROLL.
70
+ */
71
+ timeWindowBehavior?: TimeWindowBehavior;
72
+ /**
73
+ * The pinned start time for each axis, for SQUEEZE
74
+ */
75
+ initialTimes?: Map<string, number>;
76
+ }
77
+ /**
78
+ * The view driver for a plot whose x-axes are time (the scatter, raster, and outlier plots): it
79
+ * advances each x-axis's window as the data's time passes its end, records each axis's current
80
+ * time, and asks the plot to redraw.
81
+ *
82
+ * Without cadence, each axis's window advances (SCROLL or SQUEEZE) as new data passes its end.
83
+ * With cadence, cadence ticks advance every axis's window smoothly between data arrivals, to the
84
+ * stream time projected from a wall-clock anchor; real data (treated as ground truth) re-syncs the
85
+ * axes, and corrects the anchor when cadence has fallen behind. The driver also catches the axes up
86
+ * to the data source's latest time when it starts (e.g. after a remount), and whenever the page
87
+ * becomes visible again.
88
+ * @param dataSource The data source whose updates drive the view
89
+ * @param xAxesState The current state of the x-axes
90
+ * @param axisTimesFor Gives the current time of each x-axis that a chunk of data has new points for
91
+ * (e.g. {@link timeSeriesAxisTimes} or {@link outlierAxisTimes})
92
+ * @param updateTimingAndPlot Redraws the plot for the (advanced) time-windows
93
+ * @param setCurrentTime Records the current time for an axis
94
+ * @param options The batching, cadence, and time-window behavior
95
+ * @return The driver's subscription, to unsubscribe when the plot unmounts
96
+ * @template CD The type of the chart data
97
+ */
98
+ export declare function timeAxisViewDriverFor<CD extends ChartData>(dataSource: ViewDriverSource<CD>, xAxesState: AxesState<ContinuousNumericAxis>, axisTimesFor: AxisTimesFor<CD>, updateTimingAndPlot: (ranges: Map<string, ContinuousAxisRange>) => void, setCurrentTime: (axisId: string, end: number) => void, options: TimeAxisViewDriverOptions): Subscription;
99
+ /**
100
+ * The view driver for an ordinal (bar) plot: reports the chart-wide current time and asks the
101
+ * plot to redraw as new data arrives. (The stats are kept by the data source.) Unlike the
102
+ * time-series drivers, it has no axis ranges to advance: an ordinal plot's axes don't scroll as
103
+ * data arrives, so its axes' ranges change only through the plot's own zoom, pan, and resize.
104
+ * @param dataSource The data source whose updates drive the view
105
+ * @param windowingTime The time (ms) over which updates are batched before redrawing
106
+ * @param updateTimingAndPlot Redraws the plot (and reports the chart time)
107
+ * @param setCurrentTime Records the chart-wide current time
108
+ * @param dataUpdatePeriod The period (ms) at which the source emits, when known (see {@link renderBatching})
109
+ * @return The driver's subscription, to unsubscribe when the plot unmounts
110
+ */
111
+ export declare function ordinalViewDriverFor(dataSource: ViewDriverSource<OrdinalChartData>, windowingTime: number, updateTimingAndPlot: () => void, setCurrentTime: (currentTime: number) => void, dataUpdatePeriod?: number): Subscription;
112
+ /**
113
+ * The view driver for an iterates (Poincaré) plot: reports the current time and asks the plot to
114
+ * redraw as new data arrives (once the plot has both an x-axis and a y-axis).
115
+ * @param dataSource The data source whose updates drive the view
116
+ * @param windowingTime The time (ms) over which updates are batched before redrawing
117
+ * @param xAxesState The current state of the x-axes
118
+ * @param yAxesState The current state of the y-axes
119
+ * @param updateRangesAndPlot Updates the axes' ranges, and redraws the plot
120
+ * @param updateCurrentTime Records the current time (see {@link iteratesCurrentTime})
121
+ * @return The driver's subscription, to unsubscribe when the plot unmounts
122
+ */
123
+ export declare function iteratesViewDriverFor(dataSource: ViewDriverSource<IterateChartData>, windowingTime: number, xAxesState: AxesState<ContinuousNumericAxis>, yAxesState: AxesState<ContinuousNumericAxis>, updateRangesAndPlot: () => void, updateCurrentTime: (time: number) => void): Subscription;
124
+ //# sourceMappingURL=viewDrivers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewDrivers.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/subscriptions/viewDrivers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmD,YAAY,EAAC,MAAM,MAAM,CAAC;AAEpF,OAAO,EAAuB,KAAK,qBAAqB,EAAC,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAmB5E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;CAGrB,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,EAAE,SAAS,SAAS,IAAI,IAAI,CAAC,mBAAmB,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,4BAA4B,GAAG,YAAY,CAAC,CAAA;AAgKxI;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAEhE;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EAC5C,UAAU,EAAE,SAAS,CAAC,qBAAqB,CAAC,GAC7C,YAAY,CAAC,mBAAmB,CAAC,CAWnC;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,EACxD,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EAC5C,UAAU,EAAE,SAAS,CAAC,qBAAqB,CAAC,GAC7C,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAYnC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IACvC;;OAEG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,SAAS,SAAS,EACtD,UAAU,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAChC,UAAU,EAAE,SAAS,CAAC,qBAAqB,CAAC,EAC5C,YAAY,EAAE,YAAY,CAAC,EAAE,CAAC,EAC9B,mBAAmB,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,KAAK,IAAI,EACvE,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,EACrD,OAAO,EAAE,yBAAyB,GACnC,YAAY,CA0Ed;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,EAC9C,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,MAAM,IAAI,EAC/B,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,EAC7C,gBAAgB,CAAC,EAAE,MAAM,GAC1B,YAAY,CAOd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACjC,UAAU,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,EAC9C,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,SAAS,CAAC,qBAAqB,CAAC,EAC5C,UAAU,EAAE,SAAS,CAAC,qBAAqB,CAAC,EAC5C,mBAAmB,EAAE,MAAM,IAAI,EAC/B,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC1C,YAAY,CAQd"}
@@ -0,0 +1,338 @@
1
+ import { interval } from "rxjs";
2
+ import { bufferCount, bufferTime, map, mergeAll, mergeWith } from "rxjs/operators";
3
+ import { continuousAxisRanges } from "../axes/axes";
4
+ import { currentTimesByGroup } from "../datasources/timeSeriesDataSource";
5
+ import { iteratesCurrentTime } from "../datasources/iteratesDataSource";
6
+ /*
7
+ * View drivers: the *view* half of a streaming plot.
8
+ *
9
+ * A {@link StreamingDataSource} (owned by the application) ingests the stream and keeps the series.
10
+ * A view driver (owned by one mounted plot) listens to the source's `chartDataUpdatesObservable` and keeps that plot's
11
+ * view in step with the data -- advancing the visible time-window (auto-scroll, cadence) and asking
12
+ * the plot to redraw. A plot creates its driver when it mounts and *always* unsubscribes it when it
13
+ * unmounts. Nothing here ever outlives the plot that created it, and nothing here ever mutates the
14
+ * series, so there is never a reason to keep a driver alive across a remount, adopt one, or defer
15
+ * its teardown.
16
+ *
17
+ * (Before v2, a plot's single subscription did both the ingestion and the view work, which tied
18
+ * the data's lifetime to the plot's -- see the data sources for the ingestion half.)
19
+ */
20
+ /**
21
+ * The behavior of the time window when data is added to the chart: `SCROLL` slides the window
22
+ * forward (keeping its width) as new data passes its end; `SQUEEZE` keeps the window's start
23
+ * pinned and widens it instead.
24
+ * Note: a const object rather than an enum, to support `erasableSyntaxOnly`
25
+ */
26
+ export const TimeWindowBehavior = {
27
+ SCROLL: "SCROLL",
28
+ SQUEEZE: "SQUEEZE"
29
+ };
30
+ /**
31
+ * Batches the source's updates for rendering. When the source's own emission period is known,
32
+ * batches by a fixed count (`windowingTime / dataUpdatePeriod`) rather than by wall-clock time:
33
+ * `bufferTime` and the source's own timer are two independent clocks, so ordinary timer jitter can
34
+ * shift a tick across a buffer boundary, making the number of ticks per flush vary and the
35
+ * auto-scroll uneven. Counting emissions directly is immune to that jitter.
36
+ * @param windowingTime The time (ms) over which to batch updates
37
+ * @param dataUpdatePeriod The period (ms) at which the source emits, when known
38
+ * @return The batching operator
39
+ */
40
+ function renderBatching(windowingTime, dataUpdatePeriod) {
41
+ return dataUpdatePeriod !== undefined && dataUpdatePeriod > 0 ?
42
+ bufferCount(Math.max(1, Math.round(windowingTime / dataUpdatePeriod))) :
43
+ bufferTime(windowingTime);
44
+ }
45
+ /**
46
+ * Advances the visible window for the specified axis (in place, within `timesWindows`) so its
47
+ * right edge sits at `targetTime`, preserving the window's current width (but never starting
48
+ * before 0, in which case the window stays at [0, width] until the time passes its width) -- but only once
49
+ * `targetTime` actually exceeds the window's current right edge. This gate is what lets a user
50
+ * pan/zoom the window ahead of the current time and watch the data catch up to it before scrolling
51
+ * resumes. Leaves `.original` untouched (zoom math is incremental, so it doesn't depend on it).
52
+ * @param timesWindows A `map(axis_id -> range)` updated in place
53
+ * @param axisId The axis to advance
54
+ * @param targetTime The time the axis's right edge should advance to
55
+ */
56
+ function advanceAxisRangeInMapTo(timesWindows, axisId, targetTime) {
57
+ const range = timesWindows.get(axisId);
58
+ if (range === undefined)
59
+ return;
60
+ const [startTime, endTime] = range.current.asTuple();
61
+ if (endTime < targetTime) {
62
+ const timeWindow = endTime - startTime;
63
+ timesWindows.set(axisId, range.update(Math.max(0, targetTime - timeWindow), Math.max(targetTime, timeWindow)));
64
+ }
65
+ }
66
+ /**
67
+ * Advances a range to a target time when new data arrives: SCROLL slides the window (width
68
+ * preserved); SQUEEZE pins the window's start at `initialStart` so the window widens instead.
69
+ * @param range The range to advance
70
+ * @param targetTime The time the range's right edge should advance to
71
+ * @param timeWindowBehavior Whether to scroll or squeeze
72
+ * @param initialStart The pinned start time for SQUEEZE mode (ignored for SCROLL)
73
+ * @return The advanced range, with `.original` unchanged
74
+ */
75
+ function scrollOrSqueezeRangeTo(range, targetTime, timeWindowBehavior, initialStart) {
76
+ const [startTime, endTime] = range.current.asTuple();
77
+ const timeWindow = endTime - startTime;
78
+ const newStart = timeWindowBehavior === TimeWindowBehavior.SQUEEZE && initialStart !== undefined ?
79
+ initialStart :
80
+ Math.max(0, targetTime - timeWindow);
81
+ return range.update(newStart, Math.max(targetTime, timeWindow));
82
+ }
83
+ /**
84
+ * @param axisAssignments The assignment of the series to their x- and y-axes
85
+ * @param xAxesState The current state of the x-axes (for the default x-axis)
86
+ * @return A {@link TimeGroupFor} that groups series by their assigned x-axis (or the default x-axis)
87
+ */
88
+ function xAxisGroupFor(axisAssignments, xAxesState) {
89
+ return name => { var _a; return ((_a = axisAssignments.get(name)) === null || _a === void 0 ? void 0 : _a.xAxis) || xAxesState.axisDefaultId().getOrElse(""); };
90
+ }
91
+ /**
92
+ * Re-syncs every x-axis to the data's ground-truth time whenever the page becomes visible again.
93
+ * Browsers pause `requestAnimationFrame` and throttle timers for hidden pages (including a macOS
94
+ * Spaces switch), and the cadence and data timers don't resume in lockstep, so without this an
95
+ * axis can lag behind until whichever clock fell behind organically catches up.
96
+ * @param dataSource The data source (for the data's ground-truth time)
97
+ * @param xAxesState The current state of the x-axes
98
+ * @param timesWindows A `map(axis_id -> range)` of the x-axes' windows, updated in place
99
+ * @param setCurrentTime Records the current time for an axis
100
+ * @param updateTimingAndPlot Redraws the plot for the (advanced) time-windows
101
+ * @return The teardown for the listener, to add to the driver's subscription
102
+ */
103
+ function resyncOnVisible(dataSource, xAxesState, timesWindows, setCurrentTime, updateTimingAndPlot) {
104
+ if (typeof document === 'undefined')
105
+ return () => {
106
+ };
107
+ const resyncAxesOnVisible = () => {
108
+ if (document.visibilityState !== 'visible')
109
+ return;
110
+ const groundTruthTime = dataSource.latestTime();
111
+ if (!isFinite(groundTruthTime))
112
+ return;
113
+ xAxesState.axisIds().forEach(axisId => {
114
+ advanceAxisRangeInMapTo(timesWindows, axisId, groundTruthTime);
115
+ setCurrentTime(axisId, groundTruthTime);
116
+ });
117
+ updateTimingAndPlot(timesWindows);
118
+ };
119
+ document.addEventListener('visibilitychange', resyncAxesOnVisible);
120
+ return () => document.removeEventListener('visibilitychange', resyncAxesOnVisible);
121
+ }
122
+ /**
123
+ * Marks a cadence tick in a view driver's stream of updates (rather than disguising the tick as an
124
+ * empty chunk of chart data)
125
+ */
126
+ const CADENCE_TICK = Symbol('cadence-tick');
127
+ /**
128
+ * The cadence ticks merged, unbuffered, with the batched data updates. Cadence ticks must not go
129
+ * through the render batching, or each batch would deliver its cadence ticks in one burst,
130
+ * collapsing the smooth per-tick scroll down to the batch rate. (The ticks carry no time: the
131
+ * driver projects the stream time from its own wall-clock anchor, so throttled ticks don't make it
132
+ * fall permanently behind.)
133
+ * @param updates$ The data source's updates
134
+ * @param windowingTime The time (ms) over which the data updates are batched
135
+ * @param cadencePeriod The time (ms) between cadence ticks
136
+ * @return The data updates (each batch flattened back into single updates), merged with the
137
+ * cadence ticks
138
+ */
139
+ function withCadence(updates$, windowingTime, cadencePeriod) {
140
+ const cadence = interval(cadencePeriod).pipe(map(() => CADENCE_TICK));
141
+ return updates$.pipe(bufferTime(windowingTime), mergeAll(), mergeWith(cadence));
142
+ }
143
+ /**
144
+ * Tracks the best-known stream time and when it was measured, so a cadence tick can project the
145
+ * current stream time as `knownTime + (now - measuredAt)`. Seeded from the data source -- which
146
+ * kept ingesting while the plot was unmounted, so this is the true current time even right after
147
+ * a remount -- and corrected forward whenever real data overtakes the projection (but never
148
+ * backward, which would make cadence stutter by the data's processing latency on every tick).
149
+ * @param seedTime The best-known stream time to start from (`-Infinity` when there's no data yet)
150
+ * @return The anchor: `now()` projects the current stream time, `isKnown()` says whether there's a
151
+ * stream time to project from, and `correctTo(time)` moves the anchor forward to a later real time
152
+ */
153
+ function cadenceAnchor(seedTime) {
154
+ let knownTime = seedTime;
155
+ let measuredAt = performance.now();
156
+ const now = () => knownTime + (performance.now() - measuredAt);
157
+ return {
158
+ now,
159
+ isKnown: () => isFinite(knownTime),
160
+ correctTo: (realTime) => {
161
+ if (realTime > now()) {
162
+ knownTime = realTime;
163
+ measuredAt = performance.now();
164
+ }
165
+ }
166
+ };
167
+ }
168
+ /**
169
+ * The x-axes' times for time-series chart data: each axis's time is the latest time of the
170
+ * series assigned to it (see {@link currentTimesByGroup}), falling back to the chunk's latest time
171
+ * @param axisAssignments The assignment of the series to their x- and y-axes
172
+ * @param xAxesState The current state of the x-axes (for the default x-axis)
173
+ * @return The x-axes' times for a chunk of chart data
174
+ */
175
+ export function timeSeriesAxisTimes(axisAssignments, xAxesState) {
176
+ const groupFor = xAxisGroupFor(axisAssignments, xAxesState);
177
+ return data => {
178
+ const groupTimes = currentTimesByGroup(data, groupFor);
179
+ const times = new Map();
180
+ data.newPoints.forEach((_, name) => {
181
+ const axisId = groupFor(name);
182
+ times.set(axisId, groupTimes.get(axisId) || data.maxTime);
183
+ });
184
+ return times;
185
+ };
186
+ }
187
+ /**
188
+ * The x-axes' times for outlier chart data: each axis's time is the time of the newest datum, of
189
+ * the series assigned to it, in the chunk
190
+ * @param axisAssignments The assignment of the series to their x- and y-axes
191
+ * @param xAxesState The current state of the x-axes (for the default x-axis)
192
+ * @return The x-axes' times for a chunk of chart data
193
+ * @template M The type of the outlier series' measures
194
+ */
195
+ export function outlierAxisTimes(axisAssignments, xAxesState) {
196
+ const groupFor = xAxisGroupFor(axisAssignments, xAxesState);
197
+ return data => {
198
+ const times = new Map();
199
+ data.newPoints.forEach((newData, name) => {
200
+ var _a;
201
+ const axisId = groupFor(name);
202
+ let time = (_a = times.get(axisId)) !== null && _a !== void 0 ? _a : -Infinity;
203
+ for (const datum of newData)
204
+ time = Math.max(time, datum.datum.x);
205
+ if (Number.isFinite(time))
206
+ times.set(axisId, time);
207
+ });
208
+ return times;
209
+ };
210
+ }
211
+ /**
212
+ * The view driver for a plot whose x-axes are time (the scatter, raster, and outlier plots): it
213
+ * advances each x-axis's window as the data's time passes its end, records each axis's current
214
+ * time, and asks the plot to redraw.
215
+ *
216
+ * Without cadence, each axis's window advances (SCROLL or SQUEEZE) as new data passes its end.
217
+ * With cadence, cadence ticks advance every axis's window smoothly between data arrivals, to the
218
+ * stream time projected from a wall-clock anchor; real data (treated as ground truth) re-syncs the
219
+ * axes, and corrects the anchor when cadence has fallen behind. The driver also catches the axes up
220
+ * to the data source's latest time when it starts (e.g. after a remount), and whenever the page
221
+ * becomes visible again.
222
+ * @param dataSource The data source whose updates drive the view
223
+ * @param xAxesState The current state of the x-axes
224
+ * @param axisTimesFor Gives the current time of each x-axis that a chunk of data has new points for
225
+ * (e.g. {@link timeSeriesAxisTimes} or {@link outlierAxisTimes})
226
+ * @param updateTimingAndPlot Redraws the plot for the (advanced) time-windows
227
+ * @param setCurrentTime Records the current time for an axis
228
+ * @param options The batching, cadence, and time-window behavior
229
+ * @return The driver's subscription, to unsubscribe when the plot unmounts
230
+ * @template CD The type of the chart data
231
+ */
232
+ export function timeAxisViewDriverFor(dataSource, xAxesState, axisTimesFor, updateTimingAndPlot, setCurrentTime, options) {
233
+ const { windowingTime, dataUpdatePeriod, cadencePeriod, timeWindowBehavior = TimeWindowBehavior.SCROLL, initialTimes = new Map(), } = options;
234
+ // built ONCE, here, and advanced in place on every update: the plot hands this same map
235
+ // back to its pan/zoom handlers (via `updateTimingAndPlot`), so their mutations land here too
236
+ // rather than being discarded by a rebuild
237
+ const timesWindows = continuousAxisRanges(xAxesState.axes);
238
+ if (cadencePeriod === undefined) {
239
+ return dataSource.chartDataUpdatesObservable
240
+ .pipe(renderBatching(windowingTime, dataUpdatePeriod))
241
+ .subscribe(dataList => dataList.forEach(data => {
242
+ axisTimesFor(data).forEach((currentAxisTime, axisId) => {
243
+ // record the axis' "now" on every update -- not only once the window starts
244
+ // scrolling -- since the plot's zoom pivots on it while streaming: before the
245
+ // data reaches the window's end, there would otherwise be no "now" to pivot on,
246
+ // and the zoom would pivot on the window's right edge, possibly leaving the
247
+ // data off-screen
248
+ setCurrentTime(axisId, currentAxisTime);
249
+ const range = timesWindows.get(axisId);
250
+ if (range !== undefined && range.current.end < currentAxisTime) {
251
+ timesWindows.set(axisId, scrollOrSqueezeRangeTo(range, currentAxisTime, timeWindowBehavior, initialTimes.get(axisId)));
252
+ }
253
+ });
254
+ updateTimingAndPlot(timesWindows);
255
+ }));
256
+ }
257
+ const anchor = cadenceAnchor(dataSource.latestTime());
258
+ const catchUp = () => {
259
+ if (!anchor.isKnown())
260
+ return;
261
+ xAxesState.axisIds().forEach(axisId => advanceAxisRangeInMapTo(timesWindows, axisId, anchor.now()));
262
+ updateTimingAndPlot(timesWindows);
263
+ };
264
+ // catch the axes up to the current stream time right away, rather than leaving them where they
265
+ // were restored to until the first tick arrives (which, right after a remount, can take a
266
+ // noticeable while and would show up as "pause, then jump")
267
+ catchUp();
268
+ const subscription = withCadence(dataSource.chartDataUpdatesObservable, windowingTime, cadencePeriod)
269
+ .subscribe(update => {
270
+ if (update === CADENCE_TICK) {
271
+ // a cadence tick: advance every axis to the projected stream time
272
+ const cadenceTime = anchor.now();
273
+ xAxesState.axisIds().forEach(axisId => {
274
+ advanceAxisRangeInMapTo(timesWindows, axisId, cadenceTime);
275
+ setCurrentTime(axisId, cadenceTime);
276
+ });
277
+ }
278
+ else {
279
+ // real data: re-sync each axis to the data's own time, and correct the cadence
280
+ // anchor if the data has overtaken it
281
+ axisTimesFor(update).forEach((currentAxisTime, axisId) => {
282
+ advanceAxisRangeInMapTo(timesWindows, axisId, currentAxisTime);
283
+ anchor.correctTo(currentAxisTime);
284
+ });
285
+ }
286
+ updateTimingAndPlot(timesWindows);
287
+ });
288
+ subscription.add(resyncOnVisible(dataSource, xAxesState, timesWindows, setCurrentTime, updateTimingAndPlot));
289
+ // one more catch-up on the next paint frame, narrowing the gap until the first real tick
290
+ // (whose scheduling can lag right after a route change, while React commits the new tree)
291
+ const catchUpFrame = requestAnimationFrame(catchUp);
292
+ subscription.add(() => cancelAnimationFrame(catchUpFrame));
293
+ return subscription;
294
+ }
295
+ /**
296
+ * The view driver for an ordinal (bar) plot: reports the chart-wide current time and asks the
297
+ * plot to redraw as new data arrives. (The stats are kept by the data source.) Unlike the
298
+ * time-series drivers, it has no axis ranges to advance: an ordinal plot's axes don't scroll as
299
+ * data arrives, so its axes' ranges change only through the plot's own zoom, pan, and resize.
300
+ * @param dataSource The data source whose updates drive the view
301
+ * @param windowingTime The time (ms) over which updates are batched before redrawing
302
+ * @param updateTimingAndPlot Redraws the plot (and reports the chart time)
303
+ * @param setCurrentTime Records the chart-wide current time
304
+ * @param dataUpdatePeriod The period (ms) at which the source emits, when known (see {@link renderBatching})
305
+ * @return The driver's subscription, to unsubscribe when the plot unmounts
306
+ */
307
+ export function ordinalViewDriverFor(dataSource, windowingTime, updateTimingAndPlot, setCurrentTime, dataUpdatePeriod) {
308
+ return dataSource.chartDataUpdatesObservable
309
+ .pipe(renderBatching(windowingTime, dataUpdatePeriod))
310
+ .subscribe(dataList => dataList.forEach(data => {
311
+ if (data.newPoints.size > 0)
312
+ setCurrentTime(data.stats.maxDatum.time.time || NaN);
313
+ updateTimingAndPlot();
314
+ }));
315
+ }
316
+ /**
317
+ * The view driver for an iterates (Poincaré) plot: reports the current time and asks the plot to
318
+ * redraw as new data arrives (once the plot has both an x-axis and a y-axis).
319
+ * @param dataSource The data source whose updates drive the view
320
+ * @param windowingTime The time (ms) over which updates are batched before redrawing
321
+ * @param xAxesState The current state of the x-axes
322
+ * @param yAxesState The current state of the y-axes
323
+ * @param updateRangesAndPlot Updates the axes' ranges, and redraws the plot
324
+ * @param updateCurrentTime Records the current time (see {@link iteratesCurrentTime})
325
+ * @return The driver's subscription, to unsubscribe when the plot unmounts
326
+ */
327
+ export function iteratesViewDriverFor(dataSource, windowingTime, xAxesState, yAxesState, updateRangesAndPlot, updateCurrentTime) {
328
+ return dataSource.chartDataUpdatesObservable
329
+ .pipe(bufferTime(windowingTime))
330
+ .subscribe(dataList => dataList.forEach(data => {
331
+ if (data.newPoints.size > 0)
332
+ updateCurrentTime(iteratesCurrentTime(data));
333
+ // (the original only redrew once both a default x-axis and a default y-axis existed)
334
+ if (xAxesState.axes.size > 0 && yAxesState.axes.size > 0)
335
+ updateRangesAndPlot();
336
+ }));
337
+ }
338
+ //# sourceMappingURL=viewDrivers.js.map