App crash when zooming in
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
* [x] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md).
## What did you do?
Pinched to zoom in the graph
## What did you expect to happen?
The graph should zoom in
## What happened instead?
App crashed
## Charts Environment
pod 'Socket.IO-Client-Swift', '~> 13.1.0'
10.1 (10B61)
Swift 4
iOS11.2
macOS 10.13.6
## Demo Project
This is a company application, I can not send it.
## detalis:
When zooming in the graph, we get this - CODE FROM THE POD:
/// Sets up the axis values. Computes the desired number of labels between the two given extremes.
///////////////////////////////// MIN and MAX are NaN /////////////////////////////////
@objc open func computeAxisValues(min: Double, max: Double)
{
guard let axis = self.axis else { return }
let yMin = min
let yMax = max
let labelCount = axis.labelCount
let range = abs(yMax - yMin)
if labelCount == 0 || range <= 0 || range.isInfinite
{
axis.entries = [Double]()
axis.centeredEntries = [Double]()
return
}
// Find out how much spacing (in y value space) between axis values
let rawInterval = range / Double(labelCount)
var interval = rawInterval.roundedToNextSignficant()
// If granularity is enabled, then do not allow the interval to go below specified granularity.
// This is used to avoid repeated values when rounding values for display.
if axis.granularityEnabled
{
interval = interval < axis.granularity ? axis.granularity : interval
}
// Normalize interval
let intervalMagnitude = pow(10.0, Double(Int(log10(interval)))).roundedToNextSignficant() <- THE LINE WITH THE CRASH



Contributor guide
Assessment
This issue has not been assessed yet.