@fundar/data-chart-telling 1.18.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.
- package/CHANGELOG.md +35 -0
- package/README.md +2 -1
- package/dist/configuration/config.svelte.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/layout/coordinates/CoordinatesLayout.svelte +3 -1
- package/dist/layout/geometry/GeometryLayout.svelte +57 -22
- package/dist/layout/geometry/ScaleFreeContext.d.ts +31 -0
- package/dist/layout/geometry/ScaleFreeContext.js +65 -0
- package/dist/layout/geometry/ScaleFreeMarks.svelte +14 -0
- package/dist/layout/geometry/ScaleFreeMarks.svelte.d.ts +7 -0
- package/dist/layout/geometry/ScaleGate.svelte.d.ts +8 -0
- package/dist/layout/geometry/ScaleGate.svelte.js +95 -0
- package/dist/layout/geometry/ScaleGateMarks.svelte +15 -0
- package/dist/layout/geometry/ScaleGateMarks.svelte.d.ts +7 -0
- package/dist/layout/hover/HoverShapes.d.ts +20 -8
- package/dist/layout/hover/HoverShapes.js +119 -59
- package/dist/layout/margins/Box.d.ts +4 -0
- package/dist/layout/margins/Box.js +14 -0
- package/dist/layout/margins/PlotMargins.svelte.js +26 -1
- package/dist/layout/plot/{Plot.svelte.d.ts → AbstractPlot.svelte.d.ts} +3 -3
- package/dist/layout/styles/ValueLabels.d.ts +109 -58
- package/dist/layout/styles/ValueLabels.js +299 -141
- package/dist/markers/MarkerKinds.d.ts +79 -1
- package/dist/markers/MarkerKinds.js +149 -23
- package/dist/markers/area/AreaMarker.svelte +1 -1
- package/dist/markers/bar/BarMarker.svelte +8 -6
- package/dist/markers/bollinger/BollingerMarker.svelte +1 -1
- package/dist/markers/box/BoxMarker.svelte +1 -1
- package/dist/markers/dot/DotRadius.d.ts +11 -0
- package/dist/markers/dot/DotRadius.js +21 -0
- package/dist/markers/labels/CurveLabel.svelte +56 -0
- package/dist/markers/labels/CurveLabel.svelte.d.ts +9 -0
- package/dist/markers/labels/LabelMerge.d.ts +11 -0
- package/dist/markers/labels/LabelMerge.js +87 -0
- package/dist/markers/labels/MarkerLabel.svelte +36 -0
- package/dist/markers/labels/MarkerLabel.svelte.d.ts +10 -0
- package/dist/markers/labels/MarkerLabels.d.ts +52 -0
- package/dist/markers/labels/MarkerLabels.js +97 -0
- package/dist/markers/labels/geometry/BoxGeometry.d.ts +8 -0
- package/dist/markers/labels/geometry/BoxGeometry.js +101 -0
- package/dist/markers/labels/geometry/CurveGeometry.d.ts +34 -0
- package/dist/markers/labels/geometry/CurveGeometry.js +193 -0
- package/dist/markers/labels/geometry/PointGeometry.d.ts +9 -0
- package/dist/markers/labels/geometry/PointGeometry.js +22 -0
- package/dist/markers/labels/layouts/BoxLayout.d.ts +10 -0
- package/dist/markers/labels/layouts/BoxLayout.js +49 -0
- package/dist/markers/labels/layouts/PathLayout.d.ts +11 -0
- package/dist/markers/labels/layouts/PathLayout.js +91 -0
- package/dist/markers/labels/layouts/PointLayout.d.ts +19 -0
- package/dist/markers/labels/layouts/PointLayout.js +94 -0
- package/dist/markers/regression/RegressionMarker.svelte +1 -1
- package/dist/markers/text/Covering.d.ts +13 -0
- package/dist/markers/text/Covering.js +29 -0
- package/dist/markers/text/Declutter.d.ts +24 -3
- package/dist/markers/text/Declutter.js +46 -3
- package/dist/markers/text/TextMarker.svelte +90 -17
- package/dist/markers/text/TextMarker.svelte.d.ts +1 -1
- package/dist/markers/tick/TickMarker.svelte +1 -1
- package/dist/markers/utils/MarkerChannels.d.ts +1 -1
- package/dist/markers/utils/MarkerChannels.js +3 -2
- package/dist/markers/violin/ViolinMarker.svelte +1 -1
- package/dist/markers/waffle/WaffleMarker.svelte +1 -1
- package/dist/phases/context/RowContext.d.ts +2 -0
- package/dist/phases/context/RowContext.js +2 -0
- package/dist/phases/markers/MarkerStyles.js +14 -11
- package/dist/phases/markers/MarkersPhase.d.ts +2 -3
- package/dist/phases/markers/MarkersPhase.js +17 -11
- package/dist/phases/statistics/MarkerGrouping.js +5 -32
- package/dist/phases/statistics/MarkerInheritance.d.ts +11 -0
- package/dist/phases/statistics/MarkerInheritance.js +25 -0
- package/dist/phases/statistics/MarkerOrientation.d.ts +26 -0
- package/dist/phases/statistics/MarkerOrientation.js +29 -0
- package/dist/phases/statistics/StatisticsPhase.js +15 -15
- package/dist/phases/transforms/TransformsPhase.js +5 -3
- package/dist/plots/correlation/heatmap/Plot.svelte +2 -2
- package/dist/plots/correlation/heatmap/Plot.svelte.d.ts +0 -1
- package/dist/plots/correlation/heatmap/defaults.js +14 -1
- package/dist/plots/correlation/heatmap/markers.d.ts +0 -6
- package/dist/plots/correlation/heatmap/markers.js +5 -9
- package/dist/plots/correlation/scatter/Plot.svelte +2 -2
- package/dist/plots/correlation/scatter/Plot.svelte.d.ts +0 -1
- package/dist/plots/correlation/scatter/defaults.js +9 -3
- package/dist/plots/correlation/scatter/markers.d.ts +0 -9
- package/dist/plots/correlation/scatter/markers.js +21 -28
- package/dist/plots/distribution/box/BoxSummaries.d.ts +5 -0
- package/dist/plots/distribution/box/BoxSummaries.js +9 -0
- package/dist/plots/distribution/box/Plot.svelte +2 -2
- package/dist/plots/distribution/box/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/box/defaults.js +11 -0
- package/dist/plots/distribution/box/markers.js +10 -1
- package/dist/plots/distribution/density/Plot.svelte +2 -2
- package/dist/plots/distribution/density/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/density/defaults.js +16 -0
- package/dist/plots/distribution/density/markers.js +5 -1
- package/dist/plots/distribution/histogram/Plot.svelte +2 -2
- package/dist/plots/distribution/histogram/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/histogram/defaults.js +16 -11
- package/dist/plots/distribution/histogram/markers.js +3 -3
- package/dist/plots/distribution/pyramid/Plot.svelte +2 -2
- package/dist/plots/distribution/pyramid/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/pyramid/defaults.js +9 -2
- package/dist/plots/distribution/pyramid/markers.d.ts +0 -8
- package/dist/plots/distribution/pyramid/markers.js +6 -16
- package/dist/plots/distribution/violin/Plot.svelte +2 -2
- package/dist/plots/distribution/violin/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/violin/defaults.js +11 -0
- package/dist/plots/distribution/violin/markers.js +27 -3
- package/dist/plots/evolution/area/Plot.svelte +2 -2
- package/dist/plots/evolution/area/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/area/defaults.js +4 -7
- package/dist/plots/evolution/area/markers.js +3 -1
- package/dist/plots/evolution/line/Plot.svelte +2 -2
- package/dist/plots/evolution/line/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/line/defaults.js +4 -6
- package/dist/plots/evolution/line/markers.js +3 -1
- package/dist/plots/evolution/slope/Plot.svelte +2 -2
- package/dist/plots/evolution/slope/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/slope/defaults.js +4 -3
- package/dist/plots/evolution/slope/markers.d.ts +4 -3
- package/dist/plots/evolution/slope/markers.js +16 -9
- package/dist/plots/evolution/sparkline/Plot.svelte +2 -2
- package/dist/plots/evolution/sparkline/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/sparkline/defaults.js +1 -1
- package/dist/plots/evolution/sparkline/markers.js +3 -1
- package/dist/plots/generic/Plot.svelte +42 -0
- package/dist/plots/generic/Plot.svelte.d.ts +25 -0
- package/dist/plots/generic/defaults.d.ts +4 -0
- package/dist/plots/generic/defaults.js +7 -0
- package/dist/plots/map/geo/Plot.svelte +2 -2
- package/dist/plots/map/geo/Plot.svelte.d.ts +0 -1
- package/dist/plots/part-of-a-whole/treemap/Plot.svelte +2 -2
- package/dist/plots/part-of-a-whole/treemap/Plot.svelte.d.ts +0 -1
- package/dist/plots/part-of-a-whole/treemap/defaults.js +2 -2
- package/dist/plots/ranking/bar/Plot.svelte +2 -2
- package/dist/plots/ranking/bar/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/bar/defaults.js +13 -3
- package/dist/plots/ranking/bar/markers.js +10 -27
- package/dist/plots/ranking/bullet/Plot.svelte +2 -2
- package/dist/plots/ranking/bullet/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/bullet/defaults.js +20 -0
- package/dist/plots/ranking/bullet/markers.js +7 -1
- package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +2 -9
- package/dist/plots/ranking/cleveland/ClevelandMarkers.js +65 -47
- package/dist/plots/ranking/cleveland/Plot.svelte +2 -2
- package/dist/plots/ranking/cleveland/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/cleveland/defaults.js +33 -2
- package/dist/plots/ranking/dumbbell/Plot.svelte +2 -2
- package/dist/plots/ranking/dumbbell/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/forest/Plot.svelte +2 -2
- package/dist/plots/ranking/forest/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/lollipop/Plot.svelte +2 -2
- package/dist/plots/ranking/lollipop/Plot.svelte.d.ts +0 -1
- package/dist/types/layout/context.d.ts +2 -0
- package/dist/types/layout/styles/bullet.d.ts +4 -1
- package/dist/types/layout/styles/values.d.ts +51 -11
- package/dist/types/markers/axis/area.d.ts +5 -1
- package/dist/types/markers/axis/bar.d.ts +5 -2
- package/dist/types/markers/axis/bollinger.d.ts +2 -1
- package/dist/types/markers/axis/box.d.ts +2 -1
- package/dist/types/markers/axis/cell.d.ts +4 -1
- package/dist/types/markers/axis/line.d.ts +4 -1
- package/dist/types/markers/axis/rect.d.ts +4 -1
- package/dist/types/markers/axis/regression.d.ts +2 -1
- package/dist/types/markers/axis/tick.d.ts +2 -1
- package/dist/types/markers/axis/trail.d.ts +4 -1
- package/dist/types/markers/axis/violin.d.ts +2 -1
- package/dist/types/markers/axis/waffle.d.ts +5 -1
- package/dist/types/markers/basic/dot.d.ts +4 -1
- package/dist/types/markers/basic/text.d.ts +25 -21
- package/dist/types/markers/channels/commonMarkerConfigWithLabel.d.ts +5 -9
- package/dist/types/markers/channels/commonMarkerConfigWithOrientation.d.ts +5 -0
- package/dist/types/markers/channels/commonMarkerConfigWithOrientation.js +1 -0
- package/dist/types/markers/labels/box.d.ts +57 -0
- package/dist/types/markers/labels/box.js +1 -0
- package/dist/types/markers/labels/common.d.ts +15 -0
- package/dist/types/markers/labels/common.js +1 -0
- package/dist/types/markers/labels/path.d.ts +52 -0
- package/dist/types/markers/labels/path.js +1 -0
- package/dist/types/markers/labels/point.d.ts +40 -0
- package/dist/types/markers/labels/point.js +1 -0
- package/dist/types/markers/traits.d.ts +10 -0
- package/dist/types/phases/markers/phase.d.ts +1 -8
- package/dist/types/phases/statistics/phase.d.ts +8 -3
- package/dist/types/phases/styles/phase.d.ts +15 -3
- package/dist/types/phases/transforms/phase.d.ts +2 -0
- package/dist/types/plots/constants.d.ts +0 -12
- package/dist/types/plots/correlation/heatmap/props.d.ts +3 -2
- package/dist/types/plots/correlation/scatter/props.d.ts +3 -2
- package/dist/types/plots/distribution/box/props.d.ts +6 -2
- package/dist/types/plots/distribution/density/props.d.ts +2 -1
- package/dist/types/plots/distribution/histogram/props.d.ts +3 -2
- package/dist/types/plots/distribution/pyramid/props.d.ts +3 -2
- package/dist/types/plots/distribution/violin/props.d.ts +4 -1
- package/dist/types/plots/evolution/area/props.d.ts +3 -2
- package/dist/types/plots/evolution/line/props.d.ts +3 -2
- package/dist/types/plots/generic/props.d.ts +16 -0
- package/dist/types/plots/generic/props.js +1 -0
- package/dist/types/plots/generic/state.d.ts +4 -0
- package/dist/types/plots/generic/state.js +1 -0
- package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +4 -2
- package/dist/types/plots/ranking/bar/props.d.ts +3 -2
- package/dist/types/plots/ranking/cleveland/props.d.ts +3 -2
- package/dist/types/plots/ranking/dumbbell/props.d.ts +3 -2
- package/dist/types/plots/ranking/forest/props.d.ts +5 -2
- package/dist/types/plots/ranking/lollipop/props.d.ts +3 -2
- package/docs/architecture.md +9 -9
- package/docs/markers.md +2 -4
- package/docs/plots/ranking/cleveland.md +1 -1
- package/docs/styles-and-segments.md +1 -14
- package/docs/value-labels.md +159 -0
- package/examples/BarValues.svelte +1 -1
- package/llms-full.txt +2 -2
- package/llms.txt +1 -0
- package/package.json +3 -1
- package/dist/markers/utils/BoxLabel.d.ts +0 -58
- package/dist/markers/utils/BoxLabel.js +0 -175
- package/dist/markers/utils/MarkerLabel.svelte +0 -33
- package/dist/markers/utils/MarkerLabel.svelte.d.ts +0 -10
- /package/dist/layout/plot/{Plot.svelte → AbstractPlot.svelte} +0 -0
|
@@ -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: {
|
|
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: {
|
|
11
|
-
|
|
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: {
|
|
14
|
-
|
|
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: {
|
|
18
|
-
|
|
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: {
|
|
21
|
-
|
|
22
|
-
|
|
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: {
|
|
29
|
-
|
|
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: {
|
|
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: {
|
|
35
|
-
|
|
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: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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());
|
|
@@ -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
|
|
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(
|
|
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
|
|
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(
|
|
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(
|
|
93
|
-
{#if
|
|
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
|
+
}
|
|
@@ -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
|
+
}
|