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

Stacked Bar Series Order Problem

10 Answers 227 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Ilya Peskov
Top achievements
Rank 1
Ilya Peskov asked on 04 Nov 2009, 06:24 PM
I am using Telerik AJAX for ASP.NET v 2008.3.1125.35. And I am having problems with radchart control. For some reason series position is not consistent in the graph as you can see from attached image. In the first bar "Unknown" series is the third from the bottom, but for the fourth bar it is first from the bottom which seems wrong to me. I am using DataGroupColumn property to create series automatically from data that I am getting from database. Any suggestions?

10 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 04 Nov 2009, 10:54 PM
There might be an issue with how the chart is adding the items to a series - have you tried manually adding the series to see if that would change anything?
0
Ilya Peskov
Top achievements
Rank 1
answered on 05 Nov 2009, 12:32 AM
No I havent try that. I will try and we will see how it goes.
0
Ilya Peskov
Top achievements
Rank 1
answered on 06 Nov 2009, 08:36 PM
I think I have found what is causing this problem. The data that I am getting from db and binding to chart looks like that:

Date Case Count Group Column

05/01/2009 6 Female
05/01/2009 4 Male
05/01/2009 8 Other
05/01/2009        11 Unknown
06/01/2009 4 Female
06/01/2009 3 Male
06/01/2009 3 Unknown
07/01/2009 6 Female
07/01/2009 6 Male
07/01/2009 5 Other
07/01/2009 5 Unknown

and I am using RadChart.DataGroupColumn = "GroupColumn" property so chart will create series for me automatically. It leads to inconsistency of series position as you can see from attached "wrongPosition.png" file.

So I decided to manually inject a record for 06/01/2009 that will have some values for the "Other" gender so 06/01/200 will not miss 4th series value:

Date Case Count Group Column

05/01/2009 6 Female
05/01/2009 4 Male
05/01/2009 8 Other
05/01/2009        11 Unknown
06/01/2009 4 Female
06/01/2009 3 Male
06/01/2009 8 Other
06/01/2009 3 Unknown
07/01/2009 6 Female
07/01/2009 6 Male
07/01/2009 5 Other
07/01/2009 5 Unknown

and result is correct. All series are consistently positioned in graph as you can see from attached "rightPosition.png" file. Furthermore if will inject a record with values:
06/01/2009 0 Other
it is creating chart correctly.

Is it a known bug? Is there an easy way of fixing this?
0
Ilya Peskov
Top achievements
Rank 1
answered on 09 Nov 2009, 04:26 PM
Anyone?
0
Schlurk
Top achievements
Rank 2
answered on 09 Nov 2009, 09:11 PM
I believe this is by design since you are specifically looking for Female/Male/Other/Unknown and then one of them is missing, thus 'causing the databinding to mess like you originally displayed. It seems as if you found the easiest solution - adding an entry for "Other" with a value of 0. I think you need to maintain this consistency to have the RadChart display correctly.
0
Ilya Peskov
Top achievements
Rank 1
answered on 09 Nov 2009, 09:20 PM
Ok, thanks.
0
Greg M
Top achievements
Rank 1
answered on 06 Apr 2010, 08:09 PM
Has this issue been fixed or are there any other workaround?  I am unable to insert records for no value entries due to the dynamicness of the data I am returning. I do not have a set list of group items and would have to parse for the greatness number of group items and try to back fill data. 

I would think that the control should be smart enough to default no values entries to 0 instead of causing databinding to get all messed up.
0
Ilya Peskov
Top achievements
Rank 1
answered on 16 Apr 2010, 02:40 PM
No we didn't find any better solution for this particular version. I don't know but maybe Telerik fixed it in recent version of the product.
0
Schlurk
Top achievements
Rank 2
answered on 19 Apr 2010, 04:37 PM
Have you looked into using the ItemDataBound event of the RadChart and setting up an if-statement that will default a certain value to 0? You can see how this can potentially be implemented by looking at the code-behind files of this online demo.
0
Greg M
Top achievements
Rank 1
answered on 19 Apr 2010, 05:04 PM
Actually I have come up with a solution for this.. I am manually creating the ChartSeries and adding the ChartSeriesItems to them.  This was alot quicker and easier then trying to parse my generic 1 to N data for each series to try to match everything up.
Tags
Chart (Obsolete)
Asked by
Ilya Peskov
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Ilya Peskov
Top achievements
Rank 1
Greg M
Top achievements
Rank 1
Share this question
or