7
1

Stupidly Simple SVG Sparklines

1mon 4d ago by programming.dev/u/codeinabox in webdev@programming.dev from shkspr.mobi

viewBox="0 0 $svg_width $svg_height"

The y co-ordinate is harder. The algorithm is: Find the height of the SVG.

Why is the viewBox using parameters?

SVG stands for scalable vector graphics. Let it scale.

viewBox can serve as a native baseline area coordinate system. Put width and height on the SVG or let it render in its container instead of misusing the viewBox for size and it will scale just fine. No?