Unable to format&style Legend properly

Thread is closed for posting
2 posts, 0 answers
  1. Maarten Bos
    Maarten Bos avatar
    5 posts
    Member since:
    Apr 2010

    Posted 25 Jan 2012 Link to this post

    Currently I am trying to format and style a chart legend according to the design given to me by the design team on the project.

    *see attached image ChartDesign.PNG*

    However I am sofar unable to even put the chart Legend in the correct position, let alone divide the markers.

    The code below would logically do the trick to position the block to bottom left but it stays at bottom CENTER.
    chart.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.BottomLeft;

    *edit*
    I just found out by trial and error that the line
    chart.AutoLayout = true;
    Prevents the legend from being aligned to the left.. I still find this quite strange and would expect other behaviour.
    */edit*

    Can anyone give me some tips or hints on how to move the legend to bottom left and divide the items so that it won't be just a long vertical list?

    Cheers,

    Maarten
  2. Maarten Bos
    Maarten Bos avatar
    5 posts
    Member since:
    Apr 2010

    Posted 25 Jan 2012 Link to this post

    Update;

    I have found a workaround, but this really feels more like a dirty hack, rather than best practice:

    chart.AutoLayout = true;
    chart.Legend.Appearance.Dimensions.AutoSize =
    false;
    chart.Legend.Appearance.Dimensions.Height = 75;
    chart.Legend.Appearance.Dimensions.Width = new Telerik.Charting.Styles.Unit(chart.Width.Value);
    chart.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.BottomLeft;

    This way the chart still scales automatically to available width and the legend box is sized the width of the entire graph and with a height just big enough for 3 series and thus forces the graph legend to position bottom left with 3 items per column.
    See also attached screenshot for result.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top