Skip to content

Comment on JavaScript in SVGs

Comments

The more I learn about SVG the more amazed I am at its capabilities. Realtime updated SVG charts/images is a very interesting idea. I wonder what kind of component model you could build around SVG? If the SVG JS can determine the SVG's document origin, you could parse GET parameters to dynamically render the SVG based on the URL.

FYI SVG charts have been around for a while and there are many libraries that use them: https://blog.logrocket.com/comparing-most-popular-javascript...

Depending on your use cases and complexity though, sometimes it's better to render to canvas instead (usually for performance reasons). JS and WASM are way more optimized than SVG is, so sometimes it's better to do the heavy calcs and then render raw pixels, instead of relying on SVG geometries.

This is making me think about doing performance tests between HTML JS and SVG JS

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.