Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

add pages of examples translated from ObservablePlot docs#72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
jamesscottbrown wants to merge20 commits intosvelteplot:main
base:main
Choose a base branch
Loading
fromjamesscottbrown:examples
Draft
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
20 commits
Select commitHold shift + click to select a range
c535083
add pages of examples translated from ObservablePlot docs
jamesscottbrownMay 28, 2025
32269fb
Merge branch 'main' of github.com:svelteplot/svelteplot into examples
jamesscottbrownMay 28, 2025
49bcf66
add rule/tick examples
jamesscottbrownMay 28, 2025
ee0aa2e
fix links in sidebar
jamesscottbrownMay 28, 2025
bab3ce8
add axis examples
jamesscottbrownMay 28, 2025
e686b41
edits to examples
jamesscottbrownMay 28, 2025
684af53
ad dnot about bug
jamesscottbrownMay 28, 2025
0c10887
Merge branch 'main' of github.com:svelteplot/svelteplot into examples
jamesscottbrownMay 29, 2025
9c264f2
link to issues
jamesscottbrownMay 29, 2025
214211d
update page of rule/tick examples
jamesscottbrownMay 29, 2025
6c3d52f
add link to issues for line mark examples
jamesscottbrownMay 29, 2025
1b71990
link to issues
jamesscottbrownMay 29, 2025
d9e2581
fix build by disabling broken chart
jamesscottbrownMay 29, 2025
432dd2c
more links to issues
jamesscottbrownMay 29, 2025
75f4891
fix build
jamesscottbrownMay 29, 2025
8fc63e7
Merge branch 'main' of github.com:svelteplot/svelteplot into examples
jamesscottbrownMay 29, 2025
91cf061
remove waring as bug fixed
jamesscottbrownMay 29, 2025
c09264d
fix build
jamesscottbrownMay 29, 2025
31feedf
Merge branch 'main' of github.com:svelteplot/svelteplot into examples
jamesscottbrownJun 2, 2025
17c888c
remove a note as issue fixed
jamesscottbrownJun 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
add rule/tick examples
  • Loading branch information
@jamesscottbrown
jamesscottbrown committedMay 28, 2025
commit49bcf66d93b31a90a12f467a0b29fd1b37e0758c
5 changes: 4 additions & 1 deletionconfig/sidebar.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,7 +138,10 @@ export default {
title: 'Line',
to: 'line'
},

{
title: 'Rule/Tick',
to: 'rule-tick'
},
]
}
]
Expand Down
2 changes: 1 addition & 1 deletionsrc/routes/examples/line/+page.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,7 +211,7 @@ Contrast with a chart where missing values have been filtered out:

## [Overlapping density estimations](https://observablehq.com/@observablehq/plot-overlapping-density-estimations)

::warning:: Fails witherro 'unknown reducer proportion in AreaY'
::warning:: Fails witherror 'unknown reducer proportion in AreaY'

```svelte live
<script>
Expand Down
64 changes: 64 additions & 0 deletionssrc/routes/examples/rule-tick/+page.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
---
title: Examples of Rule and Tick marks
---

This page shows many examples of the use of the `Rule` and `Tick` marks translated from the [Observable Plot Plot Gallery](https://observablehq.com/@observablehq/plot-gallery).
It only includes examples using the standard demo datasets from the [@observablehq/sample-datasets](www.npmjs.com/package/@observablehq/sample-datasets) package;
it excludes those with `FileAttachment`s added to Observable Notebooks.


## [Candlestick chart](https://observablehq.com/@observablehq/plot-candlestick-chart)

```svelte live
<script>
import { Plot, RuleX } from 'svelteplot';
import { page } from '$app/state';

let { aapl } = $derived(page.data.data);
const ticker = aapl.slice(-130);
</script>

<Plot inset={6} width={928} grid=true y={{ label: "↑ Apple stock price ($)"}} color={{ domain: [-1, 0, 1], range: ["#e41a1c", "currentColor", "#4daf4a"]}} >
<RuleX data={ticker} x="Date" y1="Low" y2="High" />
<RuleX data={ticker} x="Date" y1="Open" y2="Close" stroke={d => Math.sign(d.Close - d.Open)} strokeWidth={4} strokeLinecap="round" />
</Plot>
```


## [Lollipop](https://observablehq.com/@observablehq/plot-lollipop)

> :warning: This seems to be interpreting "letter" as a literal value, rather than the name of a field.

```svelte live
<script>
import { Plot, Dot, RuleX } from 'svelteplot';
import { page } from '$app/state';

let { alphabet } = $derived(page.data.data);
</script>

<Plot x={{ label: null, tickPadding: 6, tickSize: 0}} y={{ percent: true}} >
<RuleX data={alphabet} x="letter" y="frequency" strokeWidth={2} />
<Dot data={alphabet} x="letter" y="frequency" fill="currentColor" r={4} />
</Plot>
```


## [Bar and tick](https://observablehq.com/@observablehq/plot-bar-and-tick)

> :warning: This fails with error "scale type mismatch for x (needs band)".

```svelte live
<script>
import { Plot, BarY, TickY, RuleY } from 'svelteplot';
import { page } from '$app/state';

let { alphabet } = $derived(page.data.data);
</script>

<Plot x={{ label: null}} y={{ percent: true}} >
<BarY data={alphabet} x="letter" y="frequency" fillOpacity={0.2} />
<TickY data={alphabet} x="letter" y="frequency" />
<RuleY data={[0]} />
</Plot>
```
8 changes: 8 additions & 0 deletionssrc/routes/examples/rule-tick/+page.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
import { loadDatasets } from '$lib/helpers/data.js';
import type { PageLoad } from './$types.js';

export const load: PageLoad = async ({ fetch }) => {
return {
data: await loadDatasets(['aapl', 'penguins', 'olympians'], fetch)
};
};
Loading

[8]ページ先頭

©2009-2025 Movatter.jp