When using the Orientation.Horizontal attribute in using LegendModifier 3D, Legend items are displayed in a single line.
I want to print in two lines but I’m not looking for a way to implement that feature.
If there’s a way to print it out, I’d appreciate it if you could let me know.
The development language is C#.
- MIN JAE KIM asked 2 months ago
-
Hi Min Jae Kim, Thanks for your question. I’m going to discuss this with our team and will get back to you as soon as I have an update. Kind regards, Lex, SciChart Technical Support Engineer
- You must login to post comments
Hi Min Jae Kim,
Hope you are doing well.
We discussed your inquiry.
The default Panel for SciChartLegend is a standard WPF StackPanel, which supports two layout modes – Vertical and Horizontal.
If you want Legend items to be arranged differently, you will need to re-template SciChartLegend and replace the default panel with a Panel that will support your desired layout.
Please take a look at the “Templating the SciChartLegend Control” section of the following documentation article:
SciChart WPF Documentation – LegendModifier _ WPF Chart Documentation
You can provide a Panel by setting the ItemsPanel property on the SciChartLegend.
For example, your LegendModifier with a custom Legend Template may look like this:
<s:LegendModifier x:Name="legendModifier"
ShowLegend="True" Orientation="Horizontal" Margin="10" >
<s:LegendModifier.LegendTemplate>
<ControlTemplate>
<!-- Change the AutoGenerated SciChartLegend -->
<s:SciChartLegend ItemTemplate="{Binding LegendItemTemplate}"
LegendData="{Binding LegendData}"
Orientation="{Binding Orientation}"
ScrollViewer.HorizontalScrollBarVisibility="{Binding Path=(ScrollViewer.HorizontalScrollBarVisibility)}"
ScrollViewer.VerticalScrollBarVisibility="{Binding Path=(ScrollViewer.VerticalScrollBarVisibility)}"
ShowSeriesMarkers="{Binding ShowSeriesMarkers}"
ShowVisibilityCheckboxes="{Binding ShowVisibilityCheckboxes}">
<s:SciChartLegend.ItemsPanel>
<ItemsPanelTemplate>
<!-- StackPanel is the default Panel. -->
<!-- Please replace with another Panel to customize Legend Items layout -->
<StackPanel Orientation="{Binding Orientation, RelativeSource={RelativeSource AncestorType=visuals:SciChartLegend}}"/>
</ItemsPanelTemplate>
</s:SciChartLegend.ItemsPanel>
</s:SciChartLegend>
</ControlTemplate>
</s:LegendModifier.LegendTemplate>
Kind regards,
Lex
- Lex answered 2 months ago
- You must login to post comments
Please login first to submit.