svelteplot 0.4.5-pr-207.0 → 0.4.5-pr-209.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/dist/marks/AxisX.svelte
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
/** approximate number of pixels between generated ticks */
|
|
52
52
|
tickSpacing?: number;
|
|
53
53
|
/** text anchor for axis labels */
|
|
54
|
-
textAnchor?: ConstantAccessor<CSS.Property.TextAnchor, Datum>;
|
|
54
|
+
textAnchor?: ConstantAccessor<CSS.Property.TextAnchor | 'auto', Datum>;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
let markProps: AxisXMarkProps = $props();
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
tickPadding: 3,
|
|
62
62
|
tickFontSize: 11,
|
|
63
63
|
titleFontSize: 11,
|
|
64
|
-
textAnchor: '
|
|
64
|
+
textAnchor: 'auto',
|
|
65
65
|
opacity: 0.8,
|
|
66
66
|
anchor: 'bottom',
|
|
67
67
|
...getContext<PlotDefaults>('svelteplot/_defaults').axis,
|
|
@@ -84,7 +84,7 @@ declare class __sveltets_Render<Datum extends RawValue> {
|
|
|
84
84
|
/** approximate number of pixels between generated ticks */
|
|
85
85
|
tickSpacing?: number;
|
|
86
86
|
/** text anchor for axis labels */
|
|
87
|
-
textAnchor?: ConstantAccessor<CSS.Property.TextAnchor, Datum>;
|
|
87
|
+
textAnchor?: ConstantAccessor<"auto" | CSS.Property.TextAnchor, Datum>;
|
|
88
88
|
};
|
|
89
89
|
events(): {};
|
|
90
90
|
slots(): {};
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
dx: ConstantAccessor<number>;
|
|
36
36
|
dy: ConstantAccessor<number>;
|
|
37
37
|
filter: ChannelAccessor;
|
|
38
|
+
textAnchor: ConstantAccessor<'start' | 'middle' | 'end'> | 'auto';
|
|
38
39
|
};
|
|
39
40
|
text: boolean;
|
|
40
41
|
plot: PlotState;
|
|
@@ -141,6 +142,8 @@
|
|
|
141
142
|
}
|
|
142
143
|
});
|
|
143
144
|
|
|
145
|
+
$inspect({ options });
|
|
146
|
+
|
|
144
147
|
$effect(() => {
|
|
145
148
|
// clear margins on destroy
|
|
146
149
|
return () => {
|
|
@@ -187,6 +190,15 @@
|
|
|
187
190
|
{
|
|
188
191
|
fontVariant: isQuantitative ? 'tabular-nums' : 'normal',
|
|
189
192
|
...options,
|
|
193
|
+
textAnchor:
|
|
194
|
+
options.textAnchor === 'auto'
|
|
195
|
+
? // automatically adjust text anchor based on rotation
|
|
196
|
+
tickRotate < 0
|
|
197
|
+
? 'end'
|
|
198
|
+
: tickRotate > 0
|
|
199
|
+
? 'start'
|
|
200
|
+
: 'middle'
|
|
201
|
+
: options.textAnchor,
|
|
190
202
|
fontSize: tickFontSize_,
|
|
191
203
|
stroke: null
|
|
192
204
|
},
|