AChartEngine does not display the maximum value of the chart - Bar Chart

I am working on Achart Engine and am facing two problems

Issue 1) I faced the same problem as in the screenshot showing the maximum values ​​of the chart on the Y axis

2) suppose in 3 bars, if one of the columns is 0, say the middle, then the row will not be drawn and will display the space between the two columns, but I don't want to show any space.

In the questions I want to achieve:

Problem 1) My Ymax value is 50, I can make the Ymax value equal to 60 so that the max value will be displayed and not clipped. But now it is displaying 10,20,30,40,50 in Y, but if I do it 60 it displays 20,40,60, but I want it to display 10,20,30,40,50,60 ...

Problem 2) If the middle row value is 0 or any other bar value that is equal to a draw, then I don't want to show a space or I don't draw the bar at all.

Please help me with this.

EDIT:

SCREENSHOT:

I am unable to post a screenshot that is missing reputation, so I am posting it here, please have a look at it

IMAGE

+3


source to share


2 answers


Just set the maximum y-axis value to be higher than the largest value.



Bar charts with a value of zero should be displayed. If there is no appended value, just use MathHelper.NULL_VALUE

.

+2


source


There are two ways to solve this problem.

One way is to set the transparency of the field box in the renderer

renderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00));

      



This solution works if your series has no values ​​outside the chart range. You can either recreate your series so that all values ​​are within the range, or go to solution 2.

Solution 2 - multiply the maximum Y value of your graph by 1.1 and set it as Y max

mRenderer.setYAxisMax(maxvalue*1.1);

      

0


source







All Articles