Customising BarSeries to display the value within the bar

Charts for WPF Forum

Posted 1 month ago by Colin H
Version: 20.1.1
Avatar

I have some BarSeries charts, and am using the LabelVisibility to show the bar's Y 'value'. I'd prefer though to display the Y value within the bar. (Hope that makes sense - I can't spot a way to paste an example image into this post)

Is this possible, and if so, any pointers/tips to how to customise it....? 

Comments (1)

Answer - Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Colin,

You could probably do this by customizing the BarSeries.BarTemplate. 

If you open our BarStyles QuickStart and add this to the BarSeriesStyle's Setters, you should be able to see the value in the bar:

<Setter Property="BarTemplate">
	<Setter.Value>
		<DataTemplate>
			<Grid>
				<Rectangle Fill="Yellow" />
				<TextBlock Text="{Binding YValue}" VerticalAlignment="Center" HorizontalAlignment="Center" />
			</Grid>
		</DataTemplate>
	</Setter.Value>
</Setter>

[Modified 1 month ago]


Actipro Software Support

The latest build of this product (v21.1.0) was released 7 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.