Hi,
Is it possible to set legend item orientation to horizontal? Normally they all stack vertically.
Thanks,
Charith
- You must login to post comments
Hi Charith,
Unfortunately, there aren’t any ways to do this except modifying control’s template. As a workaround, you could use VisualTreeHelper to get ItemsControl in code and change Orientation of used Panel, or replace it by another panel. Something like the following should help:
var itemsControl = legendControl.Template.FindName("PART_LegendItems", legendControl) as ItemsControl; if (itemsControl != null) { var factoryPanel = new FrameworkElementFactory(typeof (StackPanel)); factoryPanel.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal); itemsControl.ItemsPanel = new ItemsPanelTemplate {VisualTree = factoryPanel}; }
I logged your request and we will try to improve SciChartLegend in future.
Best regards,
Yuriy
- Yuriy Zadereckiy answered 11 years ago
-
Just to add my 2p: Funnily enough someone else asked a similar question today on email. I would suggest re-templating as then you can do anything (That's the power of WPF!) There is a forum post on custom templating the Legend Control here. Hope this helps! Andrew
- You must login to post comments
Just an update, we are about to release SciChart v3.1, which will include a few enhancements to the legend. In v3.1, syntax to achieve a horizontal legend will include:
<!-- New to SciChart v3.1! LegendModifier exposes ability to dock a legend inside a chart, change orientation --> <SciChart:LegendModifier ShowLegend="True" LegendPlacement="Top" Orientation="Horizontal" ShowSeriesMarkers="True" ShowVisibilityCheckboxes="True" Margin="10" /> <!-- OR --> <SciChartLegend Orientation="Horizontal"/>
That’s it!
- Andrew Burnett-Thompson answered 10 years ago
- You must login to post comments
Please login first to submit.