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

populate StackedBar RadChart

3 Answers 115 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Esperanza Ramos
Top achievements
Rank 1
Esperanza Ramos asked on 06 Oct 2008, 01:05 PM
Hi, All:

I am a beginner to use StackedBar chart.

Please give some code sample on how to populate the two sections of each vertical bar in RadChart.

thanks.

Stanley Huang

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 06 Oct 2008, 03:56 PM
Hi Stanley,

You can check this online example. Just change the "Additional chart types" dropdown and the chart will appear with stacked bars. You can find the SelectedIndexChanged event handler in the code behind - only the series' Type property is changed.

Hope this helps,
Ves
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Esperanza Ramos
Top achievements
Rank 1
answered on 06 Oct 2008, 05:47 PM
Hi, Telerik Team:

I did follow your direction. but I did not get what I want.

Here is how I populcat for each bar for my Bar RadChart:

 

ChartSeries cSeries = new ChartSeries();
cSeries.Type =
ChartSeriesType.Bar;
rcChart.PlotArea.XAxis.AutoScale =
false;

 

 

foreach (string key in dict.Keys)
{
    cSeries.AddItem(dict[key], dict[key].ToString());
    rcChart.PlotArea.XAxis.Items.Add(
new ChartAxisItem(key, Color.Black));
}

 

rcChart.Series.Add(cSeries);

Please give some codes on how to populate a StackedBar chart.

thanks.

Stanley Huang

0
Esperanza Ramos
Top achievements
Rank 1
answered on 07 Oct 2008, 07:36 PM
Hi, All:

I think I got how to populate StackedBar of RadChart:

 

ChartSeries cSeries = new ChartSeries();
ChartSeries cSeries2 = new ChartSeries();
cSeries.Type =
ChartSeriesType.StackedBar;
cSeries2.Type =
ChartSeriesType.StackedBar;

 

 

int j = 0;
foreach (string key in dict.Keys)
{
    j++;
    cSeries.AddItem(dict[key], dict[key].ToString());
    cSeries2.AddItem(j, j.ToString());
    rcChart.PlotArea.XAxis.Items.Add(
new ChartAxisItem(key, Color.Black));
}
rcChart.Series.Add(cSeries);
rcChart.Series.Add(cSeries2);

Hope this help the next programmer.
good luck.

Stanley Huang

 

Tags
Chart (Obsolete)
Asked by
Esperanza Ramos
Top achievements
Rank 1
Answers by
Ves
Telerik team
Esperanza Ramos
Top achievements
Rank 1
Share this question
or