问题
I am working on Achart Engine and i am facing 2 issues
Issue 1) i am facing exactly same problem as posted in the screen shot here displaying max chart values on Y axis
2) suppose in the 3 bars if i one among the bar is 0 say middle one then the bar will not be drawn and shows blank between the two bars, but i dont want to show some space.
On Issues what i want to acheive:
Issue 1) My Ymax value is 50 ,i can make the Y max value to 60 so that the max value is displayed and will not cut.But what happens is now its display 10,20,30,40,50 in Y axis but if i make it 60 it displays 20,40,60 but i want it to display 10,20,30,40,50,60.
Issue 2) If the middle bar value is 0 or any other bar value which is draw is 0 then i dont want to show a space there or dont draw the bar at all.
Please help me to acheive this.
EDIT:
SCREEN SHOT :
I cannot post a screen shot here lack of reputation so i am posting it here please see to it
IMAGE
回答1:
Just set the Y axis maximum value to something that is higher than the biggest value.
Bar charts with value of zero must be displayed. If there isn't any value to be added than just use MathHelper.NULL_VALUE
.
回答2:
There are two ways to solve this problem.
One of the ways is to set the margin color to transparent in the renderer
renderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00));
This solution works unless your series have values that are outside the range of the chart. You can either recreate your series so all values are inside the range, or go for solution 2.
Solution 2 is to multiply the max Y value of your chart by 1.1, and set it as the Y max
mRenderer.setYAxisMax(maxvalue*1.1);
来源:https://stackoverflow.com/questions/14788810/achartengine-does-not-display-the-maximum-chart-value-bar-chart