I'm currently working on a project that involves building a dynamic diagram and am looking at using SVGs for this.
Based on this, I wish to see whether what I am after is actually possible with SVGs.
1) Using JavaScript and json, is it possible to build an SVG diagram within a HTML page dynamically, based on my json data?
Basically, I want to construct say a rectangle box within the page, where I can have say 1 to 10 svg lines as inputs into the rectangle box, on the left hand side. To determine how many actual lines appear, will come from my json object.
So as mentioned above, is this possible and if so, how might this be setup to draw this inline svg diagram?
2) Again, using JavaScript, is it possible to place hyperlink labels on these svg lines, again based on info within the json object?
I started playing with static inline SVG but unsure how to construct this using javascript instead, to cover off my two points above, i.e.:
<body>
<h1>My SVG Test</h1><hr/>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<text x="465" y="90" fill="red">Heading One</text>
<image x="100" y="110" width="50%" height="50%"
xlink:href="http://my-image.com/myimg.jpg" />
<line x1="25" y1="80" x2="350" y2="80" style="stroke: #000000; stroke-width: 2;"/>
</svg>
</body>