AChartEngine does not display the maximum chart value

别等时光非礼了梦想. 提交于 2019-12-04 04:49:10

问题


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});  

回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!