Scalable Vector Graphics (SVG) - compute text size

J

James-Hughes

I am currently working on a .Net assembly (C#) to dynamically generate
an SVG in the form of a bar chart. I am having a problem drawing the
legend based upon dynamic data being passed to my class. When I am
drawing the legend, I need to determine which item is the longest and
make the legend at least that wide. What I would like to do is
determine the height and width of a piece of text based upon a
selected font and size. Does anyone have any code to do this or know
of where I can go for more information.
 
T

Thomas Meinike

James-Hughes said:
I am currently working on a .Net assembly (C#) to dynamically generate
an SVG in the form of a bar chart. I am having a problem drawing the
legend based upon dynamic data being passed to my class. When I am
drawing the legend, I need to determine which item is the longest and
make the legend at least that wide.

Use the method getComputedTextLength(), see for example:
<http://www.datenverdrahten.de/svglbc/?code=textinformationen>
<http://www.datenverdrahten.de/svglbc/?code=tooltip>

cu, Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top