Skip to content

Commit 19bee36

Browse files
committed
add tick classes example
1 parent 825660f commit 19bee36

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

src/lib/marks/AxisX.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
/** ticks is a shorthand for defining data, tickCount or interval */
4545
ticks?: number | string | Datum[];
4646
/** set to false or null to disable tick labels */
47-
text: boolean | null;
47+
text?: boolean | null;
4848
/** approximate number of ticks to be generated */
4949
tickCount?: number;
5050
/** approximate number of pixels between generated ticks */
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<script module>
2+
export const title = 'Tick classes';
3+
</script>
4+
5+
<script>
6+
import { Plot, AxisX } from 'svelteplot';
7+
</script>
8+
9+
<Plot marginTop={30} x={{ domain: [-100, 100] }}>
10+
<AxisX
11+
tickClass={(d) =>
12+
d < 0 ? 'negative' : 'positive'} />
13+
</Plot>
14+
15+
<style>
16+
:global {
17+
.tick.negative {
18+
color: var(--svp-red) !important;
19+
}
20+
.tick.positive {
21+
color: var(--svp-blue) !important;
22+
}
23+
}
24+
</style>

src/routes/examples/axis/ticks-inside.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<script>
66
import { Plot, AxisY, Line } from 'svelteplot';
77
import { page } from '$app/state';
8-
import { setContext } from 'svelte';
98
109
let { aapl } = $derived(page.data.data);
1110
</script>
6.72 KB
Loading

static/examples/axis/tick-classes.png

6.34 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