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. Image for the cookie policy date
close icon

Formatting Legend

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


5 Replies

AD Administrator Syncfusion Team September 25, 2008 04:52 AM UTC

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


SJ Søren Jespersen September 25, 2008 09:05 AM UTC


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



AD Administrator Syncfusion Team September 25, 2008 09:44 AM UTC

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



SJ Søren Jespersen September 26, 2008 06:41 AM UTC

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





AD Administrator Syncfusion Team September 26, 2008 07:00 AM UTC

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


Loader.
Live Chat Icon For mobile
Up arrow icon