Plotting single X- Axis with two different set of values

Apr 4, 2011 at 5:28 PM

Hi,

   I am plotting a XY graph with two different sets of X and Y values.  This is how my dataset looks -> [ X1 = {1,3,5,...}, Y1 = {104, 98, 36,....} and X2 = {2,4,6..}, Y2 = { 76, 65, 110..}].

  This is the code I am using:

series1.DependentValueBinding = new System.Windows.Data.Binding("Y1");
series1.IndependentValueBinding = new System.Windows.Data.Binding("X1");

series1.DependentRangeAxis = YAxis;

series1.IndependentAxis = XAxis;

series2.DependentValueBinding = new System.Windows.Data.Binding("Y2");
series2.IndependentValueBinding = new System.Windows.Data.Binding("X2");

series2.DependentRangeAxis = YAxis;

series2.IndependentAxis = XAxis;

This code works fine for assigning two series to single Y-Axis, but when two series with different X and Y values are assigned to X-Axis it messes up the first series.  It plots both Y1 = {104, 98, 36,....} and Y2 = { 76, 65, 110..} with respect to X2 = {2,4,6..}, instead of plotting X1 with respect to Y1 and X2 with respect to Y2 and having only one X and Y axis.

Please advice me on what needs to be done to assign two different set of values to single X-axis.

Thank you in advance!

-Anna

Apr 4, 2011 at 6:36 PM
Edited Apr 4, 2011 at 6:40 PM

Problem is solved.  This code is correct.. There is something to do with my value assignment (I noticed that I was clearing X1 value before using X2. But to make the code work all the values X1, Y1, X2, Y2 should be preserved until the chart is created)..Thank you!

series1.DependentValueBinding = new System.Windows.Data.Binding("Y1");
series1.IndependentValueBinding = new System.Windows.Data.Binding("X1");

series1.DependentRangeAxis = YAxis;

series1.IndependentAxis = XAxis;

series2.DependentValueBinding = new System.Windows.Data.Binding("Y2");
series2.IndependentValueBinding = new System.Windows.Data.Binding("X2");

series2.DependentRangeAxis = YAxis;

series2.IndependentAxis = XAxis;