@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,4 @@
1
+ import { ValueLabels } from '../../../layout/styles/ValueLabels';
1
2
  import { getConfiguration } from '../../../configuration/config.svelte';
2
3
  import { buildLineMarkers } from '../line/markers';
3
4
  import { resolveAccessor } from '../../../utils/accessors';
@@ -6,10 +7,10 @@ import { isGapValue } from '../../utils/gaps';
6
7
  * SparklinePlot's "markers" phase: each series' line, thin, and a dot on its
7
8
  * last point with a value.
8
9
  */
9
- export function buildMarks(state, ctx) {
10
+ export function buildMarks(state, env) {
10
11
  const { sparkline } = getConfiguration();
11
12
  const groups = state.processedGroups ?? [];
12
- const disabledDotsFor = (name) => ctx.interaction?.dotsFor(name);
13
+ const disabledDotsFor = (name) => env.interaction?.dotsFor(name);
13
14
  const lines = buildLineMarkers({
14
15
  groupedSeries: groups.map((group) => ({
15
16
  ...group,
@@ -22,7 +23,7 @@ export function buildMarks(state, ctx) {
22
23
  }))
23
24
  })),
24
25
  colorFor: state.colorForSeries,
25
- disabledStrokeFor: (name) => ctx.interaction?.strokeFor(name),
26
+ disabledStrokeFor: (name) => env.interaction?.strokeFor(name),
26
27
  disabledDotsFor,
27
28
  curve: state.styles?.curve
28
29
  });
@@ -52,5 +53,6 @@ export function buildMarks(state, ctx) {
52
53
  }
53
54
  ];
54
55
  });
55
- return [...lines, ...dots];
56
+ const labels = state.valueLabels?.show ? state.valueLabels.forSeries(state, env) : undefined;
57
+ return [...ValueLabels.onMarkers(lines, 'line', labels), ...dots];
56
58
  }
@@ -0,0 +1,42 @@
1
+ <script lang="ts" generics="TData extends Record<string, unknown>">
2
+ import AbstractPlot from '../../layout/plot/AbstractPlot.svelte';
3
+ import { buildGenericDefaults } from './defaults';
4
+ import type { GenericPlotProps, GenericPlotCoreProps } from '../../types/plots/generic/props';
5
+
6
+ /**
7
+ * A plot of no kind: no shapes or defaults of its own, only its `markers`. `data` and the channels
8
+ * are optional; markers without their own take them, and its `segments`, `transforms`, `styles`,
9
+ * chrome, `timeline` and `facet` work as on any plot.
10
+ * `margins` is bindable: it reports the margin the plot settled on.
11
+ */
12
+ let {
13
+ title,
14
+ subtitle,
15
+ caption,
16
+ header,
17
+ footer,
18
+ legend,
19
+ order,
20
+ timeline,
21
+ facet,
22
+ tooltip,
23
+ margins = $bindable(),
24
+ ...core
25
+ }: GenericPlotProps<TData> = $props();
26
+ </script>
27
+
28
+ <AbstractPlot
29
+ core={core as GenericPlotCoreProps<TData>}
30
+ defaults={buildGenericDefaults}
31
+ bind:margins
32
+ {title}
33
+ {subtitle}
34
+ {caption}
35
+ {header}
36
+ {footer}
37
+ {legend}
38
+ {order}
39
+ {timeline}
40
+ {facet}
41
+ {tooltip}
42
+ />
@@ -0,0 +1,25 @@
1
+ import type { GenericPlotProps } from '../../types/plots/generic/props';
2
+ declare function $$render<TData extends Record<string, unknown>>(): {
3
+ props: GenericPlotProps<TData>;
4
+ exports: {};
5
+ bindings: "margins";
6
+ slots: {};
7
+ events: {};
8
+ };
9
+ declare class __sveltets_Render<TData extends Record<string, unknown>> {
10
+ props(): ReturnType<typeof $$render<TData>>['props'];
11
+ events(): ReturnType<typeof $$render<TData>>['events'];
12
+ slots(): ReturnType<typeof $$render<TData>>['slots'];
13
+ bindings(): "margins";
14
+ exports(): {};
15
+ }
16
+ interface $$IsomorphicComponent {
17
+ new <TData extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TData>['props']>, ReturnType<__sveltets_Render<TData>['events']>, ReturnType<__sveltets_Render<TData>['slots']>> & {
18
+ $$bindings?: ReturnType<__sveltets_Render<TData>['bindings']>;
19
+ } & ReturnType<__sveltets_Render<TData>['exports']>;
20
+ <TData extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<TData>['props']> & {}): ReturnType<__sveltets_Render<TData>['exports']>;
21
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
22
+ }
23
+ declare const Plot: $$IsomorphicComponent;
24
+ type Plot<TData extends Record<string, unknown>> = InstanceType<typeof Plot<TData>>;
25
+ export default Plot;
@@ -0,0 +1,4 @@
1
+ import type { AxisPlotDefaults } from '../../types/phases';
2
+ import type { GenericPlotState, GenericPlotEnv } from '../../types/plots/generic/state';
3
+ /** The plot with no kind: it draws only its `markers`. */
4
+ export declare function buildGenericDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<GenericPlotState<TData>, GenericPlotEnv>;
@@ -0,0 +1,7 @@
1
+ /** The plot with no kind: it draws only its `markers`. */
2
+ export function buildGenericDefaults() {
3
+ return {
4
+ data: { segments: { color: (style) => style?.fill } },
5
+ markers: { marks: () => [] }
6
+ };
7
+ }
@@ -7,7 +7,7 @@
7
7
  import BasePlotLayout from '../../../layout/base/BasePlotLayout.svelte';
8
8
  import type { GeoPlotCoreProps } from '../../../types/plots/map/geo/props';
9
9
  import type { CoordinatesConfig } from '../../../types/layout/coordinates';
10
- import type { GeoPlotState, GeoPlotCtx } from '../../../types/plots/map/geo/state';
10
+ import type { GeoPlotState, GeoPlotEnv } from '../../../types/plots/map/geo/state';
11
11
 
12
12
  /**
13
13
  * A map from GeoJSON or TopoJSON. `segments` styles features by id,
@@ -76,7 +76,7 @@
76
76
  y: { domain: [90, -90] }
77
77
  });
78
78
 
79
- const ctx = $derived<GeoPlotCtx<TProps>>({
79
+ const env = $derived<GeoPlotEnv<TProps>>({
80
80
  cfg,
81
81
  range,
82
82
  fill: styles.fill,
@@ -103,7 +103,7 @@
103
103
  height,
104
104
  margins
105
105
  },
106
- ctx
106
+ env
107
107
  ) as GeoPlotState<TProps>
108
108
  );
109
109
 
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" generics="TProps extends Record<string, unknown>">
2
2
  import Core from './Core.svelte';
3
- import Plot from '../../../layout/plot/Plot.svelte';
3
+ import AbstractPlot from '../../../layout/plot/AbstractPlot.svelte';
4
4
  import { merge } from '../../../utils/merge';
5
5
  import { buildGeoDefaults } from './defaults';
6
6
  import { buildGeoSlicing } from './slices';
@@ -87,7 +87,7 @@
87
87
  }
88
88
  </script>
89
89
 
90
- <Plot
90
+ <AbstractPlot
91
91
  {Core}
92
92
  core={core as GeoPlotCoreProps<TProps>}
93
93
  defaults={buildGeoDefaults}
@@ -1,4 +1,3 @@
1
- import Plot from '../../../layout/plot/Plot.svelte';
2
1
  import type { GeoPlotProps } from '../../../types/plots/map/geo/props';
3
2
  declare function $$render<TProps extends Record<string, unknown>>(): {
4
3
  props: GeoPlotProps<TProps>;
@@ -1,4 +1,4 @@
1
- import type { GeoPlotState, GeoPlotCtx } from '../../../types/plots/map/geo/state';
1
+ import type { GeoPlotState, GeoPlotEnv } from '../../../types/plots/map/geo/state';
2
2
  import { Pipeline } from '../../../phases/Pipeline';
3
3
  /** GeoPlot's own pipeline (data, scales, markers, tooltip, hover), run over the state its core seeds, hovering one feature at a time. */
4
- export declare function buildGeoDefaults<TProps extends Record<string, unknown>>(): Pipeline<GeoPlotState<TProps>, GeoPlotCtx<TProps>>;
4
+ export declare function buildGeoDefaults<TProps extends Record<string, unknown>>(): Pipeline<GeoPlotState<TProps>, GeoPlotEnv<TProps>>;
@@ -1,6 +1,6 @@
1
1
  import type { GeoPlotState } from '../../../../types/plots/map/geo/state';
2
2
  /**
3
3
  * GeoPlot's "data" phase: every feature tagged with its resolved id/centroid,
4
- * then reduced by `excludeParts`. Reads no ctx.
4
+ * then reduced by `excludeParts`. Reads no env.
5
5
  */
6
6
  export declare function buildData<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>): GeoPlotState<TProps>;
@@ -3,7 +3,7 @@ import { GeoGeometry } from '../GeoGeometry';
3
3
  import { GeoFeatures } from '../GeoFeatures.svelte';
4
4
  /**
5
5
  * GeoPlot's "data" phase: every feature tagged with its resolved id/centroid,
6
- * then reduced by `excludeParts`. Reads no ctx.
6
+ * then reduced by `excludeParts`. Reads no env.
7
7
  */
8
8
  export function buildData(state) {
9
9
  const { rawFeatures, featureId, excludeParts } = state;
@@ -1,4 +1,4 @@
1
- import type { GeoPlotState, GeoPlotCtx } from '../../../../types/plots/map/geo/state';
1
+ import type { GeoPlotState, GeoPlotEnv } from '../../../../types/plots/map/geo/state';
2
2
  /** Whether a pointer event is over an `inset` marker's panel, which has its own hover. */
3
3
  export declare function isOverInset(e: PointerEvent): boolean;
4
4
  /**
@@ -6,4 +6,4 @@ export declare function isOverInset(e: PointerEvent): boolean;
6
6
  * feature under the cursor and read as its id. A feature outside the active
7
7
  * legend range stays drawn, dimmed, but is never a candidate.
8
8
  */
9
- export declare function buildHover<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>, ctx: GeoPlotCtx<TProps>): GeoPlotState<TProps>;
9
+ export declare function buildHover<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>, env: GeoPlotEnv<TProps>): GeoPlotState<TProps>;
@@ -10,9 +10,9 @@ export function isOverInset(e) {
10
10
  * feature under the cursor and read as its id. A feature outside the active
11
11
  * legend range stays drawn, dimmed, but is never a candidate.
12
12
  */
13
- export function buildHover(state, ctx) {
13
+ export function buildHover(state, env) {
14
14
  const { color, tooltip, authoredMarkers } = state;
15
- const { range } = ctx;
15
+ const { range } = env;
16
16
  const features = state.features;
17
17
  const label = (f) => f.__id;
18
18
  const points = features
@@ -28,7 +28,7 @@ export function buildHover(state, ctx) {
28
28
  defaultStrategy: 'punctual',
29
29
  // Match the feature under the cursor, not the nearest centroid.
30
30
  pointMatching: 'contains',
31
- number: NumberFormat.of(NumberFormat.displayOf(tooltip), ctx.cfg)
31
+ number: NumberFormat.of(NumberFormat.displayOf(tooltip), env.cfg)
32
32
  }),
33
33
  // A map has no axes for a crosshair: 'punctual' only means an exact match.
34
34
  strategy: 'punctual',
@@ -1,4 +1,4 @@
1
- import type { GeoPlotState, GeoPlotCtx } from '../../../../types/plots/map/geo/state';
1
+ import type { GeoPlotState, GeoPlotEnv } from '../../../../types/plots/map/geo/state';
2
2
  /**
3
3
  * GeoPlot's "markers" phase: per-feature style resolution/grouping, the base
4
4
  * `'geo'` marker(s), and the full draw order - any authored marker with
@@ -6,4 +6,4 @@ import type { GeoPlotState, GeoPlotCtx } from '../../../../types/plots/map/geo/s
6
6
  * with any `hover` marker moved last. The base marker(s) match the pointer
7
7
  * themselves, over the features inside the legend's range.
8
8
  */
9
- export declare function buildMarkers<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>, ctx: GeoPlotCtx<TProps>): GeoPlotState<TProps>;
9
+ export declare function buildMarkers<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>, env: GeoPlotEnv<TProps>): GeoPlotState<TProps>;
@@ -19,9 +19,9 @@ function isBehindMarker(marker) {
19
19
  * with any `hover` marker moved last. The base marker(s) match the pointer
20
20
  * themselves, over the features inside the legend's range.
21
21
  */
22
- export function buildMarkers(state, ctx) {
22
+ export function buildMarkers(state, env) {
23
23
  const { features, segments, authoredMarkers, color, grouping, resolveColor, resolveOpacity } = state;
24
- const { range, fill, fillOpacity, stroke, strokeWidth, cfg, onFeatureClick } = ctx;
24
+ const { range, fill, fillOpacity, stroke, strokeWidth, cfg, onFeatureClick } = env;
25
25
  const OPACITY_STEPS = 32;
26
26
  function rangeFilteredStyle(base, f) {
27
27
  if (range == null || !color)
@@ -67,6 +67,6 @@ export function buildMarkers(state, ctx) {
67
67
  const behindMarkers = authoredMarkers.filter(isBehindMarker);
68
68
  const frontMarkers = authoredMarkers.filter((m) => !isBehindMarker(m) && m.type !== 'geo-hover');
69
69
  const hoverMarker = authoredMarkers.find((m) => m.type === 'geo-hover');
70
- const markers = MarkerStyles.resolveAll(MarkerChannels.inheritAll([...behindMarkers, ...featureMarkers, ...frontMarkers, ...(hoverMarker ? [hoverMarker] : [])], state.scales), { cfg: ctx.cfg });
70
+ const markers = MarkerStyles.resolveAll(MarkerChannels.inheritAll([...behindMarkers, ...featureMarkers, ...frontMarkers, ...(hoverMarker ? [hoverMarker] : [])], state.scales), { cfg: env.cfg });
71
71
  return { ...state, markers, styleGroups };
72
72
  }
@@ -1,4 +1,4 @@
1
- import type { GeoPlotState, GeoPlotCtx } from '../../../../types/plots/map/geo/state';
1
+ import type { GeoPlotState, GeoPlotEnv } from '../../../../types/plots/map/geo/state';
2
2
  /**
3
3
  * GeoPlot's "scales" phase: each feature's own resolved color (mirrors
4
4
  * HeatmapPlot's own), with a per-feature override for whichever segment
@@ -7,4 +7,4 @@ import type { GeoPlotState, GeoPlotCtx } from '../../../../types/plots/map/geo/s
7
7
  * the features that share its own key, so e.g. two grouping buckets each
8
8
  * get a ramp scaled to their own value range, not the whole dataset's.
9
9
  */
10
- export declare function buildScales<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>, ctx: GeoPlotCtx<TProps>): GeoPlotState<TProps>;
10
+ export declare function buildScales<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>, env: GeoPlotEnv<TProps>): GeoPlotState<TProps>;
@@ -10,9 +10,9 @@ import { GeoSegments } from '../GeoSegments';
10
10
  * the features that share its own key, so e.g. two grouping buckets each
11
11
  * get a ramp scaled to their own value range, not the whole dataset's.
12
12
  */
13
- export function buildScales(state, ctx) {
13
+ export function buildScales(state, env) {
14
14
  const { scales, features, color, grouping, opacity, segments } = state;
15
- const { range, cfg } = ctx;
15
+ const { range, cfg } = env;
16
16
  const colorValues = color
17
17
  ? features.map((f) => color(f)).filter((v) => v != null)
18
18
  : [];
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" generics="TData extends Record<string, unknown>">
2
- import Plot from '../../../layout/plot/Plot.svelte';
2
+ import AbstractPlot from '../../../layout/plot/AbstractPlot.svelte';
3
3
  import { buildTreemapDefaults } from './defaults';
4
4
  import type {
5
5
  TreemapPlotProps,
@@ -30,7 +30,7 @@
30
30
  }: TreemapPlotProps<TData> = $props();
31
31
  </script>
32
32
 
33
- <Plot
33
+ <AbstractPlot
34
34
  core={core as TreemapPlotCoreProps<TData>}
35
35
  defaults={buildTreemapDefaults}
36
36
  bind:margins
@@ -1,4 +1,3 @@
1
- import Plot from '../../../layout/plot/Plot.svelte';
2
1
  import type { TreemapPlotProps } from '../../../types/plots/part-of-a-whole/treemap/props';
3
2
  declare function $$render<TData extends Record<string, unknown>>(): {
4
3
  props: TreemapPlotProps<TData>;
@@ -1,5 +1,5 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { TreemapPlotState, TreemapPlotCtx } from '../../../types/plots/part-of-a-whole/treemap/state';
2
+ import type { TreemapPlotState, TreemapPlotEnv } from '../../../types/plots/part-of-a-whole/treemap/state';
3
3
  /**
4
4
  * TreemapPlot on the shared pipeline: its rows are the tiles of the `treemap` transform, laid out in a unit square
5
5
  * the plot's two continuous axes span (hidden). Its series are the outermost level of its `grouping`, which colors
@@ -7,4 +7,4 @@ import type { TreemapPlotState, TreemapPlotCtx } from '../../../types/plots/part
7
7
  * hovering its row: an invisible `rect` over each one drives the plot's hover, and its tooltip names the tile and
8
8
  * gives its share.
9
9
  */
10
- export declare function buildTreemapDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<TreemapPlotState<TData>, TreemapPlotCtx>;
10
+ export declare function buildTreemapDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<TreemapPlotState<TData>, TreemapPlotEnv>;
@@ -1,4 +1,6 @@
1
1
  import { TREEMAP_ROW } from '../../../phases/transforms/methods/TreemapTransform';
2
+ import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
3
+ import { RowContext } from '../../../phases/context/RowContext';
2
4
  import { NumberFormat } from '../../../utils/NumberFormat';
3
5
  import { Grouping } from '../../../utils/grouping';
4
6
  import { getConfiguration } from '../../../configuration/config.svelte';
@@ -13,14 +15,22 @@ const DEFAULT_ASPECT = 1.6;
13
15
  function shareDisplay(values) {
14
16
  return { ...NumberFormat.displayOf(values), suffix: values?.suffix ?? '%' };
15
17
  }
16
- /** A tile's name, path and share (from `0` to `100`), as the transform left them on its row. */
18
+ /**
19
+ * What a treemap knows of a tile, as the transform left it on its row: its name, path, summed value and share
20
+ * (from `0` to `100`). The tiles sit in a unit square, so they have no `x` or `y` to read.
21
+ */
17
22
  function tileOf(row) {
18
23
  return {
19
24
  name: String(row[TREEMAP_ROW.name] ?? ''),
20
25
  path: row[TREEMAP_ROW.path] ?? [],
21
- share: Number(row[TREEMAP_ROW.share]) * 100
26
+ value: Number(row[TREEMAP_ROW.value]),
27
+ share: Number(row[TREEMAP_ROW.share]) * 100,
28
+ x: undefined,
29
+ y: undefined
22
30
  };
23
31
  }
32
+ /** A tile's context, as the "context" phase left it on its row. */
33
+ const contextOf = (row) => RowContext.of(row);
24
34
  /**
25
35
  * The plot's tiles: a `treemap` of its `value`, nested by the levels of its `grouping` (its `color` when unset,
26
36
  * as every plot groups by it then) and shaped for its box,
@@ -50,7 +60,7 @@ function edgesOf(state) {
50
60
  * (`'Tertiary.Finance'`), outermost first, so the more specific wins. The series' own are in its style already.
51
61
  */
52
62
  function pathKeysOf(state, row) {
53
- const { path } = tileOf(row);
63
+ const { path } = contextOf(row);
54
64
  return path
55
65
  .slice(1)
56
66
  .map((_, i) => path.slice(0, i + 2).join(Grouping.SEPARATOR))
@@ -60,35 +70,37 @@ function pathKeysOf(state, row) {
60
70
  * The tiles as `rect` markers, each with a `label`: the name of the tile over its share, fitted to it. A series'
61
71
  * tiles take its style - its color, under `styles.area` and the segments keyed by it (and `default`) - and the
62
72
  * segments keyed by a tile's path restyle it, so the tiles split into one marker per style. The legend's dimming
63
- * goes over all of them.
73
+ * goes over all of them, and the hover marker's `active` and `others` over the tiles it reaches.
64
74
  */
65
- function buildMarks(state, ctx) {
75
+ function buildMarks(state, env) {
66
76
  if (!state.processedData?.data.length)
67
77
  return [];
68
- const look = ctx.cfg.treemap;
78
+ const look = env.cfg.treemap;
69
79
  const edges = edgesOf(state);
70
80
  const labels = state.valueLabels?.show ? state.valueLabels : undefined;
71
- const number = NumberFormat.of(shareDisplay(state.values), ctx.cfg, SHARE_DECIMALS);
72
- const shareText = (row, series) => {
73
- const { share } = tileOf(row);
74
- return state.values?.format ? state.values.format(share, series, row, number) : number(share);
81
+ const number = NumberFormat.of(shareDisplay(state.values), env.cfg, SHARE_DECIMALS);
82
+ const shareText = (row) => {
83
+ const context = contextOf(row);
84
+ return state.values?.format
85
+ ? state.values.format(context.share, number, context)
86
+ : number(context.share);
75
87
  };
76
88
  /** The label of a series' tiles: the name over the share, fitted - or the share alone where the name does not fit. */
77
- const labelOf = (labels, series) => {
78
- const shape = labels.shapeLabel(ctx, (row) => `${tileOf(row).name}
79
- ${shareText(row, series)}`, { fontSize: look.fontSize });
89
+ const labelOf = (labels) => {
90
+ const shape = labels.label(env, (row) => `${contextOf(row).name}
91
+ ${shareText(row)}`, { fontSize: look.fontSize });
80
92
  return {
81
93
  ...shape,
82
94
  styles: { lineHeight: look.lineHeight, ...shape.styles },
83
- fit: { padding: look.padding, fallback: (row) => shareText(row, series) }
95
+ fit: { padding: look.padding, fallback: (row) => shareText(row) }
84
96
  };
85
97
  };
86
98
  return (state.processedGroups ?? []).flatMap((group) => {
87
99
  const series = group.series.name;
88
- const dimmed = ctx.interaction?.fillFor(series);
100
+ const dimmed = env.interaction?.fillFor(series);
89
101
  const seriesColor = state.colorForSeries(series);
90
102
  /** A tile's color: its series', or a tone of it by its path while `scales.color.depth` asks for one. */
91
- const colorOf = (row) => state.colorForPath ? state.colorForPath(tileOf(row).path) : seriesColor;
103
+ const colorOf = (row) => state.colorForPath ? state.colorForPath(contextOf(row).path) : seriesColor;
92
104
  return group.visualSegments.flatMap((segment) => {
93
105
  const styled = new Map();
94
106
  for (const row of segment.data) {
@@ -111,7 +123,8 @@ ${shareText(row, series)}`, { fontSize: look.fontSize });
111
123
  stroke: style.stroke ?? look.stroke,
112
124
  strokeWidth: style.strokeWidth ?? look.strokeWidth
113
125
  },
114
- label: labels && labelOf(labels, series)
126
+ label: labels && labelOf(labels),
127
+ hover: 'style'
115
128
  };
116
129
  });
117
130
  });
@@ -133,6 +146,8 @@ export function buildTreemapDefaults() {
133
146
  },
134
147
  // An omitted sector keeps its tiles' room, and every other tile its share; a rescaled one does not.
135
148
  transforms: { transforms: buildTransforms, keepsOmitted: true },
149
+ // A tile's name, path, value and share, for its label, its tooltip and its hover.
150
+ context: () => tileOf,
136
151
  scales: {
137
152
  defaults: () => ({
138
153
  x: { axisDisplay: 'none', grid: false },
@@ -140,28 +155,29 @@ export function buildTreemapDefaults() {
140
155
  }),
141
156
  fit: () => ({ x: { domain: [0, 1], fitted: true }, y: { domain: [0, 1], fitted: true } })
142
157
  },
143
- styles: { values: { show: true } },
158
+ styles: { values: { show: true, layout: 'box' } },
144
159
  markers: { marks: buildMarks },
145
160
  hover: {
146
161
  strategy: 'punctual',
147
162
  // A tile is hovered through its own hit area, not through whichever point the pointer is nearest.
148
163
  pointMatching: 'contains',
164
+ // A tile has no axes for a crosshair, and writes its own label: its hover only restyles the tiles.
165
+ marker: (_state, env) => HoverDefaults.shapes(env.cfg),
149
166
  hitAreas: (state, hover) => hover.points.map(({ row }) => ({
150
167
  type: 'rect',
151
168
  data: [row],
152
169
  ...edgesOf(state),
153
170
  styles: { fill: 'transparent' },
154
- hover: hover.active
171
+ hover: hover.active && 'trigger'
155
172
  })),
156
173
  format: (state) => {
157
174
  const number = NumberFormat.of(shareDisplay(state.values), getConfiguration(), SHARE_DECIMALS);
158
175
  return ((row) => {
159
- const tile = tileOf(row);
176
+ const tile = contextOf(row);
160
177
  return `${tile.name}: ${number(tile.share)}`;
161
178
  });
162
179
  },
163
- label: () => ((row) => tileOf(row).name),
164
- context: () => ((row) => ({ share: tileOf(row).share }))
180
+ label: () => ((row) => contextOf(row).name)
165
181
  }
166
182
  };
167
183
  }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" generics="TData extends Record<string, unknown>">
2
- import Plot from '../../../layout/plot/Plot.svelte';
2
+ import AbstractPlot from '../../../layout/plot/AbstractPlot.svelte';
3
3
  import { buildBarDefaults } from './defaults';
4
4
  import type { BarPlotProps, BarPlotCoreProps } from '../../../types/plots/ranking/bar/props';
5
5
 
@@ -24,7 +24,7 @@
24
24
  }: BarPlotProps<TData> = $props();
25
25
  </script>
26
26
 
27
- <Plot
27
+ <AbstractPlot
28
28
  core={core as BarPlotCoreProps<TData>}
29
29
  defaults={buildBarDefaults}
30
30
  bind:margins
@@ -1,4 +1,3 @@
1
- import Plot from '../../../layout/plot/Plot.svelte';
2
1
  import type { BarPlotProps } from '../../../types/plots/ranking/bar/props';
3
2
  declare function $$render<TData extends Record<string, unknown>>(): {
4
3
  props: BarPlotProps<TData>;
@@ -1,6 +1,6 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
2
  import type { AxisScale } from '../../../types/layout/scales';
3
- import type { BarPlotState, BarPlotCtx } from '../../../types/plots/ranking/bar/state';
3
+ import type { BarPlotState, BarPlotEnv } from '../../../types/plots/ranking/bar/state';
4
4
  /**
5
5
  * The domain a bar plot fits to its own bars on its value axis: from zero to
6
6
  * the tallest span (and the `extra` values a plot draws beyond its bars), niced to as many ticks as fit the plot. Left out when the
@@ -13,4 +13,4 @@ export declare function fitValueDomain<TData extends Record<string, unknown>>(st
13
13
  * it off the values - its own scales (padding, bar layout) and markers.
14
14
  * Its plot defaults to: hover along the category axis, timeline tweens matched per category and group.
15
15
  */
16
- export declare function buildBarDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<BarPlotState<TData>, BarPlotCtx>;
16
+ export declare function buildBarDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<BarPlotState<TData>, BarPlotEnv>;
@@ -3,6 +3,7 @@ import { buildMarks, buildHitAreas, buildBarGeometry } from './markers';
3
3
  import { NiceTicks } from '../../../layout/scales/NiceTicks';
4
4
  import { SERIES_KEY } from '../../../phases/transforms/TransformsPhase';
5
5
  import { PlotAxes } from '../../../phases/data/PlotAxes';
6
+ import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
6
7
  /**
7
8
  * The domain a bar plot fits to its own bars on its value axis: from zero to
8
9
  * the tallest span (and the `extra` values a plot draws beyond its bars), niced to as many ticks as fit the plot. Left out when the
@@ -53,22 +54,32 @@ export function buildBarDefaults() {
53
54
  },
54
55
  scales: {
55
56
  zero: ['value'],
56
- defaults: (_state, ctx) => ({
57
- category: { paddingInner: ctx.cfg.bar.paddingInner, paddingOuter: ctx.cfg.bar.paddingOuter }
57
+ defaults: (_state, env) => ({
58
+ category: { paddingInner: env.cfg.bar.paddingInner, paddingOuter: env.cfg.bar.paddingOuter }
58
59
  }),
59
60
  fit: (state) => fitValueDomain(state)
60
61
  },
62
+ transforms: { labels: {} },
61
63
  styles: {
62
64
  values: {
65
+ layout: (state) => ProcessedPositions.span(state.processedData, PlotAxes.valueOf(state))
66
+ .stacked
67
+ ? 'box'
68
+ : 'path',
69
+ layouts: {
70
+ path: { edge: 'tip', side: 'outside' },
71
+ box: { anchor: 'middle' },
72
+ point: { anchor: 'top', side: 'above' }
73
+ },
63
74
  // An `'outside'` label sits past its bar's end, which the tallest bar takes to the edge.
64
75
  reach: (labels, state) => {
65
- if (labels.anchor !== 'outside')
76
+ if (!labels.pastTip)
66
77
  return [];
67
78
  const axis = PlotAxes.valueOf(state);
68
79
  if (ProcessedPositions.span(state.processedData, axis).stacked)
69
80
  return [];
70
81
  if (!state.axes?.isHorizontal) {
71
- const offset = labels.offset('y');
82
+ const offset = labels.offset();
72
83
  const boxes = [
73
84
  labels.edgeBox('0', { x: 'middle', y: 'before' }, { y: -offset }, ['top'])
74
85
  ];
@@ -81,12 +92,12 @@ export function buildBarDefaults() {
81
92
  return boxes;
82
93
  }
83
94
  // A bar below zero reaches out to the left, with its label turned that way.
84
- const offset = labels.offset('x');
95
+ const offset = labels.offset();
85
96
  return labels
86
97
  .extremes(state.resolvedSeries ?? [], PlotAxes.valueOf(state), 'both')
87
98
  .map(({ series, value }) => value < 0
88
- ? labels.edgeBox(labels.format(value, series.name), { x: 'before', y: 'middle' }, { x: -offset }, ['left'])
89
- : labels.edgeBox(labels.format(value, series.name), { x: 'after', y: 'middle' }, { x: offset }, ['right']));
99
+ ? labels.edgeBox(labels.format(value, undefined, series.name), { x: 'before', y: 'middle' }, { x: -offset }, ['left'])
100
+ : labels.edgeBox(labels.format(value, undefined, series.name), { x: 'after', y: 'middle' }, { x: offset }, ['right']));
90
101
  }
91
102
  }
92
103
  },
@@ -95,13 +106,18 @@ export function buildBarDefaults() {
95
106
  // Each bar matched by its own band (see `buildHitAreas`); a grouped bar's dot is
96
107
  // drawn in its series' slice of the band.
97
108
  pointMatching: 'contains',
98
- decorate: (state, ctx) => {
99
- const { sliceOf } = buildBarGeometry(state, ctx.cfg.bar.seriesPadding);
109
+ decorate: (state, env) => {
110
+ const { sliceOf } = buildBarGeometry(state, env.cfg.bar.seriesPadding);
100
111
  return (row) => ({
101
112
  areaInset: sliceOf(String(row[SERIES_KEY]))
102
113
  });
103
114
  },
104
- hitAreas: buildHitAreas
115
+ hitAreas: buildHitAreas,
116
+ // The hovered category's band behind its bars - its series' slice of it, when that bar alone is hovered.
117
+ marker: (state) => ({
118
+ back: [HoverDefaults.band(state.axes?.isHorizontal ? 'y' : 'x')],
119
+ front: []
120
+ })
105
121
  },
106
122
  timeline: { interpolation: { value: 'value', key: ['category', 'grouping'] } }
107
123
  };
@@ -1,5 +1,5 @@
1
1
  import type { BarMarkerConfig } from '../../../types/markers/common';
2
- import type { BarPlotState, BarPlotCtx } from '../../../types/plots/ranking/bar/state';
2
+ import type { BarPlotState, BarPlotEnv } from '../../../types/plots/ranking/bar/state';
3
3
  import type { ProcessedRow } from '../../../types/phases';
4
4
  import type { AxisValue } from '../../../types/layout/mapping';
5
5
  import type { BandSlice } from '../../../types/layout/hover';
@@ -25,11 +25,11 @@ export declare function buildBarGeometry<TData extends Record<string, unknown>>(
25
25
  * slice of it. The pointer needn't be over the visible bar. They drive the
26
26
  * plot's hover when it is active.
27
27
  */
28
- export declare function buildHitAreas<TData extends Record<string, unknown>>(state: BarPlotState<TData>, hover: HoverConfig<any>, ctx: BarPlotCtx): BarMarkerConfig[];
28
+ export declare function buildHitAreas<TData extends Record<string, unknown>>(state: BarPlotState<TData>, hover: HoverConfig<any>, env: BarPlotEnv): BarMarkerConfig[];
29
29
  /**
30
30
  * BarPlot's "markers" phase: visible `role: 'segment'` bars - real data plus
31
31
  * gap fills - drawing the rows the "transforms" phase left, prepended onto
32
32
  * whatever the "statistics" phase already put in `state.markers`, and its
33
33
  * value labels on top of everything.
34
34
  */
35
- export declare function buildMarks<TData extends Record<string, unknown>>(state: BarPlotState<TData>, ctx: BarPlotCtx): AxisBasedMarkersConfig[];
35
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: BarPlotState<TData>, env: BarPlotEnv): AxisBasedMarkersConfig[];