Feature/wasm svg support#212
Open
JaminMartin wants to merge 2 commits into
Open
Conversation
added 2 commits
December 19, 2025 14:13
This adds the ability to override the default "canvas" backend for the WASM renderer. ChartSize has been replaced by InitOptions to better reflect adding of additional initialisation options.
Collaborator
|
CI is failing due to another problem. I will review the code on the weekend. |
Author
|
@LukaOber Is this still failing due to another issue? or something I have done? happy to fix if there is an issue. |
Author
|
@LukaOber any progress on this? Understandable if you are busy! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After some great help from @LukaOber in #211 I have added the ability to choose the rendering backend for the
WasmRendererKey changes at the user level:
let renderer = WasmRenderer::new(600, 400).renderer(Renderer::Svg);The user can now specify the rendering backend, if the
.renderermethod is not added, the current default behaviour is used (i.e. defaults tocanvasUnder the hood, the
WasmRenderernow accepts additionalinitoptions, not just its size. I have also renamedChartSizetoInitOptionsto reflect this.I believe some of these could be renamed further, e.g.
let renderer = WasmRenderer::new(600, 400).backend(Renderer::Svg);The
Rendererenum could also be renamed if there is a more appropriate name.I have updated the Leptos example to include this and it works well, replicating the same results as was provided by #211
This should work for all Wasm supporting frameworks e.g Dioxus, Yew etc.