> The problem I am having is that in order to make a path, I need to convert
> my points to the SVG data string (M 0,0 10,50 24,3).
As Ian pointed out, d3.svg.line is the most common way to convert an
array of points to a path string. Another idiom I sometimes use for
simple lines is this:
"M" + points.join("L")
Where points is an array of two-number arrays ([[x1, y1], [x2, y2],
…]), such as:
var points = [[0, 0], [1, 2], [3, 3]];
This takes advantage of the default toString behavior of JavaScript
arrays, which is to convert each element in the array to a string and
then join them with a comma. Those two-element arrays are then joined
with the character "L" to produce a polyline. The resulting string
looks like this:
M0,0L1,2L3,3
If you want a polygon rather than a polyline, you can also tack a "Z"
on the end.
Mike