- From: Jeffrey W. Baker <jwbaker@acm.org>
- Date: Fri, 20 Jan 2006 17:19:19 -0800
- To: www-svg@w3.org
I wonder if I'm reading the SVG specification correctly, because it seems to me impossible to scale an element without scaling the widths of the strokes on that element. It also seems to me that this would be a handy feature. So I wonder: 1) Is it possible to scale a coordinate system without scaling strokes? 2) Wouldn't that be nice? The reason I ask this is because of line chart/graphs I am working with. Suppose you have 400 data points in a time series where the vertical values range from -1 to +1, and you want to put that in a 400x400 box. The easiest thing to do would be to declare a polyline of your raw data, y-scale by -1, y-transform by +1, y-scale by 200. <svg x="0" y="0" width="100%" height="100%" viewBox="0 0 400 400" preserveAspectRatio="none"> <polyline stroke="black" stroke-width="1pt" transform="scale(1,200) transform(0,+1) scale(1,-1)" points="etc etc etc" /> </svg> The problem with this transform is that the line strokes will be 200 times larger than desired. You can also see this effect if you take a square graph and make it ten times wider than it is tall. The stroke will become one-tenth the desired width in the vertical direction, giving it a strange anisotropic appearance. The only (apparent) way to achieve what I need is to pre-compute the scaled polyline vertices, and this still does not solve the problem of the user stretching one axis or the other. In short, what I want is a way to scale a line *before* stroking, whereas it seems the only available functionality is to stroke, then scale. Regards, Jeffrey Baker
Received on Tuesday, 24 January 2006 04:38:47 UTC