add NaN check to allow non-digits handling for radar chart #152
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The background is that not every data in every dataSet is valid number in real life.
add NaN check to allow non-digits handleing. if a CGPoint contains NaN, simply ignore it, this will ignore current point and continue the path with next valid point.
This is helpful, where dataSet 1 contains invalid data but dataSet 2 has valid data. People can have a chance to insert NaN if user found the data is nil/null/NSNotFound/ifinity/DOUBLE_MAX.... any number that cannot be drawn on screen or even exists in real life, and still get the chart.
for example,
xValues: [1,2,3,4,5]
dataSet 1: [5,6,NaN,8,9]
dataSet 2: [11,12,13,14,15]
With NaN support, the radar chart will connect dataSet 1 values: 5-6-8-9 as a web, and dataSet 2 as 11-12-13-14-15 as another web.
Attention:
I only add the code for radar chart, since I am more familiar with it and gives the demo. If it is a valid scenario, you can expand it to other charts accordingly.