I am trying to display horizontal bar chart using AChartEngine.
In the bar chart, ChartValues should be displayed. (I am using XYSeriesRenderer.setDisplayChartValues(true) in my code.)
Following is the rendered chart.
As you can see, the maximum value is not displayed. I think the length of the x-axis (about 140) region is not enough to display the region of maximum chartvalue. Anyway, how can I display the maximum chartvalue in my chart?
Here's my code.
renderer.setColor(Color.parseColor("#158aea"));
renderer.setDisplayChartValues(true);
renderer.setChartValuesTextSize(15);
renderer.setChartValuesTextAlign(Align.LEFT);
myRenderer.setLabelsTextSize(15);
myRenderer.setShowGridX(true);
myRenderer.setShowLegend(true);
myRenderer.setShowLabels(true);
myRenderer.addSeriesRenderer(renderer);
myRenderer.setPanEnabled(false, false);
myRenderer.setXLabels(0);
myRenderer.setXLabelsAlign(Align.RIGHT);
myRenderer.setYLabelsAlign(Align.RIGHT);
myRenderer.setLegendTextSize(20);
myRenderer.setBarSpacing(0.2);
//myRenderer.setZoomEnabled(false, false);
myRenderer.setShowAxes(true);
myRenderer.setInScroll(true);
myRenderer.setOrientation(Orientation.VERTICAL);
myRenderer.setApplyBackgroundColor(true);
myRenderer.setBackgroundColor(Color.WHITE);
myRenderer.setMarginsColor(Color.WHITE);
myRenderer.setLabelsColor(Color.BLACK);
myRenderer.setXLabelsColor(Color.BLACK);
myRenderer.setYLabelsColor(0, Color.BLACK);
myRenderer.setMargins(new int[] {60, -20, 80, 0});
You can manually set the maximum Y axis value such as you will have enough space for the maximum value to be displayed.
myRenderer.setYAxisMax(150);
来源:https://stackoverflow.com/questions/14048709/achartengine-does-not-display-the-maximum-chart-value