nabils Posted April 23, 2008 Report Share 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? Quote Link to comment Share on other sites More sharing options...
JuanC Posted April 23, 2008 Report Share 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 Quote Link to comment Share on other sites More sharing options...
VinnieP79 Posted April 23, 2008 Report Share Posted April 23, 2008 Is it possible to make the legend flow horizontally rather than stacking vertically? Quote Link to comment Share on other sites More sharing options...
JuanC Posted April 23, 2008 Report Share 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 Quote Link to comment Share on other sites More sharing options...
nabils Posted April 24, 2008 Author Report Share 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. Quote Link to comment Share on other sites More sharing options...
JuanC Posted April 24, 2008 Report Share 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, Quote Link to comment Share on other sites More sharing options...
Mick Posted April 5, 2010 Report Share 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.