Trivial, but I can’t seem to print a jQuery SVG polygon from a string or array. Following the example at http://keith-wood.name/svgRef.html#polygon works fine.
So I fabricated a string that looks like [[129.03,192],[151.47,204.8],[134.64,233.6],[112.2,224]], but it returns an error: TypeError: Object [ has no method 'join'.
The documentation at the previous link hints at `points(number[][2]) being the x/y coordinates, but any combination of variables I stuff in fail.
What’s the secret? How can I compile a string or array of points to make a polygon with?
EDIT: polygon example code from link: svg.polyline([[450,250],
[475,250],[475,220],[500,220],[500,250],...],
{fill: 'none', stroke: 'blue', strokeWidth: 5});
var arr = [[129.03,192],[151.47,204.8],[134.64,233.6],[112.2,224]]and it should not bevar arr = "[[129.03,192],[151.47,204.8],[134.64,233.6],[112.2,224]]"as you have said “So I fabricated a string that looks like “if you get them as string then do
eval("[[129.03,192],[151.47,204.8],[134.64,233.6],[112.2,224]]")But many say eval is evil