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

Issue with Stacked 100 Bar Series and Line Series

1 Answer 106 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 2
JP asked on 22 May 2015, 06:18 AM

Hi,

I am trying to have a single chart with a Stacked 100 Bar series with a Line Series over it, however the line series doesn't want to show.

 

Example code:

<telerik:RadCartesianChart.Series>
                    <telerik:BarSeries x:Name="barSeries1" CategoryBinding="MyDateTime"
                                   ValueBinding="RedValue"
  ItemsSource="{Binding MyDataSource}"
  CombineMode="Stack100">
                        <telerik:BarSeries.PointTemplate>
                            <DataTemplate>
                                <Rectangle Fill="Red"/>
                            </DataTemplate>
                        </telerik:BarSeries.PointTemplate>
                    </telerik:BarSeries>
                        <telerik:BarSeries x:Name="barSeries2" CategoryBinding="MyDateTime"
                                   ValueBinding="GreenValue"
  ItemsSource="{Binding MyDataSource}"
                                           CombineMode="Stack100"
  >
                        <telerik:BarSeries.PointTemplate>
                            <DataTemplate>
                                <Rectangle Fill="Green"/>
                            </DataTemplate>
                        </telerik:BarSeries.PointTemplate>
                    </telerik:BarSeries> 
                    <telerik:LineSeries x:Name="lineSeries1" CategoryBinding="MyDateTime" ValueBinding="MyValue" Stroke="Black" 
  ItemsSource="{Binding MyDataSource}"
   />
</telerik:RadCartesianChart.Series>

 Any assistance would be greatly appreciated.

1 Answer, 1 is accepted

Sort by
0
Anna
Telerik team
answered on 25 May 2015, 07:53 AM
Hi,

The reason why the line series doesn't show is that the bar series have Stack100 set as CombineMode. This combine mode automatically calculates the values of the bars as percentage of all the bars in the stack and the line series becomes incompatible with it.

To display the series in your scenario, you can use couple approaches. One thing that you can try is to use the Stack mode instead and calculate the values of the bar series in your view model, so that they stack as they would in Stack100. In this case you will have to set the Maximum property of the linear (vertical) axis, in order to prevent it from leaving an offset between its max value and the max value plotted on the chart.

Another option is to define an additional linear axis as a static resource and use it for all series which have Stack100 as CombineMode. You can read a bit more about multiple axes in this documentation article

I hope this will be helpful. Please, let us know if you have any further questions.

Regards,
Anna
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ChartView
Asked by
JP
Top achievements
Rank 2
Answers by
Anna
Telerik team
Share this question
or