Jump to content
Software FX Community

Positioning the legend


nabils
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 1 year later...

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...