This is a migrated thread and some comments may be shown as answers.

Cannot make PieChart take up 100% of parents space

1 Answer 79 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jesper asked on 21 Aug 2012, 09:48 AM

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.

1 Answer, 1 is accepted

Sort by
Petar Marchev
Telerik team
answered on 24 Aug 2012, 08:04 AM
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.

Asked by
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question