I have a few ValueOverlay objects on my graph, and I would like to remove them from the legend. I set the legend property to null, but the overlays still appear in the legend. How do I remove them?
Hi Ed,
I have been looking into your requirement and I believe that you just need not to set the legend property for your value overlay. I am attaching a sample application(DataChart_Legend.zip) where everything seems to work as expected.
Let me know, if you need any further assistance on this matter.
Although I agree with your code, my particular code does not behave in this way. I wonder is it because I create my series dynamically in the view model? I also have a custom template for the legend which sets the line font in the legend to match the series line font (dash array), but I don't have any code to automatically add my series to the legend.
I also have my legend bound to my xamDataChart legend property per the legend API guidance for a Common Legend. Will this cause my series to appear in the legend, even if I don't set their legend property?
Thank you for your replies. I have been looking into your scenarion and you could remove the value overlays from the lened by setting the ‘LegendItemTemplate’ to false like e.g.:
<Style TargetType="local:ValueOverlay" BasedOn="{StaticResource Series}" >
<Setter Property="LegendItemTemplate" Value="{x:Null}"/>
</Style>
I am attaching a modified version of my sample application(DataChart_Legend_2.zip) that shows this approach.
You can find the default styles for the elements of the XamDataChart in:
C:\Program Files (x86)\Infragistics\2015.1\WPF\DefaultStyles\XamDataChart\generic.shared.xaml
Thank you for your reply. I am glad that you have managed to resolve your issue.
Hi again,
Instead of modifying the styles, I simply removed the legend binding from the xamDataGraph and just assign the legend to the series I want to appear in the legend.