Comments (2)
If I change your example code with this it causes crash
self.data = @[@[@1, @1, @1, @1, @1, @1, @1],];
from graphkit.
Thank you for reporting this issue. I have renamed the title to be more adequate to the problem.
The crash is caused by NaN, which is a special float value meaning "not a valid float number". In most cases it is caused by division by zero, and that is the case in this instance also.
In order to calculate scale value
, GKLineGraph
uses minValue
and maxValue
of all line data values.
CGFloat scale = (value - [self _minValue]) / ([self _maxValue] - [self _minValue]);
From the code above you can clearly see that you will cause division by zero each time you pass values which are the same number.
To fix that problem, simply pass data for another line (at index 0), and set that line color to clear.
self.data = @[
@[@2, @2, @2, @2, @2, @2, @6],
@[@1, @1, @1, @1, @1, @1, @1]
];
from graphkit.
Related Issues (20)
- BarGraph only displaying max of 6 bars
- Autolayout issues. HOT 1
- Several Errors When Loading BarGraph HOT 15
- GKBarGraph uses same name as an Apple private selector HOT 4
- is it possible to invert the graphic ? HOT 1
- titleForBarAtIndex on Bar Graph not treated as Optional
- Updating the line graph with new values? HOT 1
- Tutorial HOT 1
- Line Chart Crashes if it only has equal values for a line
- NSInvalidArgumentException Error When Passing an array of NSNumbers HOT 1
- Multi line graph with unequal data set
- fix for the NaN exception on GKLineGraph
- Smooth curves?
- FR - Rounded line graph HOT 1
- Graph not plotted correctly if I apply OrderedSet on title labels. HOT 1
- Crashing on [self.graph reset] calling
- FR - Custom Labels
- GKLineGraph issue HOT 2
- Not conform to protocol in Swift project HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphkit.