How to: Create a 2D Side-by-Side Stacked Bar Chart
The following example demonstrates how to create a 2D Side-by-Side Stacked Bar chart. To do this, it is necessary to assign the ChartControl.Diagram property to XYDiagram2D, and then add four BarSideBySideStackedSeries2D objects with points to the diagram’s Diagram.Series collection. And, to stack the series, use their BarSideBySideStackedSeries2D.StackedGroup property.
<Window x:Class="SideBySideStackedBarChart.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts">
<Grid>
<dxc:ChartControl HorizontalAlignment="Left" Name="chartControl1" VerticalAlignment="Top" Height="311" Width="504" Margin="-1,0,0,0">
<dxc:ChartControl.Diagram>
<dxc:XYDiagram2D>
<dxc:XYDiagram2D.Series>
<dxc:BarSideBySideStackedSeries2D DisplayName="First Series" StackedGroup="1" BarWidth="0.5">
<!--region #Model-->
<dxc:BarSideBySideStackedSeries2D.Model>
<dxc:Quasi3DBar2DModel />
</dxc:BarSideBySideStackedSeries2D.Model>
<!--endregion #Model-->
<dxc:BarSideBySideStackedSeries2D.Points>
<dxc:SeriesPoint Argument="A" Value="1" />
<dxc:SeriesPoint Argument="B" Value="2" />
</dxc:BarSideBySideStackedSeries2D.Points>
</dxc:BarSideBySideStackedSeries2D>
<dxc:BarSideBySideStackedSeries2D DisplayName="Second Series" StackedGroup="1" BarWidth="0.5">
<!--region #Model2-->
<dxc:BarSideBySideStackedSeries2D.Model>
<dxc:Quasi3DBar2DModel />
</dxc:BarSideBySideStackedSeries2D.Model>
<!--endregion #Model2-->
<dxc:BarSideBySideStackedSeries2D.Points>
<dxc:SeriesPoint Argument="A" Value="4" />
<dxc:SeriesPoint Argument="B" Value="3" />
</dxc:BarSideBySideStackedSeries2D.Points>
</dxc:BarSideBySideStackedSeries2D>
<dxc:BarSideBySideStackedSeries2D DisplayName="Third Series" StackedGroup="2" BarWidth="0.5">
<!--region #Model3-->
<dxc:BarSideBySideStackedSeries2D.Model>
<dxc:Quasi3DBar2DModel />
</dxc:BarSideBySideStackedSeries2D.Model>
<!--endregion #Model3-->
<dxc:BarSideBySideStackedSeries2D.Points>
<dxc:SeriesPoint Argument="A" Value="5" />
<dxc:SeriesPoint Argument="B" Value="6" />
</dxc:BarSideBySideStackedSeries2D.Points>
</dxc:BarSideBySideStackedSeries2D>
<dxc:BarSideBySideStackedSeries2D DisplayName="Fourth Series" StackedGroup="2" BarWidth="0.5">
<!--region #Model4-->
<dxc:BarSideBySideStackedSeries2D.Model>
<dxc:Quasi3DBar2DModel />
</dxc:BarSideBySideStackedSeries2D.Model>
<!--endregion #Model4-->
<dxc:BarSideBySideStackedSeries2D.Points>
<dxc:SeriesPoint Argument="A" Value="2" />
<dxc:SeriesPoint Argument="B" Value="3" />
</dxc:BarSideBySideStackedSeries2D.Points>
</dxc:BarSideBySideStackedSeries2D>
</dxc:XYDiagram2D.Series>
</dxc:XYDiagram2D>
</dxc:ChartControl.Diagram>
</dxc:ChartControl>
</Grid>
</Window>