Skip to content

Commit b3181d8

Browse files
committed
docs: more examples + repl links
1 parent 1ebbeab commit b3181d8

9 files changed

Lines changed: 45 additions & 1 deletion

File tree

src/routes/+layout.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@
9898
'tick/tick-x',
9999
'vector/spike-map',
100100
'vector/wind',
101-
'waffle/custom-symbol'
101+
'waffle/custom-symbol',
102+
'waffle/stacked-x'
102103
].map((d) => ({
103104
key: d,
104105
light: resolve(`/examples/${d}.png`),

src/routes/examples/waffle/custom-symbol.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
'A waffle chart using a custom SVG symbol for each unit, passed via symbol snippet.';
55
export let sortKey = 20;
66
export let transforms = ['group'];
7+
export let repl =
8+
'https://svelte.dev/playground/be263ac346794e71a80e6ce86b592eef?version=5';
79
</script>
810

911
<script>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script module>
2+
export let title = 'Stacked WaffleX';
3+
export let sortKey = 5;
4+
export let transforms = ['group'];
5+
export let repl =
6+
'https://svelte.dev/playground/bfcc3c72808e4406a795884af8207d12?version=5';
7+
</script>
8+
9+
<script>
10+
import { Plot, WaffleX, groupY } from 'svelteplot';
11+
12+
import { page } from '$app/state';
13+
let { penguins } = $derived(page.data.data);
14+
</script>
15+
16+
<Plot
17+
height={400}
18+
x={{ grid: true }}
19+
color={{ legend: true }}>
20+
<WaffleX
21+
gap={2}
22+
borderRadius={2}
23+
{...groupY(
24+
{
25+
data: penguins,
26+
y: 'island',
27+
fill: 'species'
28+
},
29+
{ x: 'count' }
30+
)} />
31+
</Plot>

src/routes/examples/waffle/stacked.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
export let title = 'Stacked waffle';
33
export let sortKey = 5;
44
export let transforms = ['group'];
5+
export let repl =
6+
'https://svelte.dev/playground/4ade8154c5fa4de5ba9981a616680ade?version=5';
57
</script>
68

79
<script>

src/routes/examples/waffle/waffle-x.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script module>
22
export let title = 'Horizontal waffle';
33
export let sortKey = 2;
4+
export let repl =
5+
'https://svelte.dev/playground/56ab7b1534714fd3b8b8416048365701?version=5';
46
</script>
57

68
<script>

src/routes/examples/waffle/waffle-y.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script module>
22
export let title = 'Vertical waffle';
33
export let sortKey = 1;
4+
export let repl =
5+
'https://svelte.dev/playground/7312ce68199747b8b49814bb4adcefee?version=5';
46
</script>
57

68
<script>

src/routes/marks/waffle/+page.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ The Waffle mark renders pictograms or waffle charts, which are grids of squares
2424
</Plot>
2525
```
2626

27+
[fork](https://svelte.dev/playground/7312ce68199747b8b49814bb4adcefee?version=5)
28+
2729
The waffle mark is often used with the group transform to compute counts. The chart below compares the number of female and male athletes in the 2012 Olympics.
2830

2931
```svelte live
@@ -260,6 +262,8 @@ You can pass the **symbol** snippet to customize the shape of the waffle cells (
260262
</Plot>
261263
```
262264

265+
[fork](https://svelte.dev/playground/be263ac346794e71a80e6ce86b592eef?version=5)
266+
263267
## Waffle options
264268

265269
The waffle mark accepts the following options in addition to the standard mark options:
94.7 KB
Loading
93.7 KB
Loading

0 commit comments

Comments
 (0)