I'm created BarChart using MPAndroidChart and remove right YAxis labels by follow code:
mBarChart.getAxisRight().setDrawLabels(false);
after this, my background lines become duplicated
Before:

Here is what I have now:

My code:
//barChart
mBarChart.setDrawBarShadow(false);
mBarChart.setDrawValueAboveBar(true);
mBarChart.setDescription("");
// if more than 60 entries are displayed in the chart, no values will be
// drawn
mBarChart.setMaxVisibleValueCount(60);
// scaling can now only be done on x- and y-axis separately
mBarChart.setPinchZoom(true);
// draw shadows for each bar that show the maximum value
mBarChart.setDrawBarShadow(false);
mBarChart.animateY(2000, Easing.EasingOption.EaseInQuart);
// mChart.setDrawXLabels(false);
mBarChart.setDrawGridBackground(false);
//mBarChart.setDrawYLabels(false);
XAxis xAxis = mBarChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTypeface(tf);
xAxis.setDrawGridLines(false);
xAxis.setSpaceBetweenLabels(2);
ValueFormatter custom = new MyValueFormatter();
YAxis leftAxis = mBarChart.getAxisLeft();
leftAxis.setTypeface(tf);
leftAxis.setLabelCount(6);
leftAxis.setValueFormatter(custom);
leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
leftAxis.setSpaceTop(15f);
mBarChart.getAxisRight().setDrawLabels(false);
/*YAxis rightAxis = mBarChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setTypeface(tf);
rightAxis.setLabelCount(8);
rightAxis.setValueFormatter(custom);
rightAxis.setSpaceTop(15f);*/
Legend legend = mBarChart.getLegend();
legend.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
legend.setForm(Legend.LegendForm.SQUARE);
legend.setFormSize(9f);
legend.setTextSize(11f);
legend.setXEntrySpace(4f);
/* legend.setExtra(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc",
"def", "ghj", "ikl", "mno" });
legend.setCustom(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc",
"def", "ghj", "ikl", "mno" });*/
setDataToBarChart(mParties.size(), 50);
The reason for this is that the right axis is not disabled, but only it's labels are hidden, and you have different settings (the top-space, typeface and label count) that cause the lines to be in different places.
To prevent this from happening, call
rightAxis.setEnabled(false). This will disable the whole axis and no longer cause your issue.It's all in the documentation.