I am struggling to remove the background gridlines and X and Y axis from my Bar Graph/Chart. Can you help me with that.
I believe what you are looking for is:
- drawAxisLineEnabled
- drawGridLinesEnabled
If you're using Objective-C just set these on the desired axis:
yAxis.drawAxisLineEnabled = NO;
yAxis.drawGridLinesEnabled = NO;
or if you're using Swift:
yAxis.drawAxisLineEnabled = false
yAxis.drawGridLinesEnabled = false
Hope it helps.
thanks
Awesome Thanks
How to change grid line color?
Thanks
what about javafx ? plz
I'm using Swift 4 and I can't get rid of any of the grid lines.
I'm creating a LineChartView and customizing it as so:
let lineChart: LineChartView = {
let chart = LineChartView()
chart.leftAxis.drawAxisLineEnabled = false
chart.leftAxis.drawGridLinesEnabled = false
chart.leftAxis.gridColor = NSUIColor.clear
chart.xAxis.drawGridLinesEnabled = false
chart.backgroundColor = .white
chart.translatesAutoresizingMaskIntoConstraints = false
return chart
}
The chart the appears looks exactly like the default line chart without any customization.
Here is how I did that
lineChart.leftAxis.enabled = false
lineChart.rightAxis.enabled = false
lineChart.xAxis.enabled = false
It seems you can't directly disable grid lines in swift 4. Workaround is just setting the grid color to clear so they won't be visible
lineChart.xAxis.gridColor = .clear
lineChart.leftAxis.gridColor = .clear
lineChart.rightAxis.gridColor = .clear
Most helpful comment
I believe what you are looking for is:
If you're using Objective-C just set these on the desired axis:
or if you're using Swift:
Hope it helps.