Pre loader

IDataSeries.FindClosestPoint(..) fails with invalid cast exception for XyDataSeries

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

We have annotations placed based on mouseposition. To snap the annotation to the position of the datapoints, we use IDataSeries.FindClosestPoint(..) method to step to the nearest point, then applying it to the “X1”-property of the belonging annotation. This works well for most of the Series, but it fails for

XyDataSeries<int, double>

error:

InvalidCastException Specified cast is not valid.

Is this a known issue, any work-arounds for this ?

Version
5
  • You must to post comments
0
0

It’s hard to say without a code snippet, but you are aware, this function only returns you an index of the point in the dataseries?

  • You must to post comments
0
0

As explained above, we use this method to snap to the datapoints, and so yes, the index is what we want.

XyDataSeries<int, double> is a valid series type and FindClosestPoint() seems to always throw an exception for this kind of series.

If there are any samples with an <int, double> series working, please let us know.

  • Martin Hanke
    Hi a) is there any possibility for you to switch to ? This would be my approach – I know it’s not nice… b) I haven’t checked, does int implement IComparable? c) The other thing I once ran into was using the wrong axis reference for the annotation. *facepalm* d) when using MVVM I had problems with annotations and values being null or invalid I can’t supply you any sample, as I’m working on a customer’s closed source project. Hope any of the above might help you
  • Thomas Böttcher-Holschen
    b) Yes, scichart can treat integers as valid IComparables. a )We could build an uncomfortable but stable work-around and treat int like doubles. Before, some info abot the implementation of FindClosestPoint() would be nice. Maybe someone who has a license with sourcecode could check for the exception?
  • You must to post comments
0
0

Hi Steffen,

Thanks for your inquiry.
Unfortunately, we have noticed your license support has expired.

If you wish to continue receiving technical support further please consider renewing your support subscription.
To do that please contact Sales here:
https://www.scichart.com/contact-us/

Or email us to [email protected]

If you believe this is not correct please provide your new order details.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies