Horizontal Legend Layout

Charts for WPF Forum

Posted 2 years ago by Nathan Hanson
Version: 17.2.0662
Avatar

Hi! I'm evaluating Actipro's charting component for use in an upcoming software release. It's looking great so far but I have a question about the legend. The Legend can be placed in a variety of locations and that's really helpful. But I'd like to have the legend items lay out horizontally instead of vertically when I put the legend above or below the chart itself. Can a horizontal orientation be set through a template or anything?

Thanks,

Nate Hanson

EPIS, LLC.

Comments (2)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nate,

Thanks for evaluating our products.  The Legend is an ItemsControl, so you can change its layout to horizontal by adding this to XYChart:

<charts:XYChart.LegendStyle>
	<Style TargetType="ItemsControl">
		<Setter Property="ItemsPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<StackPanel Orientation="Horizontal" />
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</charts:XYChart.LegendStyle>


Actipro Software Support

Posted 2 years ago by Nathan Hanson
Avatar

Excellent! That worked like a charm. I love WPF components. The chart I'm hoping to replace is an old Winforms component and I have no control over things like the legend style.

Thanks for the help! I'll be demoing my WPF chart sample app for the higher ups soon. Hoping to sell them on the whole suite of your controls.

The latest build of this product (v2019.1 build 0682) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.