Jump to content
Software FX Community

How to wrap legend labels when they are too long


Recommended Posts

Hello TKE,

To accomplish this you may want to use the following:

chart1.LegendBox.Height = 100;

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

chart1.LegendBox.Width = 100;

chart1.LegendBox.Style |= ChartFX.WinForms.LegendBoxStyles.Wordbreak;

Notice that for the property Wordbreak of the LegendBox you must set the size of your LegendBox.

Here is my full sample code:

chart1.Data.Series = 1;

chart1.Data.Points = 3;

chart1.Gallery = ChartFX.WinForms.Gallery.Pie;

chart1.LegendBox.Visible = true;

chart1.Data[0, 0] = 30;

chart1.Data[0, 1] = 50;

chart1.Data[0, 2] = 20;

chart1.Data.Labels[0] = "Internet Explorer nbvbvxbvx";

chart1.Data.Labels[1] = "Netscape";

chart1.Data.Labels[2] = "Other";

chart1.LegendBox.Height = 100;

chart1.LegendBox.Width = 100;

chart1.LegendBox.Style |= ChartFX.WinForms.LegendBoxStyles.Wordbreak;
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.

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.

  • Create New...