I'd like to preface this by commending you on such a great library. It's truly a breath of fresh air.
I’m unsure whether svelteplot strictly adheres to Observable Plot’s API or is open to divergence as noted in the README:
Its API is heavily inspired by Observable Plot.
Regardless, I’d like to propose three potential solutions for a missing feature.
Is your feature request related to a problem? Please describe.
Currently, users lack fine-grained control over mark rendering beyond the exposed props. My specific use case involves tweening between states, which doesn’t seem possible with svelteplot today. Another use case is rendering custom components as marks.
Describe the solution you'd like
Here are three approaches to address this:
1. Implement a render transform
This would expose low-level D3 constructs, allowing users to inject custom logic (e.g., .transform()) into the rendering pipeline.
Example: https://observablehq.com/@fil/plot-animate-a-bar-chart/2
2. Integrate with svelte/motion
Expose a motion prop, either:
Examples:
3. Support children snippet
The simplest yet most powerful option: allow users to inject Svelte snippets for full rendering control.
I'd like to preface this by commending you on such a great library. It's truly a breath of fresh air.
I’m unsure whether svelteplot strictly adheres to Observable Plot’s API or is open to divergence as noted in the README:
Regardless, I’d like to propose three potential solutions for a missing feature.
Is your feature request related to a problem? Please describe.
Currently, users lack fine-grained control over mark rendering beyond the exposed props. My specific use case involves tweening between states, which doesn’t seem possible with
svelteplottoday. Another use case is rendering custom components as marks.Describe the solution you'd like
Here are three approaches to address this:
1. Implement a
rendertransformThis would expose low-level D3 constructs, allowing users to inject custom logic (e.g.,
.transform()) into the rendering pipeline.Example: https://observablehq.com/@fil/plot-animate-a-bar-chart/2
2. Integrate with
svelte/motionExpose a motion prop, either:
Declaratively (similar to
layerchart):Or via direct object injection (cleaner/treeshakable):
Examples:
3. Support
childrensnippetThe simplest yet most powerful option: allow users to inject Svelte snippets for full rendering control.