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

Rad Chart Stacked Bar Data Binding to Data Table

1 Answer 132 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Moran
Top achievements
Rank 1
Moran asked on 04 May 2014, 12:16 PM
Hi,
After reading posts in different sited for hours, i couldn't find the problem in my code.
I'm using telerik rad chart and need to create a stacked bar chart, according to this data table structure:

Work Week         Product         Quantity
-------------------------------------------------------
201401               a                      10
201401               a                      20
201402               a                       5
201402               b                      10
201402               c                       6
201418               a                      10
201418               b                       25

I know there is a similar question to this, and you referred them to:
 http://www.telerik.com/help/aspnet-ajax/chart-grouping-databound-items.html


but its not helping. 
My code is:

        RadChart1.DataSource = dataForGraph; //dataForGraph is a data table
        RadChart1.DataGroupColumn = "product";
        RadChart1.PlotArea.XAxis.DataLabelsColumn = "WW";
        RadChart1.Legend.Appearance.GroupNameFormat = "#NAME:#VALUE";
        
        RadChart1.DataBind();
        foreach (ChartSeries s in RadChart1.Series)
        {
            s.Type = ChartSeriesType.StackedBar;
        }
And the result is that the quantity is stacked in wrong places (for example quantity 25 is in 201401 instead of 201418)
What am i doing wrong?

Thx,




1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 07 May 2014, 10:51 AM
Hello Moran,

In order for the grouping functionality to be working as expected the categories in the data source field for each series must match. This is illustrated in the example of the mentioned help article.

Regards,
Danail Vasilev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart (Obsolete)
Asked by
Moran
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or