Hello,
I have created a xamdatachart with a couple of stacked fragment columns, I would like to show the values of this data inside the columns. (fixed, not tooltips)
What I have found so far is that I can use the MarkerTemplate for this, however if say, the mid column fragment value is 0 (or another small amount) this will overlap with my bottom fragment's value. I figured it was possible to move the markerTemplate's with a Margin, however I would like it to be dynamic instead of fixed with margins. My idea is that it would be something like verticalalignment="center", but could not find anything near this.
This is the code I am using:
<ig:XamDataChart x:Name="ChartControlPerformance" Grid.Column="0" Legend="{Binding ElementName=xmLegend}"> <ig:XamDataChart.Axes> <ig:NumericYAxis x:Name="ChartControlPerformanceYaxis" MinimumValue="0"/> <ig:CategoryXAxis x:Name="ChartControlPerformanceXaxis" ItemsSource="{Binding}" Label="{}{TimeSpan}" /> </ig:XamDataChart.Axes> <ig:XamDataChart.Series> <ig:StackedColumnSeries XAxis="{Binding ElementName=ChartControlPerformanceXaxis}" YAxis="{Binding ElementName=ChartControlPerformanceYaxis}" ItemsSource="{Binding}"> <ig:StackedColumnSeries.Series> <ig:StackedFragmentSeries x:Name="PerformanceProductionColumn" ValueMemberPath="Production" Title="Productie" Brush="Green" MarkerBrush="Green" MarkerOutline="Green" Outline="Green"> <ig:StackedFragmentSeries.MarkerTemplate> <DataTemplate> <Grid VerticalAlignment="Center"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock Margin="2" Text="{Binding Item.Production}" Foreground="White" FontSize="12" HorizontalAlignment="Center" /> </StackPanel> </Grid> </DataTemplate> </ig:StackedFragmentSeries.MarkerTemplate> </ig:StackedFragmentSeries> <ig:StackedFragmentSeries x:Name="PerformanceDowntimeColumn" ValueMemberPath="Downtime" Title="Stilstandverlies" Brush="Orange" MarkerBrush="Orange" MarkerOutline="Orange" Outline="Orange"> <ig:StackedFragmentSeries.MarkerTemplate> <DataTemplate> <Grid> <StackPanel HorizontalAlignment="Right"> <TextBlock Margin="2" Text="{Binding Item.Downtime}" Foreground="White" FontSize="12" HorizontalAlignment="Center" /> </StackPanel> </Grid> </DataTemplate> </ig:StackedFragmentSeries.MarkerTemplate> </ig:StackedFragmentSeries> <ig:StackedFragmentSeries x:Name="PerformanceSpeedLossColumn" ValueMemberPath="PerformanceLoss" Title="Prestatieverlies" Brush="Red" MarkerBrush="Red" MarkerOutline="Red" Outline="Red"> <ig:StackedFragmentSeries.MarkerTemplate> <DataTemplate> <Grid> <StackPanel HorizontalAlignment="Left"> <TextBlock Margin="2" Text="{Binding Item.PerformanceLoss}" Foreground="White" FontSize="12" HorizontalAlignment="Center" /> </StackPanel> </Grid> </DataTemplate> </ig:StackedFragmentSeries.MarkerTemplate> </ig:StackedFragmentSeries> </ig:StackedColumnSeries.Series> </ig:StackedColumnSeries> <ig:LineSeries x:Name="LineSeriesPerformancePlanning" ItemsSource="{Binding}" ValueMemberPath="Planning" Title="Planning" Thickness="5" MarkerType="None" XAxis="{Binding ElementName=ChartControlPerformanceXaxis}" Background="Black" Brush="Black" Outline="Black" YAxis="{Binding ElementName=ChartControlPerformanceYaxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="False"> <ig:LineSeries.MarkerTemplate> <DataTemplate> <Grid Margin="0,0,0,22"> <StackPanel HorizontalAlignment="Left"> <TextBlock Margin="2" Text="{Binding Item.Planning}" Foreground="Black" FontSize="12" HorizontalAlignment="Center" /> </StackPanel> </Grid> </DataTemplate> </ig:LineSeries.MarkerTemplate> </ig:LineSeries> </ig:XamDataChart.Series> </ig:XamDataChart>
I would like to know if it is possible to move a MarkerTemplate to the verticalcenter of a StackedFragmentSeries column.
Hello Ron,
Yes, it is possible and I will create a sample that demonstrates how to achieve this feature and I will post this sample here by end of tomorrow. In mean time, could you please create product idea on this website since it is a feature request for Stacked Series? Thank you,
Martin
Hello Martin,
Thanks for your reply, I'm looking forward to the sample!
I have posted the feature request, it can be found at:
http://ideas.infragistics.com/forums/192363-wpf/suggestions/13412424-alignments-horizontal-vertical-for-markertemplat
I created s sample for you with DataChart showing marker values inside of stacked fragments. Let me know if you need more assistance with it.
- Martin
Thanks a lot!
FYI here preview of my sample with custom markers.