nabils Posted April 23, 2008 Report Posted April 23, 2008 How do I position the legend? The help docs mention a property of legendbox called Dock to allow you to dock the legend around the chart but I cannot find this. I need to display the legend at the top of the chart and make the items flow horizontally rather than vertically? Is this possible?
JuanC Posted April 23, 2008 Report Posted April 23, 2008 Inside the chart we use a DockPanel - actually a very similar panel - to layout the different tools (LegendBox, DataView). Because of this you can get the legend at the top of the chart by doing this in XAML <cfx:Chart.LegendBox><cfx:LegendBox Visibility="Visible" DockPanel.Dock="Top" /></cfx:Chart.LegendBox>or in code DockPanel.SetDock(chart1.LegendBox, Dock.Top);Regards, JuanC
VinnieP79 Posted April 23, 2008 Report Posted April 23, 2008 Is it possible to make the legend flow horizontally rather than stacking vertically?
JuanC Posted April 23, 2008 Report Posted April 23, 2008 Our current builds will do that automatically, you can also setup your own panel by using the LegendBox.ContainerStyle property with a style as follows <Style x:Key="MyLegendStyle" TargetType="{x:Type ItemsControl}"><Setter Property="Template"><Setter.Value><ControlTemplate><StackPanel Orientation="Horizontal" IsItemsHost="True"/></ControlTemplate></Setter.Value></Setter></Style>Regards, JuanC
nabils Posted April 24, 2008 Author Report Posted April 24, 2008 The legend seems to position itself underneath the title when using DockPanel.Top. Can I get them on the same line? Title on the left and legend on the right.
JuanC Posted April 24, 2008 Report Posted April 24, 2008 >> Can I get them on the same line? Yes, we will contact you offline with a sample on how to do this. Regards,
Mick Posted April 5, 2010 Report Posted April 5, 2010 When I define this style in a default Chart's resources (a chart that has no data set), it doesn't seem to apply it. <cfx:Chart> <cfx:Chart.Resources> <Style x:Key="{x:Type ItemsControl}" TargetType="{x:Type ItemsControl}"> ... I changed the key so that it would be the default style for any ItemsControl. Is there something else I should be doing? Also, if I define this style in XAML in a global resource dictionary in my application, how would I apply it in code? Thank you, Mick
Recommended Posts
Archived
This topic is now archived and is closed to further replies.