Multiple BarSeries in Stack mode on 1 Y-axis

8 posts, 1 answers
  1. Vinc3nt
    Vinc3nt avatar
    10 posts
    Member since:
    Jun 2013

    Posted 03 Jul 2013 Link to this post

    Hi,

    I need to plot more than one BarSeries in Stack combine mode.

    Example :
    - One vertical Y-Axis and one horizontal X-Axis,
    - Two BarSeries in stack mode
    - Two other BarSeries in stack mode.

    When I implement this, the result is 1 Bar divided in 4, not 1 Bar divided in 2 and another one Bar divided in 2.

    I know the way to identify the Bar in stack mode is the vertical axis but Is there an other way ?

    Thank you,
    Vincent.
  2. Peshito
    Admin
    Peshito avatar
    520 posts

    Posted 05 Jul 2013 Link to this post

    Hello,

    This can be achieved by using the StackGroupKey property of the series and adding it to the series you want to group like this:
    <telerik:RadCartesianChart.Series>
        <telerik:BarSeries CombineMode="Stack" StackGroupKey="g1">
            <telerik:BarSeries.DataPoints>
                <telerik:CategoricalDataPoint Category="x1" Value="1" />
            </telerik:BarSeries.DataPoints>
        </telerik:BarSeries>
        <telerik:BarSeries CombineMode="Stack" StackGroupKey="g1">
            <telerik:BarSeries.DataPoints>
                <telerik:CategoricalDataPoint Category="x1" Value="1" />
            </telerik:BarSeries.DataPoints>
        </telerik:BarSeries>
        <telerik:BarSeries CombineMode="Stack" StackGroupKey="g2">
            <telerik:BarSeries.DataPoints>
                <telerik:CategoricalDataPoint Category="x2" Value="3" />
            </telerik:BarSeries.DataPoints>
        </telerik:BarSeries>
        <telerik:BarSeries CombineMode="Stack" StackGroupKey="g2">
            <telerik:BarSeries.DataPoints>
                <telerik:CategoricalDataPoint Category="x2" Value="3" />
            </telerik:BarSeries.DataPoints>
        </telerik:BarSeries>
    </telerik:RadCartesianChart.Series>

    Hope this helps.

    Regards,
    Peshito
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    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. Vinc3nt
    Vinc3nt avatar
    10 posts
    Member since:
    Jun 2013

    Posted 05 Jul 2013 Link to this post

    Thank you for your answer.

    I tried your solution but I have an ArgumentException : La valeur n'est pas comprise dans la plage attendue (Value does not fall within expected range).

    Is there a problem adding multiple bar series in code behind ?


  4. Answer
    Peshito
    Admin
    Peshito avatar
    520 posts

    Posted 09 Jul 2013 Link to this post

    Hello Lamarque,

    I was not able to reproduce the error you have described. Please, find attached a sample project demonstrating the earlier approach described in my previous reply but this time in code behind.

    Hope this helps.

    Regards,
    Peshito
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    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 >>
  5. William
    William avatar
    37 posts
    Member since:
    Sep 2016

    Posted 12 Jun in reply to Peshito Link to this post

    I cannot get a stacked bar to show, no matter what I do. I have verified the data is correct, I have set CombineMode to "None" or "Stack", added StackGroupKey values, and reset the ItemsSource. The .zip file you included doesn't load in VisualStudio.
  6. Dinko
    Admin
    Dinko avatar
    367 posts

    Posted 13 Jun Link to this post

    Hello William,

    We are reattaching the sample from the Petar Horozov reply. Can you give this project a try and let us know if it works for you. If not, you can elaborate more on your approach - what do you mean by the stacked bar is not showing. It will be great if you can send us isolated project from your application reproducing this behavior so we can directly investigate it.

    Regards,
    Dinko
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  7. William
    William avatar
    37 posts
    Member since:
    Sep 2016

    Posted 13 Jun in reply to Dinko Link to this post

    Sorry - it does not load into Visual studio.
  8. Dinko
    Admin
    Dinko avatar
    367 posts

    Posted 14 Jun Link to this post

    Hello William,

    We have tested the project and we successfully run the project using Visual Studio. Can you tell us which Visual Studio version are you using? Also, are you getting errors when you try to open it?

    Regards,
    Dinko
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top