Cannot make PieChart take up 100% of parents space

2 posts, 1 answers
  1. Jesper
    Jesper avatar
    18 posts
    Member since:
    Jun 2012

    Posted 21 Aug 2012 Link to this post

    Hello,

    I am exploring the PieChart and, like som many others, I've stumbled across problems with its size. As I understand it the PieChart should take up 100% of its parent's area but so far it is always rendered at some sort of minimum size and I need help understanding why. The only difference between my XAML and the ones I've seen in your vanilla examples is the fact I render using DataTemplates, as a result of using MVVM.

    This is the XAML I use to try it out:

    <DataTemplate x:Key="PieChartTemplate">
        <Grid Background="Beige">
                <telerik:RadPieChart VerticalAlignment="Center" HorizontalAlignment="Center" Background="CadetBlue" >
      
                    <telerik:PieSeries ShowLabels="True">
                        <telerik:PieSeries.DataPoints>
                            <telerik:PieDataPoint Value="10" Label="A"/>
                            <telerik:PieDataPoint Value="4" Label="B"/>
                            <telerik:PieDataPoint Value="7" Label="C"/>
                            <telerik:PieDataPoint Value="11" Label="D"/>
                            <telerik:PieDataPoint Value="15" Label="E"/>
                        </telerik:PieSeries.DataPoints>
                    </telerik:PieSeries>
                </telerik:RadPieChart>
        </Grid>
    </DataTemplate>

    And here's how it renders:

    http://www.flickr.com/photos/59656722@N06/7830046920/in/photostream/lightbox/

    Please note that the PieChart's parent is the beige grid. I also set a background color ("CadetBlue") for the PieChart itself to see how much space it uses.

    Please help me understand how to fix this.
    Thanks
  2. Answer
    Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 24 Aug 2012 Link to this post

    Hi Jesper,

    I think the reason for this is because you have set the horizontal and vertical alignment of the ChartView to be Center. If you remove this setting and leave it to its default value, which is Stretch, all should be fine.

    <telerik:RadPieChart Background="CadetBlue" >

    Kind regards,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top