Size of chart in view

2 posts, 0 answers
  1. Torrie Graeff
    Torrie Graeff avatar
    1 posts
    Member since:
    Feb 2010

    Posted 03 Feb 2010 Link to this post

    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> 



  2. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 05 Feb 2010 Link to this post

    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.
Back to Top