Skip to content

Commit 32ee329

Browse files
committed
add shuffled bar example
1 parent b238a19 commit 32ee329

File tree

5 files changed

+31
-0
lines changed

5 files changed

+31
-0
lines changed

src/routes/examples/+layout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const load: PageServerLoad = async ({ fetch }) => {
1111
...(await loadDatasets(
1212
[
1313
'aapl',
14+
'alphabet',
1415
'beagle',
1516
'bls',
1617
'co2',

src/routes/examples/bar/_index.svelte

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script module>
2+
export let title = 'Bar';
3+
</script>
4+
5+
<h1>Bar examples</h1>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<script module>
2+
export let title = 'Shuffled Bars';
3+
</script>
4+
5+
<script>
6+
import { Plot, BarY, RuleY, shuffle } from 'svelteplot';
7+
8+
import { page } from '$app/state';
9+
let { alphabet } = $derived(page.data.data);
10+
11+
let seed = $state(42);
12+
</script>
13+
14+
<Plot
15+
grid
16+
y={{ percent: true }}
17+
x={{ sort: false }}
18+
marginTop={25}>
19+
<RuleY data={[0]} />
20+
<BarY
21+
{...shuffle(
22+
{ data: alphabet, x: 'letter', y: 'frequency' },
23+
{ seed }
24+
)} />
25+
</Plot>
33.5 KB
Loading

static/examples/bar/shuffled-bars.png

33.6 KB
Loading

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