populate StackedBar RadChart

Thread is closed for posting
4 posts, 0 answers
  1. Esperanza Ramos
    Esperanza Ramos avatar
    104 posts
    Member since:
    Jul 2012

    Posted 06 Oct 2008 Link to this post

    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
  2. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 06 Oct 2008 Link to this post

    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.
  3. Esperanza Ramos
    Esperanza Ramos avatar
    104 posts
    Member since:
    Jul 2012

    Posted 06 Oct 2008 Link to this post

    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

  4. Esperanza Ramos
    Esperanza Ramos avatar
    104 posts
    Member since:
    Jul 2012

    Posted 07 Oct 2008 Link to this post

    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

     

Back to Top