This is a migrated thread and some comments may be shown as answers.

Unable to format&style Legend properly

1 Answer 75 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Maarten Bos
Top achievements
Rank 1
Maarten Bos asked on 25 Jan 2012, 04:19 PM
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

1 Answer, 1 is accepted

Sort by
0
Maarten Bos
Top achievements
Rank 1
answered on 25 Jan 2012, 05:24 PM
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.
Tags
Chart (Obsolete)
Asked by
Maarten Bos
Top achievements
Rank 1
Answers by
Maarten Bos
Top achievements
Rank 1
Share this question
or