Please: I'm trying to position 2 lines of text above each other at the center of a pie chart. Each text has dynamic content, font-size and style therefore i create 2 elements using the text() function. Now i run into weirdness trying to determine positions:
Since the getBBox() function is only available after adding the text element to the paper it seems there is no way to calculate size and according position before text shows up?
Should i create text in an offscreen position first and shift it to the calculated coordinates after getting its Bounds? I could also create transparent text and make it opaque later but both solutions sound overly complicated. Is getBBox() the way to go or are there probably easier solutions i've missed?
Please: I'm trying to position 2 lines of text above each other at the center of a pie chart. Each text has dynamic content, font-size and style therefore i create 2 elements using the text() function. Now i run into weirdness trying to determine positions:
Since the getBBox() function is only available after adding the text element to the paper it seems there is no way to calculate size and according position before text shows up?
Should i create text in an offscreen position first and shift it to the calculated coordinates after getting its Bounds? I could also create transparent text and make it opaque later but both solutions sound overly complicated. Is getBBox() the way to go or are there probably easier solutions i've missed?