|
| 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 | + |
1 | 25 | <script lang="ts">
|
2 | 26 | import Mark from '../Mark.svelte';
|
3 | 27 | import { getContext } from 'svelte';
|
|
18 | 42 | const { getPlotState } = getContext<PlotContext>('svelteplot');
|
19 | 43 | let plot = $derived(getPlotState());
|
20 | 44 |
|
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 |
| -
|
40 | 45 | let { data = [{}], ...options }: TickYMarkProps = $props();
|
41 | 46 |
|
42 | 47 | let args = $derived(recordizeY({ data, ...options }, { withIndex: false }));
|
|
0 commit comments