Skip to content

Commit 759a380

Browse files
committed
spike defaults
1 parent f29d0c5 commit 759a380

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

src/lib/marks/Spike.svelte

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,26 @@
88

99
<script lang="ts">
1010
import Vector, { type VectorMarkProps } from './Vector.svelte';
11-
let { data = [{}], ...options }: SpikeMarkProps = $props();
11+
import type { PlotDefaults } from '../types.js';
12+
import { getContext } from 'svelte';
13+
14+
let markProps: SpikeMarkProps = $props();
15+
16+
const DEFAULTS = {
17+
fill: 'currentColor',
18+
fillOpacity: 0.3,
19+
strokeWidth: 1,
20+
anchor: 'start' as const,
21+
stroke: 'currentColor',
22+
sort: { channel: '-y' },
23+
shape: 'spike' as const,
24+
...getContext<PlotDefaults>('svelteplot/_defaults').spike
25+
};
26+
27+
const { data = [{}], ...options }: SpikeMarkProps = $derived({
28+
...DEFAULTS,
29+
...markProps
30+
});
1231
</script>
1332

14-
<Vector
15-
{data}
16-
fill={options.stroke || 'currentColor'}
17-
fillOpacity={0.3}
18-
strokeWidth={1}
19-
anchor="start"
20-
stroke="currentColor"
21-
sort={{ channel: '-y' }}
22-
{...options}
23-
shape="spike" />
33+
<Vector {data} {...options} />

src/routes/examples/brush/zoomable-scatter.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
}} />
7373
{:else}
7474
<Frame
75+
stroke={false}
7576
fill="transparent"
7677
cursor="zoom-out"
7778
onpointerup={resetZoom} />

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ Another use case for the Brush mark would be to create a zoomable plot by changi
293293
{:else}
294294
<Frame
295295
fill="transparent"
296+
stroke="transparent"
296297
cursor="zoom-out"
297298
onpointerup={resetZoom} />
298299
{/if}

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