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

problem with rad stacked bar chart

1 Answer 29 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Asutosh
Top achievements
Rank 1
Asutosh asked on 23 Apr 2014, 01:17 PM
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.

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 28 Apr 2014, 06:11 AM
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:
ASPX:
<telerik:RadChart ID="RadChart1" runat="server" Height="400px" Width="600px">
    <PlotArea>
        <XAxis AutoScale="false">
            <Items>
                <telerik:ChartAxisItem TextBlock-Text="month 1"></telerik:ChartAxisItem>
                <telerik:ChartAxisItem TextBlock-Text="month 2"></telerik:ChartAxisItem>
                <telerik:ChartAxisItem TextBlock-Text="month 3"></telerik:ChartAxisItem>
            </Items>
        </XAxis>
        <YAxis>
        </YAxis>
    </PlotArea>
</telerik:RadChart>
C#:
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;
        }
        else
        {
            csi1.YValue = i + 1;
        }
        cs1.Items.Add(csi1);
    }
    RadChart1.Series.Add(cs1);
}



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
Asutosh
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or