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,36 +1,81 @@
1
1
  import { failureResult, successResult } from "result-fn";
2
+ import { FastShiftArray } from "fast-shift-array";
3
+ /**
4
+ * Default number of shifts a series' backing `FastShiftArray` accumulates before it's compacted,
5
+ * used whenever a caller doesn't specify one explicitly. This is deliberately much lower than
6
+ * `FastShiftArray`'s own default of 100,000: compaction is a single, blocking O(n) operation (it
7
+ * splices out all the accumulated dead slots in one call), so with the default threshold, a
8
+ * long-running streaming chart hits one large, very perceptible stutter once cumulative shifts
9
+ * cross 100,000 -- visible as a sudden jump/lag rather than a gradual slowdown. Compacting more
10
+ * often, on a much smaller batch each time, trades that one large pause for many much smaller
11
+ * (and much less noticeable) ones spread across the session.
12
+ *
13
+ * If a particular use case genuinely prefers fewer, larger pauses (e.g. a non-interactive/batch
14
+ * context where per-call overhead matters more than pause smoothness), pass a larger
15
+ * `compactingSize` explicitly to `seriesFrom`/`emptySeries`/`emptySeriesFor`.
16
+ */
17
+ export const DEFAULT_COMPACTING_SIZE = 10000;
2
18
  /**
3
19
  * Creates a series from the name and the optional array of `Datum`.
20
+ *
21
+ * **Ownership warning:** when `data` is a plain array (or already a {@link FastShiftArray}), it is
22
+ * wrapped **by reference**, not copied -- the returned series' backing storage *is* that same
23
+ * array/`FastShiftArray`. As the chart streams in new data and ages old data out, the library calls
24
+ * `shift()` on it (clearing the head slot, and periodically `splice`-ing it during compaction),
25
+ * mutating it in place. If you keep your own reference to the array you pass in (to reuse,
26
+ * snapshot, or compare later), you will see it change out from under you. If you need an
27
+ * independent copy, pass `data.slice()` instead -- see e.g. `StreamingBarChart.tsx`,
28
+ * `StreamingRasterChart.tsx`, and `StreamingPoincareChart.tsx`, which all do this when re-deriving
29
+ * initial series from data they still hold a reference to elsewhere.
4
30
  * @param name The name of the series (i.e. neuron)
5
31
  * @param data The array of datum, which could be `(t, f(t))`, or `(f[n](x), f[n+1](x))`
6
- * @return A {@link BaseSeries} for object that can be used by in {@link Chart}s
32
+ * @param compactingSize The number of shifts the series' backing array accumulates before it's
33
+ * compacted (see {@link DEFAULT_COMPACTING_SIZE}). Only applies when `data` is a plain array (and
34
+ * so a new `FastShiftArray` is created for it) -- ignored when `data` is already a `FastShiftArray`,
35
+ * since compaction size is fixed at that instance's own construction time.
36
+ * @return A {@link BaseSeries} that can be used in {@link Chart}s
7
37
  * @see seriesFromTuples
8
38
  * @see emptySeries
9
39
  */
10
- export function seriesFrom(name, data = []) {
40
+ export function seriesFrom(name, data = [], compactingSize = DEFAULT_COMPACTING_SIZE) {
41
+ // `backing` is the single source of truth stored in `.data` below -- `last`/`length`/`isEmpty`
42
+ // must close over this (not the original `data` param) so they go through FastShiftArray's own
43
+ // headIndex-aware accessors. When `data` is a plain array, `FastShiftArray.fromArray` wraps it
44
+ // by reference rather than copying, so reading `data.length` directly (the old behavior) read
45
+ // the raw backing array's physical length, which `shift()` never shrinks -- it only advances
46
+ // an internal headIndex.
47
+ const backing = data instanceof Array ?
48
+ FastShiftArray.fromArray(data, true, compactingSize) :
49
+ data;
11
50
  return {
12
51
  name: name,
13
- data: data,
14
- last: () => data ? (data.length > 0 ? successResult(data[data.length - 1]) : failureResult("Data is empty")) : failureResult("Data is not defined"),
15
- length: () => data ? data.length : 0,
16
- isEmpty: () => data ? data.length === 0 : true
52
+ data: backing,
53
+ last: () => backing.length > 0 ?
54
+ successResult(backing[backing.length - 1]) :
55
+ failureResult("Data is empty"),
56
+ length: () => backing.length,
57
+ isEmpty: () => backing.length === 0
17
58
  };
18
59
  }
19
60
  /**
20
61
  * Returns an empty series with the specified name
21
62
  * @param name The name of the series
63
+ * @param compactingSize The number of shifts the series' backing array accumulates before it's
64
+ * compacted (see {@link DEFAULT_COMPACTING_SIZE})
22
65
  * @return The empty series
23
66
  * @see seriesFrom
24
67
  * @see seriesFromTuples
25
68
  */
26
- export const emptySeries = (name) => seriesFrom(name);
69
+ export const emptySeries = (name, compactingSize = DEFAULT_COMPACTING_SIZE) => seriesFrom(name, [], compactingSize);
27
70
  /**
28
71
  * Creates an array of empty series, one for each specified name
29
72
  * @param names The names for each of the empty series
73
+ * @param compactingSize The number of shifts each series' backing array accumulates before it's
74
+ * compacted (see {@link DEFAULT_COMPACTING_SIZE})
30
75
  * @return An array of empty series with the specified names
31
76
  * @see emptySeries
32
77
  * @see seriesFrom
33
78
  * @see seriesFromTuples
34
79
  */
35
- export const emptySeriesFor = (names) => names.map(name => seriesFrom(name));
80
+ export const emptySeriesFor = (names, compactingSize = DEFAULT_COMPACTING_SIZE) => names.map(name => seriesFrom(name, [], compactingSize));
36
81
  //# sourceMappingURL=baseSeries.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"baseSeries.js","sourceRoot":"","sources":["../../../../src/app/charts/series/baseSeries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAU,aAAa,EAAC,MAAM,WAAW,CAAC;AAc/D;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAI,IAAY,EAAE,OAAiB,EAAE;IAC3D,OAAO;QACH,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAY,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAY,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAY,qBAAqB,CAAC;QACpL,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACpC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;KACjD,CAAA;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,IAAY,EAAiB,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAEhF;;;;;;;GAO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GAAG,CAAI,IAAY,EAAE,iBAAyB,uBAAuB,EAAiB,EAAE,CAC5G,UAAU,CAAC,IAAI,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;AAEzC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAI,KAAoB,EAAE,iBAAyB,uBAAuB,EAAwB,EAAE,CAC9H,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { BaseSeries } from "./baseSeries";
1
+ import { type BaseSeries } from "./baseSeries";
2
2
  /**
3
3
  * An immutable datum object that holds the iterate `(f[n](x), f[n+1](x))` with an
4
4
  * informational time
@@ -9,7 +9,7 @@ export interface IterateDatum {
9
9
  readonly iterateN_1: number;
10
10
  }
11
11
  /**
12
- * Creates an empty iterate datum
12
+ * An empty iterate datum (its time and iterates are all `NaN`)
13
13
  */
14
14
  export declare const emptyIterateDatum: IterateDatum;
15
15
  /**
@@ -21,10 +21,10 @@ export declare const emptyIterateDatum: IterateDatum;
21
21
  */
22
22
  export declare const iterateDatumOf: (time: number, iterateN: number, iterateN_1: number) => IterateDatum;
23
23
  /**
24
- * Returns whether the iterate datum is considered empty. An iterate datum is considered
25
- * empty when the time, `f[n](x)`, `f[n+1](x)` values are all `NaN`
24
+ * Returns whether the iterate datum is non-empty. An iterate datum is considered empty when any
25
+ * of its time, `f[n](x)`, and `f[n+1](x)` values is `NaN`
26
26
  * @param datum The iterate datum to test
27
- * @return `true` if the iterate datum is empty; `false` otherwise
27
+ * @return `true` if the iterate datum is non-empty (none of its values is `NaN`); `false` otherwise
28
28
  */
29
29
  export declare const nonEmptyIterateDatum: (datum: IterateDatum) => boolean;
30
30
  /**
@@ -32,11 +32,12 @@ export declare const nonEmptyIterateDatum: (datum: IterateDatum) => boolean;
32
32
  */
33
33
  export type IterateSeries = BaseSeries<IterateDatum>;
34
34
  /**
35
- * Creates a series from the name and the optional array of (x, y) pairs (tuples)
35
+ * Creates a series from the name and the optional array of `(time, f[n](x), f[n+1](x))` tuples
36
36
  * @param name The name of the series
37
- * @param data The optional array of (x, y) pairs (tuples)
38
- * @return A `Series` for object that can be used by the `PoincarePlot`
37
+ * @param data The optional array of `(time, f[n](x), f[n+1](x))` tuples
38
+ * @return An {@link IterateSeries} that can be used by the `PoincarePlot`
39
39
  * @see seriesFrom
40
40
  * @see emptySeries
41
41
  */
42
42
  export declare const iterateSeriesFromTuples: (name: string, data?: Array<[number, number, number]>) => IterateSeries;
43
+ //# sourceMappingURL=iterateSeries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterateSeries.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/series/iterateSeries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,UAAU,EAAa,MAAM,cAAc,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC9B;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAA0D,CAAA;AAE1F;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,EAAE,YAAY,MAAM,KAAG,YAIlF,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,YAAY,KAAG,OACiB,CAAA;AAE5E;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,EAAE,OAAM,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAM,KAAG,aACrB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { seriesFrom } from "./baseSeries";
2
2
  /**
3
- * Creates an empty iterate datum
3
+ * An empty iterate datum (its time and iterates are all `NaN`)
4
4
  */
5
5
  export const emptyIterateDatum = { time: NaN, iterateN: NaN, iterateN_1: NaN };
6
6
  /**
@@ -16,17 +16,17 @@ export const iterateDatumOf = (time, iterateN, iterateN_1) => ({
16
16
  iterateN_1
17
17
  });
18
18
  /**
19
- * Returns whether the iterate datum is considered empty. An iterate datum is considered
20
- * empty when the time, `f[n](x)`, `f[n+1](x)` values are all `NaN`
19
+ * Returns whether the iterate datum is non-empty. An iterate datum is considered empty when any
20
+ * of its time, `f[n](x)`, and `f[n+1](x)` values is `NaN`
21
21
  * @param datum The iterate datum to test
22
- * @return `true` if the iterate datum is empty; `false` otherwise
22
+ * @return `true` if the iterate datum is non-empty (none of its values is `NaN`); `false` otherwise
23
23
  */
24
24
  export const nonEmptyIterateDatum = (datum) => !isNaN(datum.time) && !isNaN(datum.iterateN) && !isNaN(datum.iterateN_1);
25
25
  /**
26
- * Creates a series from the name and the optional array of (x, y) pairs (tuples)
26
+ * Creates a series from the name and the optional array of `(time, f[n](x), f[n+1](x))` tuples
27
27
  * @param name The name of the series
28
- * @param data The optional array of (x, y) pairs (tuples)
29
- * @return A `Series` for object that can be used by the `PoincarePlot`
28
+ * @param data The optional array of `(time, f[n](x), f[n+1](x))` tuples
29
+ * @return An {@link IterateSeries} that can be used by the `PoincarePlot`
30
30
  * @see seriesFrom
31
31
  * @see emptySeries
32
32
  */
@@ -1 +1 @@
1
- {"version":3,"file":"iterateSeries.js","sourceRoot":"","sources":["../../../../src/app/charts/series/iterateSeries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAC,MAAM,cAAc,CAAC;AAYpD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAiB,EAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAC,CAAA;AAE1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AAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;AAO5E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAY,EAAE,OAAwC,EAAE,EAAiB,EAAE,CAC/G,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA"}
@@ -1,5 +1,5 @@
1
- import { BaseSeries } from "./baseSeries";
2
- import { OrdinalChartData, OrdinalStats } from "../observables/ordinals";
1
+ import { type BaseSeries } from "./baseSeries";
2
+ import { type OrdinalChartData, type OrdinalStats } from "../observables/ordinals";
3
3
  /**
4
4
  * An immutable datum object for series with a category and value.
5
5
  * This could be a series of (ordinal, value) where the category runs
@@ -12,24 +12,28 @@ export interface OrdinalDatum {
12
12
  readonly value: number;
13
13
  }
14
14
  /**
15
- * Creates an empty ordinal datum
15
+ * An empty ordinal datum (`NaN` time and value, and an empty ordinal)
16
16
  */
17
17
  export declare const emptyOrdinalDatum: OrdinalDatum;
18
+ /**
19
+ * Copies an ordinal datum
20
+ * @param datum The datum to copy
21
+ * @return The copy
22
+ */
18
23
  export declare const copyOrdinalDatum: (datum: OrdinalDatum) => OrdinalDatum;
19
24
  /**
20
- * Creates an iterate datum
25
+ * Creates an ordinal datum
21
26
  * @param time The datum time, which is mostly informational
22
27
  * @param ordinal The category name or identifier
23
28
  * @param value The value
24
- * @return An iterate datum
29
+ * @return An ordinal datum
25
30
  */
26
31
  export declare const ordinalDatumOf: (time: number, ordinal: string, value: number) => OrdinalDatum;
27
32
  /**
28
- * Returns whether the ordinal datum is empty. An ordinal datum is considered empty
29
- * when the time is NaN, the ordinal is blank (empty or only whitespace), and the value
30
- * is NaN.
31
- * @param datum The iterate datum to test
32
- * @return `true` if the iterate datum is empty; `false` otherwise
33
+ * Returns whether the ordinal datum is non-empty. An ordinal datum is considered empty when its
34
+ * time is NaN, its ordinal is blank (empty or only whitespace), or its value is NaN.
35
+ * @param datum The ordinal datum to test
36
+ * @return `true` if the ordinal datum is non-empty; `false` otherwise
33
37
  */
34
38
  export declare const nonEmptyOrdinalDatum: (datum: OrdinalDatum) => boolean;
35
39
  /**
@@ -46,9 +50,19 @@ export type OrdinalSeries = BaseSeries<OrdinalDatum>;
46
50
  */
47
51
  export declare function ordinateSeriesFromTuples(name: string, data?: Array<[time: number, ordinal: string, value: number]>): OrdinalSeries;
48
52
  /**
49
- * Creates an empty chart data object with all the values set to 0
50
- * @param seriesList The list of series names (identifiers) to update
51
- * @return An empty chart data object
53
+ * Creates the ordinal chart data for the specified series: their names, the stats calculated over
54
+ * their data (see {@link calculateOrdinalStats}), and copies of all their data as the new points
55
+ * @param seriesList The series
56
+ * @return The ordinal chart data for the series
52
57
  */
53
58
  export declare function initialOrdinalChartData(seriesList: Array<OrdinalSeries>): OrdinalChartData;
59
+ /**
60
+ * Calculates the stats of the specified series: the data with the min and max time, and with the
61
+ * min and max value, over all the series, and each series' value stats (its min, max, count, sum,
62
+ * sum of squares, and mean)
63
+ * @param seriesList The series
64
+ * @return The stats (when there's no data, the extremes are the initial ones that searches start
65
+ * from -- see e.g. `initialMinTimeDatum`)
66
+ */
54
67
  export declare function calculateOrdinalStats(seriesList: Array<OrdinalSeries>): OrdinalStats;
68
+ //# sourceMappingURL=ordinalSeries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ordinalSeries.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/series/ordinalSeries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,UAAU,EAAa,MAAM,cAAc,CAAC;AACzD,OAAO,EAIH,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAEpB,MAAM,yBAAyB,CAAC;AAGjC;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACzB;AAGD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAI/B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,YAAY,KAAG,YAIrD,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,OAAO,MAAM,KAAG,YAI5E,CAAA;AAGF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,YAAY,KAAG,OACiC,CAAA;AAE5F;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;AAEpD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACpC,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAM,GACjE,aAAa,CAKf;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,gBAAgB,CAc1F;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,YAAY,CAyDpF"}
@@ -1,24 +1,29 @@
1
1
  import { seriesFrom } from "./baseSeries";
2
2
  import { initialMaxTimeDatum, initialMaxValueDatum, initialMinTimeDatum, initialMinValueDatum } from "../observables/ordinals";
3
3
  /**
4
- * Creates an empty ordinal datum
4
+ * An empty ordinal datum (`NaN` time and value, and an empty ordinal)
5
5
  */
6
6
  export const emptyOrdinalDatum = {
7
7
  time: NaN,
8
8
  ordinal: "",
9
9
  value: NaN,
10
10
  };
11
+ /**
12
+ * Copies an ordinal datum
13
+ * @param datum The datum to copy
14
+ * @return The copy
15
+ */
11
16
  export const copyOrdinalDatum = (datum) => ({
12
17
  time: datum.time,
13
18
  ordinal: datum.ordinal,
14
19
  value: datum.value,
15
20
  });
16
21
  /**
17
- * Creates an iterate datum
22
+ * Creates an ordinal datum
18
23
  * @param time The datum time, which is mostly informational
19
24
  * @param ordinal The category name or identifier
20
25
  * @param value The value
21
- * @return An iterate datum
26
+ * @return An ordinal datum
22
27
  */
23
28
  export const ordinalDatumOf = (time, ordinal, value) => ({
24
29
  time,
@@ -26,11 +31,10 @@ export const ordinalDatumOf = (time, ordinal, value) => ({
26
31
  value,
27
32
  });
28
33
  /**
29
- * Returns whether the ordinal datum is empty. An ordinal datum is considered empty
30
- * when the time is NaN, the ordinal is blank (empty or only whitespace), and the value
31
- * is NaN.
32
- * @param datum The iterate datum to test
33
- * @return `true` if the iterate datum is empty; `false` otherwise
34
+ * Returns whether the ordinal datum is non-empty. An ordinal datum is considered empty when its
35
+ * time is NaN, its ordinal is blank (empty or only whitespace), or its value is NaN.
36
+ * @param datum The ordinal datum to test
37
+ * @return `true` if the ordinal datum is non-empty; `false` otherwise
34
38
  */
35
39
  export const nonEmptyOrdinalDatum = (datum) => !isNaN(datum.time) && datum.ordinal.replace(/\s/g, "").length > 0 && !isNaN(datum.value);
36
40
  /**
@@ -45,14 +49,16 @@ export function ordinateSeriesFromTuples(name, data = []) {
45
49
  return seriesFrom(name, data.map(([t, ordinal, value]) => ordinalDatumOf(t, ordinal, value)));
46
50
  }
47
51
  /**
48
- * Creates an empty chart data object with all the values set to 0
49
- * @param seriesList The list of series names (identifiers) to update
50
- * @return An empty chart data object
52
+ * Creates the ordinal chart data for the specified series: their names, the stats calculated over
53
+ * their data (see {@link calculateOrdinalStats}), and copies of all their data as the new points
54
+ * @param seriesList The series
55
+ * @return The ordinal chart data for the series
51
56
  */
52
57
  export function initialOrdinalChartData(seriesList) {
53
58
  return {
54
59
  seriesNames: new Set(seriesList.map(series => series.name)),
55
60
  stats: calculateOrdinalStats(seriesList),
61
+ // newPoints: new Map<string, Array<OrdinalDatum>>(seriesList.map(series => [
56
62
  newPoints: new Map(seriesList.map(series => [
57
63
  series.name,
58
64
  series.data.map(datum => ({
@@ -63,6 +69,14 @@ export function initialOrdinalChartData(seriesList) {
63
69
  ]))
64
70
  };
65
71
  }
72
+ /**
73
+ * Calculates the stats of the specified series: the data with the min and max time, and with the
74
+ * min and max value, over all the series, and each series' value stats (its min, max, count, sum,
75
+ * sum of squares, and mean)
76
+ * @param seriesList The series
77
+ * @return The stats (when there's no data, the extremes are the initial ones that searches start
78
+ * from -- see e.g. `initialMinTimeDatum`)
79
+ */
66
80
  export function calculateOrdinalStats(seriesList) {
67
81
  const ordinalValueStats = new Map(seriesList.map((series) => {
68
82
  const seriesMin = series.data.reduce((min, datum) => datum.value < min.value ? datum : min, initialMinValueDatum());
@@ -82,12 +96,12 @@ export function calculateOrdinalStats(seriesList) {
82
96
  const minValueDatum = Array.from(ordinalValueStats.values()).reduce((min, value) => value.min.value < min.value ? value.min : min, initialMinValueDatum());
83
97
  const maxValueDatum = Array.from(ordinalValueStats.values()).reduce((max, value) => value.max.value > max.value ? value.max : max, initialMaxValueDatum());
84
98
  const minTimeDatum = seriesList.reduce((globalMin, series) => {
85
- const seriesMin = series.data.reduce((min, datum) => datum.value < min.value ? datum : min, globalMin);
86
- return seriesMin.value < globalMin.value ? seriesMin : globalMin;
99
+ const seriesMin = series.data.reduce((min, datum) => datum.time < min.time ? datum : min, globalMin);
100
+ return seriesMin.time < globalMin.time ? seriesMin : globalMin;
87
101
  }, initialMinTimeDatum());
88
102
  const maxTimeDatum = seriesList.reduce((globalMax, series) => {
89
- const seriesMax = series.data.reduce((max, datum) => datum.value > max.value ? datum : max, globalMax);
90
- return seriesMax.value > globalMax.value ? seriesMax : globalMax;
103
+ const seriesMax = series.data.reduce((max, datum) => datum.time > max.time ? datum : max, globalMax);
104
+ return seriesMax.time > globalMax.time ? seriesMax : globalMax;
91
105
  }, initialMaxTimeDatum());
92
106
  return {
93
107
  maxDatum: { time: maxTimeDatum, value: maxValueDatum },
@@ -1 +1 @@
1
- {"version":3,"file":"ordinalSeries.js","sourceRoot":"","sources":["../../../../src/app/charts/series/ordinalSeries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAC,MAAM,cAAc,CAAC;AACpD,OAAO,EACH,mBAAmB,EACnB,oBAAoB,EAAE,mBAAmB,EACzC,oBAAoB,EAIvB,MAAM,yBAAyB,CAAC;AAejC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAiB;IAC3C,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,GAAG;CACb,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAmB,EAAgB,EAAE,CAAC,CAAC;IACpE,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,OAAO,EAAE,KAAK,CAAC,OAAO;IACtB,KAAK,EAAE,KAAK,CAAC,KAAK;CACrB,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,OAAe,EAAE,KAAa,EAAgB,EAAE,CAAC,CAAC;IAC3F,IAAI;IACJ,OAAO;IACP,KAAK;CACR,CAAC,CAAA;AAGF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAmB,EAAW,EAAE,CACjE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AAO5F;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CACpC,IAAY,EACZ,OAA8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I,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAC;QACpD,QAAQ,EAAE,EAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAC;QACpD,mBAAmB,EAAE,iBAAiB;KACzC,CAAA;AACL,CAAC"}
@@ -0,0 +1,142 @@
1
+ import type { Datum } from "./timeSeries";
2
+ import { type BaseSeries } from "./baseSeries";
3
+ import { type Result } from "result-fn";
4
+ import type { FastShiftArray } from "fast-shift-array";
5
+ /**
6
+ * A series of {@link OutlierDatum}s, along with the measures that the data's bounds are for
7
+ * @template M The type of the measures that is expressed as a tuple of numbers.
8
+ */
9
+ export interface OutlierSeries<M extends readonly number[]> extends BaseSeries<OutlierDatum<M>> {
10
+ /**
11
+ * The measures of the datum. For example, this could be a series of probabilities of
12
+ * the point being an outlier.
13
+ */
14
+ readonly measures: readonly [...M];
15
+ /**
16
+ * The descriptions of the measures. For example, this could be a series of descriptions
17
+ * of the probabilities of the point being an outlier.
18
+ */
19
+ readonly measureDescriptions?: {
20
+ readonly [K in keyof M]: string;
21
+ };
22
+ }
23
+ /**
24
+ * The bounds of a datum.
25
+ */
26
+ export interface OutlierBounds {
27
+ /**
28
+ * The lower bound of the datum
29
+ */
30
+ readonly lower: number;
31
+ /**
32
+ * The upper bound of the datum
33
+ */
34
+ readonly upper: number;
35
+ }
36
+ /**
37
+ * A datum with an upper and lower bounds B(L, U) associated with each measure. The idea is the
38
+ * following. We have a datum (x, y) value. The bounds determine whether the datum is
39
+ * within the range associated with the measure. For example, the measure could be the
40
+ * 0.95 probability that the datum falls within that bound. And if the (x, y) value falls
41
+ * outside the bounds B(L, U), the datum could be considered an "outlier".
42
+ *
43
+ * Often we would like to have a set of measures that mean different things. For example, if
44
+ * the datum falls outside the bounds B1(L, U) representing the range in which we expect
45
+ * the datum to fall with a 0.95 probability, then we could consider the datum an "outlier". We
46
+ * may also want to consider the datum an "outlier" if it falls outside the bounds B2(L, U)
47
+ * representing the range in which we expect the datum to fall with a 0.75 probability. If the
48
+ * datum falls outside B2(L, U), then we could consider the datum a "possible outlier" and
49
+ * treat it differently from an "outlier".
50
+ *
51
+ * Note that there are constraints.
52
+ * 1. The cardinality of the measures and the bounds must be the same.
53
+ * 2. The i-th bound is associated with the i-th measure.
54
+ *
55
+ * @template M The type of the measures that is expressed as a tuple of numbers.
56
+ * @see OutlierBounds
57
+ * @see outlierBoundsFor
58
+ * @see outlierDatumFor
59
+ * @see outlierSeriesFor
60
+ *
61
+ * @example
62
+ * // possible-outlier = 0.75, outlier = 0.95
63
+ * const Measures = [0.75, 0.95] as const;
64
+ * const value: Datum = datumOf(1, 10);
65
+ * const bounds = [
66
+ * outlierBoundsFor(21, 121),
67
+ * outlierBoundsFor(2, 52)
68
+ * ] as const;
69
+ * const datum = outlierDatumFor<typeof Measures>(value, Measures, bounds);
70
+ */
71
+ export interface OutlierDatum<M extends readonly number[]> {
72
+ /**
73
+ * The datum with the x and y values
74
+ */
75
+ readonly datum: Datum;
76
+ /**
77
+ * The bounds of the measures. For example, if the measures are probabilities, then
78
+ * the bounds are a series that hold the lower and upper bounds for each probability
79
+ * in the measures.
80
+ */
81
+ readonly bounds: {
82
+ readonly [K in keyof M]: OutlierBounds;
83
+ };
84
+ }
85
+ /**
86
+ * Convenience function to create an outlier bounds object.
87
+ * @param lower The lower bound of the measure
88
+ * @param upper The upper bound of the measure
89
+ * @return An outlier bounds object
90
+ */
91
+ export declare function outlierBoundsFor(lower: number, upper: number): OutlierBounds;
92
+ /**
93
+ * Creates an outlier datum from the (x, y) value and the bounds associated with each measure. Because
94
+ * the length of the bounds-array must be the same as the length of the measures-array, this returns
95
+ * a {@link Result} object with the outcome of the operation.
96
+ * @param datum The (x, y) value
97
+ * @param measures The measures array where each measure is associated with a bound of the same index
98
+ * @param bounds The bounds array where each bound is associated with a measure of the same index
99
+ * @return A {@link Result} object with the outcome of the operation. If the operation is successful,
100
+ * then the result is an {@link OutlierDatum} object. If the operation is not successful, then
101
+ * the result is a `string` with the error message.
102
+ * @template M The type of the measures that is expressed as a tuple of numbers.
103
+ */
104
+ export declare function outlierDatumFor<M extends readonly number[]>(datum: Datum, measures: readonly [...M], bounds: {
105
+ readonly [K in keyof M]: OutlierBounds;
106
+ }): Result<OutlierDatum<M>, string>;
107
+ /**
108
+ * Creates an outlier series from the name and the array of (x, y, bounds) tuples. If any of the
109
+ * datum have bounds that do not have the same length as the measures, then this function will fail and
110
+ * return a failure result. Otherwise, it will return a success result with the outlier series.
111
+ * @param name The name of the series
112
+ * @param measures The measures that are associated with the series
113
+ * @param data The array of (x, y, bounds) tuples that define the series
114
+ * @param [measureDescriptions=undefined] The descriptions of the measures
115
+ * @return A {@link Result} object with the outcome of the operation. If the operation is successful,
116
+ * then the result is an {@link OutlierSeries} object. If the operation is not successful, then
117
+ * the result is an array of error messages.
118
+ * @template M The type of the measures that is expressed as a tuple of numbers.
119
+ */
120
+ export declare function outlierSeriesFor<M extends readonly number[]>(name: string, measures: readonly [...M], data: Array<[time: number, value: number, bounds: {
121
+ readonly [K in keyof M]: OutlierBounds;
122
+ }]>, measureDescriptions?: {
123
+ readonly [K in keyof M]: string;
124
+ }): Result<OutlierSeries<M>, Array<string>>;
125
+ /**
126
+ * Creates an outlier series for the data and measures
127
+ *
128
+ * **Ownership warning:** `outlierData` is forwarded directly to {@link seriesFrom}, which wraps a
129
+ * plain array (or `FastShiftArray`) **by reference**, not a copy -- see {@link seriesFrom}'s own
130
+ * ownership warning for the full explanation. If you keep your own reference to `outlierData`,
131
+ * pass `outlierData.slice()` instead if you need an independent copy.
132
+ * @param name The name of the series
133
+ * @param outlierData The data for the series
134
+ * @param measures The measure defining the outlier bands
135
+ * @param measureDescriptions The (optional) meaning of each band
136
+ * @return An outlier series
137
+ * @template M The type of the measures that is expressed as a tuple of numbers.
138
+ */
139
+ export declare function outlierSeriesFrom<M extends readonly number[]>(name: string, outlierData: Array<OutlierDatum<M>> | FastShiftArray<OutlierDatum<M>>, measures: readonly [...M], measureDescriptions?: {
140
+ readonly [K in keyof M]: string;
141
+ }): OutlierSeries<M>;
142
+ //# sourceMappingURL=outlierSeries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outlierSeries.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/series/outlierSeries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,KAAK,UAAU,EAAa,MAAM,cAAc,CAAC;AACzD,OAAO,EAAgB,KAAK,MAAM,EAA+B,MAAM,WAAW,CAAC;AACnF,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,CAAE,SAAQ,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC3F;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;IAClC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE;QAAC,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;KAAC,CAAA;CACnE;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE;IACrD;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE;QAAC,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa;KAAC,CAAA;CAC5D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EA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C,CAElB"}
@@ -0,0 +1,82 @@
1
+ import { seriesFrom } from "./baseSeries";
2
+ import { failureResult, resultFromAll, successResult } from "result-fn";
3
+ /**
4
+ * Convenience function to create an outlier bounds object.
5
+ * @param lower The lower bound of the measure
6
+ * @param upper The upper bound of the measure
7
+ * @return An outlier bounds object
8
+ */
9
+ export function outlierBoundsFor(lower, upper) {
10
+ return { lower, upper };
11
+ }
12
+ /**
13
+ * Creates an outlier datum from the (x, y) value and the bounds associated with each measure. Because
14
+ * the length of the bounds-array must be the same as the length of the measures-array, this returns
15
+ * a {@link Result} object with the outcome of the operation.
16
+ * @param datum The (x, y) value
17
+ * @param measures The measures array where each measure is associated with a bound of the same index
18
+ * @param bounds The bounds array where each bound is associated with a measure of the same index
19
+ * @return A {@link Result} object with the outcome of the operation. If the operation is successful,
20
+ * then the result is an {@link OutlierDatum} object. If the operation is not successful, then
21
+ * the result is a `string` with the error message.
22
+ * @template M The type of the measures that is expressed as a tuple of numbers.
23
+ */
24
+ export function outlierDatumFor(datum, measures, bounds) {
25
+ if (measures.length !== bounds.length) {
26
+ return failureResult(`The number of measures and bounds must be the same; ` +
27
+ `datum: (${datum.x}, ${datum.y}); ` +
28
+ `measures_length: ${measures.length}; ` +
29
+ `bounds_length: ${bounds.length}; ` +
30
+ `measures: [${measures.join(", ")}]; ` +
31
+ `bounds: [${Object.values(bounds).map(b => `(${b.lower}, ${b.upper})`).join(", ")}]`);
32
+ }
33
+ return successResult({ datum, bounds });
34
+ }
35
+ /**
36
+ * Creates an outlier series from the name and the array of (x, y, bounds) tuples. If any of the
37
+ * datum have bounds that do not have the same length as the measures, then this function will fail and
38
+ * return a failure result. Otherwise, it will return a success result with the outlier series.
39
+ * @param name The name of the series
40
+ * @param measures The measures that are associated with the series
41
+ * @param data The array of (x, y, bounds) tuples that define the series
42
+ * @param [measureDescriptions=undefined] The descriptions of the measures
43
+ * @return A {@link Result} object with the outcome of the operation. If the operation is successful,
44
+ * then the result is an {@link OutlierSeries} object. If the operation is not successful, then
45
+ * the result is an array of error messages.
46
+ * @template M The type of the measures that is expressed as a tuple of numbers.
47
+ */
48
+ export function outlierSeriesFor(name, measures, data, measureDescriptions) {
49
+ // enrich each datum in the data array with the measures
50
+ const outlierData = data.map(([time, value, bounds]) => outlierDatumFor({ x: time, y: value }, measures, bounds));
51
+ // if all data has bounds-dimensions that match the measures-dimensions, then we can safely
52
+ // create the outlier series, otherwise we must report the errors
53
+ if (outlierData.filter(datum => datum.succeeded).length === data.length) {
54
+ // convert the Array<Result<OutlierDatum<M>, string>> to Result<Array<OutlierDatum<M>>, Array<string>>
55
+ return resultFromAll(outlierData)
56
+ .map(data => outlierSeriesFrom(name, data, measures, measureDescriptions))
57
+ .mapFailure(failure => [failure]);
58
+ }
59
+ // collect all the errors for datum whose bounds and measures dimensions did not
60
+ // match and report each error
61
+ return failureResult(outlierData
62
+ .filter(result => result.failed)
63
+ .map(result => result.error));
64
+ }
65
+ /**
66
+ * Creates an outlier series for the data and measures
67
+ *
68
+ * **Ownership warning:** `outlierData` is forwarded directly to {@link seriesFrom}, which wraps a
69
+ * plain array (or `FastShiftArray`) **by reference**, not a copy -- see {@link seriesFrom}'s own
70
+ * ownership warning for the full explanation. If you keep your own reference to `outlierData`,
71
+ * pass `outlierData.slice()` instead if you need an independent copy.
72
+ * @param name The name of the series
73
+ * @param outlierData The data for the series
74
+ * @param measures The measure defining the outlier bands
75
+ * @param measureDescriptions The (optional) meaning of each band
76
+ * @return An outlier series
77
+ * @template M The type of the measures that is expressed as a tuple of numbers.
78
+ */
79
+ export function outlierSeriesFrom(name, outlierData, measures, measureDescriptions) {
80
+ return { ...seriesFrom(name, outlierData), measures, measureDescriptions };
81
+ }
82
+ //# sourceMappingURL=outlierSeries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outlierSeries.js","sourceRoot":"","sources":["../../../../src/app/charts/series/outlierSeries.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,UAAU,EAAC,MAAM,cAAc,CAAC;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