I want to include Charts on a section of my side project. I struggle to get their demo working. I do not know Objective C so I've converted their code to Swift. Im using Swift 3:
viewDidLoad():
self.title = "Filled Line Chart"
self.chartView.delegate = self // after build: Thread 1:EXC_BAD_ACCESS (code=2, address=0x……)
self.chartView.backgroundColor = UIColor.white
self.chartView.gridBackgroundColor = UIColor(red: CGFloat(51 / 255.0), green: CGFloat(181 / 255.0), blue: CGFloat(229 / 255.0), alpha: CGFloat(150 / 255.0))
self.chartView.drawGridBackgroundEnabled = true
self.chartView.drawBordersEnabled = true
self.chartView.chartDescription.isEnabled = false
self.chartView.pinchZoomEnabled = false
self.chartView.dragEnabled = true
chartView.scaleEnabled = true
var l = chartView.legend
l.isEnabled = false
var xAxis = chartView.xAxis
xAxis.isEnabled = false
var leftAxis = chartView.leftAxis
leftAxis.axisMaximum = 900.0
leftAxis.axisMinimum = -250.0
leftAxis.drawAxisLineEnabled = false
Since I dont know what to do from there, I dragged a line from my view to the code to create an IBOutlet: @IBOutlet var chartView: BarChartView!
In all it looks like this:
import UIKit
import Charts
class DashboardVC: UIViewController, ChartViewDelegate {
@IBOutlet var chartView: BarChartView!
override func viewDidLoad() {
super.viewDidLoad()
self.title = "Filled Line Chart"
self.chartView.delegate = self
self.chartView.backgroundColor = UIColor.white
self.chartView.gridBackgroundColor = UIColor(red: CGFloat(51 / 255.0), green: CGFloat(181 / 255.0), blue: CGFloat(229 / 255.0), alpha: CGFloat(150 / 255.0))
self.chartView.drawGridBackgroundEnabled = true
self.chartView.drawBordersEnabled = true
self.chartView.chartDescription?.isEnabled = false
self.chartView.pinchZoomEnabled = false
self.chartView.dragEnabled = true
self.chartView.scaleXEnabled = true
var l = chartView.legend
l.isEnabled = false
var xAxis = chartView.xAxis
xAxis.isEnabled = false
var leftAxis = chartView.leftAxis
leftAxis.axisMaximum = 900.0
leftAxis.axisMinimum = -250.0
leftAxis.drawAxisLineEnabled = false
}
}
Error I got with above:
The aim was to add a chart in a small container on my view but just to see of this moule works, I select the entire view to create the outlet. I see not documentation. I've looked on youtube for videos, searched for tutorials for this module but nothing. Spent 2hrs looking and so far no good. Would appreciate any little input.
Thanks.
EDIT:
As per comments/answer, Ive changed isEnabled to enable. Only one error, Thread 1:EXC_BAD_ACCESS. The fix brought me to this.
This simple question gets longer as when I made the change but selecting Charts for Module, I get the above error which points to my custom segue:
func goTodashboard() {
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let dc: DashboardVC = storyboard.instantiateViewController(withIdentifier: "dashboardVC") as! DashboardVC
self.present(dc, animated: true, completion: nil)
}
Basically, that code is called in viewDidAppear() from loginViewController. When user logs in, it goes to the dashboard. Is that the correct way to switch view? It works ok but the Charts having an issue with it.

LoginVCandDashboardVC.