svg - getBBox() returns nothing for rect or path -


please refer below rect code.

<rect id="container_svg_chartarea" x="146.8" y="20" width="633.2" height="414" fill="white" stroke-width="1" stroke="gray"></rect> 

i tried rectangle bounding box value returns nothing i.e."0" x=0,y=0,width=0,height=0

$("#container_svg_chartarea")[0].getbbox() 

but when attribute x/y/width/height returns value

$("#container_svg_chartarea").attr("x") ->value returned. 

same path element rectangle element.

what going wrong?

no solution provide here.

how bounding box or rect (getbbox()) svg path in jquery

thats why created thread. not duplicate thread.

thanks,

siva

look example on how , manage bounding box of svg elements

http://www.janvas.com/illustrators_designers_developers/projects/janvas2d_web/examples_en.php?examplename=ufo_animation_en

in general

var svgelement = document.getelementbyid('the id of element'); bbox = svgelement.getbbox();  console.log( bbox.x ) ; console.log( bbox.y ) ; console.log( bbox.width ) ;    console.log( bbox.height ) ;  

Comments