@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,5 +1,5 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { ViolinPlotState, ViolinPlotCtx } from '../../../types/plots/distribution/violin/state';
2
+ import type { ViolinPlotState, ViolinPlotEnv } from '../../../types/plots/distribution/violin/state';
3
3
  /**
4
4
  * ViolinPlot on the shared pipeline: one violin per category of each series
5
5
  * along one category axis - `x`, or `y` for horizontal violins - in the order
@@ -7,4 +7,4 @@ import type { ViolinPlotState, ViolinPlotCtx } from '../../../types/plots/distri
7
7
  * fits the values, without reaching for zero. Its plot defaults to: hover
8
8
  * along the category axis, over one summary per violin, read as a box plot's.
9
9
  */
10
- export declare function buildViolinDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<ViolinPlotState<TData>, ViolinPlotCtx>;
10
+ export declare function buildViolinDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<ViolinPlotState<TData>, ViolinPlotEnv>;
@@ -1,9 +1,9 @@
1
1
  import { buildMarks } from './markers';
2
+ import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
2
3
  import { BoxSummaries } from '../box/BoxSummaries';
3
4
  import { PlotAxes } from '../../../phases/data/PlotAxes';
4
5
  import { ProcessedPositions } from '../../../phases/transforms/ProcessedPositions';
5
6
  import { NiceTicks } from '../../../layout/scales/NiceTicks';
6
- import { TooltipState } from '../../../layout/tooltip/TooltipState.svelte';
7
7
  /**
8
8
  * The value axis fit to the values the violins are drawn from, when the author leaves it unpinned: no svelteplot mark reads them, so nothing else sets its domain.
9
9
  */
@@ -43,20 +43,33 @@ export function buildViolinDefaults() {
43
43
  scales: {
44
44
  bandOrder: 'data',
45
45
  fit: (state) => fitValueDomain(state),
46
- defaults: (_state, ctx) => ({
46
+ defaults: (_state, env) => ({
47
47
  category: {
48
- paddingInner: ctx.cfg.violin.paddingInner,
49
- paddingOuter: ctx.cfg.violin.paddingOuter
48
+ paddingInner: env.cfg.violin.paddingInner,
49
+ paddingOuter: env.cfg.violin.paddingOuter
50
50
  }
51
51
  })
52
52
  },
53
+ // Each value's box: its quartiles and whiskers, worked out once for its tooltip and hover to read.
54
+ context: (state) => BoxSummaries.context(state),
55
+ styles: {
56
+ values: {
57
+ layout: 'point',
58
+ // A quartile is worked out, not read: at most two decimals, as the tooltip writes it.
59
+ format: (value, number) => number(Math.round(value * 100) / 100),
60
+ parts: {
61
+ placements: (state) => BoxSummaries.partPlacements(state),
62
+ default: ['median']
63
+ }
64
+ }
65
+ },
53
66
  markers: { marks: buildMarks },
54
67
  hover: {
68
+ // The hovered category's band behind its shape.
69
+ marker: (state) => HoverDefaults.behindBand(PlotAxes.other(PlotAxes.valueOf(state))),
55
70
  rows: BoxSummaries.of,
56
71
  position: BoxSummaries.position,
57
- label: () => ((row) => String(row.median)),
58
- format: (state) => BoxSummaries.format(state),
59
- sort: () => TooltipState.descending((row) => row.median)
72
+ format: (state) => BoxSummaries.format(state)
60
73
  }
61
74
  };
62
75
  }
@@ -1,4 +1,4 @@
1
- import type { ViolinPlotState, ViolinPlotCtx } from '../../../types/plots/distribution/violin/state';
1
+ import type { ViolinPlotState, ViolinPlotEnv } from '../../../types/plots/distribution/violin/state';
2
2
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
3
3
  /**
4
4
  * ViolinPlot's "markers" phase: one `violin` - and a narrow `box` over it - per visual
@@ -7,4 +7,4 @@ import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
7
7
  * by side. The markers the "statistics" phase already put in `state.markers`
8
8
  * come after, so they render on top.
9
9
  */
10
- export declare function buildMarks<TData extends Record<string, unknown>>(state: ViolinPlotState<TData>, ctx: ViolinPlotCtx): AxisBasedMarkersConfig[];
10
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: ViolinPlotState<TData>, env: ViolinPlotEnv): AxisBasedMarkersConfig[];
@@ -1,3 +1,6 @@
1
+ import { ValueLabels } from '../../../layout/styles/ValueLabels';
2
+ import { BoxSummaries } from '../box/BoxSummaries';
3
+ import { SERIES_KEY } from '../../../phases/transforms/TransformsPhase';
1
4
  import { ProcessedPositions } from '../../../phases/transforms/ProcessedPositions';
2
5
  import { PlotAxes } from '../../../phases/data/PlotAxes';
3
6
  import { ViolinProfiles } from '../../../markers/violin/ViolinProfiles';
@@ -8,14 +11,24 @@ import { ViolinProfiles } from '../../../markers/violin/ViolinProfiles';
8
11
  * by side. The markers the "statistics" phase already put in `state.markers`
9
12
  * come after, so they render on top.
10
13
  */
11
- export function buildMarks(state, ctx) {
14
+ export function buildMarks(state, env) {
12
15
  const processed = state.processedData;
13
16
  if (!processed)
14
17
  return [];
15
- const { cfg } = ctx;
18
+ const { cfg } = env;
16
19
  const styles = state.styles;
17
20
  const { channels } = processed;
18
21
  const groups = state.processedGroups ?? [];
22
+ // Series share a band side by side only where they meet in it: one series per category - grouped by the category
23
+ // itself - fills each band.
24
+ const categoryOf = ProcessedPositions.of(processed, PlotAxes.valueOf(state))[PlotAxes.categoryOf(state)];
25
+ const seriesIn = new Map();
26
+ for (const row of processed.data) {
27
+ const key = String(categoryOf(row));
28
+ seriesIn.set(key, (seriesIn.get(key) ?? new Set()).add(row[SERIES_KEY]));
29
+ }
30
+ const shared = [...seriesIn.values()].some((series) => series.size > 1);
31
+ const slotOf = (index) => (shared ? { index, count: groups.length } : undefined);
19
32
  let peak;
20
33
  if (styles?.scale === 'shared') {
21
34
  const valueAxis = PlotAxes.valueOf(state);
@@ -32,7 +45,7 @@ export function buildMarks(state, ctx) {
32
45
  const ink = 'currentColor';
33
46
  const violins = groups.flatMap((group, index) => {
34
47
  const name = group.series.name;
35
- const disabled = ctx.interaction?.fillFor(name);
48
+ const disabled = env.interaction?.fillFor(name);
36
49
  return group.visualSegments.map((seg) => ({
37
50
  type: 'violin',
38
51
  series: name,
@@ -43,7 +56,7 @@ export function buildMarks(state, ctx) {
43
56
  bandwidth: styles?.bandwidth,
44
57
  trim: styles?.trim,
45
58
  peak,
46
- slot: { index, count: groups.length },
59
+ slot: slotOf(index),
47
60
  styles: {
48
61
  // An outline asked for without a color is the fill's.
49
62
  ...(seg.styles.strokeWidth !== undefined
@@ -65,11 +78,22 @@ export function buildMarks(state, ctx) {
65
78
  x: channels.x,
66
79
  y: channels.y,
67
80
  thickness: boxWidth,
68
- slot: { index, count: groups.length },
81
+ slot: slotOf(index),
69
82
  bar: { fill: ink, fillOpacity: 1 },
70
83
  rule: { stroke: ink, strokeWidth: 1.5 },
71
84
  dot: { r: 0 },
72
85
  tickMinMax: false
73
86
  })));
74
- return [...violins, ...boxes];
87
+ // The parts of each violin's box `styles.values` labels: its median by default, beside it, in its series' slot.
88
+ const slots = new Map(groups.map((group, index) => [group.series.name, index]));
89
+ const summaries = state;
90
+ const labels = state.valueLabels?.show
91
+ ? state.valueLabels.partMarkers(env, BoxSummaries.of(summaries),
92
+ // Beside the narrow box inside each violin, the violin itself as wide as its values are dense.
93
+ ValueLabels.bandPoint(state, 'category', boxWidth ?? 0, (row) => {
94
+ const index = slots.get(String(row[SERIES_KEY]));
95
+ return index === undefined ? undefined : slotOf(index);
96
+ }), { seriesColor: (row) => state.colorForSeries(String(row[SERIES_KEY])) })
97
+ : [];
98
+ return [...violins, ...boxes, ...labels];
75
99
  }
@@ -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 { buildAreaDefaults } from './defaults';
4
4
  import type { AreaPlotProps, AreaPlotCoreProps } from '../../../types/plots/evolution/area/props';
5
5
 
@@ -25,7 +25,7 @@
25
25
  }: AreaPlotProps<TData> = $props();
26
26
  </script>
27
27
 
28
- <Plot
28
+ <AbstractPlot
29
29
  core={core as AreaPlotCoreProps<TData>}
30
30
  defaults={buildAreaDefaults}
31
31
  bind:margins
@@ -1,4 +1,3 @@
1
- import Plot from '../../../layout/plot/Plot.svelte';
2
1
  import type { AreaPlotProps } from '../../../types/plots/evolution/area/props';
3
2
  declare function $$render<TData extends Record<string, unknown>>(): {
4
3
  props: AreaPlotProps<TData>;
@@ -1,4 +1,4 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { AreaPlotState, AreaPlotCtx } from '../../../types/plots/evolution/area/state';
2
+ import type { AreaPlotState, AreaPlotEnv } from '../../../types/plots/evolution/area/state';
3
3
  /** AreaPlot on the shared pipeline: areas from a zero baseline, author markers taking the plot's `x`/`y`, and its own markers. Its plot defaults to: hover along x, cumulative timeline tweening `y` per series. */
4
- export declare function buildAreaDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<AreaPlotState<TData>, AreaPlotCtx>;
4
+ export declare function buildAreaDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<AreaPlotState<TData>, AreaPlotEnv>;
@@ -6,20 +6,17 @@ export function buildAreaDefaults() {
6
6
  data: {
7
7
  segments: { color: (style) => style?.fill, base: { flat: 'area' } }
8
8
  },
9
- statistics: { inheritPositions: true },
10
9
  scales: { zero: ['y'] },
11
10
  transforms: { labels: { select: 'last', skip: ValueLabels.skipGaps } },
12
11
  styles: {
13
12
  values: {
14
- anchor: 'start',
15
- format: (v, name, number) => `${name} - ${number(v)}`,
16
- reach: (labels, state) => labels.reachAtSeriesEnds(state)
13
+ layout: 'point',
14
+ layouts: { point: { side: 'after' }, path: { edge: 'top', side: 'above', offset: 'end' } },
15
+ format: (v, number, context) => `${context.series} - ${number(v)}`,
16
+ reach: (labels, state) => (labels.layout === 'point' ? labels.reachAtSeriesEnds(state) : [])
17
17
  }
18
18
  },
19
- markers: {
20
- marks: buildMarks,
21
- valueLabels: (labels, state) => labels.atSeriesEnds(state)
22
- },
19
+ markers: { marks: buildMarks },
23
20
  timeline: { filterMode: 'upTo', interpolation: { value: 'y', key: ['grouping'] } }
24
21
  };
25
22
  }
@@ -1,4 +1,4 @@
1
- import type { AreaPlotState, AreaPlotCtx } from '../../../types/plots/evolution/area/state';
1
+ import type { AreaPlotState, AreaPlotEnv } from '../../../types/plots/evolution/area/state';
2
2
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
3
3
  /**
4
4
  * AreaPlot's "markers" phase: one `area` per visual segment of each series,
@@ -11,4 +11,4 @@ import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
11
11
  * another series' value label, dims its own areas' fill to
12
12
  * `legend.disabledOpacity`, in place, so a stack keeps its full extent.
13
13
  */
14
- export declare function buildMarks<TData extends Record<string, unknown>>(state: AreaPlotState<TData>, ctx: AreaPlotCtx): AxisBasedMarkersConfig[];
14
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: AreaPlotState<TData>, env: AreaPlotEnv): AxisBasedMarkersConfig[];
@@ -1,3 +1,4 @@
1
+ import { ValueLabels } from '../../../layout/styles/ValueLabels';
1
2
  import { Transforms } from '../../../phases/transforms/Transforms';
2
3
  /**
3
4
  * AreaPlot's "markers" phase: one `area` per visual segment of each series,
@@ -10,17 +11,17 @@ import { Transforms } from '../../../phases/transforms/Transforms';
10
11
  * another series' value label, dims its own areas' fill to
11
12
  * `legend.disabledOpacity`, in place, so a stack keeps its full extent.
12
13
  */
13
- export function buildMarks(state, ctx) {
14
+ export function buildMarks(state, env) {
14
15
  const { resolvedSeries = [] } = state;
15
16
  const { channels, options, transforms } = state.processedData;
16
- const { cfg } = ctx;
17
+ const { cfg } = env;
17
18
  // A fill opacity per series name, for the dim: a legend-off series fades to
18
19
  // the legend's disabled opacity, every other one keeps the area default.
19
20
  const fillOpacityOf = (name) => {
20
- const off = ctx.interaction?.dimmed(name);
21
+ const off = env.interaction?.dimmed(name);
21
22
  return off ? (off.opacity ?? cfg.legend.disabledOpacity) : cfg.area.fillOpacity;
22
23
  };
23
- const dimmed = resolvedSeries.some((s) => ctx.interaction?.dimmed(s.name));
24
+ const dimmed = resolvedSeries.some((s) => env.interaction?.dimmed(s.name));
24
25
  const opacityScale = {
25
26
  range: Object.fromEntries(resolvedSeries.map((s) => [s.name, fillOpacityOf(s.name)]))
26
27
  };
@@ -44,5 +45,6 @@ export function buildMarks(state, ctx) {
44
45
  ...dimByName(group.series.name)
45
46
  }, transforms);
46
47
  }));
47
- return areas;
48
+ const labels = state.valueLabels?.show ? state.valueLabels.forSeries(state, env) : undefined;
49
+ return ValueLabels.onMarkers(areas, 'area', labels);
48
50
  }
@@ -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 { buildLineDefaults } from './defaults';
4
4
  import type { LinePlotProps, LinePlotCoreProps } from '../../../types/plots/evolution/line/props';
5
5
 
@@ -25,7 +25,7 @@
25
25
  }: LinePlotProps<TData> = $props();
26
26
  </script>
27
27
 
28
- <Plot
28
+ <AbstractPlot
29
29
  core={core as LinePlotCoreProps<TData>}
30
30
  defaults={buildLineDefaults}
31
31
  bind:margins
@@ -1,4 +1,3 @@
1
- import Plot from '../../../layout/plot/Plot.svelte';
2
1
  import type { LinePlotProps } from '../../../types/plots/evolution/line/props';
3
2
  declare function $$render<TData extends Record<string, unknown>>(): {
4
3
  props: LinePlotProps<TData>;
@@ -1,4 +1,4 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { LinePlotState, LinePlotCtx } from '../../../types/plots/evolution/line/state';
2
+ import type { LinePlotState, LinePlotEnv } from '../../../types/plots/evolution/line/state';
3
3
  /** LinePlot on the shared pipeline: continuous segments colored by their stroke, and its own markers. Its plot defaults to: hover along x, cumulative timeline tweening `y` per series. */
4
- export declare function buildLineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<LinePlotState<TData>, LinePlotCtx>;
4
+ export declare function buildLineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<LinePlotState<TData>, LinePlotEnv>;
@@ -22,15 +22,13 @@ export function buildLineDefaults() {
22
22
  transforms: { labels: { select: 'last', skip: ValueLabels.skipGaps } },
23
23
  styles: {
24
24
  values: {
25
- anchor: 'start',
26
- format: (v, name, number) => `${name} - ${number(v)}`,
27
- reach: (labels, state) => labels.reachAtSeriesEnds(state)
25
+ layout: 'point',
26
+ layouts: { point: { side: 'after' }, path: { side: 'above', offset: 'end' } },
27
+ format: (v, number, context) => `${context.series} - ${number(v)}`,
28
+ reach: (labels, state) => (labels.layout === 'point' ? labels.reachAtSeriesEnds(state) : [])
28
29
  }
29
30
  },
30
- markers: {
31
- marks: buildMarks,
32
- valueLabels: (labels, state) => labels.atSeriesEnds(state)
33
- },
31
+ markers: { marks: buildMarks },
34
32
  timeline: { filterMode: 'upTo', interpolation: { value: 'y', key: ['grouping'] } }
35
33
  };
36
34
  }
@@ -4,7 +4,7 @@ import type { LineSegmentStyle } from '../../../types/plots/segments/common';
4
4
  import type { VisualGroup } from '../../../types/plots/segments/config';
5
5
  import type { StrokeStyle, DotStyle } from '../../../types/plots/styling';
6
6
  import type { LineMarkerConfig, DotMarkerConfig } from '../../../types/markers/common';
7
- import type { LinePlotState, LinePlotCtx } from '../../../types/plots/evolution/line/state';
7
+ import type { LinePlotState, LinePlotEnv } from '../../../types/plots/evolution/line/state';
8
8
  import type { CurveName } from '../../../types/layout/styles/curve';
9
9
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
10
10
  /**
@@ -49,4 +49,4 @@ export declare function buildGapMarkers<TData extends Record<string, unknown>>(a
49
49
  * whatever the "statistics" phase already put in `state.markers` - and its
50
50
  * value labels on top of everything.
51
51
  */
52
- export declare function buildMarks<TData extends Record<string, unknown>>(state: LinePlotState<TData>, ctx: LinePlotCtx): AxisBasedMarkersConfig[];
52
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: LinePlotState<TData>, env: LinePlotEnv): AxisBasedMarkersConfig[];
@@ -1,3 +1,4 @@
1
+ import { ValueLabels } from '../../../layout/styles/ValueLabels';
1
2
  import { getConfiguration } from '../../../configuration/config.svelte';
2
3
  import { resolveGapRuns, resolveGapsForSeries } from '../../utils/gaps';
3
4
  /**
@@ -178,10 +179,10 @@ export function buildGapMarkers(args) {
178
179
  * whatever the "statistics" phase already put in `state.markers` - and its
179
180
  * value labels on top of everything.
180
181
  */
181
- export function buildMarks(state, ctx) {
182
+ export function buildMarks(state, env) {
182
183
  const { colorForSeries, gaps } = state;
183
- const disabledStrokeFor = (name) => ctx.interaction?.strokeFor(name);
184
- const disabledDotsFor = (name) => ctx.interaction?.dotsFor(name);
184
+ const disabledStrokeFor = (name) => env.interaction?.strokeFor(name);
185
+ const disabledDotsFor = (name) => env.interaction?.dotsFor(name);
185
186
  const groups = state.processedGroups ?? [];
186
187
  const lineMarkers = buildLineMarkers({
187
188
  groupedSeries: groups,
@@ -197,5 +198,6 @@ export function buildMarks(state, ctx) {
197
198
  disabledStrokeFor,
198
199
  disabledDotsFor
199
200
  });
200
- return [...lineMarkers, ...gapMarkers];
201
+ const labels = state.valueLabels?.show ? state.valueLabels.forSeries(state, env) : undefined;
202
+ return [...ValueLabels.onMarkers(lineMarkers, 'line', labels), ...gapMarkers];
201
203
  }
@@ -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 { buildSlopeDefaults } from './defaults';
4
4
  import type { SlopePlotProps, SlopePlotCoreProps } from '../../../types/plots/evolution/slope/props';
5
5
 
@@ -25,7 +25,7 @@
25
25
  }: SlopePlotProps<TData> = $props();
26
26
  </script>
27
27
 
28
- <Plot
28
+ <AbstractPlot
29
29
  core={core as SlopePlotCoreProps<TData>}
30
30
  defaults={buildSlopeDefaults}
31
31
  bind:margins
@@ -1,4 +1,3 @@
1
- import Plot from '../../../layout/plot/Plot.svelte';
2
1
  import type { SlopePlotProps } from '../../../types/plots/evolution/slope/props';
3
2
  declare function $$render<TData extends Record<string, unknown>>(): {
4
3
  props: SlopePlotProps<TData>;
@@ -1,8 +1,8 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { SlopePlotState, SlopePlotCtx } from '../../../types/plots/evolution/slope/state';
2
+ import type { SlopePlotState, SlopePlotEnv } from '../../../types/plots/evolution/slope/state';
3
3
  /**
4
4
  * SlopePlot on the shared pipeline: a LinePlot over a category axis of a few
5
5
  * positions - two, for a slope - with a dot on every point and its first and
6
6
  * last labelled, each before or after it.
7
7
  */
8
- export declare function buildSlopeDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SlopePlotState<TData>, SlopePlotCtx>;
8
+ export declare function buildSlopeDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SlopePlotState<TData>, SlopePlotEnv>;
@@ -1,4 +1,6 @@
1
- import { buildMarks, buildValueLabels } from './markers';
1
+ import { buildMarks } from './markers';
2
+ import { PlotAxes } from '../../../phases/data/PlotAxes';
3
+ import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
2
4
  import { ValueLabels } from '../../../layout/styles/ValueLabels';
3
5
  import { buildLineDefaults } from '../line/defaults';
4
6
  /**
@@ -15,17 +17,20 @@ export function buildSlopeDefaults() {
15
17
  scales: {
16
18
  bandOrder: 'data',
17
19
  // The labels give the values, so the value axis stays out of their way.
18
- defaults: (_state, ctx) => ({
19
- category: { type: 'point', padding: ctx.cfg.slope.padding },
20
+ defaults: (_state, env) => ({
21
+ category: { type: 'point', padding: env.cfg.slope.padding },
20
22
  value: { axisDisplay: 'none' }
21
23
  })
22
24
  },
23
25
  styles: {
24
26
  values: {
25
- anchor: 'start',
26
- format: (v, name, number) => `${name} - ${number(v)}`
27
+ layout: 'point',
28
+ layouts: { point: { side: 'after' }, path: { side: 'above', offset: 'middle' } },
29
+ format: (v, number, context) => `${context.series} - ${number(v)}`
27
30
  }
28
31
  },
29
- markers: { marks: buildMarks, valueLabels: buildValueLabels }
32
+ markers: { marks: buildMarks },
33
+ // Only two positions: a rule along the value axis at the hovered point says more than one across them.
34
+ hover: { ...line.hover, marker: (state) => HoverDefaults.valueRule(PlotAxes.valueOf(state)) }
30
35
  };
31
36
  }
@@ -1,16 +1,17 @@
1
- import type { ValueLabels } from '../../../layout/styles/ValueLabels';
1
+ import { ValueLabels } from '../../../layout/styles/ValueLabels';
2
2
  import type { EdgeBox } from '../../../types/layout/box';
3
- import type { AxisBasedMarkersConfig, TextMarkerConfig } from '../../../types/markers/common';
4
- import type { SlopePlotState, SlopePlotCtx } from '../../../types/plots/evolution/slope/state';
3
+ import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
4
+ import type { MarkerLabelConfig } from '../../../types/markers/labels/common';
5
+ import type { SlopePlotState, SlopePlotEnv } from '../../../types/plots/evolution/slope/state';
5
6
  /**
6
7
  * SlopePlot's "markers" phase: each series' line, with a dot on every point
7
8
  * (a slope has few), over the rows the "transforms" phase left.
8
9
  */
9
- export declare function buildMarks<TData extends Record<string, unknown>>(state: SlopePlotState<TData>, ctx: SlopePlotCtx): AxisBasedMarkersConfig[];
10
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: SlopePlotState<TData>, env: SlopePlotEnv): AxisBasedMarkersConfig[];
10
11
  /**
11
12
  * SlopePlot's value labels: the series' first points labelled before them and
12
13
  * its last ones after, each end spread apart where its labels would overlap.
13
14
  */
14
- export declare function buildValueLabels<TData extends Record<string, unknown>>(labels: ValueLabels, state: SlopePlotState<TData>): TextMarkerConfig[];
15
+ export declare function buildValueLabels<TData extends Record<string, unknown>>(labels: ValueLabels, state: SlopePlotState<TData>, env: SlopePlotEnv): MarkerLabelConfig[];
15
16
  /** Where SlopePlot's labels are expected to sit: past the points at both ends. */
16
17
  export declare function buildReach<TData extends Record<string, unknown>>(labels: ValueLabels, state: SlopePlotState<TData>): EdgeBox[];
@@ -1,9 +1,10 @@
1
1
  import { getConfiguration } from '../../../configuration/config.svelte';
2
2
  import { buildLineMarkers } from '../line/markers';
3
3
  import { ProcessedPositions } from '../../../phases/transforms/ProcessedPositions';
4
- /** The anchor of the labels at the plot's start: the mirror of the end's, so `'start'` always reads outward. */
5
- function startAnchor(anchor) {
6
- return anchor === 'start' ? 'end' : anchor === 'end' ? 'start' : anchor;
4
+ import { ValueLabels } from '../../../layout/styles/ValueLabels';
5
+ /** The side of the labels at the plot's start: the mirror of the end's, so `'after'` always reads outward. */
6
+ function startSide(side) {
7
+ return side === 'after' ? 'before' : side === 'before' ? 'after' : side;
7
8
  }
8
9
  /** The value a position is told apart by: a date by its time. */
9
10
  const keyOf = (value) => (value instanceof Date ? value.getTime() : value);
@@ -11,7 +12,7 @@ const keyOf = (value) => (value instanceof Date ? value.getTime() : value);
11
12
  * SlopePlot's "markers" phase: each series' line, with a dot on every point
12
13
  * (a slope has few), over the rows the "transforms" phase left.
13
14
  */
14
- export function buildMarks(state, ctx) {
15
+ export function buildMarks(state, env) {
15
16
  const { slope } = getConfiguration();
16
17
  const groups = (state.processedGroups ?? []).map((group) => ({
17
18
  ...group,
@@ -24,13 +25,17 @@ export function buildMarks(state, ctx) {
24
25
  }
25
26
  }))
26
27
  }));
27
- return buildLineMarkers({
28
+ const lines = buildLineMarkers({
28
29
  groupedSeries: groups,
29
30
  colorFor: state.colorForSeries,
30
- disabledStrokeFor: (name) => ctx.interaction?.strokeFor(name),
31
- disabledDotsFor: (name) => ctx.interaction?.dotsFor(name),
31
+ disabledStrokeFor: (name) => env.interaction?.strokeFor(name),
32
+ disabledDotsFor: (name) => env.interaction?.dotsFor(name),
32
33
  curve: state.styles?.curve
33
34
  });
35
+ const labels = state.valueLabels?.show
36
+ ? buildValueLabels(state.valueLabels, state, env)
37
+ : undefined;
38
+ return ValueLabels.onMarkers(lines, 'line', labels);
34
39
  }
35
40
  /** The rows labelled at the plot's first position and at its last, each series' own. */
36
41
  function labelledEnds(state) {
@@ -52,25 +57,27 @@ function labelledEnds(state) {
52
57
  * SlopePlot's value labels: the series' first points labelled before them and
53
58
  * its last ones after, each end spread apart where its labels would overlap.
54
59
  */
55
- export function buildValueLabels(labels, state) {
60
+ export function buildValueLabels(labels, state, env) {
56
61
  if (!state.processedData)
57
62
  return [];
63
+ if (labels.layout === 'path')
64
+ return labels.alongSeries(state, env);
58
65
  const { start, end } = labelledEnds(state);
59
66
  return [
60
- ...labels.atSeriesEnds(state, {
67
+ ...labels.atSeriesEnds(state, env, {
61
68
  rows: start,
62
- anchor: startAnchor(labels.anchor),
69
+ side: startSide(labels.side),
63
70
  lane: true,
64
71
  flip: false
65
72
  }),
66
- ...labels.atSeriesEnds(state, { rows: end, lane: true })
73
+ ...labels.atSeriesEnds(state, env, { rows: end, lane: true })
67
74
  ];
68
75
  }
69
76
  /** Where SlopePlot's labels are expected to sit: past the points at both ends. */
70
77
  export function buildReach(labels, state) {
71
78
  // Labels before the first position reach the left edge, those after the last one the right.
72
79
  const before = labels
73
- .reachAtSeriesEnds(state, startAnchor(labels.anchor))
80
+ .reachAtSeriesEnds(state, startSide(labels.side))
74
81
  .map(({ box, edges }) => ({ box, edges: edges.filter((edge) => edge !== 'right') }));
75
82
  const after = labels
76
83
  .reachAtSeriesEnds(state)
@@ -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 { buildSparklineDefaults } from './defaults';
4
4
  import type {
5
5
  SparklinePlotProps,
@@ -28,7 +28,7 @@
28
28
  }: SparklinePlotProps<TData> = $props();
29
29
  </script>
30
30
 
31
- <Plot
31
+ <AbstractPlot
32
32
  core={core as SparklinePlotCoreProps<TData>}
33
33
  defaults={buildSparklineDefaults}
34
34
  bind:margins
@@ -1,4 +1,3 @@
1
- import Plot from '../../../layout/plot/Plot.svelte';
2
1
  import type { SparklinePlotProps } from '../../../types/plots/evolution/sparkline/props';
3
2
  declare function $$render<TData extends Record<string, unknown>>(): {
4
3
  props: SparklinePlotProps<TData>;
@@ -1,7 +1,7 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { SparklinePlotState, SparklinePlotCtx } from '../../../types/plots/evolution/sparkline/state';
2
+ import type { SparklinePlotState, SparklinePlotEnv } from '../../../types/plots/evolution/sparkline/state';
3
3
  /**
4
4
  * SparklinePlot on the shared pipeline: a LinePlot with its axes left out, a
5
5
  * thin line, and a dot and value on the last point of each series.
6
6
  */
7
- export declare function buildSparklineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SparklinePlotState<TData>, SparklinePlotCtx>;
7
+ export declare function buildSparklineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SparklinePlotState<TData>, SparklinePlotEnv>;
@@ -1,4 +1,5 @@
1
1
  import { buildMarks } from './markers';
2
+ import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
2
3
  import { ValueLabels } from '../../../layout/styles/ValueLabels';
3
4
  import { buildLineDefaults } from '../line/defaults';
4
5
  /**
@@ -15,9 +16,11 @@ export function buildSparklineDefaults() {
15
16
  values: {
16
17
  ...line.styles?.values,
17
18
  show: true,
18
- format: (value, _name, number) => number(value)
19
+ format: (value, number) => number(value)
19
20
  }
20
21
  },
21
- markers: { marks: buildMarks, valueLabels: line.markers.valueLabels }
22
+ markers: { marks: buildMarks },
23
+ // Small and bare: a dot on the hovered point, and nothing else.
24
+ hover: { ...line.hover, marker: () => ({ back: [], front: [HoverDefaults.dot()] }) }
22
25
  };
23
26
  }
@@ -1,7 +1,7 @@
1
1
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
2
- import type { SparklinePlotState, SparklinePlotCtx } from '../../../types/plots/evolution/sparkline/state';
2
+ import type { SparklinePlotState, SparklinePlotEnv } from '../../../types/plots/evolution/sparkline/state';
3
3
  /**
4
4
  * SparklinePlot's "markers" phase: each series' line, thin, and a dot on its
5
5
  * last point with a value.
6
6
  */
7
- export declare function buildMarks<TData extends Record<string, unknown>>(state: SparklinePlotState<TData>, ctx: SparklinePlotCtx): AxisBasedMarkersConfig[];
7
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: SparklinePlotState<TData>, env: SparklinePlotEnv): AxisBasedMarkersConfig[];