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

Programmatically place radChartArea in grid

2 Answers 68 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Gilberto
Top achievements
Rank 1
Gilberto asked on 30 Nov 2009, 08:00 PM
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 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 01 Dec 2009, 10:59 AM
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.
0
Gilberto
Top achievements
Rank 1
answered on 01 Dec 2009, 03:02 PM
Thanks, works really fine
Tags
Chart
Asked by
Gilberto
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Gilberto
Top achievements
Rank 1
Share this question
or