WPF Scatter Series Chart with Category Axis? (WPF Toolkit)

Mar 25, 2010 at 6:47 PM

Hi,

I'm trying to create a scatter chart in WPF using the WPF Toolkit.  The chart needs to have a catgory axis and a linear axis.  I'm trying to get a category axis on the left of the chart (typically Y), and the linear axis on the bottom of the chart.

The data will be in the format of a List< KeyValuePair<string, int>>, with the string containing the date for the category axis, and the int for the linear axis.

The chart xaml is as follows:-

<my:Chart Name="chart1">
            <my:ScatterSeries Name="test"
                              IndependentValueBinding="{Binding Key}"
                              DependentValueBinding="{Binding Value}"
                              />
</my:Chart>

Then i assign the items in the code-behind:

List<KeyValuePair<string, int>> plot = new List<KeyValuePair<string, int>>();
plot.Add(new KeyValuePair<string, int>("Category A", 1));
plot.Add(new KeyValuePair<string, int>("Category B", 2));

test.ItemsSource = plot;

 When i try and chage the axis orientation in the xaml like this:

<my:ScatterSeries.IndependentAxis>
  <my:CategoryAxis Orientation="Y" Location="Left" />
</my:ScatterSeries.IndependentAxis>

i get this error : "Assigned independent axis cannot be used. This may be due to an unset Orientation property for the axis"

 When i try and chage the axis orientation in the xaml like this:

<my:ScatterSeries.DependentRangeAxis>
  <my:LinearAxis Orientation="X" Minimum="0" Maximum="5" />
</my:ScatterSeries.DependentRangeAxis>

i get his error: "Assigned dependent axis cannot be used. This may be due to an unset Orientation property for the axis or a type mismatch between the values being plotted and those supported by the axis."

Can anybody help me please? I basically want to chage the orientation of the axis, with category as Y and Linear as X.

Thanks