Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Border and Margin around iOS Charts in Swift

Tags:

ios-charts

I am using iOS Charts with Swift 3, and I can't figure out how to do a couple things:

  1. I want to remove the margin around the chart. I know the chart goes edge-to-edge in my UI because if I change the chart's background color, it goes all the way to the edge. How do I remove the gap indicated by the red arrows below?

  2. How do I remove the border around the whole graph (note the black arrow)? I already have totalsGraph.drawBordersEnabled = false and it doesn't work. Is there a different option for that?

enter image description here

Thank you!

like image 605
Clifton Labrum Avatar asked Oct 12 '16 06:10

Clifton Labrum


1 Answers

It is minOffset.

/** Sets the minimum offset (padding) around the chart, defaults to 10 */

You can change it as this:

chartView.minOffset = 0
like image 197
Y.Bi Avatar answered Sep 19 '22 20:09

Y.Bi