Skip to content

Commit dd22572

Browse files
committed
feat: apply dot mark defaults
1 parent 6e7efd4 commit dd22572

File tree

9 files changed

+9
-5
lines changed

9 files changed

+9
-5
lines changed

src/lib/marks/Dot.svelte

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,19 @@
3535
import { addEventHandlers } from './helpers/events.js';
3636
import Anchor from './helpers/Anchor.svelte';
3737
38-
let {
38+
const DEFAULTS = {
39+
...getContext<PlotDefaults>('svelteplot/_defaults').dot
40+
};
41+
42+
let markProps: DotMarkProps = $props();
43+
44+
const {
3945
data = [{}],
4046
canvas = false,
4147
class: className = '',
4248
dotClass = null,
4349
...options
44-
}: DotMarkProps = $props();
50+
}: DotMarkProps = $derived({ ...DEFAULTS, ...markProps });
4551
4652
const { getPlotState } = getContext<PlotContext>('svelteplot');
4753
const plot = $derived(getPlotState());
@@ -50,8 +56,6 @@
5056
return d3Symbol(maybeSymbol(symbolType), size)();
5157
}
5258
53-
const { dotRadius } = getContext<PlotDefaults>('svelteplot/_defaults');
54-
5559
const args = $derived(
5660
// todo: move sorting to Mark
5761
sort(
@@ -80,7 +84,7 @@
8084
'fillOpacity',
8185
'strokeOpacity'
8286
]}
83-
defaults={{ r: dotRadius, symbol: 'circle' }}
87+
defaults={{ r: 3, symbol: 'circle' }}
8488
{...args}>
8589
{#snippet children({ mark, usedScales, scaledData })}
8690
<g class="dot {className || ''}">

static/examples/arrow/metro.dark.png

219 KB
Loading

static/examples/arrow/metro.png

219 KB
Loading
-20 Bytes
Loading
721 Bytes
Loading

static/examples/regression/cars.png

24 Bytes
Loading
-8 Bytes
Loading
18 Bytes
Loading
-3 Bytes
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