0

I'm using SwiftCharts for Swift 4. I haven't been able to figure out how to get the simple graphs to show properly either starting the app in landscape orientation, or handling rotation from portrait to landscape. Can anyone point me to examples or documentation on how to handle non-portrait implementations?

Thanks in advance

Jon Clayton
  • 93
  • 1
  • 2
  • 10

1 Answers1

0

Found this in the RangedAxisExample.

let orientation = UIApplication.shared.statusBarOrientation
    guard (lastOrientation.map{$0.rawValue != orientation.rawValue} ?? true) else {return}

    lastOrientation = orientation

    guard let chart = chart else {return}
    for view in chart.view.subviews {
        view.removeFromSuperview()
    }
    self.drawChart() //  my chart code here

    chart.view.setNeedsDisplay()
Jon Clayton
  • 93
  • 1
  • 2
  • 10