Jump to content
Software FX Community

Question concerning size determination of legends.


User (Legacy)
 Share

Recommended Posts

I have a chart with a legend that I want to output as a metafile.  There is

a limit to the total size of the image( chart + legend may not exceed this

size ). The problem that I am having is due to the use of the

SizeToFitMethod for the legend object. If I happen to have a long legend

name the SizeToFit call seems to like to force the whole string to be put

into the legend box as a single line, even though the ability for it to be a

multi-line legend is enabled. In certain cases this causes the legend to

take up more of the total output size than the chart area does. Is there a

way to for the legend to draw itself nicely but not to exceed certain limits

on the total size that can be take up by the legend box....something like

25% of the total area allowed? I do not necessarily know the legend values

up front so I cannot neccessarily format those strings with \r\n to force

the legends to appear on multiple line. I know that I can set the size of

the legend box, but how do I tell the legend box that it should redraw its

contents to fit within the size that I set? Thank you.

-Mac

Link to comment
Share on other sites

The SizeTOFit method, as you pointed out, calculates the size base on ONE

line of text. There is no unique way of determining the "best size" when

word breaks are allowed.

The best option here, I think, would be to set the legend size manually to a

fixed width and let the word-break do the fitting. Of course there is no way

to ensure that everything will fit but if you have a general idea of the

dimensions of your text and the height of the chart you can probably come up

with a size that works for you.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Yes that was my question...HOW to allow word break to do the fitting.  I am

only creating the window to generate a bitmap at this point. After I resize

or limit the size of the legend what do I call then? Some sort of resize or

redraw? I haven't found anything in the help on this and I always used

SizeToFit method previously. And if wordbreak is allowed I do not need to

have /r/n in the text in order for it to break, unless I want the word

broken at that particular spot. Is this correct? Thanks again.

-Mac

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:Zr3yTwVGDHA.1060@webserver1.softwarefx.com...

> The SizeTOFit method, as you pointed out, calculates the size base on ONE

> line of text. There is no unique way of determining the "best size" when

> word breaks are allowed.

>

> The best option here, I think, would be to set the legend size manually to

a

> fixed width and let the word-break do the fitting. Of course there is no

way

> to ensure that everything will fit but if you have a general idea of the

> dimensions of your text and the height of the chart you can probably come

up

> with a size that works for you.

>

> --

> FP

> Software FX, Inc.

>

>

post-2107-13922394666679_thumb.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...