problem with rad stacked bar chart

Thread is closed for posting
2 posts, 0 answers
  1. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 23 Apr 2014 Link to this post

    Hi team,

    we are facing an issue working with stacked bar chart. suppose we have each bar representing month and each portion of bar displays different diseas count .

    now the thing is if we have 5 portion(diseas) in each bar .

    but when we receive 5 rows for each bar in our dataset thats okay.

    but sometimes we have only 4 rows per bar. and in that case our bar overlaps. means it takes 5th value from bar next to it. which we dont want. 

    we want if some bar has only 4 portion it should display 4 only. 

    any help will be appreciated.
  2. Danail Vasilev
    Danail Vasilev avatar
    1502 posts

    Posted 28 Apr 2014 Link to this post

    Hello Asutosh,

    In order to avoid the unexpected behavior you can set the Empty property of the item that is to be added to true. For example:
    <telerik:RadChart ID="RadChart1" runat="server" Height="400px" Width="600px">
            <XAxis AutoScale="false">
                    <telerik:ChartAxisItem TextBlock-Text="month 1"></telerik:ChartAxisItem>
                    <telerik:ChartAxisItem TextBlock-Text="month 2"></telerik:ChartAxisItem>
                    <telerik:ChartAxisItem TextBlock-Text="month 3"></telerik:ChartAxisItem>
    for (int i = 0; i < 5; i++)
        ChartSeries cs1 = new ChartSeries();
        cs1.Type = ChartSeriesType.Bar;
        for (int g = 0; g < 3; g++)
            ChartSeriesItem csi1 = new ChartSeriesItem();
            if (i == 0 && g == 0)
                csi1.Empty = true;
                csi1.YValue = i + 1;

    Danail Vasilev

    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.

Back to Top