In WPF, we can use chart features using charting toolkits available through Nuget library.

While using the chart, by default the legends will show without any settings we make.

To avoid the legend, we dont have any straight forward methods as like normal .net grids/charts, we can workaround as below:

<chartingToolkit:Chart.LegendStyle>
<Style TargetType=”{x:Type visualizationToolkit:Legend}”>
<Setter Property=”Visibility” Value=”Hidden”/>
<Setter Property=”Width” Value=”0″></Setter>
</Style>
</chartingToolkit:Chart.LegendStyle>

To hide the legend we have to apply the width property to ZERO also along with making it hidden.

Hope in next version, VS team will resolve this need of extra setting !!!

Leave a Reply