Customizing RadChart layout

3 posts, 1 answers
  1. David Kossatz
    David Kossatz avatar
    5 posts
    Member since:
    Feb 2010

    Posted 09 Feb 2010 Link to this post

    Hey all,

    I am trying to customize my RadChart layout and have something very similiar to the following:

        <Grid x:Name="LayoutRoot" Background="White">               
                <RowDefinition Height="9*"/>    
                <RowDefinition Height="1*"/>    
            <Border BorderBrush="Aquamarine" BorderThickness="10" Grid.Row="0">    
                <Chart:RadChart x:Name="Chart1" UseDefaultLayout="False" Grid.Row="0">    
                        <Style TargetType="Charting:ChartLegend">    
                            <Setter Property="ItemsPanel" >    
                                        <StackPanel Orientation="Horizontal" />    
                            <RowDefinition Height="1*" />    
                            <RowDefinition Height="8*" />    
                            <RowDefinition Height="1*" />    
                        <Charting:ChartArea x:Name="ChartArea1" LegendName="ChartLegend1"     
                                   Grid.Row="1" />    
                        <Charting:ChartTitle Content="Sample Report" Grid.Row="0"    
                                    VerticalAlignment="Top" HorizontalAlignment="Center"    
                        <Charting:ChartLegend x:Name="ChartLegend1" Header="Legend:"    
            <Button x:Name="Btn" Content="Load" Click="Btn_Click" Grid.Row="1"/>    

    Also (not shown above), I have a RadGridView that has a DateTime value in the first column, and a few more columns (Value1, Value2, etc).
    I want it to plot each of the Values columns on the Y-axis and the DateTime on the x-axis.  So in the code-behind, I have the SeriesMapping created with the ItemMappings set up properly and I add the each of the SeriesMappings to Chart1.

    So when the user selects some rows, I have in the SelectionChanged event handler to update the Chart1.ItemsSource field but the points do not get graphed! (this is the problem)

    When I don't use my customized layout (and just UseDefaultLayout = True), my points do get graphed.  I've also tried setting the ChartArea1.ItemsSource field to the selected items but that didn't work either.

    Any help would be appreciated!  If you need more info, let me know.


  2. David Kossatz
    David Kossatz avatar
    5 posts
    Member since:
    Feb 2010

    Posted 10 Feb 2010 Link to this post

    I found a workaround for now...

                RadChart1.ItemsSource = selectedList;  
                foreach (var ds in RadChart1.DefaultView.ChartArea.DataSeries)  

    Once I set the RadChart1.ItemsSource to the selected rows of the GridView, it updates the RadChart1.DefaultView.ChartArea.DataSeries.  I would expect that if I set the ChartArea1.ItemsSource to the selected rows, the ChartArea1.DataSeries would be updated...but it is not.

    Is this the intended behaviour?  Or is there another way I should be doing this?


  3. Answer
    Vladimir Milev
    Vladimir Milev avatar
    1061 posts

    Posted 12 Feb 2010 Link to this post

    Hi David Kossatz,

    If you intend to use databinding with a ChartArea different from the one in the DefaultView simply use the SeriesMapping.ChartArea or SeriesMapping.ChartAreaName propeties to indicate that.

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