SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

0
0

Hi,

I am trying to get the index of a specific date in CategoryDateTime X axis. I was trying to use this approach:

int idxOfMaxAvgScoreDate = [[self.dataSeriesAvg xValues] indexOf:SCIGeneric(dateOfMaxAvgScore) IsSorted:YES SearchMode:SCIArraySearchMode_Exact];

but it was returning -1. My guess is that comparison operator for the DateTime type is “too precise”, so some kind of range check needs to be done, similarly to common practice when comparing two floats:

if (abs(float1-float2) < epsilon)

instead of

if (float1 == float2)

I tried using SCIArraySearchMode_Nearest, but without success – most of the times I get a column right after the one I need (desiredIndex+1).

While trying to implement index lookup myself by iterating through the dataSeries.xValues I noticed that DateTime type decoder is not there for individual elements of SCIArrayControllerProtocol. Autocompletion for line below

[[self.dataSeries xValues] valueAt:i].

offers all typed of data decoding (int16, int32, char…) except dateTime. Is this the way it is supposed to be?

I tried solving it this way:

SCIGenericDate([[self.dataSeries xValues] valueAt:i])

but the date I am getting is always 01-01-1970. This indicates that entries in the X axis are not DateTime elements, which is not true, since this is my X axis:

id<SCIAxis2D> xAxis = [[SCICategoryDateTimeAxis alloc] init];

Any help, or even just thoughts and comments, would be highly appreciated.

Thanks,
Igor

Version
1.2.4
  • You must to post comments
1
0

Hi, Igor Peric

I’ve fixed valueAt in category dataSeries. You can find new fix in new version in our framework.
https://www.scichart.com/Downloads/iOS/v1.2/SciChart_iOS_v1.2.4.1296_SDK.zip

Please feel free to contact us if you need anything else.

Best Regards, Mykola

  • Igor Peric
    Thanks, works like a charm! :)
  • Igor Peric
    Hey Mykola, can you please integrate the fix in 2.0 branch as well? Thanks.
  • You must to post comments
0
0

This fix worked perfectly well in version 1.2. However, just upgrading to 2.0 made the code broken again. When can we expect having the fix in version 2.0? Thanks.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.