Skip to content

Commit a4250fb

Browse files
committed
feat: pass scales and options to overlay snippet
1 parent 6996b87 commit a4250fb

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/lib/core/Plot.svelte

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,20 @@
519519
{/if}
520520
</FacetGrid>
521521
</svg>
522-
{#if overlay}<div class="plot-overlay">{@render overlay?.()}</div>{/if}
522+
{#if overlay}<div class="plot-overlay">
523+
{@render overlay?.({
524+
width,
525+
height,
526+
options: plotOptions,
527+
scales: plotState.scales,
528+
mapXY,
529+
hasProjection,
530+
hasExplicitAxisX,
531+
hasExplicitAxisY,
532+
hasExplicitGridX,
533+
hasExplicitGridY
534+
})}
535+
</div>{/if}
523536
</div>
524537
{#if footer}
525538
<figcaption class="plot-footer">

src/lib/types/plot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ export type PlotOptions = {
466466
* The overlay snippet is useful for adding a layer of custom HTML markup
467467
* in front of the SVG body of your plot, e.g. for HTML tooltips.
468468
*/
469-
overlay: Snippet;
469+
overlay: Snippet<[{ width: number; height: number; options: PlotOptions; scales: PlotScales }]>;
470470
facetAxes: Snippet;
471471
/**
472472
* if you set testid, the plot container will get a data-testid attribute which

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