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

two chart series in a stacked bar chart

5 Answers 154 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Adrian Wright
Top achievements
Rank 1
Adrian Wright asked on 13 Jul 2009, 10:31 AM
Hi there,

For our application we are trying to show two series of data in a stacked bar chart, each series contains 2 items. We are finding a problem where we are getting both series items being displayed within the same stacked bar, so rather than having 2 items per bar...we have 4.

If we use the group databinding feature on a normal bar chart it seems to be working fine but under stacked bar chart type we are encountering problems

Hope you can help

Regards

5 Answers, 1 is accepted

Sort by
0
David Penny
Top achievements
Rank 2
answered on 13 Jul 2009, 11:04 AM
Hi Adrian,

Not sure if this is the answer, but I'm in the middle of building the same type of chart programatically, and found I had to have the initial Chart definitions outside of my loop, eg:

 Dim cs_hours As New ChartSeries  
                    cs_hours.Name = "Hours Recorded" 
                    Dim cs_under As New ChartSeries  
                    cs_under.Name = "Hours Deficit" 
                    Dim cs_over As New ChartSeries  
                    cs_over.Name = "Hours Over" 
 
                    cs_hours.Type = ChartSeriesType.StackedBar  
                    cs_under.Type = ChartSeriesType.StackedBar  
                    cs_over.Type = ChartSeriesType.StackedBar  
 
                    Chart.Series.Add(cs_hours)  
                    Chart.Series.Add(cs_under)  
                    Chart.Series.Add(cs_over)  
 
                    While dr.Read  
                        Dim tm As String = dr.Item(0)  
                        Dim hrs As Decimal = dr.Item(1)  
                        Dim ehrs As Decimal = dr.Item(2)  
...  
                        cs_hours.AddItem(ah, "", Drawing.Color.Green)  
                        cs_under.AddItem(vh, "", Drawing.Color.Blue)  
                        cs_over.AddItem(rh, "", Drawing.Color.Red)  
                    End While 

I had initially put all the initialisation code for the Chart inside the read loop, which resulted in what you seem to be getting.

David Penny
0
Adrian Wright
Top achievements
Rank 1
answered on 13 Jul 2009, 11:46 AM
Hi there and thanks for the swift reply!

The way we are creating the charts is done in the way that you have posted, but still no luck on our ends.. what we are trying to implement is something similar to what is shown in this link Silverlight stacked bar chart example. Unfortunately its implemented in Silverlight controls but we are hoping that it can be implemented the same using the stacked bar chart (asp.net) controls

0
Vladimir Milev
Telerik team
answered on 15 Jul 2009, 07:15 AM
Hello Adrian Wright,

I think you are referring to the StackGroups feature of our Silverlight chart. Unfortunately RadChart for ASP.NET does not allow you to have more than one stack group.

We apologize for this inconvenience.

Best wishes,
Vladimir Milev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
VINEET
Top achievements
Rank 2
answered on 02 Jun 2012, 01:52 PM
Hello Telerik Team,
Is this possible to have more then one Stack Group in Chart Control.
0
Rosko
Telerik team
answered on 06 Jun 2012, 10:49 AM
Hi Vineet,

It is possible only in WPF and Silverlight. Unfortunately, it is not possible in ASP.NET. Thee good thing is that you can integrate RadChart for Silverlight in an ASP.NET application. You can find an online example demonstrating the integration in action online.

Greetings,
Rosko
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Chart (Obsolete)
Asked by
Adrian Wright
Top achievements
Rank 1
Answers by
David Penny
Top achievements
Rank 2
Adrian Wright
Top achievements
Rank 1
Vladimir Milev
Telerik team
VINEET
Top achievements
Rank 2
Rosko
Telerik team
Share this question
or