When I try to append data to iOS Charts LineChart it crashes with message: Fatal error: Range requires lowerBound <= upperBound in class BarLineScatterBubbleRenderer at line 137.
I have created a fresh XCode project which uses Storyboards, Charts version 4.1.0 has been installed using cocoa pods, this is the ViewController code which I use to display the chart and append data:
class ViewController: UIViewController {
private let chartData = LineChartData()
private let dataset = LineChartDataSet()
private var dataCounter = 1
@IBOutlet weak var chartView: LineChartView!
override func viewDidLoad() {
super.viewDidLoad()
chartData.append(dataset)
chartView.data = chartData
}
@IBAction func onButtonTap(_ sender: UIButton) {
dataset.append(ChartDataEntry(x: Double(dataCounter), y: .random(in: 0...5)))
chartView.notifyDataSetChanged()
dataCounter += 1
}
}