Skip to content

feat: pass scales and options to overlay snippet #127

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 1 commit into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 14 additions & 1 deletion src/lib/core/Plot.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,20 @@
{/if}
</FacetGrid>
</svg>
{#if overlay}<div class="plot-overlay">{@render overlay?.()}</div>{/if}
{#if overlay}<div class="plot-overlay">
{@render overlay?.({
Copy link
Preview

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

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

The call site treats overlay as a single-object argument, but the type expects an array of arguments (Snippet<[OverlayContext]>). Align the invocation with the updated signature, e.g., overlay?.([ { … } ]), or adjust the type to accept an object directly.

Copilot uses AI. Check for mistakes.

width,
height,
options: plotOptions,
scales: plotState.scales,
mapXY,
hasProjection,
hasExplicitAxisX,
hasExplicitAxisY,
hasExplicitGridX,
hasExplicitGridY
})}
</div>{/if}
</div>
{#if footer}
<figcaption class="plot-footer">
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types/plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export type PlotOptions = {
* The overlay snippet is useful for adding a layer of custom HTML markup
* in front of the SVG body of your plot, e.g. for HTML tooltips.
*/
overlay: Snippet;
overlay: Snippet<[{ width: number; height: number; options: PlotOptions; scales: PlotScales }]>;
Copy link
Preview

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

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

The overlay signature only includes width, height, options, and scales, but the Svelte invocation also passes mapXY, hasProjection, and the explicit axis/grid flags. Update the generic type to include those additional properties or consolidate into a named OverlayContext type.

Suggested change
overlay: Snippet<[{ width: number; height: number; options: PlotOptions; scales: PlotScales }]>;
overlay: Snippet<[OverlayContext]>;

Copilot uses AI. Check for mistakes.

facetAxes: Snippet;
/**
* if you set testid, the plot container will get a data-testid attribute which
Expand Down
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