Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
docs: kneeling demo plot
  • Loading branch information
gka committed Feb 21, 2026
commit 3ccb8a783fd7125c600d69d3530e89c5364a0df5
1 change: 1 addition & 0 deletions src/routes/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ examples:
- geo/us-choropleth
- image/image-scatter
- image/image-beeswarm
- line/bls
- line/geo-line
- line/gradient-line
- line/indexed-stocks
Expand Down
3 changes: 1 addition & 2 deletions src/routes/examples/line/bls.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script module>
export const title =
'Multiple line chart with highlight';
export const title = 'Multiple lines';
export const description =
'Multiple unemployment lines by metro division with one series highlighted. Derived from an <a href="https://observablehq.com/@observablehq/plot-multiple-line-highlight">Observable Plot example</a>.';
export const data = { bls: '/data/bls.csv' };
Expand Down
45 changes: 45 additions & 0 deletions src/routes/examples/line/symlog.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<script module>
export const title = 'Symlog kneeling curve';
export const description =
'Useful for long time spans: this chart shows ~800k years of CO2 concentration while preserving detail around year zero using a symmetric log scale.';
export const data = { kneeling: '/data/kneeling.csv' };
</script>

<script lang="ts">
import { Plot, Line } from 'svelteplot';
import { Slider, RadioInput } from '$shared/ui';
import type { KneelingRow } from '../types';

let { kneeling }: { kneeling: KneelingRow[] } =
$props();

let type = $state('symlog');
let constant = $state(2000);
</script>

<div class="controls">
<Slider
label="constant"
bind:value={constant}
min={100}
max={2000} />
<RadioInput
label="type"
options={['symlog', 'linear']}
bind:value={type} />
</div>

<Plot grid height={300} x={{ type, constant }}>
<Line data={kneeling} x="year" y="co2" />
</Plot>

<style>
.controls {
display: flex;
justify-content: space-between;
gap: 0.75rem;
align-items: center;
margin-bottom: 0.5rem;
flex-wrap: wrap;
}
</style>
5 changes: 5 additions & 0 deletions src/routes/examples/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export type BlsRow = {
unemployment: number;
};

export type KneelingRow = {
year: number;
co2: number;
};

export type LanguagesRow = {
Language: string;
Remarks: string;
Expand Down
41 changes: 0 additions & 41 deletions src/routes/tests/demos/kneeling/+page.md

This file was deleted.

8 changes: 0 additions & 8 deletions src/routes/tests/demos/kneeling/+page.ts

This file was deleted.

Binary file added src/snapshots/line/symlog.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/snapshots/line/symlog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.