Charts: StackedColumnSeries side-by-side with ColumnSeries

Jun 30, 2010 at 3:59 PM

If I create a standard column chart, I can add multiple ColumnSeries and they will all be shown side-by-side like the top chart in the screenshot below.  If I try the same thing with the StackedColumnSeries and a ColumnSeries, the Column series is displayed in front of the StackedColumnSeries, not next to it (like in the bottom chart in the screenshot).  In the bottom chart I would expect Parts 1-3 to be stacked and "other" to be on the right of the stack.

Here is the XAML:

   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition />
         <RowDefinition />
      </Grid.RowDefinitions>

      <charting:Chart Grid.Row="0">
         <charting:Chart.Series>
            <charting:ColumnSeries ItemsSource="{Binding Path=.}" IndependentValueBinding="{Binding Path=Day}" DependentValueBinding="{Binding DataPart1}" Title="Part 1" />
            <charting:ColumnSeries ItemsSource="{Binding Path=.}" IndependentValueBinding="{Binding Path=Day}" DependentValueBinding="{Binding DataPart2}" Title="Part 2" />
            <charting:ColumnSeries ItemsSource="{Binding Path=.}" IndependentValueBinding="{Binding Path=Day}" DependentValueBinding="{Binding DataPart3}" Title="Part 3" />
            <charting:ColumnSeries ItemsSource="{Binding Path=.}" IndependentValueBinding="{Binding Path=Day}" DependentValueBinding="{Binding DataOther}" Title="Other" />
         </charting:Chart.Series>
      </charting:Chart>

      <charting:Chart Grid.Row="1">
         <charting:Chart.Series>
            <charting:StackedColumnSeries>
               <charting:SeriesDefinition ItemsSource="{Binding Path=.}" IndependentValueBinding="{Binding Path=Day}" DependentValueBinding="{Binding DataPart1}" Title="Part 1" />
               <charting:SeriesDefinition ItemsSource="{Binding Path=.}" IndependentValueBinding="{Binding Path=Day}" DependentValueBinding="{Binding DataPart2}" Title="Part 2" />
               <charting:SeriesDefinition ItemsSource="{Binding Path=.}" IndependentValueBinding="{Binding Path=Day}" DependentValueBinding="{Binding DataPart3}" Title="Part 3" />
            </charting:StackedColumnSeries>
            <charting:ColumnSeries ItemsSource="{Binding Path=.}" IndependentValueBinding="{Binding Path=Day}" DependentValueBinding="{Binding DataOther}" Title="Other" />
         </charting:Chart.Series>
      </charting:Chart>
   </Grid>

And here is the code behind: 

   public partial class MainWindow : Window
   {
      public MainWindow()
      {
         InitializeComponent();

         this.Data = new ObservableCollection<MyData>();
         this.Data.Add(new MyData() { Day = "Monday", DataPart1 = 1, DataPart2 = 2, DataPart3 = 3, DataOther = 4 });
         this.Data.Add(new MyData() { Day = "Tuesday", DataPart1 = 2, DataPart2 = 4, DataPart3 = 6, DataOther = 8 });
         this.Data.Add(new MyData() { Day = "Wednesday", DataPart1 = 3, DataPart2 = 6, DataPart3 = 9, DataOther = 12 });
         this.Data.Add(new MyData() { Day = "Thursday", DataPart1 = 1, DataPart2 = 2, DataPart3 = 3, DataOther = 4 });
         this.Data.Add(new MyData() { Day = "Friday", DataPart1 = 2, DataPart2 = 4, DataPart3 = 6, DataOther = 8 });
         this.Data.Add(new MyData() { Day = "Saturday", DataPart1 = 3, DataPart2 = 6, DataPart3 = 9, DataOther = 12 });
         this.Data.Add(new MyData() { Day = "Sunday", DataPart1 = 1, DataPart2 = 2, DataPart3 = 3, DataOther = 4 });

         this.DataContext = this.Data;
      }

      public ObservableCollection<MyData> Data;

      public class MyData
      {
         public string Day { getset; }
         public int DataPart1 { getset; }
         public int DataPart2 { getset; }
         public int DataPart3 { getset; }
         public int DataOther { getset; }
      }
   }

I am using .NET/WPF 4.0 and the WPF Data Visualization Development Release found here: http://blogs.msdn.com/b/delay/archive/2010/04/20/phone-y-charts-silverlight-wpf-data-visualization-development-release-4-and-windows-phone-7-charting-sample.aspx

Is this the expected behavior, or is this a bug? Is there any way to get the StackedColumnSeries and the ColumnSeries side-by-side?

Thanks,

John Myczek