substack/amplitude-viewer — pull request #1 by skratchdot (2014-03-30 14:09:09+00:00)
Title: using viewbox for width,height=100%

I've ran into this issue before in firefox in which svg widths and heights of 100% don't seem to render intuitively when using polylines. To fix the behavior in firefox, I started using a viewbox with an 'x' range between 0-1, and a 'y' range between -1.1-1.3.

Then the polyline is created with amplitude values between -1-1, and x/time values between 0-1.

The reason the viewbox range is -1.1-1.3 is for some padding (I played w/ a few settings, and these looked the best).

I removed the .resize() event because it wasn't needed anymore (no more width/height calculations).

The downside is that the polyline width of .005 is kind of strange (and might break backwards compatibility if anyone was passing in 'px' values as an option).