Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a crash caused by NaNs in CombinedChartView with empty data set #577

Closed
wants to merge 1 commit into from
Closed

Commits on Nov 27, 2015

  1. Fixes a crash caused by NaNs in CombinedChartView when an empty datas…

    …et is passed in.
    
    Also fixes a simlar NaN-related crash when such a chart is touched.
    
    A minimal view controller to reproduce is:
    
    import UIKit
    import Charts
    
    class InformationViewController: UIViewController {
        @IBOutlet weak var chartView: CombinedChartView!
    
        override func viewDidLoad() {
            let xAxisData = [NSDate]()
            let bar1Data = BarChartDataSet(yVals: [BarChartDataEntry]())
            let bar2Data = BarChartDataSet(yVals: [BarChartDataEntry]())
    
            chartView.xAxis.labelPosition = .Bottom
            chartView.descriptionText = ""
            chartView.animate(xAxisDuration: 0.5, yAxisDuration: 1.0)
    
            let combinedData = CombinedChartData(xVals: xAxisData)
            combinedData.barData = BarChartData(xVals: xAxisData, dataSets: [bar1Data, bar2Data])
    
            chartView.data = combinedData
        }
    }
    natethegreat44 committed Nov 27, 2015
    Configuration menu
    Copy the full SHA
    0bcc215 View commit details
    Browse the repository at this point in the history