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

Set ChartArea data source

3 Answers 72 Views
Chart
This is a migrated thread and some comments may be shown as answers.
AdaDog
Top achievements
Rank 1
AdaDog asked on 08 Mar 2010, 09:39 PM
Is there a way to add DataSeries to a ChartArea, which does not have a name?

I would like to create a custom layout for the ChartTitle, ChartArea, and ChartLegend in XAML but I only have access to the RadChart in code (not the ChartArea).  I know I can get to the DefaultView ChartArea through the RadChart object.  I could access the Content property of the RadChart and get the first ChartArea type, but that's not very elegant and is too dependent on the visual tree.

Any ideas?

<telerikChart:RadChart   
            x:Name="SeasonsChart"    
            VerticalAlignment="Stretch"   
            HorizontalAlignment="Stretch" 
            UseDefaultLayout="False" 
            Background="Transparent">  
        <Grid> 
            <Grid.RowDefinitions> 
                <RowDefinition Height="50"/>  
                <RowDefinition Height="*"/>  
            </Grid.RowDefinitions> 
            <Grid.ColumnDefinitions> 
                <ColumnDefinition Width="*"/>  
                <ColumnDefinition Width="Auto"/>  
            </Grid.ColumnDefinitions> 
            <Border x:Name="SeasonsImage" Grid.ColumnSpan="2" Grid.RowSpan="2" ></Border>  
            <telerikCharting:ChartTitle 
                                    Margin="20, 0, 0, 0" 
                                    Padding="5,5,5,5" 
                                    Foreground="GhostWhite" 
                                    Grid.Row="0" 
                                    Grid.Column="0"                                      
                                    HorizontalAlignment="Left" 
                                    VerticalAlignment="Bottom"/>  
            <telerikCharting:ChartArea   
                                   LegendName="SeasonsLegend" 
                                   Background="{StaticResource springTransparentBrush}"   
                                   Padding="20, 20, 0, 30"   
                                   Grid.Row="1" 
                                   Grid.Column="0"/>  
            <telerikCharting:ChartLegend   
                                     Header="Temperatures"   
                                     Visibility="Visible" 
                                     Background="{StaticResource springTransparentBrush}" 
                                     Grid.Column="1" 
                                     Grid.Row="1" 
                                     Padding="-10, 20, 20, 30"/>  
            <input:RadComboBox x:Name="SeasonCombo"   
                          SelectionChanged="SeasonCombo_SelectionChanged" 
                          HorizontalAlignment="Right"   
                          VerticalAlignment="Bottom" 
                          Margin="0, 0, 20, 0" 
                          Grid.Row="0" 
                          Grid.Column="0" 
                          MaxWidth="150" 
                          MaxHeight="30" 
                          telerik:StyleManager.Theme="{StaticResource QsfTheme}">  
                <input:RadComboBoxItem Content="Spring"></input:RadComboBoxItem> 
                <input:RadComboBoxItem Content="Summer"></input:RadComboBoxItem> 
                <input:RadComboBoxItem Content="Autumn"></input:RadComboBoxItem> 
                <input:RadComboBoxItem Content="Winter"></input:RadComboBoxItem> 
            </input:RadComboBox> 
        </Grid> 
    </telerikChart:RadChart> 

3 Answers, 1 is accepted

Sort by
0
Velin
Telerik team
answered on 11 Mar 2010, 11:21 AM
Hello Doug Simpson,

The reason RadChart provides the possibility to disable the default layout is to allow our customers to change the default view of the control and this might include scenarios with adding more than one ChartArea simultaneously into a single RadChart instance. That said you need to have Name set to the ChartArea object in order to populate it with data.

Sincerely yours,
Velin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
AdaDog
Top achievements
Rank 1
answered on 11 Mar 2010, 03:45 PM
I know why it's useful and how to change the default view.

Is there a way to access the ChartArea(s) object(collection) inside a RadChart in code?  Is a ChartArea a child of a RadChart?  Where is it in the tree?
0
Velin
Telerik team
answered on 12 Mar 2010, 09:32 AM
Hello Doug Simpson,

I'm afraid that there is no way to access a non default ChartArea object through RadChart. You can only access it by name or by using the visual tree.

Best wishes,
Velin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Chart
Asked by
AdaDog
Top achievements
Rank 1
Answers by
Velin
Telerik team
AdaDog
Top achievements
Rank 1
Share this question
or