Stacked Bar Chart binding with MVVM collection

4 posts, 0 answers
  1. Monte Baker
    Monte Baker avatar
    26 posts
    Member since:
    Mar 2009

    Posted 01 Dec 2010 Link to this post

    I am hoping you have some examples of using the Stacked Bar Chart with databinding in XAML to a MVVM Property.  What I am trying to do is create a chart with "Month" along the horizontal access and to series ("Planned" & "Actual") and then stack the values by the "GroupLvl" Column


    GroupLvl Xcat Planned Actual
    CENTRAL NOV 30 45
    CENTRAL OCT 0 1
    CENTRAL SEP 0 0
    CENTRAL YTD 0 1
    SOUTHEAST APR 0 1
    SOUTHEAST AUG 1 0
    SOUTHEAST DEC 1173 6840
    TENNESSEE/KENTUCKY NOV 3560 3231
    TENNESSEE/KENTUCKY OCT 2126 3869
    TENNESSEE/KENTUCKY SEP 2756 2174
    TENNESSEE/KENTUCKY YTD 1537 2634

    here is what I have been trying in XAML, but I am still far from the desired mark.

     

     

     

     

    <telerik:RadChart x:Name="CxPerformance"
                                ItemsSource="{Binding CurrentCXCompletedProjectPerformances, Mode=TwoWay}"
                                VerticalAlignment="Top" 
                                Margin="2" 
                                Grid.Column="0" 
                                telerik:StyleManager.Theme="Windows7">
                                <telerik:RadChart.DefaultView>
                                   <telerik:ChartDefaultView>
                                       <telerik:ChartDefaultView.ChartTitle>
                                           <telerik:ChartTitle Content="Project Performance" />
                                       </telerik:ChartDefaultView.ChartTitle>
                                   </telerik:ChartDefaultView>
                               </telerik:RadChart.DefaultView>
      
                                <telerik:RadChart.SeriesMappings>
                                    <telerik:SeriesMapping>
                                        <telerik:SeriesMapping.SeriesDefinition>
                                            <telerik:BarSeriesDefinition ShowItemLabels="True" StackGroupName="{Binding GroupLvl}"/>
                                        </telerik:SeriesMapping.SeriesDefinition>
                                        <telerik:SeriesMapping.ItemMappings>
                                            <telerik:ItemMapping FieldName="Planned" DataPointMember="YValue"/>
                                            <telerik:ItemMapping FieldName="GroupLvl" DataPointMember="LegendLabel"/>
                                            <telerik:ItemMapping FieldName="Xcat" DataPointMember="XCategory"/>
                                        </telerik:SeriesMapping.ItemMappings>
                                    </telerik:SeriesMapping>
                                    <telerik:SeriesMapping>
                                        <telerik:SeriesMapping.SeriesDefinition>
                                            <telerik:BarSeriesDefinition ShowItemLabels="True" StackGroupName="Actual"/>
                                        </telerik:SeriesMapping.SeriesDefinition>
                                        <telerik:SeriesMapping.ItemMappings>
                                            <telerik:ItemMapping FieldName="Actual" DataPointMember="YValue"/>
                                            <telerik:ItemMapping FieldName="GroupLvl" DataPointMember="LegendLabel"/>
                                            <telerik:ItemMapping FieldName="Xcat" DataPointMember="XCategory"/>
                                        </telerik:SeriesMapping.ItemMappings>
                                    </telerik:SeriesMapping>
                                </telerik:RadChart.SeriesMappings>
                            </telerik:RadChart>

     

     




    any help you can provide would be greatly appreciated.

  2. Evgeni "Zammy" Petrov
    Admin
    Evgeni "Zammy" Petrov avatar
    168 posts

    Posted 06 Dec 2010 Link to this post

    Hi Monte Baker,

     Unfortunately the chart does not support hierarchical grouping. I have set up a project that simulates something similar.  I hope this is going to be of some help. Please, find it attached.

    Best wishes,
    Evgeni "Zammy" Petrov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. Gintu
    Gintu avatar
    3 posts
    Member since:
    Sep 2011

    Posted 19 Apr 2012 Link to this post

    hi,
    I tired your code , it worked for me. 
    But the problem i have is showing month label i.e.  'Xcat' on x- axis along with GroupLevel.
    Attaching a file which describes what i exactly require.

  5. Nikolay
    Admin
    Nikolay avatar
    386 posts

    Posted 23 Apr 2012 Link to this post

    Hi,

    Unfortunately RadChart does not support setting 2 or more X axis labels. Our developers are aware of this limitation and will work on introducing such a feature for our ChartView control.

    Please, excuse us for the inconvenience caused.

    All the best,
    Nikolay
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top