Vijay Sharma
Vijay Sharma

Reputation: 73

How to remove grid lines behind the bars in HorizontalBarChart?

I am using MPAndroidChart and I want to remove background lines at every interval displayed. Tried with this but no use. dailyTargetChart.setDrawGridBackground(false);

XAxis xl = dailyTargetChart.getXAxis();
                        xl.setDrawAxisLine(true);
                        xl.setDrawGridLines(false);

                        YAxis yl = dailyTargetChart.getAxisLeft();
                        yl.setDrawAxisLine(true);
                        yl.setDrawGridLines(true);

                        YAxis yr = dailyTargetChart.getAxisRight();
                        yr.setDrawAxisLine(true);
                        yr.setDrawGridLines(false);

Tried this also but vertical lines are still visible at intervals

Upvotes: 4

Views: 4873

Answers (2)

Narayan Ambrole
Narayan Ambrole

Reputation: 1

Try this It will remove the barchart bar background line.

chart.getXAxis().setDrawGridLines(false); // disable grid lines for the XAxis chart.getAxisLeft().setDrawGridLines(false); // disable grid lines for the left YAxis chart.getAxisRight().setDrawGridLines(false); // disable grid lines for the right YAxis

Upvotes: 0

masp
masp

Reputation: 515

Try this

 horizontalBarChart.getXAxis().setEnabled(false);
 horizontalBarChart.getAxisLeft().setEnabled(false);
 horizontalBarChart.getAxisRight().setEnabled(false);

Upvotes: 10

Related Questions