Fixed Width Legend with Legend Label Text Wrapping

3 posts, 0 answers
  1. Daniel
    Daniel avatar
    8 posts
    Member since:
    Jul 2010

    Posted 01 Oct 2010 Link to this post

    I'm trying to set my ChartLegend to a fixed width and wrap the LegendLabel text to fit inside it.

    How can I do this?
  2. Tim
    Tim avatar
    25 posts
    Member since:
    Jan 2009

    Posted 02 Oct 2010 Link to this post

    I would like to know this as well.  My legend takes up more space than my pie chart.  A scroll bar list box would be great.
  3. Evgenia
    Evgenia avatar
    1437 posts

    Posted 06 Oct 2010 Link to this post


    By default the ChartLegend uses a vertical StackPanel to arrange its children. Its legend items are made to fit the size of the legend. You can set legend's size to fixed value like this:

    radChart.DefaultView.ChartArea.Legend.Width = 100;
    NOTE that as soon as you set legend's size to custom value your legend items maybe chopped off (not quite visible) so you should decrease FontSize value of text and retemplate the LegendItemMarker. 

    What I suggest you is a work-around - by aligning the legend to the top or bottom. Check this demo for tips on how to do it.

    If you want to keep the position of the legend at right you can add a ScrollViewer control in order to be able to show large number of chart legend items in a limited space. For more information take a look at this blogpost:
    (the style at the bottom of the post).

    Hope this helps.

    Kind regards,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top