Remove Border and Margin around iOS Charts in Swift

前端 未结 3 1241
一向
一向 2021-02-19 21:15

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-

相关标签:
3条回答
  • 2021-02-19 21:26

    Actually the way to do it is like this:

    chartView.xAxis.enabled = false
    chartView.leftAxis.enabled = false
    chartView.rightAxis.enabled = false
    chartView.drawBordersEnabled = false
    chartView.minOffset = 0
    
    0 讨论(0)
  • 2021-02-19 21:32

    It is minOffset.

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

    You can change it as this:

    chartView.minOffset = 0
    
    0 讨论(0)
  • 2021-02-19 21:39

    that line is actually axis line.

    To hide the all the lines, you can use

        totalsGraph.rightAxis.enabled = false
        totalsGraph.legend.enabled = false
        totalsGraph.leftAxis.enabled = false
        totalsGraph.xAxis.labelPosition = .bottom
        totalsGraph.xAxis.drawGridLinesEnabled = false
        totalsGraph.xAxis.drawAxisLineEnabled = false
    

    I am looking for solution to remove margins as well. I will update my answer when I find it.

    0 讨论(0)
提交回复
热议问题