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

Stacked bar charts for RadCartesianChart for 2012.1.326.40

4 Answers 327 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
syed
Top achievements
Rank 1
syed asked on 27 Nov 2016, 05:45 AM

Hi,

I am trying to build a stacked bar chart in wof 4.0 using telerik version 2012.1.326.40.

I am able to do so by using telerik:RadCartesianChart.SeriesProvider in 4.5 but as the SeriesProvider is absent in the earlier version it is hard for me to construct the same.

I am trying to achieve a chart attached.

Please advise.

4 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 01 Dec 2016, 08:12 AM
Hello Syed Masood,

As the SeriesProvider doesn't exist in the mentioned version of our controls you can specify several BarSeries in XAML and use the CombineMode property of the BarSeries. You can set it to Stack for example in order to stack the bars as shown in the attached picture.

For your convenience, we have created sample project which demonstrates this approach.

As a side note, you can consider upgrading to the latest version of our Telerik UI for WPF controls where you can take advantage of the SeriesProvider property and many other features.

Regards,
Dinko
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
syed
Top achievements
Rank 1
answered on 08 Dec 2016, 02:11 PM

Thanks for the reply.

I will definitely try to convince my client for an upgrade but for time being I need to complete this.

According to your code I did but unable to recreate the ideal solution.

Here Is the code,

<telerik:RadCartesianChart x:Name="RadCartesianChart" Palette="Metro" >
 
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:CategoricalAxis  />
            </telerik:RadCartesianChart.HorizontalAxis>
 
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis />
            </telerik:RadCartesianChart.VerticalAxis>
 
            <telerik:RadCartesianChart.Series>
                <telerik:BarSeries CombineMode="Stack" ItemsSource="{Binding ChartElem}" CategoryBinding="Category" ValueBinding="Count" >
                     
                </telerik:BarSeries>
            </telerik:RadCartesianChart.Series>
        </telerik:RadCartesianChart>

 

And the data

 

ChartElem = new ObservableCollection<ChartElements>();
           ChartElem.Add(new ChartElements { Category = "KIT", Count = 4 });
           ChartElem.Add(new ChartElements { Category = "KIT", Count = 2 });
           ChartElem.Add(new ChartElements { Category = "SLEEPER SUIT", Count = 2 });
           ChartElem.Add(new ChartElements { Category = "SLEEPER SUIT", Count = 5 });
           ChartElem.Add(new ChartElements { Category = "SLEEPER SUIT", Count = 1 });

 

I am not able to recreate stack.

0
Dinko | Tech Support Engineer
Telerik team
answered on 13 Dec 2016, 11:59 AM
Hi ,

You can create two (or more) collections with different data and populate them in the ViewModel class. Then you create two BarSeries series and bind them to these collections and set the CombineMode property of the both to Stack. Check the attached project.

Regards,
Dinko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
dec698
Top achievements
Rank 1
answered on 10 Feb 2017, 04:57 AM
Hi Syed, how do you achieve the same in code? (not xaml)
Tags
ChartView
Asked by
syed
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
syed
Top achievements
Rank 1
dec698
Top achievements
Rank 1
Share this question
or