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

Stacked Bar Chart binding with MVVM collection

5 Answers 467 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Monte Baker
Top achievements
Rank 2
Monte Baker asked on 01 Dec 2010, 03:01 PM
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.

ashwini
Top achievements
Rank 1
commented on 11 Sep 2021, 01:24 AM

hi .. have you got output for the above xaml 
ashwini
Top achievements
Rank 1
commented on 11 Sep 2021, 01:25 AM

this is the one im expecting... Could you please send the package.. 

5 Answers, 1 is accepted

Sort by
0
Evgeni "Zammy" Petrov
Telerik team
answered on 06 Dec 2010, 05:23 PM
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
0
Gintu
Top achievements
Rank 1
answered on 19 Apr 2012, 09:34 AM
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.

ashwini
Top achievements
Rank 1
commented on 11 Sep 2021, 01:46 AM

can you please share me the package .. its very urgent 
0
Nikolay
Telerik team
answered on 23 Apr 2012, 09:45 AM
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 >>
0
Hussein
Top achievements
Rank 1
answered on 12 Mar 2021, 07:17 AM
Can you drive same example using RadCartesianChart please
0
Martin Ivanov
Telerik team
answered on 16 Mar 2021, 03:01 PM

Hello Hussein,

To get this effect (stacked and clustered bars), you can use the CombineMode and the StackGroupKey properties of the BarSeries. You can see how to do this in the Combine Mode article. To add more than one label in the stack, you can use the LabelDefinitions collection of the chart series. Read more about this in the Series Labels article.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Chart
Asked by
Monte Baker
Top achievements
Rank 2
Answers by
Evgeni "Zammy" Petrov
Telerik team
Gintu
Top achievements
Rank 1
Nikolay
Telerik team
Hussein
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or