@fundar/data-chart-telling 1.18.0 → 1.20.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 (252) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +2 -1
  3. package/dist/configuration/config.svelte.js +1 -1
  4. package/dist/index.d.ts +4 -2
  5. package/dist/index.js +2 -1
  6. package/dist/layout/coordinates/CoordinatesLayout.svelte +3 -1
  7. package/dist/layout/facet/FacetLayout.svelte +54 -41
  8. package/dist/layout/geometry/GeometryLayout.svelte +57 -22
  9. package/dist/layout/geometry/ScaleFreeContext.d.ts +31 -0
  10. package/dist/layout/geometry/ScaleFreeContext.js +65 -0
  11. package/dist/layout/geometry/ScaleFreeMarks.svelte +14 -0
  12. package/dist/layout/geometry/ScaleFreeMarks.svelte.d.ts +7 -0
  13. package/dist/layout/geometry/ScaleGate.svelte.d.ts +8 -0
  14. package/dist/layout/geometry/ScaleGate.svelte.js +95 -0
  15. package/dist/layout/geometry/ScaleGateMarks.svelte +15 -0
  16. package/dist/layout/geometry/ScaleGateMarks.svelte.d.ts +7 -0
  17. package/dist/layout/hover/HoverShapes.d.ts +20 -8
  18. package/dist/layout/hover/HoverShapes.js +119 -59
  19. package/dist/layout/legend/ContinuousSection.svelte +10 -0
  20. package/dist/layout/legend/LegendState.svelte.d.ts +13 -1
  21. package/dist/layout/legend/LegendState.svelte.js +32 -0
  22. package/dist/layout/margins/Box.d.ts +4 -0
  23. package/dist/layout/margins/Box.js +14 -0
  24. package/dist/layout/margins/PlotMargins.svelte.js +26 -1
  25. package/dist/layout/plot/{Plot.svelte → AbstractPlot.svelte} +83 -6
  26. package/dist/layout/plot/{Plot.svelte.d.ts → AbstractPlot.svelte.d.ts} +4 -4
  27. package/dist/layout/plot/PublicPlotContext.d.ts +5 -0
  28. package/dist/layout/plot/PublicPlotContext.js +7 -0
  29. package/dist/layout/styles/ValueLabels.d.ts +109 -58
  30. package/dist/layout/styles/ValueLabels.js +299 -141
  31. package/dist/markers/MarkerKinds.d.ts +79 -1
  32. package/dist/markers/MarkerKinds.js +149 -23
  33. package/dist/markers/area/AreaMarker.svelte +1 -1
  34. package/dist/markers/band/BandMarker.svelte +2 -1
  35. package/dist/markers/bar/BarMarker.svelte +8 -6
  36. package/dist/markers/bollinger/BollingerMarker.svelte +1 -1
  37. package/dist/markers/box/BoxMarker.svelte +1 -1
  38. package/dist/markers/dot/DotRadius.d.ts +11 -0
  39. package/dist/markers/dot/DotRadius.js +21 -0
  40. package/dist/markers/geo/GeoHoverMarker.svelte +14 -11
  41. package/dist/markers/labels/CurveLabel.svelte +56 -0
  42. package/dist/markers/labels/CurveLabel.svelte.d.ts +9 -0
  43. package/dist/markers/labels/LabelMerge.d.ts +11 -0
  44. package/dist/markers/labels/LabelMerge.js +87 -0
  45. package/dist/markers/labels/MarkerLabel.svelte +36 -0
  46. package/dist/markers/labels/MarkerLabel.svelte.d.ts +10 -0
  47. package/dist/markers/labels/MarkerLabels.d.ts +52 -0
  48. package/dist/markers/labels/MarkerLabels.js +97 -0
  49. package/dist/markers/labels/geometry/BoxGeometry.d.ts +8 -0
  50. package/dist/markers/labels/geometry/BoxGeometry.js +101 -0
  51. package/dist/markers/labels/geometry/CurveGeometry.d.ts +34 -0
  52. package/dist/markers/labels/geometry/CurveGeometry.js +193 -0
  53. package/dist/markers/labels/geometry/PointGeometry.d.ts +9 -0
  54. package/dist/markers/labels/geometry/PointGeometry.js +22 -0
  55. package/dist/markers/labels/layouts/BoxLayout.d.ts +10 -0
  56. package/dist/markers/labels/layouts/BoxLayout.js +49 -0
  57. package/dist/markers/labels/layouts/PathLayout.d.ts +11 -0
  58. package/dist/markers/labels/layouts/PathLayout.js +91 -0
  59. package/dist/markers/labels/layouts/PointLayout.d.ts +19 -0
  60. package/dist/markers/labels/layouts/PointLayout.js +94 -0
  61. package/dist/markers/regression/RegressionMarker.svelte +1 -1
  62. package/dist/markers/text/Covering.d.ts +13 -0
  63. package/dist/markers/text/Covering.js +29 -0
  64. package/dist/markers/text/Declutter.d.ts +24 -3
  65. package/dist/markers/text/Declutter.js +46 -3
  66. package/dist/markers/text/TextMarker.svelte +90 -17
  67. package/dist/markers/text/TextMarker.svelte.d.ts +1 -1
  68. package/dist/markers/tick/TickMarker.svelte +1 -1
  69. package/dist/markers/utils/MarkerChannels.d.ts +1 -1
  70. package/dist/markers/utils/MarkerChannels.js +3 -2
  71. package/dist/markers/violin/ViolinMarker.svelte +1 -1
  72. package/dist/markers/waffle/WaffleMarker.svelte +1 -1
  73. package/dist/phases/context/RowContext.d.ts +2 -0
  74. package/dist/phases/context/RowContext.js +4 -2
  75. package/dist/phases/context/rowContextKey.d.ts +2 -0
  76. package/dist/phases/context/rowContextKey.js +2 -0
  77. package/dist/phases/markers/MarkerStyles.js +14 -11
  78. package/dist/phases/markers/MarkersPhase.d.ts +2 -3
  79. package/dist/phases/markers/MarkersPhase.js +17 -11
  80. package/dist/phases/sharedScales/SharedStepScales.d.ts +10 -0
  81. package/dist/phases/sharedScales/SharedStepScales.js +43 -0
  82. package/dist/phases/statistics/MarkerGrouping.js +5 -32
  83. package/dist/phases/statistics/MarkerInheritance.d.ts +11 -0
  84. package/dist/phases/statistics/MarkerInheritance.js +25 -0
  85. package/dist/phases/statistics/MarkerOrientation.d.ts +26 -0
  86. package/dist/phases/statistics/MarkerOrientation.js +29 -0
  87. package/dist/phases/statistics/StatisticsPhase.js +15 -15
  88. package/dist/phases/transforms/TransformsPhase.js +5 -3
  89. package/dist/plots/correlation/heatmap/Plot.svelte +2 -2
  90. package/dist/plots/correlation/heatmap/Plot.svelte.d.ts +0 -1
  91. package/dist/plots/correlation/heatmap/defaults.js +14 -1
  92. package/dist/plots/correlation/heatmap/markers.d.ts +0 -6
  93. package/dist/plots/correlation/heatmap/markers.js +5 -9
  94. package/dist/plots/correlation/scatter/Plot.svelte +2 -2
  95. package/dist/plots/correlation/scatter/Plot.svelte.d.ts +0 -1
  96. package/dist/plots/correlation/scatter/defaults.js +9 -3
  97. package/dist/plots/correlation/scatter/markers.d.ts +0 -9
  98. package/dist/plots/correlation/scatter/markers.js +21 -28
  99. package/dist/plots/distribution/box/BoxSummaries.d.ts +5 -0
  100. package/dist/plots/distribution/box/BoxSummaries.js +9 -0
  101. package/dist/plots/distribution/box/Plot.svelte +2 -2
  102. package/dist/plots/distribution/box/Plot.svelte.d.ts +0 -1
  103. package/dist/plots/distribution/box/defaults.js +11 -0
  104. package/dist/plots/distribution/box/markers.js +10 -1
  105. package/dist/plots/distribution/density/Plot.svelte +2 -2
  106. package/dist/plots/distribution/density/Plot.svelte.d.ts +0 -1
  107. package/dist/plots/distribution/density/defaults.js +16 -0
  108. package/dist/plots/distribution/density/markers.js +5 -1
  109. package/dist/plots/distribution/histogram/Plot.svelte +2 -2
  110. package/dist/plots/distribution/histogram/Plot.svelte.d.ts +0 -1
  111. package/dist/plots/distribution/histogram/defaults.js +16 -11
  112. package/dist/plots/distribution/histogram/markers.js +3 -3
  113. package/dist/plots/distribution/pyramid/Plot.svelte +2 -2
  114. package/dist/plots/distribution/pyramid/Plot.svelte.d.ts +0 -1
  115. package/dist/plots/distribution/pyramid/defaults.js +9 -2
  116. package/dist/plots/distribution/pyramid/markers.d.ts +0 -8
  117. package/dist/plots/distribution/pyramid/markers.js +6 -16
  118. package/dist/plots/distribution/violin/Plot.svelte +2 -2
  119. package/dist/plots/distribution/violin/Plot.svelte.d.ts +0 -1
  120. package/dist/plots/distribution/violin/defaults.js +11 -0
  121. package/dist/plots/distribution/violin/markers.js +27 -3
  122. package/dist/plots/evolution/area/Plot.svelte +2 -2
  123. package/dist/plots/evolution/area/Plot.svelte.d.ts +0 -1
  124. package/dist/plots/evolution/area/defaults.js +4 -7
  125. package/dist/plots/evolution/area/markers.js +3 -1
  126. package/dist/plots/evolution/line/Plot.svelte +2 -2
  127. package/dist/plots/evolution/line/Plot.svelte.d.ts +0 -1
  128. package/dist/plots/evolution/line/defaults.js +4 -6
  129. package/dist/plots/evolution/line/markers.js +3 -1
  130. package/dist/plots/evolution/slope/Plot.svelte +2 -2
  131. package/dist/plots/evolution/slope/Plot.svelte.d.ts +0 -1
  132. package/dist/plots/evolution/slope/defaults.js +4 -3
  133. package/dist/plots/evolution/slope/markers.d.ts +4 -3
  134. package/dist/plots/evolution/slope/markers.js +16 -9
  135. package/dist/plots/evolution/sparkline/Plot.svelte +2 -2
  136. package/dist/plots/evolution/sparkline/Plot.svelte.d.ts +0 -1
  137. package/dist/plots/evolution/sparkline/defaults.js +1 -1
  138. package/dist/plots/evolution/sparkline/markers.js +3 -1
  139. package/dist/plots/generic/Plot.svelte +42 -0
  140. package/dist/plots/generic/Plot.svelte.d.ts +25 -0
  141. package/dist/plots/generic/defaults.d.ts +4 -0
  142. package/dist/plots/generic/defaults.js +7 -0
  143. package/dist/plots/map/geo/Core.svelte +29 -6
  144. package/dist/plots/map/geo/Plot.svelte +40 -12
  145. package/dist/plots/map/geo/Plot.svelte.d.ts +0 -1
  146. package/dist/plots/map/geo/phases/data.d.ts +2 -1
  147. package/dist/plots/map/geo/phases/data.js +8 -2
  148. package/dist/plots/map/geo/phases/scales.js +6 -2
  149. package/dist/plots/map/geo/slices.d.ts +27 -3
  150. package/dist/plots/map/geo/slices.js +58 -5
  151. package/dist/plots/part-of-a-whole/treemap/Plot.svelte +2 -2
  152. package/dist/plots/part-of-a-whole/treemap/Plot.svelte.d.ts +0 -1
  153. package/dist/plots/part-of-a-whole/treemap/defaults.js +2 -2
  154. package/dist/plots/ranking/bar/Plot.svelte +2 -2
  155. package/dist/plots/ranking/bar/Plot.svelte.d.ts +0 -1
  156. package/dist/plots/ranking/bar/defaults.js +13 -3
  157. package/dist/plots/ranking/bar/markers.js +12 -29
  158. package/dist/plots/ranking/bullet/Plot.svelte +2 -2
  159. package/dist/plots/ranking/bullet/Plot.svelte.d.ts +0 -1
  160. package/dist/plots/ranking/bullet/defaults.js +20 -0
  161. package/dist/plots/ranking/bullet/markers.js +7 -1
  162. package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +2 -9
  163. package/dist/plots/ranking/cleveland/ClevelandMarkers.js +65 -47
  164. package/dist/plots/ranking/cleveland/Plot.svelte +2 -2
  165. package/dist/plots/ranking/cleveland/Plot.svelte.d.ts +0 -1
  166. package/dist/plots/ranking/cleveland/defaults.js +33 -2
  167. package/dist/plots/ranking/dumbbell/Plot.svelte +2 -2
  168. package/dist/plots/ranking/dumbbell/Plot.svelte.d.ts +0 -1
  169. package/dist/plots/ranking/forest/Plot.svelte +2 -2
  170. package/dist/plots/ranking/forest/Plot.svelte.d.ts +0 -1
  171. package/dist/plots/ranking/lollipop/Plot.svelte +2 -2
  172. package/dist/plots/ranking/lollipop/Plot.svelte.d.ts +0 -1
  173. package/dist/types/layout/context.d.ts +2 -0
  174. package/dist/types/layout/plot.d.ts +2 -0
  175. package/dist/types/layout/styles/bullet.d.ts +4 -1
  176. package/dist/types/layout/styles/geo.d.ts +3 -3
  177. package/dist/types/layout/styles/values.d.ts +51 -11
  178. package/dist/types/markers/axis/area.d.ts +5 -1
  179. package/dist/types/markers/axis/bar.d.ts +5 -2
  180. package/dist/types/markers/axis/bollinger.d.ts +2 -1
  181. package/dist/types/markers/axis/box.d.ts +2 -1
  182. package/dist/types/markers/axis/cell.d.ts +4 -1
  183. package/dist/types/markers/axis/line.d.ts +4 -1
  184. package/dist/types/markers/axis/rect.d.ts +4 -1
  185. package/dist/types/markers/axis/regression.d.ts +2 -1
  186. package/dist/types/markers/axis/tick.d.ts +2 -1
  187. package/dist/types/markers/axis/trail.d.ts +4 -1
  188. package/dist/types/markers/axis/violin.d.ts +2 -1
  189. package/dist/types/markers/axis/waffle.d.ts +5 -1
  190. package/dist/types/markers/basic/dot.d.ts +4 -1
  191. package/dist/types/markers/basic/text.d.ts +25 -21
  192. package/dist/types/markers/channels/commonMarkerConfigWithLabel.d.ts +5 -9
  193. package/dist/types/markers/channels/commonMarkerConfigWithOrientation.d.ts +5 -0
  194. package/dist/types/markers/channels/commonMarkerConfigWithOrientation.js +1 -0
  195. package/dist/types/markers/labels/box.d.ts +57 -0
  196. package/dist/types/markers/labels/box.js +1 -0
  197. package/dist/types/markers/labels/common.d.ts +15 -0
  198. package/dist/types/markers/labels/common.js +1 -0
  199. package/dist/types/markers/labels/path.d.ts +52 -0
  200. package/dist/types/markers/labels/path.js +1 -0
  201. package/dist/types/markers/labels/point.d.ts +40 -0
  202. package/dist/types/markers/labels/point.js +1 -0
  203. package/dist/types/markers/traits.d.ts +10 -0
  204. package/dist/types/phases/markers/phase.d.ts +1 -8
  205. package/dist/types/phases/statistics/phase.d.ts +8 -3
  206. package/dist/types/phases/styles/phase.d.ts +15 -3
  207. package/dist/types/phases/transforms/phase.d.ts +2 -0
  208. package/dist/types/plots/constants.d.ts +0 -12
  209. package/dist/types/plots/correlation/heatmap/props.d.ts +3 -2
  210. package/dist/types/plots/correlation/scatter/props.d.ts +3 -2
  211. package/dist/types/plots/data/geo.d.ts +19 -5
  212. package/dist/types/plots/distribution/box/props.d.ts +6 -2
  213. package/dist/types/plots/distribution/density/props.d.ts +2 -1
  214. package/dist/types/plots/distribution/histogram/props.d.ts +3 -2
  215. package/dist/types/plots/distribution/pyramid/props.d.ts +3 -2
  216. package/dist/types/plots/distribution/violin/props.d.ts +4 -1
  217. package/dist/types/plots/evolution/area/props.d.ts +3 -2
  218. package/dist/types/plots/evolution/line/props.d.ts +3 -2
  219. package/dist/types/plots/generic/props.d.ts +16 -0
  220. package/dist/types/plots/generic/props.js +1 -0
  221. package/dist/types/plots/generic/state.d.ts +4 -0
  222. package/dist/types/plots/generic/state.js +1 -0
  223. package/dist/types/plots/map/geo/props.d.ts +9 -3
  224. package/dist/types/plots/map/geo/state.d.ts +3 -1
  225. package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +4 -2
  226. package/dist/types/plots/ranking/bar/props.d.ts +3 -2
  227. package/dist/types/plots/ranking/cleveland/props.d.ts +3 -2
  228. package/dist/types/plots/ranking/dumbbell/props.d.ts +3 -2
  229. package/dist/types/plots/ranking/forest/props.d.ts +5 -2
  230. package/dist/types/plots/ranking/lollipop/props.d.ts +3 -2
  231. package/dist/utils/ConfigEquality.d.ts +11 -0
  232. package/dist/utils/ConfigEquality.js +37 -0
  233. package/docs/architecture.md +9 -9
  234. package/docs/facets.md +12 -0
  235. package/docs/geo.md +35 -7
  236. package/docs/legend.md +6 -0
  237. package/docs/markers.md +2 -4
  238. package/docs/plots/ranking/bar.md +1 -1
  239. package/docs/plots/ranking/cleveland.md +1 -1
  240. package/docs/state.md +1 -1
  241. package/docs/styles-and-segments.md +1 -14
  242. package/docs/timeline.md +1 -1
  243. package/docs/transforms-and-statistics.md +1 -1
  244. package/docs/value-labels.md +159 -0
  245. package/examples/BarValues.svelte +1 -1
  246. package/llms-full.txt +5 -5
  247. package/llms.txt +1 -0
  248. package/package.json +3 -1
  249. package/dist/markers/utils/BoxLabel.d.ts +0 -58
  250. package/dist/markers/utils/BoxLabel.js +0 -175
  251. package/dist/markers/utils/MarkerLabel.svelte +0 -33
  252. package/dist/markers/utils/MarkerLabel.svelte.d.ts +0 -10
@@ -1,4 +1,4 @@
1
- import type { MarkerTraits } from '../types/markers/traits';
1
+ import type { InheritedChannel, MarkerTraits } from '../types/markers/traits';
2
2
  /**
3
3
  * Every marker kind's traits, in one row each. Typed over every kind, so a
4
4
  * new kind can't be added without declaring all of its traits here.
@@ -6,9 +6,16 @@ import type { MarkerTraits } from '../types/markers/traits';
6
6
  export declare class MarkerKinds {
7
7
  static readonly traits: {
8
8
  area: {
9
+ oriented: true;
10
+ inherits: ("grouping" | "x" | "y" | "color" | "opacity")[];
9
11
  clip: true;
10
12
  drawsRows: true;
11
13
  legendSymbol: "area";
14
+ labels: {
15
+ default: "point";
16
+ path: "area";
17
+ point: "top";
18
+ };
12
19
  };
13
20
  arrow: {
14
21
  clip: false;
@@ -20,11 +27,21 @@ export declare class MarkerKinds {
20
27
  legendSymbol: "rect";
21
28
  };
22
29
  bar: {
30
+ oriented: true;
31
+ inherits: ("x" | "y" | "color")[];
23
32
  clip: true;
24
33
  drawsRows: true;
25
34
  legendSymbol: "bar";
35
+ labels: {
36
+ default: "box";
37
+ box: "band";
38
+ path: "box";
39
+ point: "box";
40
+ };
26
41
  };
27
42
  bollinger: {
43
+ oriented: true;
44
+ inherits: ("x" | "y")[];
28
45
  clip: true;
29
46
  drawsRows: true;
30
47
  legendSymbol: "line";
@@ -34,14 +51,23 @@ export declare class MarkerKinds {
34
51
  drawsRows: false;
35
52
  };
36
53
  box: {
54
+ oriented: true;
55
+ inherits: ("x" | "y")[];
37
56
  clip: true;
38
57
  drawsRows: true;
39
58
  legendSymbol: "bar";
40
59
  };
41
60
  cell: {
61
+ inherits: ("x" | "y" | "color" | "opacity")[];
42
62
  clip: true;
43
63
  drawsRows: true;
44
64
  legendSymbol: "cell";
65
+ labels: {
66
+ default: "box";
67
+ box: "cell";
68
+ path: "box";
69
+ point: "box";
70
+ };
45
71
  };
46
72
  component: {
47
73
  clip: false;
@@ -52,10 +78,12 @@ export declare class MarkerKinds {
52
78
  drawsRows: false;
53
79
  };
54
80
  delaunayLink: {
81
+ inherits: ("grouping" | "x" | "y" | "color")[];
55
82
  clip: true;
56
83
  drawsRows: true;
57
84
  };
58
85
  delaunayMesh: {
86
+ inherits: ("grouping" | "x" | "y" | "color")[];
59
87
  clip: true;
60
88
  drawsRows: true;
61
89
  };
@@ -64,19 +92,27 @@ export declare class MarkerKinds {
64
92
  drawsRows: false;
65
93
  };
66
94
  density: {
95
+ inherits: ("grouping" | "x" | "y" | "color")[];
67
96
  clip: true;
68
97
  drawsRows: true;
69
98
  legendSymbol: "area";
70
99
  };
71
100
  difference: {
101
+ inherits: ("x" | "y")[];
72
102
  clip: true;
73
103
  drawsRows: true;
74
104
  legendSymbol: "area";
75
105
  };
76
106
  dot: {
107
+ inherits: ("symbol" | "x" | "y" | "color" | "opacity" | "r")[];
77
108
  clip: false;
78
109
  drawsRows: true;
79
110
  legendSymbol: "dot";
111
+ labels: {
112
+ default: "point";
113
+ path: "rim";
114
+ point: "dot";
115
+ };
80
116
  };
81
117
  geo: {
82
118
  clip: false;
@@ -99,11 +135,13 @@ export declare class MarkerKinds {
99
135
  drawsRows: false;
100
136
  };
101
137
  hull: {
138
+ inherits: ("grouping" | "x" | "y" | "color")[];
102
139
  clip: true;
103
140
  drawsRows: true;
104
141
  legendSymbol: "area";
105
142
  };
106
143
  image: {
144
+ inherits: ("x" | "y")[];
107
145
  clip: false;
108
146
  drawsRows: true;
109
147
  };
@@ -112,9 +150,15 @@ export declare class MarkerKinds {
112
150
  drawsRows: false;
113
151
  };
114
152
  line: {
153
+ inherits: ("grouping" | "x" | "y" | "color")[];
115
154
  clip: true;
116
155
  drawsRows: true;
117
156
  legendSymbol: "line";
157
+ labels: {
158
+ default: "point";
159
+ path: "stroke";
160
+ point: "row";
161
+ };
118
162
  };
119
163
  link: {
120
164
  clip: false;
@@ -125,11 +169,20 @@ export declare class MarkerKinds {
125
169
  drawsRows: true;
126
170
  };
127
171
  rect: {
172
+ inherits: ("x" | "y" | "color" | "opacity")[];
128
173
  clip: true;
129
174
  drawsRows: true;
130
175
  legendSymbol: "rect";
176
+ labels: {
177
+ default: "box";
178
+ box: "edges";
179
+ path: "box";
180
+ point: "box";
181
+ };
131
182
  };
132
183
  regression: {
184
+ oriented: true;
185
+ inherits: ("x" | "y")[];
133
186
  clip: true;
134
187
  drawsRows: true;
135
188
  legendSymbol: "line";
@@ -144,40 +197,65 @@ export declare class MarkerKinds {
144
197
  drawsRows: false;
145
198
  };
146
199
  text: {
200
+ inherits: ("x" | "y")[];
147
201
  clip: false;
148
202
  drawsRows: true;
149
203
  };
150
204
  tick: {
205
+ oriented: true;
206
+ inherits: "color"[];
151
207
  clip: true;
152
208
  drawsRows: true;
153
209
  };
154
210
  trail: {
211
+ inherits: ("grouping" | "x" | "y" | "color" | "opacity" | "r")[];
155
212
  clip: true;
156
213
  drawsRows: true;
157
214
  legendSymbol: "line";
215
+ labels: {
216
+ default: "point";
217
+ path: "stroke";
218
+ point: "row";
219
+ };
158
220
  };
159
221
  vector: {
222
+ inherits: "length"[];
160
223
  clip: false;
161
224
  drawsRows: false;
162
225
  };
163
226
  violin: {
227
+ oriented: true;
228
+ inherits: ("x" | "y")[];
164
229
  clip: true;
165
230
  drawsRows: true;
166
231
  legendSymbol: "area";
167
232
  };
168
233
  voronoi: {
234
+ inherits: ("grouping" | "x" | "y" | "color")[];
169
235
  clip: true;
170
236
  drawsRows: true;
171
237
  };
172
238
  voronoiMesh: {
239
+ inherits: ("grouping" | "x" | "y" | "color")[];
173
240
  clip: true;
174
241
  drawsRows: true;
175
242
  };
176
243
  waffle: {
244
+ oriented: true;
245
+ inherits: ("x" | "y" | "color")[];
177
246
  clip: true;
178
247
  drawsRows: true;
248
+ labels: {
249
+ default: "box";
250
+ box: "band";
251
+ path: "box";
252
+ point: "box";
253
+ };
179
254
  };
180
255
  };
181
256
  /** The traits of a marker kind, or `undefined` for a type no kind declares. */
182
257
  static of(type: string | undefined): MarkerTraits | undefined;
258
+ static inherits(type: string | undefined, channel: InheritedChannel): boolean;
259
+ /** Whether the kind takes the plot's scales: it inherits a channel that has one. */
260
+ static inheritsScales(type: string | undefined): boolean;
183
261
  }
@@ -1,48 +1,167 @@
1
+ const SCALED = ['color', 'opacity', 'symbol', 'r', 'length'];
1
2
  /**
2
3
  * Every marker kind's traits, in one row each. Typed over every kind, so a
3
4
  * new kind can't be added without declaring all of its traits here.
4
5
  */
5
6
  export class MarkerKinds {
6
7
  static traits = {
7
- area: { clip: true, drawsRows: true, legendSymbol: 'area' },
8
+ area: {
9
+ oriented: true,
10
+ inherits: ['x', 'y', 'grouping', 'color', 'opacity'],
11
+ clip: true,
12
+ drawsRows: true,
13
+ legendSymbol: 'area',
14
+ labels: { default: 'point', path: 'area', point: 'top' }
15
+ },
8
16
  arrow: { clip: false, drawsRows: true },
9
17
  band: { clip: true, drawsRows: false, legendSymbol: 'rect' },
10
- bar: { clip: true, drawsRows: true, legendSymbol: 'bar' },
11
- bollinger: { clip: true, drawsRows: true, legendSymbol: 'line' },
18
+ bar: {
19
+ oriented: true,
20
+ inherits: ['x', 'y', 'color'],
21
+ clip: true,
22
+ drawsRows: true,
23
+ legendSymbol: 'bar',
24
+ labels: { default: 'box', box: 'band', path: 'box', point: 'box' }
25
+ },
26
+ bollinger: {
27
+ oriented: true,
28
+ inherits: ['x', 'y'],
29
+ clip: true,
30
+ drawsRows: true,
31
+ legendSymbol: 'line'
32
+ },
12
33
  brush: { clip: false, drawsRows: false },
13
- box: { clip: true, drawsRows: true, legendSymbol: 'bar' },
14
- cell: { clip: true, drawsRows: true, legendSymbol: 'cell' },
34
+ box: {
35
+ oriented: true,
36
+ inherits: ['x', 'y'],
37
+ clip: true,
38
+ drawsRows: true,
39
+ legendSymbol: 'bar'
40
+ },
41
+ cell: {
42
+ inherits: ['x', 'y', 'color', 'opacity'],
43
+ clip: true,
44
+ drawsRows: true,
45
+ legendSymbol: 'cell',
46
+ labels: { default: 'box', box: 'cell', path: 'box', point: 'box' }
47
+ },
15
48
  component: { clip: false, drawsRows: false },
16
49
  contour: { clip: false, drawsRows: false },
17
- delaunayLink: { clip: true, drawsRows: true },
18
- delaunayMesh: { clip: true, drawsRows: true },
50
+ delaunayLink: {
51
+ inherits: ['x', 'y', 'grouping', 'color'],
52
+ clip: true,
53
+ drawsRows: true
54
+ },
55
+ delaunayMesh: {
56
+ inherits: ['x', 'y', 'grouping', 'color'],
57
+ clip: true,
58
+ drawsRows: true
59
+ },
19
60
  delta: { clip: false, drawsRows: false },
20
- density: { clip: true, drawsRows: true, legendSymbol: 'area' },
21
- difference: { clip: true, drawsRows: true, legendSymbol: 'area' },
22
- dot: { clip: false, drawsRows: true, legendSymbol: 'dot' },
61
+ density: {
62
+ inherits: ['x', 'y', 'grouping', 'color'],
63
+ clip: true,
64
+ drawsRows: true,
65
+ legendSymbol: 'area'
66
+ },
67
+ difference: {
68
+ inherits: ['x', 'y'],
69
+ clip: true,
70
+ drawsRows: true,
71
+ legendSymbol: 'area'
72
+ },
73
+ dot: {
74
+ inherits: ['x', 'y', 'color', 'opacity', 'symbol', 'r'],
75
+ clip: false,
76
+ drawsRows: true,
77
+ legendSymbol: 'dot',
78
+ labels: { default: 'point', path: 'rim', point: 'dot' }
79
+ },
23
80
  geo: { clip: false, drawsRows: false },
24
81
  'geo-component': { clip: false, drawsRows: true },
25
82
  'geo-hover': { clip: false, drawsRows: false },
26
83
  graticule: { clip: false, drawsRows: false },
27
84
  hover: { clip: false, drawsRows: false },
28
- hull: { clip: true, drawsRows: true, legendSymbol: 'area' },
29
- image: { clip: false, drawsRows: true },
85
+ hull: {
86
+ inherits: ['x', 'y', 'grouping', 'color'],
87
+ clip: true,
88
+ drawsRows: true,
89
+ legendSymbol: 'area'
90
+ },
91
+ image: {
92
+ inherits: ['x', 'y'],
93
+ clip: false,
94
+ drawsRows: true
95
+ },
30
96
  inset: { clip: false, drawsRows: false },
31
- line: { clip: true, drawsRows: true, legendSymbol: 'line' },
97
+ line: {
98
+ inherits: ['x', 'y', 'grouping', 'color'],
99
+ clip: true,
100
+ drawsRows: true,
101
+ legendSymbol: 'line',
102
+ labels: { default: 'point', path: 'stroke', point: 'row' }
103
+ },
32
104
  link: { clip: false, drawsRows: false },
33
105
  raster: { clip: true, drawsRows: true },
34
- rect: { clip: true, drawsRows: true, legendSymbol: 'rect' },
35
- regression: { clip: true, drawsRows: true, legendSymbol: 'line' },
106
+ rect: {
107
+ inherits: ['x', 'y', 'color', 'opacity'],
108
+ clip: true,
109
+ drawsRows: true,
110
+ legendSymbol: 'rect',
111
+ labels: { default: 'box', box: 'edges', path: 'box', point: 'box' }
112
+ },
113
+ regression: {
114
+ oriented: true,
115
+ inherits: ['x', 'y'],
116
+ clip: true,
117
+ drawsRows: true,
118
+ legendSymbol: 'line'
119
+ },
36
120
  rule: { clip: true, drawsRows: false, legendSymbol: 'line' },
37
121
  sphere: { clip: false, drawsRows: false },
38
- text: { clip: false, drawsRows: true },
39
- tick: { clip: true, drawsRows: true },
40
- trail: { clip: true, drawsRows: true, legendSymbol: 'line' },
41
- vector: { clip: false, drawsRows: false },
42
- violin: { clip: true, drawsRows: true, legendSymbol: 'area' },
43
- voronoi: { clip: true, drawsRows: true },
44
- voronoiMesh: { clip: true, drawsRows: true },
45
- waffle: { clip: true, drawsRows: true }
122
+ text: {
123
+ inherits: ['x', 'y'],
124
+ clip: false,
125
+ drawsRows: true
126
+ },
127
+ tick: {
128
+ oriented: true,
129
+ inherits: ['color'],
130
+ clip: true,
131
+ drawsRows: true
132
+ },
133
+ trail: {
134
+ inherits: ['x', 'y', 'grouping', 'color', 'opacity', 'r'],
135
+ clip: true,
136
+ drawsRows: true,
137
+ legendSymbol: 'line',
138
+ labels: { default: 'point', path: 'stroke', point: 'row' }
139
+ },
140
+ vector: { inherits: ['length'], clip: false, drawsRows: false },
141
+ violin: {
142
+ oriented: true,
143
+ inherits: ['x', 'y'],
144
+ clip: true,
145
+ drawsRows: true,
146
+ legendSymbol: 'area'
147
+ },
148
+ voronoi: {
149
+ inherits: ['x', 'y', 'grouping', 'color'],
150
+ clip: true,
151
+ drawsRows: true
152
+ },
153
+ voronoiMesh: {
154
+ inherits: ['x', 'y', 'grouping', 'color'],
155
+ clip: true,
156
+ drawsRows: true
157
+ },
158
+ waffle: {
159
+ oriented: true,
160
+ inherits: ['x', 'y', 'color'],
161
+ clip: true,
162
+ drawsRows: true,
163
+ labels: { default: 'box', box: 'band', path: 'box', point: 'box' }
164
+ }
46
165
  };
47
166
  /** The traits of a marker kind, or `undefined` for a type no kind declares. */
48
167
  static of(type) {
@@ -50,4 +169,11 @@ export class MarkerKinds {
50
169
  ? MarkerKinds.traits[type]
51
170
  : undefined;
52
171
  }
172
+ static inherits(type, channel) {
173
+ return MarkerKinds.of(type)?.inherits?.includes(channel) ?? false;
174
+ }
175
+ /** Whether the kind takes the plot's scales: it inherits a channel that has one. */
176
+ static inheritsScales(type) {
177
+ return SCALED.some((channel) => MarkerKinds.inherits(type, channel));
178
+ }
53
179
  }
@@ -16,7 +16,7 @@
16
16
  const events = MarkerEvents.use(() => marker);
17
17
 
18
18
  const plot = usePlot();
19
- const isHorizontal = $derived(plot.axes?.isHorizontal ?? false);
19
+ const isHorizontal = $derived(marker.isHorizontal ?? plot.axes?.isHorizontal ?? false);
20
20
  const AreaMark = $derived(isHorizontal ? AreaX : AreaY);
21
21
 
22
22
  const cfg = $derived(getConfiguration());
@@ -34,7 +34,8 @@
34
34
  function boxOf(band: Band) {
35
35
  const bandwidth = scale.fn.bandwidth?.() ?? 0;
36
36
  const start = Number(scale.fn(band.category as never));
37
- const from = start + band.slice.start * bandwidth;
37
+ // Horizontal bars count their slices from the bottom of the band, as `BandNudge` and the bars' hit areas do.
38
+ const from = start + (marker.axis === 'y' ? band.slice.end : band.slice.start) * bandwidth;
38
39
  const size = Math.max(0, bandwidth * (1 - band.slice.start - band.slice.end));
39
40
  const [low, high] = extent;
40
41
  return marker.axis === 'x'
@@ -19,7 +19,9 @@
19
19
  const data = $derived(marker.data ?? []);
20
20
  const channelFill = $derived(MarkerChannels.buildFill(data, marker.color, marker.scales, cfg));
21
21
 
22
- const plot = usePlot().svelteplot;
22
+ const context = usePlot();
23
+ const plot = context.svelteplot;
24
+ const isHorizontal = $derived(marker.isHorizontal ?? context.axes?.isHorizontal ?? false);
23
25
  function categoryScaleFor(isHorizontal: boolean) {
24
26
  return isHorizontal ? plot.scales.y : plot.scales.x;
25
27
  }
@@ -36,11 +38,11 @@
36
38
  </script>
37
39
 
38
40
  {#if marker.role === 'segment'}
39
- {@const categoryScale = categoryScaleFor(marker.isHorizontal)}
41
+ {@const categoryScale = categoryScaleFor(isHorizontal)}
40
42
  {@const bandwidth = categoryScale?.type === 'band' ? categoryScale.fn.bandwidth() : 0}
41
43
  {@const centered =
42
44
  marker.thickness != null ? Math.max(0, (bandwidth - marker.thickness) / 2) : undefined}
43
- {#if marker.isHorizontal}
45
+ {#if isHorizontal}
44
46
  <BarX
45
47
  {...events.props}
46
48
  {data}
@@ -80,7 +82,7 @@
80
82
  />
81
83
  {/if}
82
84
  {:else}
83
- {@const categoryScale = categoryScaleFor(marker.isHorizontal)}
85
+ {@const categoryScale = categoryScaleFor(isHorizontal)}
84
86
  {#if categoryScale?.type === 'band'}
85
87
  {@const bandwidth = categoryScale.fn.bandwidth()}
86
88
  {@const bandStart = Number(categoryScale.fn(marker.category as never) ?? 0)}
@@ -89,8 +91,8 @@
89
91
  {@const insetTop = (marker.styles?.insetTop ?? 0) * bandwidth}
90
92
  {@const insetBottom = (marker.styles?.insetBottom ?? 0) * bandwidth}
91
93
  <!-- The band runs the plot's whole value axis, so the pointer needn't be over the bar. -->
92
- {@const [rangeMin, rangeMax] = valueExtentFor(marker.isHorizontal)}
93
- {#if marker.isHorizontal}
94
+ {@const [rangeMin, rangeMax] = valueExtentFor(isHorizontal)}
95
+ {#if isHorizontal}
94
96
  <rect
95
97
  class="dct-hit-area"
96
98
  x={rangeMin + insetLeft}
@@ -22,7 +22,7 @@
22
22
  const events = MarkerEvents.use(() => marker);
23
23
 
24
24
  const plot = usePlot();
25
- const isHorizontal = $derived(plot.axes?.isHorizontal ?? false);
25
+ const isHorizontal = $derived(marker.isHorizontal ?? plot.axes?.isHorizontal ?? false);
26
26
  const BollingerMark = $derived(isHorizontal ? BollingerX : BollingerY);
27
27
 
28
28
  const cfg = $derived(getConfiguration());
@@ -19,7 +19,7 @@
19
19
  const events = MarkerEvents.use(() => marker);
20
20
 
21
21
  const plot = usePlot();
22
- const isHorizontal = $derived(plot.axes?.isHorizontal ?? false);
22
+ const isHorizontal = $derived(marker.isHorizontal ?? plot.axes?.isHorizontal ?? false);
23
23
  const BoxMark = $derived(isHorizontal ? BoxX : BoxY);
24
24
 
25
25
  /**
@@ -0,0 +1,11 @@
1
+ import type { BoxScales } from '../../types/markers/labels/box';
2
+ type Dotted = {
3
+ r?: unknown;
4
+ styles?: object;
5
+ };
6
+ /** A dot's radius in pixels, as its marker draws it. */
7
+ export declare class DotRadius {
8
+ /** Its `r`: a number as it is, a channel through the plot's `r` scale; else its `dotRadius`, else `fallback`. */
9
+ static of(marker: Dotted, row: unknown, scales: BoxScales, fallback?: number): number;
10
+ }
11
+ export {};
@@ -0,0 +1,21 @@
1
+ const read = (channel, row) => typeof channel === 'function'
2
+ ? channel(row)
3
+ : typeof channel === 'string' || typeof channel === 'symbol'
4
+ ? row?.[channel]
5
+ : channel;
6
+ /** A dot's radius in pixels, as its marker draws it. */
7
+ export class DotRadius {
8
+ /** Its `r`: a number as it is, a channel through the plot's `r` scale; else its `dotRadius`, else `fallback`. */
9
+ static of(marker, row, scales, fallback = 5) {
10
+ const { r } = marker;
11
+ if (typeof r === 'number')
12
+ return r;
13
+ if (r !== undefined && scales.r) {
14
+ const value = Number(scales.r.fn(read(r, row)));
15
+ if (Number.isFinite(value))
16
+ return value;
17
+ }
18
+ const own = marker.styles?.dotRadius;
19
+ return typeof own === 'number' ? own : fallback;
20
+ }
21
+ }
@@ -1,10 +1,11 @@
1
1
  <script lang="ts">
2
2
  import { Geo } from 'svelteplot';
3
+ import ScaleFreeMarks from '../../layout/geometry/ScaleFreeMarks.svelte';
3
4
  import { getConfiguration } from '../../configuration/config.svelte';
4
5
  import type { GeoHoverMarkerConfig } from '../../types/markers/geo';
5
6
  import type { HoverPoint } from '../../types/layout/hover';
6
7
 
7
- /** Renders the hovered feature restyled in place - no dot, no label. `pointer-events: none` so it never steals hover from the base map underneath it. */
8
+ /** Renders the hovered feature restyled in place - no dot, no label. `pointer-events: none` so it never steals hover from the base map underneath it. Drawn on the plot's projection and scales without joining them, so a feature entering or leaving it never lays the map out again. */
8
9
  let {
9
10
  marker,
10
11
  data
@@ -15,14 +16,16 @@
15
16
  </script>
16
17
 
17
18
  {#if data.length > 0}
18
- <Geo
19
- data={data.map((p) => p.row)}
20
- fill={style.fill}
21
- fillOpacity={style.fillOpacity}
22
- stroke={style.stroke}
23
- strokeWidth={style.strokeWidth}
24
- strokeOpacity={style.strokeOpacity}
25
- strokeDasharray={style.strokeDasharray}
26
- style="vector-effect: non-scaling-stroke; pointer-events: none;"
27
- />
19
+ <ScaleFreeMarks>
20
+ <Geo
21
+ data={data.map((p) => p.row)}
22
+ fill={style.fill}
23
+ fillOpacity={style.fillOpacity}
24
+ stroke={style.stroke}
25
+ strokeWidth={style.strokeWidth}
26
+ strokeOpacity={style.strokeOpacity}
27
+ strokeDasharray={style.strokeDasharray}
28
+ style="vector-effect: non-scaling-stroke; pointer-events: none;"
29
+ />
30
+ </ScaleFreeMarks>
28
31
  {/if}
@@ -0,0 +1,56 @@
1
+ <script lang="ts">
2
+ import { usePlot } from '../../layout/plot/usePlot';
3
+ import { getConfiguration } from '../../configuration/config.svelte';
4
+ import { CurveGeometry } from './geometry/CurveGeometry';
5
+ import { Box } from '../../layout/margins/Box';
6
+ import type { PathLabelConfig, PathShape } from '../../types/markers/labels/path';
7
+ import type { BoxScales } from '../../types/markers/labels/box';
8
+
9
+ /** Writes one `'path'` label along the curves of a marker: its lines, an area's edge or each dot's rim. */
10
+ const {
11
+ marker,
12
+ label,
13
+ shape
14
+ }: {
15
+ marker: Record<string, unknown>;
16
+ label: PathLabelConfig<string, string>;
17
+ shape: Exclude<PathShape, 'box'>;
18
+ } = $props();
19
+ const plot = usePlot();
20
+ const cfg = $derived(getConfiguration());
21
+ const id = $props.id();
22
+
23
+ const styles = $derived(label.styles ?? {});
24
+ const curves = $derived(
25
+ CurveGeometry.build(shape, marker, label, {
26
+ scales: plot.svelteplot.scales as unknown as BoxScales,
27
+ gap: cfg.text.label.gap,
28
+ measure: (text) => Box.ofText(text, Number(styles.fontSize ?? 11), cfg).width
29
+ })
30
+ );
31
+ // Centred on its curve, a label is drawn over a halo of the background so the curve does not cross it.
32
+ const halo = $derived((label.side ?? '') === 'on' && styles.stroke === undefined);
33
+ /** A style's value for a curve's row: a function of the row, or the value itself. */
34
+ const of = (value: unknown, row: unknown) =>
35
+ (typeof value === 'function' ? value(row) : value) as string | number | undefined;
36
+ </script>
37
+
38
+ {#each curves as curve, i (i)}
39
+ <path id="{id}-{i}" d={curve.d} fill="none" stroke="none" />
40
+ <text
41
+ dy={curve.dy}
42
+ dominant-baseline={curve.baseline}
43
+ text-anchor={curve.textAnchor}
44
+ fill={String(of(styles.fill, curve.row) ?? curve.fill ?? 'currentColor')}
45
+ fill-opacity={of(styles.fillOpacity, curve.row)}
46
+ font-size={styles.fontSize ?? 11}
47
+ font-weight={of(styles.fontWeight, curve.row)}
48
+ font-style={of(styles.fontStyle, curve.row)}
49
+ stroke={halo ? cfg.background : (of(styles.stroke, curve.row) as string | undefined)}
50
+ stroke-width={halo ? 3 : of(styles.strokeWidth, curve.row)}
51
+ paint-order={halo ? 'stroke' : styles.paintOrder}
52
+ pointer-events="none"
53
+ >
54
+ <textPath href="#{id}-{i}" startOffset={curve.startOffset}>{curve.text}</textPath>
55
+ </text>
56
+ {/each}
@@ -0,0 +1,9 @@
1
+ import type { PathLabelConfig, PathShape } from '../../types/markers/labels/path';
2
+ type $$ComponentProps = {
3
+ marker: Record<string, unknown>;
4
+ label: PathLabelConfig<string, string>;
5
+ shape: Exclude<PathShape, 'box'>;
6
+ };
7
+ declare const CurveLabel: import("svelte").Component<$$ComponentProps, {}, "">;
8
+ type CurveLabel = ReturnType<typeof CurveLabel>;
9
+ export default CurveLabel;
@@ -0,0 +1,11 @@
1
+ import type { TextMarkerConfig } from '../../types/markers/basic/text';
2
+ /** The label a merged row was written by. */
3
+ export declare const LABEL_SOURCE: unique symbol;
4
+ /**
5
+ * Labels drawn as one `text` marker: those whose other options are alike merge, each row tagged with the label
6
+ * it comes from, so labels from several markers declutter together and draw as one.
7
+ */
8
+ export declare class LabelMerge {
9
+ #private;
10
+ static merge(markers: TextMarkerConfig[]): TextMarkerConfig[];
11
+ }