Combine stack and cluster bars

3 posts, 1 answers
  1. Alberto
    Alberto avatar
    26 posts
    Member since:
    Nov 2012

    Posted 28 Oct 2013 Link to this post

    Hello,

    I wonder if it is possible to combine stack and cluster bars to have something like the image that I am attaching.

    So far I can create Bar series with combine mode stack or cluster but not both.

    I am creating the series in the code behind like this:

    BarSeries barSer = new BarSeries();
    barSer.ShowLabels = true;
    barSer.CombineMode = ChartSeriesCombineMode.Stack;
     
    // or
     
    BarSeries barSer = new BarSeries();
    barSer.ShowLabels = true;
    barSer.CombineMode = ChartSeriesCombineMode.Cluster;
     
    foreach (DataRow dr in dtData.Rows)
                {
                    barSer.DataPoints.Add(new CategoricalDataPoint() { Category = dr["Name"], Label = string.Format("{0:N}", dr["Value"]), Value = double.Parse(dr["Value"].ToString()) });
                     
                }

    Thanks in advance.

    Alberto
  2. Answer
    Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 31 Oct 2013 Link to this post

    Hello,

    We managed to achieve your requirements in the attached project. Please take a look at it and let us know if you need any further assistance.

    Basically, you can use the CombineMode and the StackGroupKey properties of the BarSeries. The first property defines that the bars should be stacked one next to another and the second one groups the different stacks.

    I hope this project will be helpful.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Alberto
    Alberto avatar
    26 posts
    Member since:
    Nov 2012

    Posted 31 Oct 2013 Link to this post

    Hi Pavel,

    That's exactly what I needed.

    Thanks a lot.

    Alberto
Back to Top