Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Margin Between X-Axis Title and X-Axis Labels in AChartEngine

Iam using AChartEngine Stacked Bar Chart. Can i add spacing between X-Axis Title and X-Axis Labels. They are too closed to each other.

set Bottom Margin will only add spacing between X-Axis Title and Legend.

like image 440
Fahad Abid Janjua Avatar asked Sep 21 '12 08:09

Fahad Abid Janjua


2 Answers

A quick patch which solved my problem, modify your X-Axis Title and prefix it with new lines, e.g

    renderer.setXTitle("\n\n\n Months");
like image 50
Narendrasinh Dodiya Avatar answered Oct 13 '22 01:10

Narendrasinh Dodiya


Use the setMargins() method. You can set the margins between the chart and the margins of the screen.

renderer.setMargins(new int[] {30, 100, 10, 0);

The order of the values in the parameter array is: top, left, bottom, right. So, you will need to increase the left value.

like image 32
Dan D. Avatar answered Oct 13 '22 01:10

Dan D.