Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove background gridlines from Bar Chart #579

Closed
SpaceYatri opened this issue Nov 28, 2015 · 9 comments
Closed

How to remove background gridlines from Bar Chart #579

SpaceYatri opened this issue Nov 28, 2015 · 9 comments

Comments

@SpaceYatri
Copy link

I am struggling to remove the background gridlines and X and Y axis from my Bar Graph/Chart. Can you help me with that.

@alvesjtiago
Copy link
Contributor

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.

@SpaceYatri
Copy link
Author

thanks

@hernanarber
Copy link

Awesome Thanks

@KiritVaghela
Copy link

How to change grid line color?

@GurinderBatth
Copy link

Thanks

@Marwan-Mostafa7
Copy link

what about javafx ? plz

@bijanasc
Copy link

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.

@beraylik
Copy link

beraylik commented Apr 3, 2018

Here is how I did that

lineChart.leftAxis.enabled = false
lineChart.rightAxis.enabled = false
lineChart.xAxis.enabled = false

@laazer
Copy link

laazer commented Jan 4, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants