Skip to content

Commit 6022452

Browse files
committed
ts: export tick marks prop types
1 parent 13265ac commit 6022452

File tree

2 files changed

+48
-38
lines changed

2 files changed

+48
-38
lines changed

src/lib/marks/TickX.svelte

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
<!--
2+
@component
3+
The TickX mark is useful for showing one-dimensional distributions along the x axis. The y axis must be a band scale.
4+
-->
5+
<script module lang="ts">
6+
export type TickXMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity'> & {
7+
data: DataRow[];
8+
/**
9+
* the horizontal position; bound to the x scale
10+
*/
11+
x?: ChannelAccessor;
12+
/**
13+
* the vertical position; bound to the y scale, which must be band. If the y channel
14+
* is not specified, the tick will span the full vertical extent of the frame.
15+
*/
16+
y?: ChannelAccessor;
17+
/**
18+
* if ticks are used on a non-bandwidth scale, this will determine the
19+
* length of the tick. Defaults to 10 pixel
20+
*/
21+
tickLength?: ConstantAccessor<number>;
22+
};
23+
</script>
24+
125
<script lang="ts">
226
import Mark from '../Mark.svelte';
327
import { getContext } from 'svelte';
@@ -17,25 +41,6 @@
1741
const { getPlotState } = getContext<PlotContext>('svelteplot');
1842
let plot = $derived(getPlotState());
1943
20-
type TickXMarkProps = BaseMarkProps & {
21-
data: DataRow[];
22-
/**
23-
* the horizontal position; bound to the x scale
24-
*/
25-
x?: ChannelAccessor;
26-
/**
27-
* the vertical position; bound to the y scale, which must be band. If the y channel
28-
* is not specified, the tick will span the full vertical extent of the frame.
29-
*/
30-
y?: ChannelAccessor;
31-
stroke?: ChannelAccessor;
32-
/**
33-
* if ticks are used on a non-bandwidth scale, this will determine the
34-
* length of the tick. Defaults to 10 pixel
35-
*/
36-
tickLength?: ConstantAccessor<number>;
37-
};
38-
3944
let { data = [{}], ...options }: TickXMarkProps = $props();
4045
4146
let args = $derived(recordizeX({ data, ...options }, { withIndex: false }));

src/lib/marks/TickY.svelte

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
<!--
2+
@component
3+
The TickY mark is useful for showing one-dimensional distributions along the y axis. The x axis must be a band scale.
4+
-->
5+
<script module lang="ts">
6+
export type TickYMarkProps = Omit<BaseMarkProps, 'fill' | 'fillOpacity'> & {
7+
data: DataRow[];
8+
/**
9+
* the vertical position; bound to the x scale
10+
*/
11+
y?: ChannelAccessor;
12+
/**
13+
* the horizontal position; bound to the x scale, which must be band. If the x channel
14+
* is not specified, the tick will span the full horizontal extent of the frame.
15+
*/
16+
x?: ChannelAccessor;
17+
/**
18+
* if ticks are used on a non-bandwidth scale, this will determine the
19+
* length of the tick. Defaults to 10 pixel
20+
*/
21+
tickLength?: ConstantAccessor<number>;
22+
};
23+
</script>
24+
125
<script lang="ts">
226
import Mark from '../Mark.svelte';
327
import { getContext } from 'svelte';
@@ -18,25 +42,6 @@
1842
const { getPlotState } = getContext<PlotContext>('svelteplot');
1943
let plot = $derived(getPlotState());
2044
21-
type TickYMarkProps = BaseMarkProps & {
22-
data: DataRow[];
23-
/**
24-
* the vertical position; bound to the x scale
25-
*/
26-
y?: ChannelAccessor;
27-
/**
28-
* the horizontal position; bound to the x scale, which must be band. If the x channel
29-
* is not specified, the tick will span the full horizontal extent of the frame.
30-
*/
31-
x?: ChannelAccessor;
32-
stroke?: ChannelAccessor;
33-
/**
34-
* if ticks are used on a non-bandwidth scale, this will determine the
35-
* length of the tick. Defaults to 10 pixel
36-
*/
37-
tickLength?: ConstantAccessor<number>;
38-
};
39-
4045
let { data = [{}], ...options }: TickYMarkProps = $props();
4146
4247
let args = $derived(recordizeY({ data, ...options }, { withIndex: false }));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy