Tuesday, 15 May 2012

javascript - Draw line from path segment data -


I have the following XML that I'm trying to work on, which shoots in the dark.

Whatever will help me in creating a path based on this information.

  & lt; Path & gt; & Lt; Section & gt; & Lt; Dx & gt; 0 & lt; / Dx> & Lt; DI & gt; 15 & lt; / DY & gt; & Lt; To & gt; & Lt; X & gt; 359 & lt; / X & gt; & Lt; Y & gt; 701 & lt; / Y> & Lt; / Gt; & Lt; To & gt; & Lt; X & gt; 359 & lt; / X & gt; & Lt; Y & gt; 686 & lt; / Y> & Lt; / By & gt; & Lt; / Section & gt; & Lt; / Path & gt;  

I know that the above XML is part of a path which is part of a series of connecting lines. Therefore many nodes with XML are similar to the nodes given above in the HTML view.

This should be something like the following:

  & lt; Line x1 = "359" y1 = "686" x2 = "359" y2 = "701" stroke = "black" stroke-width = "1" />  

Or if you need a path:

  & lt; Path d = "m 359,686 l35 9 701" stroke = "black" stroke-width = "1" />  

Or if there are multiple line segments, you can use a polyline:

    

You will need to set the stroke color and width, because by default, they are not ready either to set them in the path / line element, or parent container object Like & lt; Svg & gt; only, or & lt; G > (in the group). / P>

It is not clear to me that what should dx and dy do, so I am ignoring those people where the XML came from ?


No comments:

Post a Comment