Calculating vertical height of a SVG text

前端 未结 1 1391
小蘑菇
小蘑菇 2021-02-14 09:57

I have an array of strings. Say,

[\'Jan 11\',\'Feb 11\']

And i am creating a vertical text with these string like so



        
相关标签:
1条回答
  • 2021-02-14 10:27

    You can use getBBox method to calculate dimensions of the SVG nodes.

    var textNode = document.getElementsByTagName('text'),
        bbox = textNode.getBBox();
    
    //bbox now have x, y, width and height properties
    
    0 讨论(0)
提交回复
热议问题