Skip to content

feature: apply mark defaults #110

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jun 5, 2025
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
Next Next commit
feat: apply dot mark defaults
  • Loading branch information
gka committed Jun 3, 2025
commit dd22572875d351cbfa1897ea5b0bd7809aca5c99
14 changes: 9 additions & 5 deletions src/lib/marks/Dot.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@
import { addEventHandlers } from './helpers/events.js';
import Anchor from './helpers/Anchor.svelte';

let {
const DEFAULTS = {
...getContext<PlotDefaults>('svelteplot/_defaults').dot
};

let markProps: DotMarkProps = $props();

const {
data = [{}],
canvas = false,
class: className = '',
dotClass = null,
...options
}: DotMarkProps = $props();
}: DotMarkProps = $derived({ ...DEFAULTS, ...markProps });

const { getPlotState } = getContext<PlotContext>('svelteplot');
const plot = $derived(getPlotState());
Expand All @@ -50,8 +56,6 @@
return d3Symbol(maybeSymbol(symbolType), size)();
}

const { dotRadius } = getContext<PlotDefaults>('svelteplot/_defaults');

const args = $derived(
// todo: move sorting to Mark
sort(
Expand Down Expand Up @@ -80,7 +84,7 @@
'fillOpacity',
'strokeOpacity'
]}
defaults={{ r: dotRadius, symbol: 'circle' }}
defaults={{ r: 3, symbol: 'circle' }}
Copy link
Preview

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a hardcoded dot radius (3) instead of pulling from the context default (dotRadius) will ignore user-defined settings. Consider replacing 3 with the value from getContext<PlotDefaults>('svelteplot/_defaults').dotRadius.

Suggested change
defaults={{ r: 3, symbol: 'circle' }}
defaults={{ r: dotRadius, symbol: 'circle' }}

Copilot uses AI. Check for mistakes.

{...args}>
{#snippet children({ mark, usedScales, scaledData })}
<g class="dot {className || ''}">
Expand Down
Binary file added static/examples/arrow/metro.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 static/examples/arrow/metro.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 modified static/examples/dot/3-dot-plot.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 modified static/examples/geo/us-choropleth-canvas.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 modified static/examples/regression/cars.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 modified static/examples/regression/faceted.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 modified static/examples/regression/loess.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 modified static/examples/regression/log.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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