Quantcast
Channel: OxyPlot (moved to GitHub)
Viewing all articles
Browse latest Browse all 2061

Commented Unassigned: Argument out of range in OxyPlot mouse over [10061]

$
0
0
I am using the oxyplot library under wpf (And I'm very happy with it) to display multiple scaled lines in the same Graph.

I have also changed some of the mouse events functionality to better represent our requirements:
1. MouseDown:
1. MouseMove:
1. MouseUp
1. Overrided for mouse wheel events:
protected override void OnMouseWheel(MouseWheelEventArgs e)

In all of those functions I might call OxyPlot functionality:
* GetSeriesFromPoint, GetNearestPoint to display the closes dot value.
* PlotControl.ZoomAt and PlotControl.Zoom, GetAxesFromPoint to pan and zoom the view or one of the axes.

And finally I set e.handle to be true in all of them.

The problem is that from time to time I receive a System.ArgumentOutOfRangeException not for my code:

```

at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at OxyPlot.Series.DataPointSeries.GetItem(Int32 i) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot\Series\DataPointSeries.cs:line 133
at OxyPlot.Series.XYAxisSeries.GetNearestInterpolatedPointInternal(IList`1 points, ScreenPoint point) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot\Series\XYAxisSeries.cs:line 306
at OxyPlot.Series.DataPointSeries.GetNearestPoint(ScreenPoint point, Boolean interpolate) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot\Series\DataPointSeries.cs:line 118
at OxyPlot.Series.LineSeries.GetNearestPoint(ScreenPoint point, Boolean interpolate) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot\Series\LineSeries.cs:line 280
at OxyPlot.Series.Series.HitTest(ScreenPoint point, Double tolerance) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot\Series\Series.cs:line 135
at OxyPlot.PlotModel.HandleMouseDown(Object sender, OxyMouseEventArgs e) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot\PlotModel\PlotModel.MouseEvents.cs:line 77
at OxyPlot.Wpf.Plot.OnMouseDown(MouseButtonEventArgs e) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 920

```
Why should this happen?

I have attacked a txt file with all of the exception.
Comments: I think the problem is in the method ``` XYAxisSeries.GetNearestInterpolatedPointInternal(IList<IDataPoint> points, ScreenPoint point) ``` If only 2 points are in the graph and these points are on the same coordinates, then ``` double u = (spl - sp1).Length / (sp2 - sp1).Length; ``` results in NaN, which is then assigned to variable index then the NaN value is casted to int, which is negative number ``` object item = this.GetItem((int)index); ```

Viewing all articles
Browse latest Browse all 2061

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>