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

Size of chart in view

1 Answer 75 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Torrie Graeff
Top achievements
Rank 1
Torrie Graeff asked on 03 Feb 2010, 04:09 PM
I have a chart in a user control and I want to have my page contain that user control view at a particular size.  Unfortunately, when I set the height & width of the view, it just affects the view size and doesn't resize the chart to that size.  How can I make my chart resize to the size of what the parent page is telling it to be?

On my main page, I have this:
<Views:SeasonRevenueBreakdown Height="200" Width="300" Grid.Column="0" Grid.Row="1" /> 

And in my user control markup I have this:
    <StackPanel Background="Black" Orientation="Vertical"
        <telerikChart:RadChart x:Name="RevenuePie" Height="450" Width="640" > 
            <telerikChart:RadChart.DefaultView> 
                <chart:ChartDefaultView> 
                    <chart:ChartDefaultView.ChartArea> 
                        <chart:ChartArea LegendName="CustomLegend"
                            <chart:ChartArea.DataSeries> 
                                <chart:DataSeries> 
                                    <chart:DataSeries.Definition> 
                                        <chart:PieSeriesDefinition /> 
                                    </chart:DataSeries.Definition> 
                                    <chart:DataPoint LegendLabel="1" LabelFormat="#%" YValue="70" /> 
                                    <chart:DataPoint LegendLabel="2" LabelFormat="#%" YValue="16" /> 
                                    <chart:DataPoint LegendLabel="3" LabelFormat="#%" YValue="4" /> 
                                    <chart:DataPoint LegendLabel="4" LabelFormat="#%" YValue="7" /> 
                                    <chart:DataPoint LegendLabel="5" LabelFormat="#%" YValue="3" /> 
                                </chart:DataSeries> 
                            </chart:ChartArea.DataSeries> 
                        </chart:ChartArea> 
                    </chart:ChartDefaultView.ChartArea> 
                    <chart:ChartDefaultView.ChartLegend> 
                        <chart:ChartLegend x:Name="CustomLegend" /> 
                    </chart:ChartDefaultView.ChartLegend> 
                    <chart:ChartDefaultView.ChartTitle> 
                        <chart:ChartTitle Content="Season Revenue Breakdown" /> 
                    </chart:ChartDefaultView.ChartTitle> 
                </chart:ChartDefaultView> 
            </telerikChart:RadChart.DefaultView> 
        </telerikChart:RadChart> 
 
        <Button Height="27" Content="Save Chart" Click="Button_Click" /> 
 
    </StackPanel> 



1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 05 Feb 2010, 03:30 PM
Hello Torrie,

You can wrap RadChart in a grid and remove chart's Width and Height settings:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="Auto"></RowDefinition>
    </Grid.RowDefinitions>
    <telerikChart:RadChart x:Name="RevenuePie">
        <telerikChart:RadChart.DefaultView>.........
        </telerikChart:RadChart.DevaultView>
    </telerikChart:RadChart>
    <Button Height="27" Content="Save Chart" Click="Button_Click" Grid.Row="1" />
</Grid>


Best regards,
Ves
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
Chart
Asked by
Torrie Graeff
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or