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


    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: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"/>

    And here's how it renders:

    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.
  2. Answer
    Petar Marchev
    Petar Marchev avatar
    996 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.

Back to Top