We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Formatting Legend

Thread ID:

Created:

Updated:

Platform:

Replies:

76799 Sep 24,2008 10:33 AM Sep 26,2008 03:00 AM WPF 5
loading
Tags: Chart
Søren Jespersen
Asked On September 24, 2008 10:33 AM

We are using the WPF grid with a numbr of ChartSeries. We also have a Legend that displays the names of the chart series and the legend placement is set to top.

However, due to the rather tight space and the number of chartseries the legends overlap (since they stay on a single line and do not wrap) and become somewhat unreadable.

Are there any ways to:

*) Let the legend wrap around so the individual legend labels are always visible?
*) Can I specify a template that the legend label uses to display
*) If not, can I somehow put a tooltip on the legend label to show the full description?

Any advice is greatly appreciated


Administrator [Syncfusion]
Replied On September 25, 2008 12:52 AM

Hi Soren,

Thanks for your interests in Syncfusion products. All your requirement can be achieved by applying a ItemTemplate to ChartLegend. I have created a sample on the same and it is attached with this post for your reference.

Let me know if you have any queries.

Regards,
Athaur Rahman GS




ChartSample_1d344ba4.zip

Søren Jespersen
Replied On September 25, 2008 05:05 AM


Hi Athaur

Thanks for the sample. Just the kind of thing I was looking for.

A quick followup question. Currently all legends stay on a single line and only text wraps. Are there any way of specifying a multiline-lenged area, where individual can legends overflow onto a new line if there is not enough room on the current line?

Thanks again for the rapid feedback

>Hi Soren,

Thanks for your interests in Syncfusion products. All your requirement can be achieved by applying a ItemTemplate to ChartLegend. I have created a sample on the same and it is attached with this post for your reference.

Let me know if you have any queries.

Regards,
Athaur Rahman GS




ChartSample_1d344ba4.zip


Administrator [Syncfusion]
Replied On September 25, 2008 05:44 AM

Hi Soren,

Text can be displayed in multiline by having TextWrapping property of the TextBlock set to Wrap in the DataTemplate.

Thanks for your interests in Syncfusion products.

Let me know if you have any queries.

Regards,
Athaur Rahman GS


Søren Jespersen
Replied On September 26, 2008 02:41 AM

Hi Athaur

I was not thinking in terms of wrapping the text of a single series but in terms of wrapping multiple series on multiple lines.

For instance, say I have 5 series in the chart but the area for the legend is so small that I need to wrap the text of each series to display them (on a single line). The option I was looking for was a way to break up the 5 series so on one line I would have three labels (without text wrapping) and below that I would have the remaining two labels (also without text wrapping).

The goal would be to avoid any text wrapping and always display the full series label while sacrificing "all-on-a-single-line". Sure it may burn up some more vertical real estate on the screen, but it may be worth it

Again, thanks for the rapid replies

Soren

>Hi Soren,

Text can be displayed in multiline by having TextWrapping property of the TextBlock set to Wrap in the DataTemplate.

Thanks for your interests in Syncfusion products.

Let me know if you have any queries.

Regards,
Athaur Rahman GS




Administrator [Syncfusion]
Replied On September 26, 2008 03:00 AM

Hi Soren,

Thanks for the details. You can achieve this requirement by having ItemsPanel of the ChartLegend set to WrapPanel. The following lines of code can be used to set the ItemsPanel of the ChartLegend.











Let me know if you have further queries.

Thanks for your interests in Syncfusion products.

Regards,
Athaur Rahman GS


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;