@fundar/data-chart-telling 1.17.0 → 1.19.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 (353) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +2 -1
  3. package/dist/configuration/config.svelte.js +4 -3
  4. package/dist/index.d.ts +10 -3
  5. package/dist/index.js +4 -1
  6. package/dist/layout/coordinates/CoordinatesLayout.svelte +3 -1
  7. package/dist/layout/geometry/GeometryLayout.svelte +222 -53
  8. package/dist/layout/geometry/ScaleFreeContext.d.ts +31 -0
  9. package/dist/layout/geometry/ScaleFreeContext.js +65 -0
  10. package/dist/layout/geometry/ScaleFreeMarks.svelte +14 -0
  11. package/dist/layout/geometry/ScaleFreeMarks.svelte.d.ts +7 -0
  12. package/dist/layout/geometry/ScaleGate.svelte.d.ts +8 -0
  13. package/dist/layout/geometry/ScaleGate.svelte.js +95 -0
  14. package/dist/layout/geometry/ScaleGateMarks.svelte +15 -0
  15. package/dist/layout/geometry/ScaleGateMarks.svelte.d.ts +7 -0
  16. package/dist/layout/hover/HoverDefaults.d.ts +52 -0
  17. package/dist/layout/hover/HoverDefaults.js +96 -0
  18. package/dist/layout/hover/HoverLayers.d.ts +35 -0
  19. package/dist/layout/hover/HoverLayers.js +122 -0
  20. package/dist/layout/hover/HoverSettings.d.ts +1 -3
  21. package/dist/layout/hover/HoverSettings.js +3 -2
  22. package/dist/layout/hover/HoverShapes.d.ts +56 -0
  23. package/dist/layout/hover/HoverShapes.js +163 -0
  24. package/dist/layout/hover/PlotHover.svelte.d.ts +18 -0
  25. package/dist/layout/hover/PlotHover.svelte.js +54 -1
  26. package/dist/layout/legend/LegendState.svelte.d.ts +2 -0
  27. package/dist/layout/legend/LegendState.svelte.js +5 -0
  28. package/dist/layout/margins/Box.d.ts +4 -0
  29. package/dist/layout/margins/Box.js +14 -0
  30. package/dist/layout/margins/PlotMargins.svelte.js +26 -1
  31. package/dist/layout/plot/{Plot.svelte.d.ts → AbstractPlot.svelte.d.ts} +3 -3
  32. package/dist/layout/plot/Core.svelte +2 -2
  33. package/dist/layout/plot/PublicPlotContext.d.ts +6 -0
  34. package/dist/layout/plot/PublicPlotContext.js +8 -0
  35. package/dist/layout/styles/ValueLabels.d.ts +118 -59
  36. package/dist/layout/styles/ValueLabels.js +313 -146
  37. package/dist/layout/tooltip/TooltipState.svelte.d.ts +8 -9
  38. package/dist/layout/tooltip/TooltipState.svelte.js +28 -29
  39. package/dist/markers/MarkerKinds.d.ts +84 -1
  40. package/dist/markers/MarkerKinds.js +150 -23
  41. package/dist/markers/area/AreaMarker.svelte +1 -1
  42. package/dist/markers/band/BandMarker.svelte +74 -0
  43. package/dist/markers/band/BandMarker.svelte.d.ts +7 -0
  44. package/dist/markers/band/Bands.d.ts +16 -0
  45. package/dist/markers/band/Bands.js +48 -0
  46. package/dist/markers/bar/BarMarker.svelte +29 -70
  47. package/dist/markers/bollinger/BollingerMarker.svelte +1 -1
  48. package/dist/markers/box/BoxMarker.svelte +1 -1
  49. package/dist/markers/dot/DotRadius.d.ts +11 -0
  50. package/dist/markers/dot/DotRadius.js +21 -0
  51. package/dist/markers/hover/HoverMarker.svelte +7 -265
  52. package/dist/markers/hover/HoverMarker.svelte.d.ts +4 -27
  53. package/dist/markers/labels/CurveLabel.svelte +56 -0
  54. package/dist/markers/labels/CurveLabel.svelte.d.ts +9 -0
  55. package/dist/markers/labels/LabelMerge.d.ts +11 -0
  56. package/dist/markers/labels/LabelMerge.js +87 -0
  57. package/dist/markers/labels/MarkerLabel.svelte +36 -0
  58. package/dist/markers/labels/MarkerLabel.svelte.d.ts +10 -0
  59. package/dist/markers/labels/MarkerLabels.d.ts +52 -0
  60. package/dist/markers/labels/MarkerLabels.js +97 -0
  61. package/dist/markers/labels/geometry/BoxGeometry.d.ts +8 -0
  62. package/dist/markers/labels/geometry/BoxGeometry.js +101 -0
  63. package/dist/markers/labels/geometry/CurveGeometry.d.ts +34 -0
  64. package/dist/markers/labels/geometry/CurveGeometry.js +193 -0
  65. package/dist/markers/labels/geometry/PointGeometry.d.ts +9 -0
  66. package/dist/markers/labels/geometry/PointGeometry.js +22 -0
  67. package/dist/markers/labels/layouts/BoxLayout.d.ts +10 -0
  68. package/dist/markers/labels/layouts/BoxLayout.js +49 -0
  69. package/dist/markers/labels/layouts/PathLayout.d.ts +11 -0
  70. package/dist/markers/labels/layouts/PathLayout.js +91 -0
  71. package/dist/markers/labels/layouts/PointLayout.d.ts +19 -0
  72. package/dist/markers/labels/layouts/PointLayout.js +94 -0
  73. package/dist/markers/regression/RegressionMarker.svelte +1 -1
  74. package/dist/markers/text/Covering.d.ts +13 -0
  75. package/dist/markers/text/Covering.js +29 -0
  76. package/dist/markers/text/Declutter.d.ts +24 -3
  77. package/dist/markers/text/Declutter.js +46 -3
  78. package/dist/markers/text/TextMarker.svelte +90 -17
  79. package/dist/markers/text/TextMarker.svelte.d.ts +1 -1
  80. package/dist/markers/tick/TickMarker.svelte +1 -1
  81. package/dist/markers/utils/MarkerChannels.d.ts +1 -1
  82. package/dist/markers/utils/MarkerChannels.js +3 -2
  83. package/dist/markers/utils/PointPixel.d.ts +37 -0
  84. package/dist/markers/utils/PointPixel.js +44 -0
  85. package/dist/markers/violin/ViolinMarker.svelte +1 -1
  86. package/dist/markers/waffle/WaffleMarker.svelte +1 -1
  87. package/dist/phases/Pipeline.d.ts +7 -7
  88. package/dist/phases/Pipeline.js +12 -9
  89. package/dist/phases/context/ContextPhase.d.ts +22 -0
  90. package/dist/phases/context/ContextPhase.js +23 -0
  91. package/dist/phases/context/RowContext.d.ts +37 -0
  92. package/dist/phases/context/RowContext.js +97 -0
  93. package/dist/phases/data/DataPhase.d.ts +4 -4
  94. package/dist/phases/data/DataPhase.js +7 -7
  95. package/dist/phases/hover/HoverPhase.d.ts +6 -7
  96. package/dist/phases/hover/HoverPhase.js +28 -23
  97. package/dist/phases/mapping/MappingPhase.d.ts +4 -4
  98. package/dist/phases/mapping/MappingPhase.js +2 -2
  99. package/dist/phases/markers/MarkerStyles.d.ts +8 -0
  100. package/dist/phases/markers/MarkerStyles.js +24 -6
  101. package/dist/phases/markers/MarkersPhase.d.ts +6 -7
  102. package/dist/phases/markers/MarkersPhase.js +18 -12
  103. package/dist/phases/scales/ScalesPhase.d.ts +4 -4
  104. package/dist/phases/scales/ScalesPhase.js +4 -4
  105. package/dist/phases/sharedScales/SharedScalesPhase.d.ts +2 -2
  106. package/dist/phases/sharedScales/SharedScalesPhase.js +2 -2
  107. package/dist/phases/statistics/MarkerGrouping.d.ts +0 -9
  108. package/dist/phases/statistics/MarkerGrouping.js +5 -48
  109. package/dist/phases/statistics/MarkerInheritance.d.ts +11 -0
  110. package/dist/phases/statistics/MarkerInheritance.js +25 -0
  111. package/dist/phases/statistics/MarkerOrientation.d.ts +26 -0
  112. package/dist/phases/statistics/MarkerOrientation.js +29 -0
  113. package/dist/phases/statistics/StatisticsPhase.js +15 -15
  114. package/dist/phases/styles/StylesPhase.d.ts +3 -3
  115. package/dist/phases/styles/StylesPhase.js +2 -2
  116. package/dist/phases/tooltip/TooltipPhase.d.ts +4 -4
  117. package/dist/phases/tooltip/TooltipPhase.js +10 -7
  118. package/dist/phases/transforms/TransformsPhase.d.ts +3 -3
  119. package/dist/phases/transforms/TransformsPhase.js +7 -5
  120. package/dist/plots/correlation/heatmap/Plot.svelte +2 -2
  121. package/dist/plots/correlation/heatmap/Plot.svelte.d.ts +0 -1
  122. package/dist/plots/correlation/heatmap/defaults.d.ts +2 -2
  123. package/dist/plots/correlation/heatmap/defaults.js +35 -7
  124. package/dist/plots/correlation/heatmap/markers.d.ts +2 -8
  125. package/dist/plots/correlation/heatmap/markers.js +8 -11
  126. package/dist/plots/correlation/scatter/Plot.svelte +2 -2
  127. package/dist/plots/correlation/scatter/Plot.svelte.d.ts +0 -1
  128. package/dist/plots/correlation/scatter/defaults.d.ts +2 -2
  129. package/dist/plots/correlation/scatter/defaults.js +18 -6
  130. package/dist/plots/correlation/scatter/markers.d.ts +2 -11
  131. package/dist/plots/correlation/scatter/markers.js +24 -30
  132. package/dist/plots/distribution/box/BoxSummaries.d.ts +22 -8
  133. package/dist/plots/distribution/box/BoxSummaries.js +99 -40
  134. package/dist/plots/distribution/box/Plot.svelte +2 -2
  135. package/dist/plots/distribution/box/Plot.svelte.d.ts +0 -1
  136. package/dist/plots/distribution/box/defaults.d.ts +2 -2
  137. package/dist/plots/distribution/box/defaults.js +20 -6
  138. package/dist/plots/distribution/box/markers.d.ts +2 -2
  139. package/dist/plots/distribution/box/markers.js +13 -4
  140. package/dist/plots/distribution/density/Plot.svelte +2 -2
  141. package/dist/plots/distribution/density/Plot.svelte.d.ts +0 -1
  142. package/dist/plots/distribution/density/defaults.d.ts +2 -2
  143. package/dist/plots/distribution/density/defaults.js +33 -1
  144. package/dist/plots/distribution/density/markers.d.ts +2 -2
  145. package/dist/plots/distribution/density/markers.js +9 -5
  146. package/dist/plots/distribution/histogram/Plot.svelte +2 -2
  147. package/dist/plots/distribution/histogram/Plot.svelte.d.ts +0 -1
  148. package/dist/plots/distribution/histogram/defaults.d.ts +2 -2
  149. package/dist/plots/distribution/histogram/defaults.js +36 -36
  150. package/dist/plots/distribution/histogram/markers.d.ts +2 -2
  151. package/dist/plots/distribution/histogram/markers.js +7 -6
  152. package/dist/plots/distribution/pyramid/Plot.svelte +2 -2
  153. package/dist/plots/distribution/pyramid/Plot.svelte.d.ts +0 -1
  154. package/dist/plots/distribution/pyramid/defaults.d.ts +2 -2
  155. package/dist/plots/distribution/pyramid/defaults.js +13 -3
  156. package/dist/plots/distribution/pyramid/markers.d.ts +2 -10
  157. package/dist/plots/distribution/pyramid/markers.js +9 -18
  158. package/dist/plots/distribution/violin/Plot.svelte +2 -2
  159. package/dist/plots/distribution/violin/Plot.svelte.d.ts +0 -1
  160. package/dist/plots/distribution/violin/defaults.d.ts +2 -2
  161. package/dist/plots/distribution/violin/defaults.js +20 -7
  162. package/dist/plots/distribution/violin/markers.d.ts +2 -2
  163. package/dist/plots/distribution/violin/markers.js +30 -6
  164. package/dist/plots/evolution/area/Plot.svelte +2 -2
  165. package/dist/plots/evolution/area/Plot.svelte.d.ts +0 -1
  166. package/dist/plots/evolution/area/defaults.d.ts +2 -2
  167. package/dist/plots/evolution/area/defaults.js +5 -8
  168. package/dist/plots/evolution/area/markers.d.ts +2 -2
  169. package/dist/plots/evolution/area/markers.js +7 -5
  170. package/dist/plots/evolution/line/Plot.svelte +2 -2
  171. package/dist/plots/evolution/line/Plot.svelte.d.ts +0 -1
  172. package/dist/plots/evolution/line/defaults.d.ts +2 -2
  173. package/dist/plots/evolution/line/defaults.js +5 -7
  174. package/dist/plots/evolution/line/markers.d.ts +2 -2
  175. package/dist/plots/evolution/line/markers.js +6 -4
  176. package/dist/plots/evolution/slope/Plot.svelte +2 -2
  177. package/dist/plots/evolution/slope/Plot.svelte.d.ts +0 -1
  178. package/dist/plots/evolution/slope/defaults.d.ts +2 -2
  179. package/dist/plots/evolution/slope/defaults.js +11 -6
  180. package/dist/plots/evolution/slope/markers.d.ts +6 -5
  181. package/dist/plots/evolution/slope/markers.js +19 -12
  182. package/dist/plots/evolution/sparkline/Plot.svelte +2 -2
  183. package/dist/plots/evolution/sparkline/Plot.svelte.d.ts +0 -1
  184. package/dist/plots/evolution/sparkline/defaults.d.ts +2 -2
  185. package/dist/plots/evolution/sparkline/defaults.js +5 -2
  186. package/dist/plots/evolution/sparkline/markers.d.ts +2 -2
  187. package/dist/plots/evolution/sparkline/markers.js +6 -4
  188. package/dist/plots/generic/Plot.svelte +42 -0
  189. package/dist/plots/generic/Plot.svelte.d.ts +25 -0
  190. package/dist/plots/generic/defaults.d.ts +4 -0
  191. package/dist/plots/generic/defaults.js +7 -0
  192. package/dist/plots/map/geo/Core.svelte +3 -3
  193. package/dist/plots/map/geo/Plot.svelte +2 -2
  194. package/dist/plots/map/geo/Plot.svelte.d.ts +0 -1
  195. package/dist/plots/map/geo/defaults.d.ts +2 -2
  196. package/dist/plots/map/geo/phases/data.d.ts +1 -1
  197. package/dist/plots/map/geo/phases/data.js +1 -1
  198. package/dist/plots/map/geo/phases/hover.d.ts +2 -2
  199. package/dist/plots/map/geo/phases/hover.js +3 -3
  200. package/dist/plots/map/geo/phases/markers.d.ts +2 -2
  201. package/dist/plots/map/geo/phases/markers.js +3 -3
  202. package/dist/plots/map/geo/phases/scales.d.ts +2 -2
  203. package/dist/plots/map/geo/phases/scales.js +2 -2
  204. package/dist/plots/part-of-a-whole/treemap/Plot.svelte +2 -2
  205. package/dist/plots/part-of-a-whole/treemap/Plot.svelte.d.ts +0 -1
  206. package/dist/plots/part-of-a-whole/treemap/defaults.d.ts +2 -2
  207. package/dist/plots/part-of-a-whole/treemap/defaults.js +38 -22
  208. package/dist/plots/ranking/bar/Plot.svelte +2 -2
  209. package/dist/plots/ranking/bar/Plot.svelte.d.ts +0 -1
  210. package/dist/plots/ranking/bar/defaults.d.ts +2 -2
  211. package/dist/plots/ranking/bar/defaults.js +26 -10
  212. package/dist/plots/ranking/bar/markers.d.ts +3 -3
  213. package/dist/plots/ranking/bar/markers.js +17 -33
  214. package/dist/plots/ranking/bullet/Plot.svelte +2 -2
  215. package/dist/plots/ranking/bullet/Plot.svelte.d.ts +0 -1
  216. package/dist/plots/ranking/bullet/defaults.d.ts +2 -2
  217. package/dist/plots/ranking/bullet/defaults.js +24 -4
  218. package/dist/plots/ranking/bullet/markers.d.ts +3 -3
  219. package/dist/plots/ranking/bullet/markers.js +16 -10
  220. package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +4 -11
  221. package/dist/plots/ranking/cleveland/ClevelandMarkers.js +73 -54
  222. package/dist/plots/ranking/cleveland/Plot.svelte +2 -2
  223. package/dist/plots/ranking/cleveland/Plot.svelte.d.ts +0 -1
  224. package/dist/plots/ranking/cleveland/defaults.d.ts +2 -2
  225. package/dist/plots/ranking/cleveland/defaults.js +39 -5
  226. package/dist/plots/ranking/dumbbell/Plot.svelte +2 -2
  227. package/dist/plots/ranking/dumbbell/Plot.svelte.d.ts +0 -1
  228. package/dist/plots/ranking/dumbbell/defaults.d.ts +2 -2
  229. package/dist/plots/ranking/forest/Plot.svelte +2 -2
  230. package/dist/plots/ranking/forest/Plot.svelte.d.ts +0 -1
  231. package/dist/plots/ranking/forest/defaults.d.ts +2 -2
  232. package/dist/plots/ranking/lollipop/Plot.svelte +2 -2
  233. package/dist/plots/ranking/lollipop/Plot.svelte.d.ts +0 -1
  234. package/dist/plots/ranking/lollipop/defaults.d.ts +2 -2
  235. package/dist/types/configuration/styling.d.ts +4 -0
  236. package/dist/types/layout/context.d.ts +23 -0
  237. package/dist/types/layout/context.js +1 -0
  238. package/dist/types/layout/hover.d.ts +3 -0
  239. package/dist/types/layout/styles/bullet.d.ts +4 -1
  240. package/dist/types/layout/styles/values.d.ts +59 -13
  241. package/dist/types/layout/tooltip.d.ts +5 -10
  242. package/dist/types/markers/axis/area.d.ts +5 -1
  243. package/dist/types/markers/axis/axisBasedMarkersConfig.d.ts +2 -1
  244. package/dist/types/markers/axis/band.d.ts +24 -0
  245. package/dist/types/markers/axis/band.js +1 -0
  246. package/dist/types/markers/axis/bar.d.ts +7 -4
  247. package/dist/types/markers/axis/bollinger.d.ts +2 -1
  248. package/dist/types/markers/axis/box.d.ts +2 -1
  249. package/dist/types/markers/axis/cell.d.ts +4 -1
  250. package/dist/types/markers/axis/hover.d.ts +60 -15
  251. package/dist/types/markers/axis/line.d.ts +4 -1
  252. package/dist/types/markers/axis/rect.d.ts +4 -1
  253. package/dist/types/markers/axis/regression.d.ts +2 -1
  254. package/dist/types/markers/axis/tick.d.ts +2 -1
  255. package/dist/types/markers/axis/trail.d.ts +4 -1
  256. package/dist/types/markers/axis/violin.d.ts +2 -1
  257. package/dist/types/markers/axis/waffle.d.ts +5 -1
  258. package/dist/types/markers/basic/dot.d.ts +4 -1
  259. package/dist/types/markers/basic/text.d.ts +25 -21
  260. package/dist/types/markers/channels/commonMarkerConfig.d.ts +6 -2
  261. package/dist/types/markers/channels/commonMarkerConfigWithLabel.d.ts +5 -9
  262. package/dist/types/markers/channels/commonMarkerConfigWithOrientation.d.ts +5 -0
  263. package/dist/types/markers/channels/commonMarkerConfigWithOrientation.js +1 -0
  264. package/dist/types/markers/common.d.ts +1 -0
  265. package/dist/types/markers/common.js +1 -0
  266. package/dist/types/markers/labels/box.d.ts +57 -0
  267. package/dist/types/markers/labels/box.js +1 -0
  268. package/dist/types/markers/labels/common.d.ts +15 -0
  269. package/dist/types/markers/labels/common.js +1 -0
  270. package/dist/types/markers/labels/path.d.ts +52 -0
  271. package/dist/types/markers/labels/path.js +1 -0
  272. package/dist/types/markers/labels/point.d.ts +40 -0
  273. package/dist/types/markers/labels/point.js +1 -0
  274. package/dist/types/markers/traits.d.ts +10 -0
  275. package/dist/types/phases/context/phase.d.ts +7 -0
  276. package/dist/types/phases/context/phase.js +1 -0
  277. package/dist/types/phases/data/phase.d.ts +2 -2
  278. package/dist/types/phases/hover/phase.d.ts +10 -7
  279. package/dist/types/phases/index.d.ts +2 -1
  280. package/dist/types/phases/kind.d.ts +11 -8
  281. package/dist/types/phases/mapping/phase.d.ts +2 -2
  282. package/dist/types/phases/markers/phase.d.ts +3 -10
  283. package/dist/types/phases/scales/phase.d.ts +4 -4
  284. package/dist/types/phases/stage.d.ts +3 -3
  285. package/dist/types/phases/state.d.ts +1 -1
  286. package/dist/types/phases/statistics/phase.d.ts +8 -3
  287. package/dist/types/phases/styles/phase.d.ts +18 -5
  288. package/dist/types/phases/transforms/phase.d.ts +4 -2
  289. package/dist/types/plots/constants.d.ts +3 -17
  290. package/dist/types/plots/correlation/heatmap/props.d.ts +3 -2
  291. package/dist/types/plots/correlation/heatmap/state.d.ts +2 -2
  292. package/dist/types/plots/correlation/scatter/props.d.ts +3 -2
  293. package/dist/types/plots/correlation/scatter/state.d.ts +2 -2
  294. package/dist/types/plots/distribution/box/props.d.ts +28 -2
  295. package/dist/types/plots/distribution/box/state.d.ts +6 -17
  296. package/dist/types/plots/distribution/density/props.d.ts +2 -1
  297. package/dist/types/plots/distribution/density/state.d.ts +2 -2
  298. package/dist/types/plots/distribution/histogram/props.d.ts +16 -2
  299. package/dist/types/plots/distribution/histogram/state.d.ts +2 -2
  300. package/dist/types/plots/distribution/pyramid/props.d.ts +3 -2
  301. package/dist/types/plots/distribution/pyramid/state.d.ts +2 -2
  302. package/dist/types/plots/distribution/violin/props.d.ts +6 -2
  303. package/dist/types/plots/distribution/violin/state.d.ts +2 -2
  304. package/dist/types/plots/evolution/area/props.d.ts +3 -2
  305. package/dist/types/plots/evolution/area/state.d.ts +2 -2
  306. package/dist/types/plots/evolution/line/props.d.ts +3 -2
  307. package/dist/types/plots/evolution/line/state.d.ts +2 -2
  308. package/dist/types/plots/evolution/slope/state.d.ts +2 -2
  309. package/dist/types/plots/evolution/sparkline/state.d.ts +2 -2
  310. package/dist/types/plots/generic/props.d.ts +16 -0
  311. package/dist/types/plots/generic/props.js +1 -0
  312. package/dist/types/plots/generic/state.d.ts +4 -0
  313. package/dist/types/plots/generic/state.js +1 -0
  314. package/dist/types/plots/map/geo/state.d.ts +1 -1
  315. package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +18 -6
  316. package/dist/types/plots/part-of-a-whole/treemap/state.d.ts +2 -2
  317. package/dist/types/plots/props.d.ts +3 -0
  318. package/dist/types/plots/ranking/bar/props.d.ts +3 -2
  319. package/dist/types/plots/ranking/bar/state.d.ts +2 -2
  320. package/dist/types/plots/ranking/bullet/state.d.ts +2 -2
  321. package/dist/types/plots/ranking/cleveland/props.d.ts +3 -2
  322. package/dist/types/plots/ranking/cleveland/state.d.ts +2 -2
  323. package/dist/types/plots/ranking/dumbbell/props.d.ts +3 -2
  324. package/dist/types/plots/ranking/dumbbell/state.d.ts +2 -2
  325. package/dist/types/plots/ranking/forest/props.d.ts +5 -2
  326. package/dist/types/plots/ranking/forest/state.d.ts +2 -2
  327. package/dist/types/plots/ranking/lollipop/props.d.ts +3 -2
  328. package/dist/types/plots/ranking/lollipop/state.d.ts +2 -2
  329. package/docs/architecture.md +9 -9
  330. package/docs/markers.md +36 -6
  331. package/docs/plots/evolution/line.md +1 -1
  332. package/docs/plots/evolution/slope.md +1 -1
  333. package/docs/plots/part-of-a-whole/treemap.md +36 -2
  334. package/docs/plots/ranking/bar.md +1 -0
  335. package/docs/plots/ranking/cleveland.md +1 -1
  336. package/docs/state.md +33 -0
  337. package/docs/styles-and-segments.md +2 -15
  338. package/docs/theming.md +2 -1
  339. package/docs/tooltip-and-hover.md +81 -3
  340. package/docs/value-labels.md +159 -0
  341. package/examples/BarValues.svelte +1 -1
  342. package/examples/LineDates.svelte +1 -1
  343. package/examples/ResponsiveLine.svelte +3 -1
  344. package/examples/TreemapHover.svelte +25 -0
  345. package/examples/ValueLabels.svelte +1 -1
  346. package/llms-full.txt +9 -7
  347. package/llms.txt +3 -1
  348. package/package.json +3 -1
  349. package/dist/markers/utils/BoxLabel.d.ts +0 -58
  350. package/dist/markers/utils/BoxLabel.js +0 -175
  351. package/dist/markers/utils/MarkerLabel.svelte +0 -33
  352. package/dist/markers/utils/MarkerLabel.svelte.d.ts +0 -10
  353. /package/dist/layout/plot/{Plot.svelte → AbstractPlot.svelte} +0 -0
@@ -1,3 +1,6 @@
1
+ import type { RimLabelConfig } from '../labels/path';
2
+ import type { PointLabelConfig } from '../labels/point';
3
+ import type { CommonMarkerConfigWithLabel } from '../channels/commonMarkerConfigWithLabel';
1
4
  import type { DotStyle, PerRow } from '../../plots/styling';
2
5
  import type { CommonMarkerConfigWithColor } from '../channels/commonMarkerConfigWithColor';
3
6
  import type { CommonMarkerConfigWithRadius } from '../channels/commonMarkerConfigWithRadius';
@@ -7,4 +10,4 @@ import type { CommonMarkerConfigWithSymbol } from '../channels/commonMarkerConfi
7
10
  export type DotMarkerConfig = CommonMarkerConfigWithRowOffset<{
8
11
  type: 'dot';
9
12
  styles?: PerRow<DotStyle>;
10
- } & CommonMarkerConfigWithRadius & CommonMarkerConfigWithColor & CommonMarkerConfigWithSymbol>;
13
+ } & CommonMarkerConfigWithRadius & CommonMarkerConfigWithColor & CommonMarkerConfigWithSymbol & CommonMarkerConfigWithLabel<RimLabelConfig | PointLabelConfig>>;
@@ -1,16 +1,23 @@
1
+ import type { CoveringShape } from '../labels/point';
1
2
  import type { FontStyle, StrokeStyle, PerRow } from '../../plots/styling';
2
3
  import type { CommonMarkerConfig } from '../channels/commonMarkerConfig';
3
4
  import type { CommonMarkerConfigWithRowOffset } from '../channels/commonMarkerConfigWithRowOffset';
4
5
  import type { Margins } from '../../../layout/margins/Margins';
5
6
  import type { BandSlice } from '../../layout/hover';
6
- import type { LabelAnchor, TextAnchor } from '../../plots/constants';
7
+ import type { LabelAnchor, LineAnchor, TextAnchor } from '../../plots/constants';
7
8
  import type { NumberDisplay } from '../../layout/numbers';
8
9
  /**
9
- * Spreads labels that would overlap apart vertically, all reaching out to one
10
- * shared column, each routed back to its own point by an elbow connector.
11
- * Unset geometry falls back to the configuration's `text.declutter`.
10
+ * How labels that would overlap are laid out. `'lanes'` spreads them apart
11
+ * vertically, all reaching out to one shared column, each routed back to its
12
+ * own point by an elbow connector; `'around'` puts each one on a free spot
13
+ * around its point (its own side first, then on clockwise),
14
+ * clear of the other labels and points, and leaves out one with no room.
12
15
  */
16
+ export type TextDeclutterMode = 'lanes' | 'around';
17
+ /** {@link TextDeclutterMode}'s options. Unset geometry falls back to the configuration's `text.declutter`. */
13
18
  export type TextDeclutterConfig = {
19
+ /** Defaults to `'lanes'`. */
20
+ mode?: TextDeclutterMode;
14
21
  /** Shortest lane's distance (px) from the point before a connector bends. */
15
22
  elbowGap?: number;
16
23
  /** Extra distance (px) each further lane sits out from the last. */
@@ -68,8 +75,10 @@ export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
68
75
  styles?: PerRow<TextRowStyle> & Omit<FontStyle, TextRowStyleKey>;
69
76
  /** Which side of its point the text sits on: a value, or a function of the row. Wins over `styles.textAnchor`. */
70
77
  textAnchor?: TextAnchor | ((d: any) => TextAnchor);
71
- /** Spreads overlapping labels apart - see {@link TextDeclutterConfig}. `true` takes every default. */
72
- declutter?: boolean | TextDeclutterConfig;
78
+ /** Which side of its point the text sits on vertically: a value, or a function of the row. Wins over `styles.lineAnchor`. */
79
+ lineAnchor?: LineAnchor | ((d: any) => LineAnchor);
80
+ /** Lays out overlapping labels - see {@link TextDeclutterConfig}. `true` is `'lanes'` with every default. */
81
+ declutter?: boolean | TextDeclutterMode | TextDeclutterConfig;
73
82
  /** Writes each label to fit its box - see {@link TextFitConfig}. `true` takes every default. */
74
83
  fit?: boolean | TextFitConfig;
75
84
  /**
@@ -80,6 +89,16 @@ export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
80
89
  edgeAware?: boolean;
81
90
  /** The slice of its category band each label sits in (a grouped bar's series); it is drawn off the band's middle, whatever the band's width. */
82
91
  bandSlice?: BandSlice;
92
+ /**
93
+ * The shape each row's point sits in: a label is left out where the shape of a row drawn after its own covers it,
94
+ * as a dot drawn over another hides that one's label.
95
+ */
96
+ covers?: (d: any, scales: any) => CoveringShape | undefined;
97
+ /** How far each row's point sits off its `x`/`y`, in pixels: labels, connectors and lanes start there. */
98
+ origin?: (d: any, scales: any) => {
99
+ dx: number;
100
+ dy: number;
101
+ } | undefined;
83
102
  /** Where, in the plot's frame, a label sits on an axis it sets no position for: `{ type: 'text', x: 5, frameAnchor: 'top' }` is at the frame's top edge. */
84
103
  frameAnchor?: LabelAnchor;
85
104
  /** Grows the plot's margins, on every side the author left open, so the labels fit. */
@@ -87,21 +106,6 @@ export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
87
106
  /** Reports how far the rendered labels reach past the plot's content box, in pixels, on each side. */
88
107
  onoverflow?: (overflow: Margins) => void;
89
108
  } & NumberDisplay & CommonMarkerConfig>;
90
- /** A `text` marker as a shape's `label`: all of it but what the shape sets - its `type`, its rows and the label's position. */
91
- export type TextLabelConfig = Omit<TextMarkerConfig, 'type' | 'data' | 'x' | 'y' | 'frameAnchor'> & {
92
- /**
93
- * Where in its shape the label sits: its `'middle'` (the default), against one of its edges (`'top'`, `'bottom'`,
94
- * `'left'`, `'right'`) or in one of its corners (`'top-left'`...). The label's `dx` and `dy` move it from there.
95
- */
96
- anchor?: LabelAnchor;
97
- /**
98
- * Puts a label anchored to an edge beyond that edge, outside the shape, instead of inside it. A label out there is not
99
- * fitted to the shape, and with `fitMargins` the plot's margins grow to hold it.
100
- */
101
- outside?: boolean;
102
- /** Pixels between the label and the edge it is anchored to. Defaults to the configuration's `text.label.gap`, `4`. */
103
- gap?: number;
104
- };
105
109
  export type { LabelAnchor };
106
110
  /** Where one decluttered label goes - see `Declutter.buildLanes`. */
107
111
  export type LabelLane = {
@@ -28,6 +28,10 @@ export type CommonMarkerConfig = CommonMarkerEvents & {
28
28
  clip?: boolean;
29
29
  /** Names the marker on its plot's automatic legend - see {@link MarkLegend}. `false` keeps a decorative marker out of it, and out of how the plot's series look there. */
30
30
  legend?: MarkLegend | false;
31
- /** Makes the marker a hit area of the plot's hover: the pointer entering any of its shapes hovers its `data` rows. */
32
- hover?: boolean;
31
+ /**
32
+ * Links the marker to the plot's hover. `'trigger'` makes it a hit area: the pointer entering any of its shapes
33
+ * hovers its `data` rows. `'style'` has its shapes take the hover marker's `active` and `others` styles.
34
+ * `true` does both.
35
+ */
36
+ hover?: boolean | 'trigger' | 'style';
33
37
  };
@@ -1,10 +1,6 @@
1
- import type { TextLabelConfig } from '../basic/text';
2
- /** The markers that draw a shape per row, which can write a label in each one. */
3
- export type CommonMarkerConfigWithLabel = {
4
- /**
5
- * A label for each shape, written by a `text` marker: every option of one but `type`, `data`, `x` and `y`,
6
- * which the shape sets. The label is centred on its shape, and fitted to it unless `fit` is `false` - see
7
- * {@link TextFitConfig}. It never takes the pointer from the shape under it.
8
- */
9
- label?: TextLabelConfig;
1
+ import type { MarkerLabelConfig, MarkerLabels } from '../labels/common';
2
+ /** `TLabel` names the layouts the marker kind supports. */
3
+ export type CommonMarkerConfigWithLabel<TLabel extends MarkerLabelConfig> = {
4
+ /** One label per shape, or a list of them. `layout` defaults to the marker kind's. */
5
+ label?: MarkerLabels<TLabel>;
10
6
  };
@@ -0,0 +1,5 @@
1
+ /** A marker drawn by svelteplot's `*X` or `*Y` pair. */
2
+ export type CommonMarkerConfigWithOrientation = {
3
+ /** Defaults to the plot's way, else to its own channels' when the plot has none. */
4
+ isHorizontal?: boolean;
5
+ };
@@ -22,6 +22,7 @@ export * from './axis/trail';
22
22
  export * from './axis/waffle';
23
23
  export * from './axis/violin';
24
24
  export * from './axis/rule';
25
+ export * from './axis/band';
25
26
  export * from './axis/hover';
26
27
  export * from './axis/component';
27
28
  export * from './axis/axisBasedMarkersConfig';
@@ -22,6 +22,7 @@ export * from './axis/trail';
22
22
  export * from './axis/waffle';
23
23
  export * from './axis/violin';
24
24
  export * from './axis/rule';
25
+ export * from './axis/band';
25
26
  export * from './axis/hover';
26
27
  export * from './axis/component';
27
28
  export * from './axis/axisBasedMarkersConfig';
@@ -0,0 +1,57 @@
1
+ import type { LabelBaseConfig } from './common';
2
+ import type { TextMarkerConfig } from '../basic/text';
3
+ import type { LabelAnchor } from '../../plots/constants';
4
+ /** A label written in the box of each shape, fitted to it unless `fit` is `false`. */
5
+ export type BoxLabelConfig = LabelBaseConfig & {
6
+ layout?: 'box';
7
+ anchor?: LabelAnchor;
8
+ /** Defaults to the configuration's `text.label.gap`. */
9
+ gap?: number;
10
+ };
11
+ export type BoxShape = 'edges' | 'cell' | 'band';
12
+ /** A field, a symbol, a function of the row or a literal. */
13
+ export type BoxEdge = unknown;
14
+ export type BoxChannels = {
15
+ x1: BoxEdge;
16
+ x2: BoxEdge;
17
+ y1: BoxEdge;
18
+ y2: BoxEdge;
19
+ };
20
+ export type BoxScales = Record<string, {
21
+ type?: string;
22
+ fn: any;
23
+ } | undefined>;
24
+ export type BoxSizer = (row: unknown, scales: BoxScales) => {
25
+ width: number;
26
+ height: number;
27
+ } | undefined;
28
+ export type BoxGeometryOf = {
29
+ x: unknown;
30
+ y: unknown;
31
+ box: BoxChannels | BoxSizer;
32
+ size?: BoxSizer;
33
+ /** For a shape that runs along a value: the axis it runs on, and where each row starts (its base) and ends (its tip). */
34
+ ends?: {
35
+ axis: 'x' | 'y';
36
+ from: (row: unknown) => unknown;
37
+ to: (row: unknown) => unknown;
38
+ };
39
+ };
40
+ export type BoxLabelMarker = {
41
+ marker: TextMarkerConfig;
42
+ box: BoxChannels | BoxSizer;
43
+ };
44
+ export type BoxedMarker = {
45
+ type?: string;
46
+ data?: unknown[];
47
+ x?: BoxEdge;
48
+ y?: BoxEdge;
49
+ x1?: BoxEdge;
50
+ x2?: BoxEdge;
51
+ y1?: BoxEdge;
52
+ y2?: BoxEdge;
53
+ isHorizontal?: boolean;
54
+ role?: string;
55
+ thickness?: number;
56
+ styles?: object;
57
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { TextMarkerConfig } from '../basic/text';
2
+ import type { BoxLabelConfig, BoxShape } from './box';
3
+ import type { PointLabelConfig, PointShape } from './point';
4
+ import type { PathLabelConfig, PathShape } from './path';
5
+ export type LabelLayout = 'box' | 'path' | 'point';
6
+ export type LabelBaseConfig = Omit<TextMarkerConfig, 'type' | 'data' | 'x' | 'y' | 'frameAnchor' | 'origin'>;
7
+ export type MarkerLabelConfig = BoxLabelConfig | PathLabelConfig<string, string> | PointLabelConfig;
8
+ export type MarkerLabels<TLabel extends MarkerLabelConfig = MarkerLabelConfig> = TLabel | TLabel[];
9
+ /** The layout a label takes by default, and the geometry the kind gives each layout it supports. */
10
+ export type MarkerLabelTraits = {
11
+ default: LabelLayout;
12
+ box?: BoxShape;
13
+ path?: PathShape;
14
+ point?: PointShape;
15
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ import type { LabelAnchor } from '../../plots/constants';
2
+ import type { LabelBaseConfig } from './common';
3
+ /** An edge of a shape as it is drawn on the page. */
4
+ export type PageEdge = 'top' | 'bottom' | 'left' | 'right';
5
+ /** An edge of a shape that runs along a value: the end away from zero, `'tip'`, or the one at zero, `'base'`. */
6
+ export type ValueEdge = 'tip' | 'base';
7
+ /** Where a label sits off a closed shape's edge: beyond it, against it within the shape, or centred on it. */
8
+ export type ShapeSide = 'outside' | 'inside' | 'on';
9
+ /** Where a label sits off an open stroke, as its text reads: above it, below it, or centred on it. */
10
+ export type StrokeSide = 'above' | 'below' | 'on';
11
+ /** A label written along an edge of its shape, read per row: a `'tip'` follows the sign of the row's value. */
12
+ export type PathLabelConfig<TEdge extends string = PageEdge | ValueEdge, TSide extends string = ShapeSide> = LabelBaseConfig & {
13
+ layout: 'path';
14
+ /** `'tip'` on a shape that runs along a value, else `'top'`. */
15
+ edge?: TEdge;
16
+ /** Defaults to `'outside'` on a shape, `'above'` on a stroke. */
17
+ side?: TSide;
18
+ /**
19
+ * Where along the edge, from its left or top end. On a line or an area, `'max'` and `'min'` are the point of each
20
+ * one with its highest or lowest value - its peak, its trough. Defaults to `'middle'`.
21
+ */
22
+ offset?: 'start' | 'middle' | 'end' | 'max' | 'min' | `${number}%`;
23
+ /** Defaults to the configuration's `text.label.gap`. */
24
+ gap?: number;
25
+ };
26
+ /** A label written along each line a marker draws, curving with it. */
27
+ export type StrokeLabelConfig = Omit<PathLabelConfig<never, StrokeSide>, 'edge'>;
28
+ /** A label written along the top (`y2`) or bottom (`y1`) edge of each area, curving with it. */
29
+ export type AreaEdgeLabelConfig = PathLabelConfig<'top' | 'bottom', StrokeSide>;
30
+ /** A label written along the rim of each dot, from its left over its top. */
31
+ export type RimLabelConfig = Omit<PathLabelConfig<never, ShapeSide>, 'edge'>;
32
+ /**
33
+ * Where a kind writes `'path'` labels: `'box'` along the edges of each row's box, `'stroke'` along each line it
34
+ * draws, `'area'` along the top or bottom edge of each area, `'rim'` around each dot.
35
+ */
36
+ export type PathShape = 'box' | 'stroke' | 'area' | 'rim';
37
+ /** Where a plot's value label goes on its shape: in its box at an `anchor`, or along one of its edges. */
38
+ export type ShapePlacement = {
39
+ anchor: LabelAnchor;
40
+ } | Required<Pick<PathLabelConfig, 'layout' | 'edge' | 'side'>>;
41
+ /** One label along a curve, in pixels: the path its text follows and where on it the text sits. */
42
+ export type CurvedLabel = {
43
+ d: string;
44
+ text: string;
45
+ /** A row it labels: the row of a dot, the first of a line. */
46
+ row: unknown;
47
+ startOffset: string;
48
+ textAnchor: 'start' | 'middle' | 'end';
49
+ dy: number;
50
+ baseline: 'auto' | 'hanging' | 'central';
51
+ fill?: string;
52
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,40 @@
1
+ import type { LabelBaseConfig } from './common';
2
+ import type { ValueSelect } from '../../layout/styles';
3
+ import type { LabelAnchor } from '../../plots/constants';
4
+ import type { BoxScales, BoxSizer } from './box';
5
+ /** A label written beside a point of its shape, spread apart from the others with `declutter`. */
6
+ export type PointLabelConfig = LabelBaseConfig & {
7
+ layout?: 'point';
8
+ /** The rows labelled, of each `grouping` of the marker. Every row by default. */
9
+ select?: ValueSelect | ValueSelect[] | ((row: any) => boolean);
10
+ /** On a shape with a box (a bar, a cell): the point of its box the label starts at, `'middle'` by default. */
11
+ anchor?: LabelAnchor;
12
+ /** Which side of its point the text is written on, as it reads: after it (to its right), before it, above, below or on it. */
13
+ side?: PointSide;
14
+ /** The gap from its point. Defaults to the configuration's `text.label.gap` on a box, else 6px across and 8px up or down. */
15
+ gap?: number;
16
+ };
17
+ export type PointSide = 'after' | 'before' | 'above' | 'below' | 'on';
18
+ /**
19
+ * `'row'` labels each row at its `x`/`y`; `'top'` at its `x`/`y2` (a stacked area); `'box'` at a point of its box;
20
+ * `'dot'` at its center, in a round shape of its radius.
21
+ */
22
+ export type PointShape = 'row' | 'top' | 'box' | 'dot';
23
+ /** Where a marker's rows are labelled; `size` is the shape around each point, when it has one, `round` a circle in it. */
24
+ export type PointGeometryOf = {
25
+ x: unknown;
26
+ y: unknown;
27
+ size?: BoxSizer;
28
+ round?: boolean;
29
+ /** How far each row's point sits off its `x`/`y`, in pixels: a series' own slot of its category's band. */
30
+ shift?: (row: unknown, scales: BoxScales) => {
31
+ dx: number;
32
+ dy: number;
33
+ } | undefined;
34
+ };
35
+ /** The shape a row's point sits in, in pixels around it: a box, or the circle in it. */
36
+ export type CoveringShape = {
37
+ width: number;
38
+ height: number;
39
+ round?: boolean;
40
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,8 @@
1
+ import type { ChannelName } from '../layout/mapping';
1
2
  import type { LegendMark } from '../layout/legend';
3
+ import type { MarkerLabelTraits } from './labels/common';
4
+ /** A plot channel a marker can take from its plot; `x`/`y` are each taken only by a marker setting no position on that axis. */
5
+ export type InheritedChannel = Exclude<ChannelName, 'value'>;
2
6
  /** What the rest of the system needs to know about a marker kind, declared once per kind in `MarkerKinds`. */
3
7
  export type MarkerTraits = {
4
8
  /**
@@ -19,4 +23,10 @@ export type MarkerTraits = {
19
23
  * dot, an area, a bar... A marker without one shows as a plain swatch.
20
24
  */
21
25
  legendSymbol?: LegendMark;
26
+ /** The plot's channels the marker takes in place of those it leaves unset, with the plot's scales for those that have one. */
27
+ inherits?: InheritedChannel[];
28
+ /** Whether it runs one way or the other (svelteplot's `*X`/`*Y` pair): the plot's way, else its own channels'. */
29
+ oriented?: boolean;
30
+ /** The labels the marker can write over its shapes; none without it. */
31
+ labels?: MarkerLabelTraits;
22
32
  };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * What a plot kind works out for each of its processed rows beyond the shared context (its series, `x`, `y` and
3
+ * value): a tile's share, a bin's edges, a box's quartiles. Given the state once, it returns a function of a row,
4
+ * so whatever the rows share (a total, a box's summary) is worked out once. What it returns is laid over the
5
+ * shared context, so it can also replace the `value` a row shows.
6
+ */
7
+ export type ContextStageOptions<TState, TEnv = unknown> = (state: TState, env: TEnv) => (row: never) => object | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -15,7 +15,7 @@ export type SegmentsStageOptions = {
15
15
  * which channels the author set, what each axis is, which way the plot runs,
16
16
  * whether `color` groups - the stage reads off the data itself.
17
17
  */
18
- export type DataStageOptions<TState, TCtx> = {
18
+ export type DataStageOptions<TState, TEnv> = {
19
19
  /** How many axes the kind lays out as categories: 0 (line), 1 (bar) or 2 (heatmap). Defaults to 0. */
20
20
  discreteAxes?: DiscreteAxesCount;
21
21
  /** How the kind's own mark splits into visual segments. */
@@ -30,5 +30,5 @@ export type DataStageOptions<TState, TCtx> = {
30
30
  */
31
31
  nested?: boolean;
32
32
  /** The plot's own extra "data" output, once the shared one is in place. */
33
- extend?: (state: TState, ctx: TCtx) => TState;
33
+ extend?: (state: TState, env: TEnv) => TState;
34
34
  };
@@ -1,5 +1,6 @@
1
1
  import type { HoverDisplayPoint, HoverStrategy } from '../../layout/hover';
2
2
  import type { HoverConfig, PointMatchingStrategy } from '../../plots/props';
3
+ import type { HoverLook } from '../../markers/common';
3
4
  /** Where a row sits for hover matching and the hover controller: its `x` and `y`. */
4
5
  export type HoverPosition = {
5
6
  x: (row: never) => unknown;
@@ -11,7 +12,7 @@ export type HoverPosition = {
11
12
  * row or a cell outside the legend's range can't), the rows themselves and
12
13
  * their series' colors - the stage reads off the plot's own state.
13
14
  */
14
- export type HoverStageOptions<TState, TCtx = unknown> = {
15
+ export type HoverStageOptions<TState, TEnv = unknown> = {
15
16
  /**
16
17
  * The hover strategy, when the plot's axes don't say it: along the axis
17
18
  * that isn't measured, or `'punctual'` with both axes holding categories.
@@ -27,16 +28,18 @@ export type HoverStageOptions<TState, TCtx = unknown> = {
27
28
  position?: (state: TState) => HoverPosition;
28
29
  /** The short label drawn next to a hovered row. Defaults to its value. */
29
30
  label?: (state: TState) => (row: never) => string;
30
- /** What a hovered row reads as, e.g. with derived fields added. Defaults to the processed row. */
31
- row?: (state: TState) => (row: never) => unknown;
32
31
  /** Fields a candidate carries besides its place, label and series color (a grouped bar's `dx`/`dy`). */
33
- decorate?: (state: TState, ctx: TCtx) => (row: never) => Partial<Omit<HoverDisplayPoint, 'x' | 'y' | 'label'>>;
32
+ decorate?: (state: TState, env: TEnv) => (row: never) => Partial<Omit<HoverDisplayPoint, 'x' | 'y' | 'label'>>;
34
33
  /** Invisible markers that drive the plot's hover themselves (a bar's band), given its resolved hover config. */
35
- hitAreas?: (state: TState, hover: HoverConfig<any>, ctx: TCtx) => {
34
+ hitAreas?: (state: TState, hover: HoverConfig<any>, env: TEnv) => {
36
35
  type: string;
37
36
  }[];
38
- /** What the kind knows of a row beyond its series, which an author's own tooltip `format` gets in its third argument. */
39
- context?: (state: TState) => (row: never) => object;
40
37
  /** How a pointer event resolves to a candidate. Defaults to the nearest one. */
41
38
  pointMatching?: PointMatchingStrategy;
39
+ /**
40
+ * The kind's own hover, which an author's `hover` marker is laid over - one look, or one for each strategy, as
41
+ * the strategy in force can change while the plot is shown (a composer's, a scrolly step's). Defaults to a
42
+ * crosshair along the axes the strategy matches along, and a dot and a label on each point.
43
+ */
44
+ marker?: (state: TState, env: TEnv) => HoverLook | ((strategy: HoverStrategy) => HoverLook);
42
45
  };
@@ -1,10 +1,11 @@
1
1
  export type { PlotPhase, PhaseStage } from './stage';
2
- export type { AxisPlotState, AxisPlotCtx } from './state';
2
+ export type { AxisPlotState, AxisPlotEnv } from './state';
3
3
  export type { AxisPlotKind, AxisPlotDefaults, SharedScalesOptions } from './kind';
4
4
  export type { DataRunState } from './pipeline';
5
5
  export type { DataStageOptions } from './data/phase';
6
6
  export type { MappingStageOptions } from './mapping/phase';
7
7
  export type { ProcessedRow, ProcessedChannel, ProcessedChannelName, ProcessedData, TransformsStageState, TransformsStageOptions } from './transforms/phase';
8
+ export type { ContextStageOptions } from './context/phase';
8
9
  export type { StatisticsStageState, StatisticsStageOptions } from './statistics/phase';
9
10
  export type { SharedAxisValues } from './sharedScales/phase';
10
11
  export type { AxisFit, ScalesStageOptions } from './scales/phase';
@@ -4,6 +4,7 @@ import type { TransformsStageOptions, TransformsStageState } from './transforms/
4
4
  import type { StatisticsStageOptions, StatisticsStageState } from './statistics/phase';
5
5
  import type { ScalesStageOptions } from './scales/phase';
6
6
  import type { HoverStageOptions } from './hover/phase';
7
+ import type { ContextStageOptions } from './context/phase';
7
8
  import type { StylesStageOptions } from './styles/phase';
8
9
  import type { MarkersStageOptions } from './markers/phase';
9
10
  import type { AxisChannelName, ChannelName } from '../layout/mapping';
@@ -12,15 +13,17 @@ import type { AxisRole } from './data/axes';
12
13
  * What one axis-based plot kind adds to the shared pipeline: options for each
13
14
  * shared stage - its own marks and value labels among them.
14
15
  */
15
- export type AxisPlotKind<TState extends TransformsStageState & StatisticsStageState, TCtx> = {
16
- data?: DataStageOptions<TState, TCtx>;
17
- mapping?: MappingStageOptions<TState, TCtx>;
18
- transforms?: TransformsStageOptions<TState, TCtx>;
16
+ export type AxisPlotKind<TState extends TransformsStageState & StatisticsStageState, TEnv> = {
17
+ data?: DataStageOptions<TState, TEnv>;
18
+ mapping?: MappingStageOptions<TState, TEnv>;
19
+ transforms?: TransformsStageOptions<TState, TEnv>;
20
+ /** What the kind works out for each of its rows, for everything that writes about a row to read - see `RowContext`. */
21
+ context?: ContextStageOptions<TState, TEnv>;
19
22
  statistics?: StatisticsStageOptions<TState>;
20
- scales?: ScalesStageOptions<TState, TCtx>;
23
+ scales?: ScalesStageOptions<TState, TEnv>;
21
24
  styles?: StylesStageOptions<TState>;
22
- markers: MarkersStageOptions<TState, TCtx>;
23
- hover?: HoverStageOptions<TState, TCtx>;
25
+ markers: MarkersStageOptions<TState, TEnv>;
26
+ hover?: HoverStageOptions<TState, TEnv>;
24
27
  /**
25
28
  * How the slices of a plot (facet panels, timeline steps) share their
26
29
  * domains. Every axis kind shares them - bands from its axes, zero from its
@@ -42,7 +45,7 @@ export type SharedScalesOptions = {
42
45
  * runs with: the options for each pipeline phase (its hover among them),
43
46
  * plus how its plot tweens a timeline unless the author says otherwise.
44
47
  */
45
- export type AxisPlotDefaults<TState extends TransformsStageState & StatisticsStageState, TCtx> = AxisPlotKind<TState, TCtx> & {
48
+ export type AxisPlotDefaults<TState extends TransformsStageState & StatisticsStageState, TEnv> = AxisPlotKind<TState, TEnv> & {
46
49
  timeline?: {
47
50
  /** Default for `timeline.filterMode`. */
48
51
  filterMode?: 'exact' | 'upTo';
@@ -1,5 +1,5 @@
1
1
  /** What differs between plots in the shared "mapping" stage. */
2
- export type MappingStageOptions<TState, TCtx> = {
2
+ export type MappingStageOptions<TState, TEnv> = {
3
3
  /** The plot's own extra "mapping" output, once every channel is resolved. */
4
- extend?: (state: TState, ctx: TCtx) => TState;
4
+ extend?: (state: TState, env: TEnv) => TState;
5
5
  };
@@ -1,13 +1,6 @@
1
- import type { ValueLabels } from '../../../layout/styles/ValueLabels';
2
- import type { AxisBasedMarkersConfig, TextMarkerConfig } from '../../markers/common';
1
+ import type { AxisBasedMarkersConfig } from '../../markers/common';
3
2
  /** What a plot kind adds to the shared "markers" stage. */
4
- export type MarkersStageOptions<TState, TCtx> = {
3
+ export type MarkersStageOptions<TState, TEnv> = {
5
4
  /** The plot's own marks - its bars, lines, dots... - drawn under every other marker. */
6
- marks: (state: TState, ctx: TCtx) => AxisBasedMarkersConfig[];
7
- /**
8
- * Its value labels, once they show: `text` markers drawn over everything.
9
- * The stage adds what every label shares - see {@link ValueLabels.hooks}.
10
- * Without it, the plot draws none.
11
- */
12
- valueLabels?: (labels: ValueLabels, state: TState, ctx: TCtx) => TextMarkerConfig[];
5
+ marks: (state: TState, env: TEnv) => AxisBasedMarkersConfig[];
13
6
  };
@@ -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
  };
@@ -91,7 +91,7 @@ export type AxisPlotState<TData extends Record<string, unknown>, TStyle extends
91
91
  hoverRows?: unknown[];
92
92
  };
93
93
  /** The environment every axis-based plot's phases read from, alongside the growing state. */
94
- export type AxisPlotCtx = {
94
+ export type AxisPlotEnv = {
95
95
  cfg: PlotStylesConfig;
96
96
  /** The legend's toggles and the figure's hover, read for one plot: which series show and how each dims. */
97
97
  interaction?: PlotInteraction;
@@ -1,6 +1,6 @@
1
1
  import type { ScopedMarkerGroup } from '../../layout/geometry';
2
2
  import type { Accessor, Series } from '../../plots/data/common';
3
- import type { AxisValue } from '../../layout/mapping';
3
+ import type { AxisChannelName, AxisValue } from '../../layout/mapping';
4
4
  import type { StatisticConfig } from '../../layout/statistics';
5
5
  import type { AxisBasedMarkersConfig } from '../../markers/common';
6
6
  import type { ProcessedData, TransformsStageState } from '../transforms/phase';
@@ -16,10 +16,17 @@ export type StatisticsStageState = Pick<FacetStageState, 'panels'> & {
16
16
  /** The key the "data" phase split the rows into series by, which an author marker inherits. */
17
17
  seriesGrouping?: Accessor<any, unknown>;
18
18
  color?: Accessor<any, unknown>;
19
+ opacity?: Accessor<any, unknown>;
20
+ symbol?: Accessor<any, unknown>;
21
+ r?: number | Accessor<any, number>;
22
+ length?: number | Accessor<any, number>;
19
23
  statistics?: StatisticConfig[];
20
24
  authorMarkers?: AxisBasedMarkersConfig[];
21
25
  resolvedSeries?: Series<any>[];
22
26
  axes?: PlotAxes;
27
+ scales?: Partial<Record<AxisChannelName, {
28
+ type?: string;
29
+ }>>;
23
30
  flat?: any[];
24
31
  colorForSeries?: (name: string) => string;
25
32
  /** Each series' segments, which a `scope: 'segment'` author marker splits by. */
@@ -39,6 +46,4 @@ export type StatisticsStageOptions<TState extends StatisticsStageState> = {
39
46
  * default; off for a plot whose `color` is a value channel, not a group.
40
47
  */
41
48
  inheritGrouping?: boolean;
42
- /** Whether a line/area/dot author marker with no `x`/`y` takes the plot's own. */
43
- inheritPositions?: boolean;
44
49
  };