Skip to content

Commit ba2411c

Browse files
committed
docs: improve marker docs
1 parent b6587de commit ba2411c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/routes/features/markers/+page.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Markers
33
---
44

5-
Markers can be used with the [line](/marks/line) and [link](/marks/link) marks.
5+
Markers can be used with the [line](/marks/line) and [link](/marks/link) marks. Markers are automatically scaled with the line width:
66

77
```svelte live
88
<script>
@@ -11,6 +11,7 @@ Markers can be used with the [line](/marks/line) and [link](/marks/link) marks.
1111
import Slider from '$lib/ui/Slider.svelte';
1212
1313
let marker = $state('circle-stroke');
14+
let strokeWidth = $state(1.5);
1415
1516
const options = [
1617
'dot',
@@ -30,13 +31,16 @@ Markers can be used with the [line](/marks/line) and [link](/marks/link) marks.
3031
<Select
3132
label="Marker:"
3233
bind:value={marker}
33-
{options} /><br />
34+
{options} />
35+
<Slider label="Stroke width" bind:value={strokeWidth} min={1} max={5} step={0.1} />
36+
<br />
3437
<Plot inset={10} grid>
3538
<Line
3639
data={crimea}
3740
x="date"
3841
y="deaths"
3942
stroke="cause"
43+
{strokeWidth}
4044
{marker} />
4145
</Plot>
4246
```
@@ -48,10 +52,13 @@ Markers can be used with the [line](/marks/line) and [link](/marks/link) marks.
4852
x="date"
4953
y="deaths"
5054
stroke="cause"
55+
strokeWidth={1.5}
5156
marker="dot" />
5257
</Plot>
5358
```
5459

60+
## Marker options
61+
5562
The supported marker options are:
5663

5764
- **markerStart** - the marker for the starting point of a line segment
@@ -76,7 +83,7 @@ Note that for the interpolation methods `basis`, `bundle`, and `step`, the marke
7683

7784
```svelte live
7885
<script lang="ts">
79-
import { Plot, LineY, Dot } from '$lib/index.js';
86+
import { Plot, LineY, Dot } from 'svelteplot';
8087
import Slider from '$lib/ui/Slider.svelte';
8188
import Select from '$lib/ui/Select.svelte';
8289
import type { CurveName } from '$lib/types.js';
@@ -115,6 +122,7 @@ Note that for the interpolation methods `basis`, `bundle`, and `step`, the marke
115122
<DotY data={numbers} symbol="plus" />
116123
</Plot>
117124
```
125+
[fork](https://svelte.dev/playground/0be2cc3070c844e692a3300d87212f58?version=5.28.2)
118126

119127
## Custom markers
120128

@@ -165,6 +173,7 @@ You can also specify a custom marker icon using the `marker` snippet:
165173
</Line>
166174
</Plot>
167175
```
176+
[fork](https://svelte.dev/playground/2e63a26ff02646db90f2e33849668033?version=5.28.2)
168177

169178
And since the marker snippets contain regular Svelte code, you can do whatever you want with the markers, like animate them, for instance:
170179

@@ -228,3 +237,4 @@ And since the marker snippets contain regular Svelte code, you can do whatever y
228237
{/snippet}
229238
<!-- </Line></Plot> -->
230239
```
240+
[fork](https://svelte.dev/playground/f02d094c5761416ca1c2f14e1f6d168d?version=5.28.2)

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