Monday, August 3, 2009

How To Hide Legend In PieChar Silverlight

<UserControl x:Class="Charting.Pagee"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows"
    Width="400" Height="300">
    <Grid x:Name="LayoutRoot" Background="White">

        <charting:Chart Title="Legend Disabled">         

            <charting:Chart.LegendStyle>
                
                <Style TargetType="datavis:Legend">
                    
                    <Setter Property="Width" Value="0"/>
                    <Setter Property="Height" Value="0"/>
                    
                </Style>
                
            </charting:Chart.LegendStyle>
            
            <charting:Chart.Series>
                
                <charting:PieSeries  DependentValuePath="X" >                    
                    <charting:PieSeries.ItemsSource>
                        <PointCollection>
                            <Point X="1"/>
                            <Point X="2"/>
                            <Point X="3"/>
                            <Point X="4"/>
                        </PointCollection>
                    </charting:PieSeries.ItemsSource>
                </charting:PieSeries>
                
            </charting:Chart.Series>
            
        </charting:Chart>
    </Grid>
</UserControl>



No comments: