This project is read-only.

Reverse Y data causes distortions.

Oct 20, 2010 at 9:44 PM
Edited Oct 20, 2010 at 10:22 PM

Here is my code for the data source of my line graph:

ObservableDataSource<Point> curveLineData = new ObservableDataSource<Point>(
                                curveLine.Select(s => new Point
                                {
                                    X = s.X,
                                    Y = s.Y
                                }
                                ).ToList());
The only difference in the following data source is the negative Y values:
ObservableDataSource curveLineData = new ObservableDataSource(
                                curveLine.Select(s => new Point
                                {
                                    X = s.X,
                                    Y = -s.Y
                                }
                                ).ToList());
As you can see the distortions are in the second image.  I don't understand why they are there.  I only put a negative on the Y values.  Is this a bug maybe?  Any ideas?  Thanks.
Larry
Edit:  I seem to have figured out my problem.  But I don't know why it worked.  I changed the code to this:
ObservableDataSource curveLineData = new ObservableDataSource(
                                curveLine.OrderByDescending(d => d.MeasuredDepth).Select(s => new Point
                                {
                                    X = s.X,
                                    Y = -s.Y
                                }
                                ).ToList());

 

MeasuredDepth serves as an index so it makes sense to use it for OrderBy but I don't understand how the OrderedBy effected the collection when I had the values as negative.