Axis ranges not being calculated correctly?


#1

I’m using ShinobiChart 2.5.4, and I have a custom model object which conforms to the SChartData protocol. For its x value it returns an NSDate *, and for its y value it returns an NSNumber *. My x axis is being automatically calculated correctly, but my y axis is always left at [0, 1], and even manual attempts to change it have very strange behavior.

E.g., calling [chart.yAxissetRangeWithMinimum:chart.yAxis.dataRange.minimumandMaximum:chart.yAxis.dataRange.maximum] returns true (and the minimum and maximum are what I expect - floating point values between 50 and 60), but then my actual axis changes to [-0.25, 1.25]. If I change the yValue function to return an NSDate* instead, the y axis range is then calculated correctly. Can I not use NSNumbers, or is there something special I need to do to make them work? Thanks.


#2

Follow-up - I revered back to version 2.1.1, and with no other changes, everything is working correctly.


#3

Thanks for the information - we’ll definitey look into this. If you could send a project that reproduces this to info@shinobicontrols.com that would be a great help.

Colin E.


#4

Project sent (via a dropbox share link to info@shinobicontrols.com - it was ~15 MB zipped).


#5

Hi Jgallagher! This is a known issue that we recently fixed. It is going to be included in our next minor release, which should be in a couple of days.

The issue actually surfaces when your data range is 0, and since all your Y-values are @50, your dataset had a range of 0. By changing your datapoint subclasses sCharYValue to the following I managed to get your range calculating properly:

int x;
- (id)sChartYValue
{
    x++;
    return @(x);
}

Please let us know if the new release doesn’t fix your issue :grin:. I’ll post on this thread when it is available!

Thanks,
Jan


#6

Hi John,

Our latest release of ShinobiCharts is now out (version 2.5.5), which should fix this issue. Give it a go, and let me know how things go!

Many thanks,

Dan


#7

Yep, that fixed it! Thanks. (Sorry for the long delay.)


#8

No worries!

Glad that that fixed your issue.

Dan