SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
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)
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.
Hi, Igor Peric
I’ve fixed valueAt in category dataSeries. You can find new fix in new version in our framework.
Please feel free to contact us if you need anything else.
Best Regards, Mykola
Please login first to submit.