I've created my own marker templates in order to increase the size of the marker and those are working as intended. However, in the legend, the circle is appearing cut off (See Screenshot). The way I have all of the templates being handled is by setting the MinHeight and MinWidth to 11 and the MaxHeight and MaxWidth to 30. All of the markers except for the circle are appearing correctly so the only thing I can think of is the Ellipse object is handled different than the Polygon object.
Let me know if there's anything I'm doing incorrectly or if you there's some work around I need to implement.
Thanks in Advanced
Hello Gary,
Thank you for your post. I have been looking into the appearance that you are having and it is caused by the default LegendItemBadgeTemplate. What I can suggest in order to have the whole marker visible in the legend is to set the LegendItemBadgeTemplate property. I have created a sample application for you, that shows how you can implement this approach.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Krasimir,
I actually have a Badge template set already.
<DataTemplate x:Key="LegendItemBadgeTemplate"> <Grid Width="18" Height="16" Margin="1 0 2 0"> <Line VerticalAlignment="Center" HorizontalAlignment="Center" X1="0" Y1="0" X2="16" Y2="0" Stroke="{Binding Series.ActualBrush}" StrokeThickness="4" StrokeEndLineCap="{Binding Series.EndCap}" StrokeStartLineCap="{Binding Series.StartCap}" Effect="{Binding Series.Effect}" /> <ContentPresenter Width="11" Height="11" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 0 2 0" ContentTemplate="{Binding Series.ActualMarkerTemplate}" Content="{Binding}" /> </Grid> </DataTemplate>
I didn't want to specify a particular shape because this graph can have any number of series on it at one time and each series will have a different marker. Let me know if you think your current solution will still work or what I should do from here.
Thanks
Thank you for your reply. I have been looking into it and if you prefer you can use the default LegendItemBadgeTemplate (the one that you have posted). This will allows you to change the ItemTemplate and have this change applied in the legend also. In order to allow the whole marker to be visible in the legend, when using the default template, you can change it as follow:
<DataTemplate >
<Grid Margin="2 0 2 0" >
<Rectangle VerticalAlignment="Center" HorizontalAlignment="Stretch"
Fill="{Binding Series.ActualBrush}"
Height="{Binding Series.Thickness}"
Effect="{Binding Series.Effect}" />
<ContentPresenter
VerticalAlignment="Center"
HorizontalAlignment="Center"
Margin="2 0 2 0"
ContentTemplate="{Binding Series.ActualMarkerTemplate}"
Content="{Binding}"/>
</Grid>
</DataTemplate>
I have modified the sample application that I attached with my previous reply, to show how you can use this template.
That doesn't really solve my issue either. I've created a sample project to show my issue. The Triangle is working as intended. I'm setting a Max and Min height/width and its using the max for the chart and the min for the legend. I want the ellipse to do the same thing. The behavior in my initial screenshot was a result of setting the Width and Height of the ellipse to 30.
I figured out a solution. It seems like the xamDataChart doesn't recognize the max height/width of Rectangles and Ellipses. I created a new circlemarkertemplate using a Path instead of an ellipse and set the attributes I wanted there and that worked.
<DataTemplate x:Key="CircleMarkerTemplate"> <Path Stretch="Fill" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Stroke="{Binding Series.ActualMarkerOutline}" StrokeThickness="4" MaxHeight="30" MaxWidth="30" MinHeight="11" MinWidth="11" Fill="{Binding Series.ActualBrush}" > <Path.Data> <PathGeometry> <PathGeometry.Figures> <PathFigure StartPoint="0,0" > <PathFigure.Segments> <ArcSegment Size="4,4" RotationAngle="0" IsLargeArc="True" SweepDirection="Clockwise" Point="0,1"/> <ArcSegment Size="4,4" RotationAngle="0" IsLargeArc="False" SweepDirection="Clockwise" Point="0,0"/> </PathFigure.Segments> </PathFigure > </PathGeometry.Figures> </PathGeometry> </Path.Data> </Path> </DataTemplate>