Programmatically place radChartArea in grid

3 posts, 0 answers
  1. Gilberto
    Gilberto avatar
    65 posts
    Member since:
    Sep 2006

    Posted 30 Nov 2009 Link to this post

    Hello,

    In xaml, i have radchart tag and grid definition only, I'd like to place the created RadChartArea programmatically to some row and column of the grid defined in design time. Any Suggestions?

    Gilberto
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 01 Dec 2009 Link to this post

    Hi Gilberto,

    You can achieve the desired functionality like this:

    XAML
    <Grid x:Name="LayoutRoot">
         
        <control:RadChart x:Name="RadChart1" UseDefaultLayout="False" Height="800" Width="800">
             
            <Grid x:Name="ChartGrid">
                <Grid.RowDefinitions>
                    <RowDefinition Height="400" />
                    <RowDefinition Height="400" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="400" />
                    <ColumnDefinition Width="400" />
                </Grid.ColumnDefinitions>
            </Grid>
             
        </control:RadChart>       
    </Grid>

    C#
    ChartArea chartArea = new ChartArea();
     
    DataSeries series = new DataSeries();
    series.Add(new DataPoint(20));
    series.Add(new DataPoint(30));
    series.Add(new DataPoint(25));
    series.Add(new DataPoint(10));
     
    chartArea.DataSeries.Add(series);
    Grid.SetRow(chartArea, 1);
    Grid.SetColumn(chartArea, 1);
     
    ChartGrid.Children.Add(chartArea);


    Hope this helps.


    Greetings,
    Manuel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Gilberto
    Gilberto avatar
    65 posts
    Member since:
    Sep 2006

    Posted 01 Dec 2009 Link to this post

    Thanks, works really fine
Back to Top