thequantimizer schrieb:

> hi ,
>   i want to display the dynamic data that i m getting in the xml file
> on my svg map , the problem i am facing is the addition of tags , like
> i want to display data as circles , dynamicaly into my svg file . any
> advice on how to do that . can we create the svg item like an object
> and then assign property to that object and show it on the screen.
>
> regards,
>
> Usman.

Hi Usman

you create tags with the createElement method of the document object:

var circle=document.createElementNS("http://www.w3.org/2000/svg","circle";)


and the set the circles attributes vie the setAttribute method:

circle.setAttribute("cx",50)
circle.setAttribute("cy",50)
circle.setAttribute("r",50)

until now nothing will get renderd, you do have a svg circle in memory 
now, to show the circle, you have to place it somewhere in your document,
you could use any of the following methods appendChild() , 
replaceChild() , insertBefore() , insertAfter().

so say your document looks like this:

<svg xmlns="http://www.w3.org/2000/svg";>
<g id="insertPoint"/>

</svg>

then your script do

var insertPoint=document.getElementById("insertPoint")
insertPoint.appendChild(circle)

so our test file looks like this:
<svg xmlns="http://www.w3.org/2000/svg"; onload="addCircle()">
    <g id="insertPoint"/>
    <script>
function addCircle(){
    var 
circle=document.createElementNS("http://www.w3.org/2000/svg","circle";)
    circle.setAttribute("cx",50)
    circle.setAttribute("cy",50)
    circle.setAttribute("r",50)
    var insertPoint=document.getElementById("insertPoint")
    insertPoint.appendChild(circle)
    }
    </script>
</svg>

hth
Holger



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to