Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

CALayerInvalidGeometry exception for duplicate & zeroed data points #3

Closed
sankaet opened this issue Jan 16, 2014 · 3 comments
Closed
Labels

Comments

@sankaet
Copy link

sankaet commented Jan 16, 2014

This thing is amazing!!! But one bug that I found so far: Everything works perfectly except for the time when all the data points have the same value. Then it gives this error:

'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [0 nan]'

@WolfJake
Copy link

This line of code allows the insertion of all points with the same value

float maxValue = [self maxValue] == 0 ? 0.1 : [self maxValue];

@Sam-Spencer
Copy link
Collaborator

The Issue
This crash is caused when your data source submits a zero-value as a data point. It occurs inside the drawGraph method while trying to iterate through the data points.

Possible Solutions
A good workaround solution is to submit a number very close to zero, but not zero. @WolfJake has a good snippet that may be helpful.

Because this is a known issue, it is strongly recommended that you check your dataSource before submitting it to BEMSimpleLineGraph. Ensure that your datasource has no zero values or duplicate values. If it has zero values, just submit values which are a fraction larger than zero (eg. 0.01). If it has duplicate values you may need to increment one of the duplicates very slightly.

Bug Fix Status
This issue is partially fixed on the feature branch of this repo. It should be fully fixed in a future commit.

Boris-Em added a commit that referenced this issue Feb 8, 2014
- Added exception to fix issue when only one point is drawn (issue #6).
- Added exception to fix issue when all of the points have the same
value (issue #3).
- Added define padding to replace hard coded number.

Thank you to @darkFunction for the help with the fix of issue #3.
This was referenced Feb 8, 2014
@Boris-Em
Copy link
Owner

Boris-Em commented Feb 8, 2014

Closed as fixed with version 1.3. Thank you for pointing this out.

@Boris-Em Boris-Em closed this as completed Feb 8, 2014
@Boris-Em Boris-Em added the fixed label Jun 9, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants