Reputation: 9
X-axis values are getting overlap and i need to make it exactly below to the bar
BarDataSet dataSet = new BarDataSet(barEntryArrayList, "Invoice Qty");
BarData lineData = new BarData(dataSet);
chart.setFitBars(true);
XAxis xAxis =chart.getXAxis();
xAxis.setValueFormatter(new AxisValueFormatter(labels));
xAxis.setGranularityEnabled(true);
xAxis.setGranularity(1f);
/* xAxis.setSpaceMax(lineData.getBarWidth() / 2f);
xAxis.setSpaceMin(lineData.getBarWidth()/2f);*/
//xAxis.setLabelRotationAngle(-120f);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setCenterAxisLabels(true);
YAxis yAxisRight = chart.getAxisRight();
yAxisRight.setEnabled(false);
chart.setData(lineData);
chart.getDescription().setEnabled(false);
chart.invalidate();`
Upvotes: 0
Views: 353
Reputation: 1854
xAxis.setLabelRotationAngle(45f);
It is working for me. I am using latest version 3.0.3
Upvotes: 1