简体   繁体   中英

How to remove all grid lines except left Y axis and bottom X axis using Charts ios?

In my app I'm using the iOS-Charts framework, and I figured out how to remove the grid (vertical and horizontal) by using:

barChartView.leftAxis.drawGridLinesEnabled = false 
barChartView.rightAxis.drawGridLinesEnabled = false 

Tried every solution available for none worked for me. Seems like from Swift 4 you can not disable grid lines totally. One solution you have though is making the grid lines clear color so that they are not visible.

chartView.xAxis.gridColor = .clear
chartView.leftAxis.gridColor = .clear
chartView.rightAxis.gridColor = .clear

To Enable x and y axis alone

 yourView.leftAxis.drawZeroLineEnabled = true

yourView.rightAxis.drawZeroLineEnabled=true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM