views:

640

answers:

1

Let's say I've got this XAML (created with Live ChartBuilder):

<Grid xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:utility="clr-namespace:Utility;assembly=ChartBuilder" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt;
  <charting:Chart>
    <charting:Chart.Series>
      <charting:BarSeries
        Title="Series 1">
        <charting:BarSeries.ItemsSource>
          <utility:ObservableObjectCollection>
            <sys:Double>1</sys:Double>
            <sys:Double>2.33333325386047</sys:Double>
            <sys:Double>3.66666674613953</sys:Double>
            <sys:Double>5</sys:Double>
          </utility:ObservableObjectCollection>
        </charting:BarSeries.ItemsSource>
      </charting:BarSeries>
      <charting:BarSeries
        Title="Series 2">
        <charting:BarSeries.ItemsSource>
          <utility:ObservableObjectCollection>
            <sys:Double>1</sys:Double>
            <sys:Double>2.33333325386047</sys:Double>
            <sys:Double>3.66666674613953</sys:Double>
            <sys:Double>5</sys:Double>
          </utility:ObservableObjectCollection>
        </charting:BarSeries.ItemsSource>
      </charting:BarSeries>
    </charting:Chart.Series>
  </charting:Chart>
</Grid>

Which produces a bar chart with two horizontally displayed bars. How can I stack those?

+3  A: 

Silverlight charts doesn't yet have fully fledged stacked bar/column charts.

Take a look at this link for an example of a custom stacked column chartseries which may fit what you need or at least can be modified without too much effort.

AnthonyWJones
Thanks. I came across that link after I posted here. I don't really like the way one has to pilfer the toolkit source (as opposed to deriving from it), but it'll work.
scottmarlowe