AChartEngine does not display the maximum value of the chart

I am trying to display a horizontal bar chart using AChartEngine.

The histogram should display ChartValues. (I am using XYSeriesRenderer.setDisplayChartValues ​​(true) in my code.)

Below is the graph.

horizontal bar chart

As you can see, the maximum value is not displayed. I think the length of the x-axis area (about 140) is not enough to display the area of ​​the chart's maximum value. Anyway, how can I display the maximum value of the chart on my graph?

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

      

+2


source to share


1 answer


You can manually set the maximum value for the Y-axis, for example, you have enough room to display the maximum value.



myRenderer.setYAxisMax(150);

      

0


source







All Articles