@fundar/data-chart-telling 1.16.0 → 1.18.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 (330) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/configuration/ConfigVars.svelte +14 -0
  3. package/dist/configuration/ConfigVars.svelte.d.ts +3 -0
  4. package/dist/configuration/config.svelte.d.ts +5 -0
  5. package/dist/configuration/config.svelte.js +20 -6
  6. package/dist/configuration/themes/dark.js +1 -1
  7. package/dist/configuration/themes/editorial.js +1 -1
  8. package/dist/index.d.ts +12 -4
  9. package/dist/index.js +4 -1
  10. package/dist/layout/base/BasePlotLayout.svelte +1 -1
  11. package/dist/layout/figure/Figure.svelte +5 -12
  12. package/dist/layout/figure/FigureChrome.svelte +2 -10
  13. package/dist/layout/geometry/GeometryLayout.svelte +219 -44
  14. package/dist/layout/hover/HoverDefaults.d.ts +52 -0
  15. package/dist/layout/hover/HoverDefaults.js +96 -0
  16. package/dist/layout/hover/HoverLayers.d.ts +35 -0
  17. package/dist/layout/hover/HoverLayers.js +122 -0
  18. package/dist/layout/hover/HoverSettings.js +4 -1
  19. package/dist/layout/hover/HoverShapes.d.ts +44 -0
  20. package/dist/layout/hover/HoverShapes.js +103 -0
  21. package/dist/layout/hover/PlotHover.svelte.d.ts +18 -0
  22. package/dist/layout/hover/PlotHover.svelte.js +54 -1
  23. package/dist/layout/legend/DisabledStyle.d.ts +1 -1
  24. package/dist/layout/legend/DisabledStyle.js +1 -1
  25. package/dist/layout/legend/DiscreteBadgeItem.svelte +1 -1
  26. package/dist/layout/legend/DiscreteSection.svelte +1 -1
  27. package/dist/layout/legend/LegendState.svelte.d.ts +14 -2
  28. package/dist/layout/legend/LegendState.svelte.js +23 -4
  29. package/dist/layout/legend/LegendText.d.ts +4 -1
  30. package/dist/layout/legend/LegendText.js +7 -1
  31. package/dist/layout/margins/PlotMargins.svelte.d.ts +2 -2
  32. package/dist/layout/margins/PlotMargins.svelte.js +2 -2
  33. package/dist/layout/plot/Core.svelte +2 -2
  34. package/dist/layout/plot/Plot.svelte +4 -2
  35. package/dist/layout/plot/Plot.svelte.d.ts +2 -1
  36. package/dist/layout/plot/PublicPlotContext.d.ts +6 -0
  37. package/dist/layout/plot/PublicPlotContext.js +8 -0
  38. package/dist/layout/scales/ScalesLayout.svelte +1 -1
  39. package/dist/layout/styles/ValueLabels.d.ts +43 -4
  40. package/dist/layout/styles/ValueLabels.js +87 -19
  41. package/dist/layout/timeline/Timeline.svelte +5 -1
  42. package/dist/layout/tooltip/TooltipState.svelte.d.ts +8 -9
  43. package/dist/layout/tooltip/TooltipState.svelte.js +28 -29
  44. package/dist/markers/MarkerKinds.d.ts +5 -0
  45. package/dist/markers/MarkerKinds.js +1 -0
  46. package/dist/markers/area/AreaMarker.svelte +3 -0
  47. package/dist/markers/arrow/ArrowMarker.svelte +9 -5
  48. package/dist/markers/band/BandMarker.svelte +74 -0
  49. package/dist/markers/band/BandMarker.svelte.d.ts +7 -0
  50. package/dist/markers/band/Bands.d.ts +16 -0
  51. package/dist/markers/band/Bands.js +48 -0
  52. package/dist/markers/bar/BarMarker.svelte +50 -96
  53. package/dist/markers/bollinger/BollingerMarker.svelte +3 -0
  54. package/dist/markers/box/BoxMarker.svelte +3 -1
  55. package/dist/markers/cell/CellMarker.svelte +11 -7
  56. package/dist/markers/contour/ContourMarker.svelte +3 -0
  57. package/dist/markers/delaunay/DelaunayLinkMarker.svelte +9 -5
  58. package/dist/markers/delaunay/DelaunayMeshMarker.svelte +3 -0
  59. package/dist/markers/density/DensityMarker.svelte +3 -0
  60. package/dist/markers/difference/DifferenceMarker.svelte +3 -0
  61. package/dist/markers/dot/DotMarker.svelte +11 -6
  62. package/dist/markers/geo/GraticuleMarker.svelte +3 -0
  63. package/dist/markers/geo/SphereMarker.svelte +3 -0
  64. package/dist/markers/hover/HoverMarker.svelte +7 -249
  65. package/dist/markers/hover/HoverMarker.svelte.d.ts +4 -27
  66. package/dist/markers/hull/HullMarker.svelte +3 -0
  67. package/dist/markers/image/ImageMarker.svelte +3 -0
  68. package/dist/markers/line/LineMarker.svelte +3 -0
  69. package/dist/markers/link/LinkMarker.svelte +3 -0
  70. package/dist/markers/raster/RasterMarker.svelte +3 -0
  71. package/dist/markers/rect/RectMarker.svelte +25 -17
  72. package/dist/markers/regression/RegressionMarker.svelte +3 -0
  73. package/dist/markers/rule/RuleMarker.svelte +15 -5
  74. package/dist/markers/text/TextFit.d.ts +44 -0
  75. package/dist/markers/text/TextFit.js +86 -0
  76. package/dist/markers/text/TextMarker.svelte +186 -90
  77. package/dist/markers/text/TextMarker.svelte.d.ts +2 -0
  78. package/dist/markers/tick/TickMarker.svelte +9 -3
  79. package/dist/markers/trail/TrailMarker.svelte +3 -0
  80. package/dist/markers/utils/BoxLabel.d.ts +58 -0
  81. package/dist/markers/utils/BoxLabel.js +175 -0
  82. package/dist/markers/utils/MarkerEvents.d.ts +23 -0
  83. package/dist/markers/utils/MarkerEvents.js +44 -0
  84. package/dist/markers/utils/MarkerLabel.svelte +33 -0
  85. package/dist/markers/utils/MarkerLabel.svelte.d.ts +10 -0
  86. package/dist/markers/utils/PointPixel.d.ts +37 -0
  87. package/dist/markers/utils/PointPixel.js +44 -0
  88. package/dist/markers/utils/RowStroke.d.ts +9 -21
  89. package/dist/markers/utils/RowStroke.js +10 -21
  90. package/dist/markers/utils/RowStyle.d.ts +26 -0
  91. package/dist/markers/utils/RowStyle.js +55 -0
  92. package/dist/markers/vector/VectorMarker.svelte +3 -0
  93. package/dist/markers/voronoi/VoronoiMarker.svelte +9 -5
  94. package/dist/markers/voronoi/VoronoiMeshMarker.svelte +3 -0
  95. package/dist/markers/waffle/WaffleMarker.svelte +9 -5
  96. package/dist/phases/Pipeline.d.ts +10 -8
  97. package/dist/phases/Pipeline.js +13 -9
  98. package/dist/phases/context/ContextPhase.d.ts +22 -0
  99. package/dist/phases/context/ContextPhase.js +23 -0
  100. package/dist/phases/context/RowContext.d.ts +35 -0
  101. package/dist/phases/context/RowContext.js +95 -0
  102. package/dist/phases/data/DataPhase.d.ts +4 -4
  103. package/dist/phases/data/DataPhase.js +53 -12
  104. package/dist/phases/hover/HoverPhase.d.ts +6 -7
  105. package/dist/phases/hover/HoverPhase.js +28 -15
  106. package/dist/phases/mapping/MappingPhase.d.ts +4 -4
  107. package/dist/phases/mapping/MappingPhase.js +4 -3
  108. package/dist/phases/markers/MarkerStyles.d.ts +26 -0
  109. package/dist/phases/markers/MarkerStyles.js +126 -0
  110. package/dist/phases/markers/MarkersPhase.d.ts +5 -5
  111. package/dist/phases/markers/MarkersPhase.js +8 -6
  112. package/dist/phases/scales/ScalesPhase.d.ts +4 -4
  113. package/dist/phases/scales/ScalesPhase.js +4 -4
  114. package/dist/phases/sharedScales/SharedScalesPhase.d.ts +2 -2
  115. package/dist/phases/sharedScales/SharedScalesPhase.js +2 -2
  116. package/dist/phases/statistics/MarkerGrouping.d.ts +0 -9
  117. package/dist/phases/statistics/MarkerGrouping.js +0 -16
  118. package/dist/phases/statistics/StatisticsPhase.js +1 -1
  119. package/dist/phases/styles/StylesPhase.d.ts +3 -3
  120. package/dist/phases/styles/StylesPhase.js +2 -2
  121. package/dist/phases/tooltip/TooltipPhase.d.ts +4 -4
  122. package/dist/phases/tooltip/TooltipPhase.js +10 -7
  123. package/dist/phases/transforms/Transforms.js +3 -1
  124. package/dist/phases/transforms/TransformsPhase.d.ts +3 -3
  125. package/dist/phases/transforms/TransformsPhase.js +60 -6
  126. package/dist/phases/transforms/methods/TreemapTransform.d.ts +28 -0
  127. package/dist/phases/transforms/methods/TreemapTransform.js +119 -0
  128. package/dist/plots/correlation/heatmap/defaults.d.ts +2 -2
  129. package/dist/plots/correlation/heatmap/defaults.js +23 -8
  130. package/dist/plots/correlation/heatmap/markers.d.ts +2 -10
  131. package/dist/plots/correlation/heatmap/markers.js +11 -37
  132. package/dist/plots/correlation/scatter/defaults.d.ts +2 -2
  133. package/dist/plots/correlation/scatter/defaults.js +9 -3
  134. package/dist/plots/correlation/scatter/markers.d.ts +3 -3
  135. package/dist/plots/correlation/scatter/markers.js +6 -5
  136. package/dist/plots/distribution/box/BoxSummaries.d.ts +17 -8
  137. package/dist/plots/distribution/box/BoxSummaries.js +90 -40
  138. package/dist/plots/distribution/box/defaults.d.ts +2 -2
  139. package/dist/plots/distribution/box/defaults.js +9 -6
  140. package/dist/plots/distribution/box/markers.d.ts +2 -2
  141. package/dist/plots/distribution/box/markers.js +3 -3
  142. package/dist/plots/distribution/density/defaults.d.ts +2 -2
  143. package/dist/plots/distribution/density/defaults.js +17 -1
  144. package/dist/plots/distribution/density/markers.d.ts +2 -2
  145. package/dist/plots/distribution/density/markers.js +4 -4
  146. package/dist/plots/distribution/histogram/defaults.d.ts +2 -2
  147. package/dist/plots/distribution/histogram/defaults.js +22 -27
  148. package/dist/plots/distribution/histogram/markers.d.ts +3 -12
  149. package/dist/plots/distribution/histogram/markers.js +21 -62
  150. package/dist/plots/distribution/pyramid/defaults.d.ts +2 -2
  151. package/dist/plots/distribution/pyramid/defaults.js +7 -4
  152. package/dist/plots/distribution/pyramid/markers.d.ts +2 -12
  153. package/dist/plots/distribution/pyramid/markers.js +16 -66
  154. package/dist/plots/distribution/violin/defaults.d.ts +2 -2
  155. package/dist/plots/distribution/violin/defaults.js +9 -7
  156. package/dist/plots/distribution/violin/markers.d.ts +2 -2
  157. package/dist/plots/distribution/violin/markers.js +4 -4
  158. package/dist/plots/evolution/area/defaults.d.ts +2 -2
  159. package/dist/plots/evolution/area/defaults.js +1 -1
  160. package/dist/plots/evolution/area/markers.d.ts +2 -2
  161. package/dist/plots/evolution/area/markers.js +4 -4
  162. package/dist/plots/evolution/line/defaults.d.ts +2 -2
  163. package/dist/plots/evolution/line/defaults.js +1 -1
  164. package/dist/plots/evolution/line/markers.d.ts +2 -2
  165. package/dist/plots/evolution/line/markers.js +3 -3
  166. package/dist/plots/evolution/slope/defaults.d.ts +2 -2
  167. package/dist/plots/evolution/slope/defaults.js +8 -4
  168. package/dist/plots/evolution/slope/markers.d.ts +2 -2
  169. package/dist/plots/evolution/slope/markers.js +3 -3
  170. package/dist/plots/evolution/sparkline/defaults.d.ts +2 -2
  171. package/dist/plots/evolution/sparkline/defaults.js +5 -2
  172. package/dist/plots/evolution/sparkline/markers.d.ts +2 -2
  173. package/dist/plots/evolution/sparkline/markers.js +3 -3
  174. package/dist/plots/map/geo/Core.svelte +3 -3
  175. package/dist/plots/map/geo/defaults.d.ts +2 -2
  176. package/dist/plots/map/geo/phases/data.d.ts +1 -1
  177. package/dist/plots/map/geo/phases/data.js +1 -1
  178. package/dist/plots/map/geo/phases/hover.d.ts +2 -2
  179. package/dist/plots/map/geo/phases/hover.js +3 -3
  180. package/dist/plots/map/geo/phases/markers.d.ts +2 -2
  181. package/dist/plots/map/geo/phases/markers.js +5 -4
  182. package/dist/plots/map/geo/phases/scales.d.ts +2 -2
  183. package/dist/plots/map/geo/phases/scales.js +2 -2
  184. package/dist/plots/part-of-a-whole/treemap/Plot.svelte +47 -0
  185. package/dist/plots/part-of-a-whole/treemap/Plot.svelte.d.ts +26 -0
  186. package/dist/plots/part-of-a-whole/treemap/defaults.d.ts +10 -0
  187. package/dist/plots/part-of-a-whole/treemap/defaults.js +183 -0
  188. package/dist/plots/ranking/bar/defaults.d.ts +2 -2
  189. package/dist/plots/ranking/bar/defaults.js +15 -9
  190. package/dist/plots/ranking/bar/markers.d.ts +4 -14
  191. package/dist/plots/ranking/bar/markers.js +45 -86
  192. package/dist/plots/ranking/bullet/defaults.d.ts +2 -2
  193. package/dist/plots/ranking/bullet/defaults.js +4 -4
  194. package/dist/plots/ranking/bullet/markers.d.ts +3 -3
  195. package/dist/plots/ranking/bullet/markers.js +11 -12
  196. package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +3 -3
  197. package/dist/plots/ranking/cleveland/ClevelandMarkers.js +28 -23
  198. package/dist/plots/ranking/cleveland/defaults.d.ts +2 -2
  199. package/dist/plots/ranking/cleveland/defaults.js +7 -4
  200. package/dist/plots/ranking/dumbbell/defaults.d.ts +2 -2
  201. package/dist/plots/ranking/forest/defaults.d.ts +2 -2
  202. package/dist/plots/ranking/lollipop/defaults.d.ts +2 -2
  203. package/dist/types/configuration/styling.d.ts +31 -2
  204. package/dist/types/layout/context.d.ts +21 -0
  205. package/dist/types/layout/context.js +1 -0
  206. package/dist/types/layout/hover.d.ts +3 -0
  207. package/dist/types/layout/legend.d.ts +8 -1
  208. package/dist/types/layout/mapping.d.ts +12 -3
  209. package/dist/types/layout/scales.d.ts +6 -0
  210. package/dist/types/layout/styles/values.d.ts +8 -2
  211. package/dist/types/layout/tooltip.d.ts +11 -4
  212. package/dist/types/markers/axis/arrow.d.ts +2 -8
  213. package/dist/types/markers/axis/axisBasedMarkersConfig.d.ts +2 -1
  214. package/dist/types/markers/axis/band.d.ts +24 -0
  215. package/dist/types/markers/axis/band.js +1 -0
  216. package/dist/types/markers/axis/bar.d.ts +6 -10
  217. package/dist/types/markers/axis/cell.d.ts +5 -5
  218. package/dist/types/markers/axis/delaunayLink.d.ts +2 -2
  219. package/dist/types/markers/axis/hover.d.ts +60 -15
  220. package/dist/types/markers/axis/rect.d.ts +4 -8
  221. package/dist/types/markers/axis/rule.d.ts +2 -16
  222. package/dist/types/markers/axis/tick.d.ts +2 -2
  223. package/dist/types/markers/axis/voronoi.d.ts +2 -2
  224. package/dist/types/markers/axis/waffle.d.ts +4 -3
  225. package/dist/types/markers/basic/dot.d.ts +2 -2
  226. package/dist/types/markers/basic/text.d.ts +56 -14
  227. package/dist/types/markers/channels/commonMarkerConfig.d.ts +8 -1
  228. package/dist/types/markers/channels/commonMarkerConfigWithArea.d.ts +1 -2
  229. package/dist/types/markers/channels/commonMarkerConfigWithLabel.d.ts +10 -0
  230. package/dist/types/markers/channels/commonMarkerConfigWithLabel.js +1 -0
  231. package/dist/types/markers/channels/commonMarkerEvents.d.ts +17 -0
  232. package/dist/types/markers/channels/commonMarkerEvents.js +13 -0
  233. package/dist/types/markers/common.d.ts +1 -0
  234. package/dist/types/markers/common.js +1 -0
  235. package/dist/types/markers/geo/contour.d.ts +2 -1
  236. package/dist/types/markers/geo/graticule.d.ts +2 -1
  237. package/dist/types/markers/geo/link.d.ts +2 -1
  238. package/dist/types/markers/geo/sphere.d.ts +2 -1
  239. package/dist/types/markers/geo/vector.d.ts +2 -1
  240. package/dist/types/phases/context/phase.d.ts +7 -0
  241. package/dist/types/phases/context/phase.js +1 -0
  242. package/dist/types/phases/data/phase.d.ts +7 -2
  243. package/dist/types/phases/hover/phase.d.ts +10 -5
  244. package/dist/types/phases/index.d.ts +2 -1
  245. package/dist/types/phases/kind.d.ts +11 -8
  246. package/dist/types/phases/mapping/phase.d.ts +2 -2
  247. package/dist/types/phases/markers/phase.d.ts +3 -3
  248. package/dist/types/phases/scales/phase.d.ts +4 -4
  249. package/dist/types/phases/stage.d.ts +3 -3
  250. package/dist/types/phases/state.d.ts +8 -1
  251. package/dist/types/phases/statistics/phase.d.ts +2 -1
  252. package/dist/types/phases/styles/phase.d.ts +3 -2
  253. package/dist/types/phases/transforms/phase.d.ts +13 -2
  254. package/dist/types/plots/constants.d.ts +17 -19
  255. package/dist/types/plots/correlation/heatmap/props.d.ts +3 -3
  256. package/dist/types/plots/correlation/heatmap/state.d.ts +2 -2
  257. package/dist/types/plots/correlation/scatter/props.d.ts +3 -3
  258. package/dist/types/plots/correlation/scatter/state.d.ts +2 -2
  259. package/dist/types/plots/data/common.d.ts +19 -6
  260. package/dist/types/plots/data/geo.d.ts +1 -1
  261. package/dist/types/plots/distribution/box/props.d.ts +25 -3
  262. package/dist/types/plots/distribution/box/state.d.ts +6 -17
  263. package/dist/types/plots/distribution/density/props.d.ts +3 -11
  264. package/dist/types/plots/distribution/density/state.d.ts +2 -2
  265. package/dist/types/plots/distribution/histogram/props.d.ts +16 -11
  266. package/dist/types/plots/distribution/histogram/state.d.ts +2 -2
  267. package/dist/types/plots/distribution/pyramid/props.d.ts +3 -3
  268. package/dist/types/plots/distribution/pyramid/state.d.ts +2 -2
  269. package/dist/types/plots/distribution/violin/props.d.ts +4 -3
  270. package/dist/types/plots/distribution/violin/state.d.ts +2 -2
  271. package/dist/types/plots/evolution/area/props.d.ts +3 -3
  272. package/dist/types/plots/evolution/area/state.d.ts +2 -2
  273. package/dist/types/plots/evolution/line/props.d.ts +3 -3
  274. package/dist/types/plots/evolution/line/state.d.ts +2 -2
  275. package/dist/types/plots/evolution/slope/state.d.ts +2 -2
  276. package/dist/types/plots/evolution/sparkline/state.d.ts +2 -2
  277. package/dist/types/plots/map/geo/state.d.ts +1 -1
  278. package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +29 -0
  279. package/dist/types/plots/part-of-a-whole/treemap/props.js +1 -0
  280. package/dist/types/plots/part-of-a-whole/treemap/state.d.ts +6 -0
  281. package/dist/types/plots/part-of-a-whole/treemap/state.js +1 -0
  282. package/dist/types/plots/props.d.ts +10 -4
  283. package/dist/types/plots/ranking/bar/props.d.ts +3 -3
  284. package/dist/types/plots/ranking/bar/state.d.ts +2 -2
  285. package/dist/types/plots/ranking/bullet/state.d.ts +2 -2
  286. package/dist/types/plots/ranking/cleveland/props.d.ts +3 -3
  287. package/dist/types/plots/ranking/cleveland/state.d.ts +2 -2
  288. package/dist/types/plots/ranking/dumbbell/props.d.ts +3 -3
  289. package/dist/types/plots/ranking/dumbbell/state.d.ts +2 -2
  290. package/dist/types/plots/ranking/forest/props.d.ts +3 -3
  291. package/dist/types/plots/ranking/forest/state.d.ts +2 -2
  292. package/dist/types/plots/ranking/lollipop/props.d.ts +3 -3
  293. package/dist/types/plots/ranking/lollipop/state.d.ts +2 -2
  294. package/dist/types/plots/styling.d.ts +24 -0
  295. package/dist/types/transforms/index.d.ts +3 -1
  296. package/dist/types/transforms/treemap.d.ts +32 -0
  297. package/dist/types/transforms/treemap.js +5 -0
  298. package/dist/utils/color/ColorTones.d.ts +19 -0
  299. package/dist/utils/color/ColorTones.js +64 -0
  300. package/dist/utils/color/CssColor.d.ts +14 -5
  301. package/dist/utils/color/CssColor.js +69 -27
  302. package/dist/utils/color/index.d.ts +4 -0
  303. package/dist/utils/color/index.js +4 -0
  304. package/dist/utils/grouping.d.ts +18 -1
  305. package/dist/utils/grouping.js +31 -0
  306. package/docs/concepts.md +3 -2
  307. package/docs/legend.md +8 -5
  308. package/docs/markers.md +110 -28
  309. package/docs/plots/evolution/line.md +1 -1
  310. package/docs/plots/evolution/slope.md +1 -1
  311. package/docs/plots/part-of-a-whole/treemap.md +103 -0
  312. package/docs/plots/ranking/bar.md +2 -1
  313. package/docs/plots/ranking/cleveland.md +1 -1
  314. package/docs/plots.md +21 -20
  315. package/docs/scales.md +3 -0
  316. package/docs/state.md +34 -1
  317. package/docs/styles-and-segments.md +20 -19
  318. package/docs/theming.md +6 -12
  319. package/docs/tooltip-and-hover.md +81 -3
  320. package/docs/transforms-and-statistics.md +17 -16
  321. package/examples/LineDates.svelte +1 -1
  322. package/examples/ResponsiveLine.svelte +3 -1
  323. package/examples/Treemap.svelte +13 -0
  324. package/examples/TreemapHover.svelte +25 -0
  325. package/examples/ValueLabels.svelte +1 -1
  326. package/examples/datasets/economic-activity.ts +40 -0
  327. package/examples/datasets/index.ts +1 -0
  328. package/llms-full.txt +11 -9
  329. package/llms.txt +4 -1
  330. package/package.json +3 -1
@@ -13,7 +13,7 @@ export type AxisFit = Partial<AnyAxisScale> & {
13
13
  * numeric axis to cover derived markers and transformed ranges; these say
14
14
  * where a kind goes beyond that.
15
15
  */
16
- export type ScalesStageOptions<TState, TCtx> = {
16
+ export type ScalesStageOptions<TState, TEnv> = {
17
17
  /** Axes whose marks grow from zero, so a domain this stage sets still reaches it - by name or by role (`'value'`). */
18
18
  zero?: AxisRef[];
19
19
  /** Axes that reach as far below zero as above it, to the largest magnitude - by name or by role. */
@@ -21,10 +21,10 @@ export type ScalesStageOptions<TState, TCtx> = {
21
21
  /** Keeps a category axis in the order the data gives it. Without it, categories sort ascending, as svelteplot does. */
22
22
  bandOrder?: 'data';
23
23
  /** The kind's own options for an axis, by name or by role, under the author's `scales`: padding, label anchor, tick format. */
24
- defaults?: (state: TState, ctx: TCtx) => Partial<Record<AxisRef, AnyAxisScale>>;
24
+ defaults?: (state: TState, env: TEnv) => Partial<Record<AxisRef, AnyAxisScale>>;
25
25
  /** The options the kind fits to its own marks on an axis the author left unpinned - a niced value axis, a domain padded for its dots. */
26
- fit?: (state: TState, ctx: TCtx) => Partial<Record<AxisChannelName, AxisFit>>;
26
+ fit?: (state: TState, env: TEnv) => Partial<Record<AxisChannelName, AxisFit>>;
27
27
  /** The kind's own extra "scales" output, once every scale is in place. */
28
- extend?: (state: TState, ctx: TCtx) => TState;
28
+ extend?: (state: TState, env: TEnv) => TState;
29
29
  };
30
30
  export {};
@@ -4,9 +4,9 @@
4
4
  * of a plot shares, `tooltip`, how a hovered row reads once
5
5
  * everything it reads from is placed, and `hover`, what the pointer can match.
6
6
  */
7
- export type PlotPhase = 'facet' | 'data' | 'mapping' | 'transforms' | 'statistics' | 'sharedScales' | 'scales' | 'styles' | 'markers' | 'coordinates' | 'tooltip' | 'hover';
7
+ export type PlotPhase = 'facet' | 'data' | 'mapping' | 'transforms' | 'context' | 'statistics' | 'sharedScales' | 'scales' | 'styles' | 'markers' | 'coordinates' | 'tooltip' | 'hover';
8
8
  /** A resolution step for one {@link PlotPhase} - same state shape in and out. Each shared phase is a class (`DataPhase`, `HoverPhase`...) that implements it. */
9
- export type PhaseStage<TState, TCtx = unknown> = {
9
+ export type PhaseStage<TState, TEnv = unknown> = {
10
10
  phase: PlotPhase;
11
- run: (state: TState, ctx: TCtx) => TState;
11
+ run: (state: TState, env: TEnv) => TState;
12
12
  };
@@ -57,6 +57,11 @@ export type AxisPlotState<TData extends Record<string, unknown>, TStyle extends
57
57
  /** What each position channel is, which one holds the categories, and which way the plot runs. */
58
58
  axes?: PlotAxes;
59
59
  resolvedSeries?: TSeries[];
60
+ /** The series the legend took out of the rows, and how (`'omit'` or `'rescale'`): a part of a whole still reads its whole from them. */
61
+ removedSeries?: {
62
+ mode: 'omit' | 'rescale';
63
+ series: TSeries[];
64
+ };
60
65
  seriesGrouping?: Accessor<any, unknown>;
61
66
  /** Every series name, before legend-omitted ones are dropped, so colors stay put. */
62
67
  allSeriesNames?: string[];
@@ -66,6 +71,8 @@ export type AxisPlotState<TData extends Record<string, unknown>, TStyle extends
66
71
  flat?: TRow[];
67
72
  scopedGroups?: ScopedMarkerGroup<TData>[];
68
73
  colorForSeries?: (name: string) => string;
74
+ /** The color of a path of the `grouping` levels, outermost first, while `scales.color.depth` reaches past the outermost (see `ColorTones.hierarchy`). */
75
+ colorForPath?: (path: readonly string[]) => string;
69
76
  /** A discrete mark's gap fills, per series id: the value each missing row is drawn at. */
70
77
  gapFillMaps?: Map<string, Map<TData, DiscreteGapFill<TStyle>>>;
71
78
  channels?: ResolvedChannels<TData>;
@@ -84,7 +91,7 @@ export type AxisPlotState<TData extends Record<string, unknown>, TStyle extends
84
91
  hoverRows?: unknown[];
85
92
  };
86
93
  /** The environment every axis-based plot's phases read from, alongside the growing state. */
87
- export type AxisPlotCtx = {
94
+ export type AxisPlotEnv = {
88
95
  cfg: PlotStylesConfig;
89
96
  /** The legend's toggles and the figure's hover, read for one plot: which series show and how each dims. */
90
97
  interaction?: PlotInteraction;
@@ -13,7 +13,8 @@ import type { PlotAxes } from '../../../phases/data/PlotAxes';
13
13
  export type StatisticsStageState = Pick<FacetStageState, 'panels'> & {
14
14
  x?: Accessor<any, AxisValue>;
15
15
  y?: Accessor<any, AxisValue>;
16
- grouping?: Accessor<any, unknown>;
16
+ /** The key the "data" phase split the rows into series by, which an author marker inherits. */
17
+ seriesGrouping?: Accessor<any, unknown>;
17
18
  color?: Accessor<any, unknown>;
18
19
  statistics?: StatisticConfig[];
19
20
  authorMarkers?: AxisBasedMarkersConfig[];
@@ -1,3 +1,4 @@
1
+ import type { PlotRowContext } from '../../layout/context';
1
2
  import type { EdgeBox } from '../../layout/box';
2
3
  import type { ValueLabels } from '../../../layout/styles/ValueLabels';
3
4
  import type { ValueAnchor } from '../../plots/constants';
@@ -7,8 +8,8 @@ export type ValueLabelsOptions<TState> = {
7
8
  show?: boolean;
8
9
  /** Where a label sits when `styles.values.anchor` is unset. Defaults to `'outside'`. */
9
10
  anchor?: ValueAnchor;
10
- /** A label's text when `styles.values.format` is unset. Defaults to the bare value. `number` writes a value as the plot's `styles.values` display fields (`decimals`, `prefix`, `suffix`, `signDisplay`) ask. */
11
- format?: (value: number, seriesName: string, number: (value: number) => string) => string;
11
+ /** A label's text when `styles.values.format` is unset. Defaults to the bare value. `number` writes a value as the plot's `styles.values` display fields (`decimals`, `prefix`, `suffix`, `signDisplay`) ask, and `context` is what the plot knows of the labelled row. */
12
+ format?: (value: number, number: (value: number) => string, context: PlotRowContext) => string;
12
13
  /**
13
14
  * Where the labels are expected to sit, from the whole data: boxes around
14
15
  * the points they label, on the plot edges those points can reach (see
@@ -26,6 +26,11 @@ export type ProcessedData = {
26
26
  /** What the shared "transforms" stage reads from and writes to a plot's state. */
27
27
  export type TransformsStageState = {
28
28
  resolvedSeries?: Series<any>[];
29
+ /** The series the legend took out of the rows, and how. */
30
+ removedSeries?: {
31
+ mode: 'omit' | 'rescale';
32
+ series: Series<any>[];
33
+ };
29
34
  /** The style every segment of a series is drawn over, which the processed groups are cut with too. */
30
35
  segmentBase?: (series: string) => any;
31
36
  axes?: PlotAxes;
@@ -46,9 +51,15 @@ export type TransformsStageState = {
46
51
  processedGroups?: VisualGroup<Series<ProcessedRow>, any>[];
47
52
  };
48
53
  /** What differs between plots in the shared "transforms" stage. */
49
- export type TransformsStageOptions<TState extends TransformsStageState, TCtx> = {
54
+ export type TransformsStageOptions<TState extends TransformsStageState, TEnv> = {
50
55
  /** The transforms to run. Defaults to the plot's own `transforms`. */
51
- transforms?: (state: TState, ctx: TCtx) => MarkerTransform[];
56
+ transforms?: (state: TState, env: TEnv) => MarkerTransform[];
57
+ /**
58
+ * Whether a series the legend omits keeps its part of the whole (a treemap's tile): the transforms run over
59
+ * its rows too, so every other part keeps its share and its place, and its own rows are dropped after.
60
+ * Unset, an omitted series is not there for the transforms at all (a stack closes over it).
61
+ */
62
+ keepsOmitted?: boolean;
52
63
  /**
53
64
  * How the processed rows split into `processedGroups`: one group per series
54
65
  * (the default), or `'runs'` of consecutive rows from the same series, in
@@ -1,20 +1,20 @@
1
1
  /**
2
- * Unified positional anchor for value labels across all plot kinds.
3
- *
4
- * - `'outside'` - beyond the tip of the mark (above a vertical bar, to the
5
- * far end of a horizontal bar or line). This is the only value with no
6
- * direct svelteplot equivalent; the plot computes dx/dy internally.
7
- * - `'start'` - at the tip of the mark, just inside (top of a bar, far end
8
- * of a pyramid bar from zero, right of a line's last point).
9
- * - `'middle'` - centred on the mark.
10
- * - `'end'` - at the baseline/zero end of the mark.
2
+ * Where something sits in a box, in a frame or on a shape: its middle, against one of its edges as they are drawn on
3
+ * the page, or in one of its corners. The anchors of a text marker's `frameAnchor`, and of a shape's `label`.
4
+ */
5
+ export type LabelAnchor = 'middle' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
6
+ /**
7
+ * Where a value label sits on its mark. Two vocabularies share the type, one per family of plots:
11
8
  *
12
- * On a bar plot the anchors read as the bars are drawn, whatever the sign of the value: `'outside'` is
13
- * beyond the tip (left of a horizontal bar below zero, under a vertical one), `'start'` the left end of a
14
- * horizontal bar or the top end of a vertical one, `'end'` the right or bottom end, both inside, and
15
- * `'middle'` the centre.
9
+ * - The plots that label a point or the end of a line (`LinePlot`, `AreaPlot`, `SlopePlot`, `ScatterPlot`...) read
10
+ * the side of the point its text is written on: `'start'` after it (right of a line's last point), `'end'` before
11
+ * it, `'middle'` on it and `'outside'` beyond it.
12
+ * - The plots that label a shape (`BarPlot`, `BulletPlot`, `PyramidPlot`, `HistogramPlot`) read where in it the
13
+ * label is. Inside the shape: a {@link LabelAnchor} - its `'middle'`, an edge as it is drawn on the page
14
+ * (`'top'`, `'left'`...) or a corner (`'top-left'`...) - or, whichever side of zero the value is, the end of the bar
15
+ * away from zero, `'tip'`, or the one at zero, `'base'`. Beyond the tip, outside the shape: `'outside'`.
16
16
  */
17
- export type ValueAnchor = 'outside' | 'start' | 'middle' | 'end';
17
+ export type ValueAnchor = LabelAnchor | 'outside' | 'start' | 'end' | 'tip' | 'base';
18
18
  /**
19
19
  * Shared by two unrelated renderers: a `dot` mark's own point shape
20
20
  * (delegated to svelteplot/d3-shape) and a discrete legend item's own icon
@@ -32,11 +32,9 @@ export type FontWeight = 'normal' | 'bold' | number;
32
32
  /** `font-style` keyword accepted by any text styling. */
33
33
  export type FontStyleKeyword = 'normal' | 'italic';
34
34
  /**
35
- * Horizontal text anchor. `'outside'` is only meaningful where the consuming
36
- * mark resolves it per-point from a signed x value (currently `HoverMarker`
37
- * only) - it anchors the label away from zero: `'start'` (extending right)
38
- * for a positive x, `'end'` (extending left) for negative. Elsewhere it's
39
- * treated the same as `'start'`.
35
+ * Horizontal text anchor. `'outside'` leaves the side to the mark that writes
36
+ * the label, where it picks one per point (a Cleveland plot's labels take
37
+ * their own); elsewhere it's treated the same as `'start'`.
40
38
  */
41
39
  export type TextAnchor = 'start' | 'middle' | 'end' | 'outside';
42
40
  /** Vertical text anchor. */
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
6
  import type { CellSegmentStyle } from '../../segments/common';
7
7
  /** `HeatmapPlot`'s public props. */
8
- export type HeatmapPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type HeatmapPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `HeatmapPlot`'s core draws from. */
10
- export type HeatmapPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type HeatmapPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,7 +1,7 @@
1
1
  import type { CellSegmentStyle } from '../../segments/common';
2
2
  import type { ResolvedChannel, ResolvedChannels } from '../../../layout/mapping';
3
3
  import type { LegendRange } from '../../../layout/legend';
4
- import type { AxisPlotState, AxisPlotCtx } from '../../../phases';
4
+ import type { AxisPlotState, AxisPlotEnv } from '../../../phases';
5
5
  /**
6
6
  * The active continuous-legend range filter, if any - narrows which cells
7
7
  * render at full opacity, and in `'rescale'` mode, the color domain itself.
@@ -23,6 +23,6 @@ export type HeatmapPlotState<TData extends Record<string, unknown>> = AxisPlotSt
23
23
  resolveOpacity?: (row: TData) => number;
24
24
  };
25
25
  /** The environment every HeatmapPlot phase reads from, alongside the growing state. */
26
- export type HeatmapPlotCtx = AxisPlotCtx & {
26
+ export type HeatmapPlotEnv = AxisPlotEnv & {
27
27
  range: HeatmapRangeFilter | null | undefined;
28
28
  };
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
6
  import type { ScatterSegmentStyle } from '../../segments/common';
7
7
  /** `ScatterPlot`'s public props. */
8
- export type ScatterPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type ScatterPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `ScatterPlot`'s core draws from. */
10
- export type ScatterPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type ScatterPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,6 +1,6 @@
1
1
  import type { ScatterSegmentStyle } from '../../segments/common';
2
- import type { AxisPlotState, AxisPlotCtx } from '../../../phases';
2
+ import type { AxisPlotState, AxisPlotEnv } from '../../../phases';
3
3
  /** ScatterPlot's pipeline state: the shared axis-based state, with no extras of its own. */
4
4
  export type ScatterPlotState<TData extends Record<string, unknown>> = AxisPlotState<TData, ScatterSegmentStyle>;
5
5
  /** The environment every ScatterPlot phase reads from, alongside the growing state. */
6
- export type ScatterPlotCtx = AxisPlotCtx;
6
+ export type ScatterPlotEnv = AxisPlotEnv;
@@ -1,4 +1,4 @@
1
- import type { AxisValue, AxisChannelName, ChannelAccessors } from '../../layout/mapping';
1
+ import type { AxisValue, AxisChannelName, ChannelAccessors, ChannelName } from '../../layout/mapping';
2
2
  /**
3
3
  * A field key or accessor function. Mirrors the shorthand used across plots
4
4
  * so chart-level encodings (`x`, `y`, `color`, facet, timeline) feel
@@ -27,7 +27,7 @@ export type Series<T extends Record<string, unknown> = Record<string, unknown>>
27
27
  /** The channels a pre-built {@link Series} carries itself, so a plot given `series` takes none of them. */
28
28
  type SeriesChannelName = AxisChannelName | 'color' | 'grouping';
29
29
  /**
30
- * Pre-built series. Mutually exclusive with {@link DataProps} - takes
30
+ * Pre-built series. Mutually exclusive with the data props ({@link DualAxisDataProps}...) - takes
31
31
  * precedence when both could apply. Any channel a series doesn't carry
32
32
  * itself is still a plot-level prop.
33
33
  */
@@ -37,12 +37,25 @@ export type SeriesProps<T extends Record<string, unknown>> = {
37
37
  } & {
38
38
  [K in SeriesChannelName]?: never;
39
39
  } & Omit<ChannelAccessors<T>, SeriesChannelName>;
40
+ /** The channels of `TRequired` as required props. */
41
+ type RequiredChannels<T extends Record<string, unknown>, TRequired extends ChannelName> = Required<Pick<ChannelAccessors<T>, TRequired>>;
40
42
  /**
41
- * Flat rows to group into series, as an alternative to {@link SeriesProps}.
42
- * Takes every channel; `x`/`y` are required.
43
+ * Flat rows to group into series, as an alternative to {@link SeriesProps}, on a plot with no axes (a treemap):
44
+ * every channel but the position ones. `TRequired` names the channels the plot cannot draw without. The base of
45
+ * {@link SingleAxisDataProps} and {@link DualAxisDataProps}.
43
46
  */
44
- export type DataProps<T extends Record<string, unknown>> = {
47
+ export type NonAxisDataProps<T extends Record<string, unknown>, TRequired extends Exclude<ChannelName, AxisChannelName> = never> = {
45
48
  series?: never;
46
49
  data: T[];
47
- } & ChannelAccessors<T> & Required<Pick<ChannelAccessors<T>, AxisChannelName>>;
50
+ x?: never;
51
+ y?: never;
52
+ } & Omit<ChannelAccessors<T>, AxisChannelName> & RequiredChannels<T, TRequired>;
53
+ /** Flat rows on one axis (a histogram): `x`, or `y` alone, besides every other channel. */
54
+ export type SingleAxisDataProps<T extends Record<string, unknown>, TRequired extends Exclude<ChannelName, AxisChannelName> = never> = Omit<NonAxisDataProps<T, TRequired>, AxisChannelName> & ((RequiredChannels<T, 'x'> & {
55
+ y?: never;
56
+ }) | (RequiredChannels<T, 'y'> & {
57
+ x?: never;
58
+ }));
59
+ /** Flat rows on both axes: `x` and `y`, besides every other channel. */
60
+ export type DualAxisDataProps<T extends Record<string, unknown>, TRequired extends Exclude<ChannelName, AxisChannelName> = never> = Omit<NonAxisDataProps<T, TRequired>, AxisChannelName> & RequiredChannels<T, AxisChannelName>;
48
61
  export {};
@@ -25,7 +25,7 @@ export type Topology = {
25
25
  bbox?: number[];
26
26
  };
27
27
  /**
28
- * Data contract for GeoPlot - the geo analog of {@link DataProps}/{@link SeriesProps}
28
+ * Data contract for GeoPlot - the geo analog of {@link DualAxisDataProps}/{@link SeriesProps}
29
29
  * (`$lib/types/plots/data/common`). There's no x/y axis pair for geographic data:
30
30
  * `data` IS the map.
31
31
  */
@@ -1,10 +1,32 @@
1
+ import type { KindRowContext } from '../../../layout/context';
2
+ import type { AxisValue } from '../../../layout/mapping';
1
3
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
4
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
5
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
6
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
7
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
8
  import type { AreaStyle } from '../../styling';
9
+ /**
10
+ * One box's summary: its category, its quartiles, the whisker ends (the farthest values within 1.5 IQR of the box),
11
+ * how many values it has and the ones past the whiskers.
12
+ */
13
+ export type BoxSummary = {
14
+ category: AxisValue;
15
+ min: number;
16
+ p25: number;
17
+ median: number;
18
+ p75: number;
19
+ max: number;
20
+ count: number;
21
+ outliers: number[];
22
+ };
23
+ /**
24
+ * What a `BoxPlot` or a `ViolinPlot` knows of a row, which its tooltip's and value labels' `format`, its hover and
25
+ * `usePlot().contextOf` read: the summary of the box (or violin) it is in. A value's own `value` stays its own; a
26
+ * hovered box's is its median.
27
+ */
28
+ export type BoxRowContext = KindRowContext<BoxSummary>;
7
29
  /** `BoxPlot`'s public props. */
8
- export type BoxPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
30
+ export type BoxPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>, undefined, BoxRowContext>;
9
31
  /** What `BoxPlot`'s core draws from. */
10
- export type BoxPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
32
+ export type BoxPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,23 +1,12 @@
1
1
  import type { AreaStyle } from '../../styling';
2
- import type { AxisPlotState, AxisPlotCtx, ProcessedRow } from '../../../phases';
3
- import type { AxisValue } from '../../../layout/mapping';
2
+ import type { AxisPlotState, AxisPlotEnv, ProcessedRow } from '../../../phases';
3
+ import type { BoxSummary } from './props';
4
4
  /** BoxPlot's pipeline state: the shared axis-based state, with no extras of its own. */
5
5
  export type BoxPlotState<TData extends Record<string, unknown>> = AxisPlotState<TData, AreaStyle>;
6
6
  /** The environment every BoxPlot phase reads from, alongside the growing state. */
7
- export type BoxPlotCtx = AxisPlotCtx;
7
+ export type BoxPlotEnv = AxisPlotEnv;
8
8
  /**
9
- * One box's summary - what a hovered box reads as: its category, its
10
- * quartiles, the whisker ends (the farthest values within 1.5 IQR of the
11
- * box) and the values past them. It also keeps the series tags and, when the
12
- * category channel is a field key, the category under that field.
9
+ * One box's summary as a row - what a hovered box reads as. It also keeps the series tags and, when the category
10
+ * channel is a field key, the category under that field.
13
11
  */
14
- export type BoxSummaryRow = ProcessedRow & {
15
- category: AxisValue;
16
- min: number;
17
- p25: number;
18
- median: number;
19
- p75: number;
20
- max: number;
21
- count: number;
22
- outliers: number[];
23
- };
12
+ export type BoxSummaryRow = ProcessedRow & BoxSummary;
@@ -1,23 +1,15 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, SingleAxisDataProps } from '../../data/common';
5
5
  import type { CurveAwarePlotStylesConfig } from '../../../layout/styles';
6
6
  import type { AreaStyle } from '../../styling';
7
- import type { AxisChannelName, ChannelAccessors } from '../../../layout/mapping';
8
- /** Flat rows estimated along one axis: `x` for a vertical curve, or `y` alone for a horizontal one. */
9
- type DensityDataProps<TRow extends Record<string, unknown>> = Omit<DataProps<TRow>, AxisChannelName> & ((Required<Pick<ChannelAccessors<TRow>, 'x'>> & {
10
- y?: never;
11
- }) | (Required<Pick<ChannelAccessors<TRow>, 'y'>> & {
12
- x?: never;
13
- }));
14
7
  /** `styles` of `DensityPlot`: the curve of the estimate, and the mark that draws it. */
15
8
  export type DensityPlotStylesConfig = CurveAwarePlotStylesConfig & {
16
9
  /** The mark drawing each estimate: a filled `'area'` or a `'line'`. Defaults to `'area'`. */
17
10
  mark?: 'area' | 'line';
18
11
  };
19
12
  /** `DensityPlot`'s public props. */
20
- export type DensityPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DensityDataProps<TData>, TData, DensityPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
13
+ export type DensityPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, DensityPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
21
14
  /** What `DensityPlot`'s core draws from. */
22
- export type DensityPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DensityDataProps<TData>, TData, DensityPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
23
- export {};
15
+ export type DensityPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, DensityPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,6 +1,6 @@
1
1
  import type { AreaStyle } from '../../styling';
2
- import type { AxisPlotState, AxisPlotCtx } from '../../../phases';
2
+ import type { AxisPlotState, AxisPlotEnv } from '../../../phases';
3
3
  /** DensityPlot's pipeline state: the shared axis-based state, with no extras of its own. */
4
4
  export type DensityPlotState<TData extends Record<string, unknown>> = AxisPlotState<TData, AreaStyle>;
5
5
  /** The environment every DensityPlot phase reads from, alongside the growing state. */
6
- export type DensityPlotCtx = AxisPlotCtx;
6
+ export type DensityPlotEnv = AxisPlotEnv;
@@ -1,18 +1,23 @@
1
+ import type { KindRowContext } from '../../../layout/context';
1
2
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
3
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
4
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
5
+ import type { SeriesProps, SingleAxisDataProps } from '../../data/common';
5
6
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
7
  import type { AreaStyle } from '../../styling';
7
- import type { AxisChannelName, ChannelAccessors } from '../../../layout/mapping';
8
- /** Flat rows binned on one axis: `x` for vertical bars, or `y` alone for horizontal ones. A bin's count is its length. */
9
- type HistogramDataProps<TRow extends Record<string, unknown>> = Omit<DataProps<TRow>, AxisChannelName> & ((Required<Pick<ChannelAccessors<TRow>, 'x'>> & {
10
- y?: never;
11
- }) | (Required<Pick<ChannelAccessors<TRow>, 'y'>> & {
12
- x?: never;
13
- }));
8
+ /**
9
+ * What a `HistogramPlot` knows of a bin, which its tooltip's and value labels' `format`, its hover and
10
+ * `usePlot().contextOf` read: its `count` (also its `value`) and the edges it spans.
11
+ */
12
+ export type HistogramRowContext = KindRowContext<{
13
+ /** How many values fall in the bin. */
14
+ count: number;
15
+ /** The bin's lower edge. */
16
+ from: number;
17
+ /** The bin's upper edge. */
18
+ to: number;
19
+ }>;
14
20
  /** `HistogramPlot`'s public props. */
15
- export type HistogramPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | HistogramDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
21
+ export type HistogramPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>, undefined, HistogramRowContext>;
16
22
  /** What `HistogramPlot`'s core draws from. */
17
- export type HistogramPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | HistogramDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
18
- export {};
23
+ export type HistogramPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,6 +1,6 @@
1
1
  import type { AreaStyle } from '../../styling';
2
- import type { AxisPlotState, AxisPlotCtx } from '../../../phases';
2
+ import type { AxisPlotState, AxisPlotEnv } from '../../../phases';
3
3
  /** HistogramPlot's pipeline state: the shared axis-based state, with no extras of its own. */
4
4
  export type HistogramPlotState<TData extends Record<string, unknown>> = AxisPlotState<TData, AreaStyle>;
5
5
  /** The environment every HistogramPlot phase reads from, alongside the growing state. */
6
- export type HistogramPlotCtx = AxisPlotCtx;
6
+ export type HistogramPlotEnv = AxisPlotEnv;
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { GapsAwarePlotStylesConfig } from '../../../layout/styles';
6
6
  import type { BarSegmentStyle } from '../../segments/common';
7
7
  /** `PyramidPlot`'s public props. */
8
- export type PyramidPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, GapsAwarePlotStylesConfig<BarSegmentStyle>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type PyramidPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<BarSegmentStyle>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `PyramidPlot`'s core draws from. */
10
- export type PyramidPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, GapsAwarePlotStylesConfig<BarSegmentStyle>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type PyramidPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<BarSegmentStyle>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,6 +1,6 @@
1
1
  import type { Series } from '../../data/common';
2
2
  import type { BarSegmentStyle } from '../../segments/common';
3
- import type { AxisPlotState, AxisPlotCtx } from '../../../phases';
3
+ import type { AxisPlotState, AxisPlotEnv } from '../../../phases';
4
4
  export type PyramidSide = 'left' | 'right';
5
5
  /** A resolved series tagged with which side of the shared zero baseline it renders on. */
6
6
  export type PyramidSeries<TData extends Record<string, unknown>> = Series<TData> & {
@@ -13,4 +13,4 @@ export type PyramidSeries<TData extends Record<string, unknown>> = Series<TData>
13
13
  */
14
14
  export type PyramidPlotState<TData extends Record<string, unknown>> = AxisPlotState<TData, BarSegmentStyle, PyramidSeries<TData>>;
15
15
  /** The environment every PyramidPlot phase reads from, alongside the growing state. */
16
- export type PyramidPlotCtx = AxisPlotCtx;
16
+ export type PyramidPlotEnv = AxisPlotEnv;
@@ -1,7 +1,8 @@
1
+ import type { BoxRowContext } from '../box/props';
1
2
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
3
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
4
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
5
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
6
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
7
  import type { AreaStyle } from '../../styling';
7
8
  import type { DensityKernel } from '../../../transforms/density';
@@ -18,6 +19,6 @@ export type ViolinPlotStylesConfig = AxisBasedStylesConfig & {
18
19
  box?: boolean | number;
19
20
  };
20
21
  /** `ViolinPlot`'s public props. */
21
- export type ViolinPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, ViolinPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
22
+ export type ViolinPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, ViolinPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>, undefined, BoxRowContext>;
22
23
  /** What `ViolinPlot`'s core draws from. */
23
- export type ViolinPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, ViolinPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
24
+ export type ViolinPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, ViolinPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,6 +1,6 @@
1
1
  import type { AreaStyle } from '../../styling';
2
- import type { AxisPlotState, AxisPlotCtx } from '../../../phases';
2
+ import type { AxisPlotState, AxisPlotEnv } from '../../../phases';
3
3
  /** ViolinPlot's pipeline state: the shared axis-based state, with no extras of its own. */
4
4
  export type ViolinPlotState<TData extends Record<string, unknown>> = AxisPlotState<TData, AreaStyle>;
5
5
  /** The environment every ViolinPlot phase reads from, alongside the growing state. */
6
- export type ViolinPlotCtx = AxisPlotCtx;
6
+ export type ViolinPlotEnv = AxisPlotEnv;
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
6
  import type { AreaStyle } from '../../styling';
7
7
  /** `AreaPlot`'s public props. */
8
- export type AreaPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type AreaPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `AreaPlot`'s core draws from. */
10
- export type AreaPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type AreaPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,6 +1,6 @@
1
1
  import type { AreaStyle } from '../../styling';
2
- import type { AxisPlotState, AxisPlotCtx } from '../../../phases';
2
+ import type { AxisPlotState, AxisPlotEnv } from '../../../phases';
3
3
  /** AreaPlot's pipeline state: the shared axis-based state, with no extras of its own. */
4
4
  export type AreaPlotState<TData extends Record<string, unknown>> = AxisPlotState<TData, AreaStyle>;
5
5
  /** The environment every AreaPlot phase reads from, alongside the growing state. */
6
- export type AreaPlotCtx = AxisPlotCtx;
6
+ export type AreaPlotEnv = AxisPlotEnv;
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { CurveAwarePlotStylesConfig, GapsAwarePlotStylesConfig } from '../../../layout/styles';
6
6
  import type { LineSegmentStyle } from '../../segments/common';
7
7
  /** `LinePlot`'s public props. */
8
- export type LinePlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type LinePlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `LinePlot`'s core draws from. */
10
- export type LinePlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type LinePlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,9 +1,9 @@
1
1
  import type { GapsConfig } from '../../gaps';
2
2
  import type { LineSegmentStyle } from '../../segments/common';
3
- import type { AxisPlotState, AxisPlotCtx } from '../../../phases';
3
+ import type { AxisPlotState, AxisPlotEnv } from '../../../phases';
4
4
  /** LinePlot's pipeline state: the shared axis-based state plus its gaps. */
5
5
  export type LinePlotState<TData extends Record<string, unknown>> = AxisPlotState<TData, LineSegmentStyle> & {
6
6
  gaps?: GapsConfig<LineSegmentStyle>;
7
7
  };
8
8
  /** The environment every LinePlot phase reads from, alongside the growing state. */
9
- export type LinePlotCtx = AxisPlotCtx;
9
+ export type LinePlotEnv = AxisPlotEnv;
@@ -1,5 +1,5 @@
1
- import type { LinePlotState, LinePlotCtx } from '../line/state';
1
+ import type { LinePlotState, LinePlotEnv } from '../line/state';
2
2
  /** SlopePlot's pipeline state: a LinePlot's. */
3
3
  export type SlopePlotState<TData extends Record<string, unknown>> = LinePlotState<TData>;
4
4
  /** The environment every SlopePlot phase reads from, alongside the growing state. */
5
- export type SlopePlotCtx = LinePlotCtx;
5
+ export type SlopePlotEnv = LinePlotEnv;
@@ -1,5 +1,5 @@
1
- import type { LinePlotState, LinePlotCtx } from '../line/state';
1
+ import type { LinePlotState, LinePlotEnv } from '../line/state';
2
2
  /** SparklinePlot's pipeline state: a LinePlot's. */
3
3
  export type SparklinePlotState<TData extends Record<string, unknown>> = LinePlotState<TData>;
4
4
  /** The environment every SparklinePlot phase reads from, alongside the growing state. */
5
- export type SparklinePlotCtx = LinePlotCtx;
5
+ export type SparklinePlotEnv = LinePlotEnv;
@@ -78,7 +78,7 @@ export type GeoPlotState<TProps extends Record<string, unknown>> = {
78
78
  hoverRows?: TaggedGeoFeature<TProps>[];
79
79
  };
80
80
  /** The environment every GeoPlot phase reads from, alongside the growing state. */
81
- export type GeoPlotCtx<TProps extends Record<string, unknown>> = {
81
+ export type GeoPlotEnv<TProps extends Record<string, unknown>> = {
82
82
  cfg: PlotStylesConfig;
83
83
  range: GeoRangeFilter | null | undefined;
84
84
  fill?: string;