title: How to display Bar Chart properly in AChart Engine android
body: <p>I am using AChart Engine to show a bar chart and want to display a bar chart like this:</p>
  
  <p><img src="https://i.stack.imgur.com/DCRJy.png" alt="enter image description here"></p>
  
  <p>But it ends up with this:
  <img src="https://i.stack.imgur.com/x25qY.png" alt="enter image description here"></p>
  
  <p>It is very frastrating and I am trying for last 4 hours to give it a proper format but failed. I searched internet for a proper tutorial but couldn't manage one. Can you please tell me what snippet should I include?</p>
  
  <p>This is my trying code:</p>
  
  <pre><code>public class BarGraph{
  
      public GraphicalView getView(Context context) 
      {   
          // Bar 1
  
          XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
  
          CategorySeries ac = new CategorySeries("AC");
          CategorySeries pe = new CategorySeries("PE");
          CategorySeries wa = new CategorySeries("WA");
          CategorySeries tl = new CategorySeries("TL");
          CategorySeries ml = new CategorySeries("ML");
          CategorySeries ce = new CategorySeries("CE");
          CategorySeries re = new CategorySeries("RE");
          CategorySeries ot = new CategorySeries("OT");
          ac.add(291);
          dataset.addSeries(ac.toXYSeries());
          pe.add(11);
          dataset.addSeries(pe.toXYSeries());
          wa.add(204);
          dataset.addSeries(ac.toXYSeries());
          tl.add(28);
          dataset.addSeries(pe.toXYSeries());
          ml.add(0);
          dataset.addSeries(ac.toXYSeries());
          ce.add(21);
          dataset.addSeries(pe.toXYSeries());
          re.add(51);
          dataset.addSeries(ac.toXYSeries());
          ot.add(4);
          dataset.addSeries(pe.toXYSeries());
  
  
          XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
          mRenderer.setChartTitle("Submission Statistics");
          mRenderer.setXTitle("Verdict Code");
          mRenderer.setYTitle("No. of Submissions");
          mRenderer.setAxesColor(Color.BLACK);
          mRenderer.setLabelsColor(Color.BLACK);
          mRenderer.setApplyBackgroundColor(true);
          mRenderer.setBackgroundColor(Color.WHITE);
          mRenderer.setMarginsColor(Color.WHITE);
          mRenderer.setZoomEnabled(true);
          mRenderer.setZoomButtonsVisible(true);
  
          XYSeriesRenderer renderer = new XYSeriesRenderer();
          renderer.setColor(Color.parseColor("#00AA00"));
          renderer.setDisplayChartValues(true);
          renderer.setChartValuesSpacing((float) 0.5);
  
          XYSeriesRenderer renderer2 = new XYSeriesRenderer();
          renderer2.setColor(Color.parseColor("#666600"));
          renderer2.setDisplayChartValues(true);
          renderer2.setChartValuesSpacing((float) 0.5);
  
          XYSeriesRenderer renderer3 = new XYSeriesRenderer();
          renderer3.setColor(Color.parseColor("#FF0000"));
          renderer3.setDisplayChartValues(true);
          renderer3.setChartValuesSpacing((float) 0.5);
  
          XYSeriesRenderer renderer4 = new XYSeriesRenderer();
          renderer4.setColor(Color.parseColor("#0000FF"));
          renderer4.setDisplayChartValues(true);
          renderer4.setChartValuesSpacing((float) 0.5);
  
          XYSeriesRenderer renderer5 = new XYSeriesRenderer();
          renderer5.setColor(Color.parseColor("#6767D0"));
          renderer5.setDisplayChartValues(true);
          renderer5.setChartValuesSpacing((float) 0.5);
  
          XYSeriesRenderer renderer6 = new XYSeriesRenderer();
          renderer6.setColor(Color.parseColor("#AAAA00"));
          renderer6.setDisplayChartValues(true);
          renderer6.setChartValuesSpacing((float) 0.5);
  
          XYSeriesRenderer renderer7 = new XYSeriesRenderer();
          renderer7.setColor(Color.parseColor("#00AAAA"));
          renderer7.setDisplayChartValues(true);
          renderer7.setChartValuesSpacing((float) 0.5);
  
          XYSeriesRenderer renderer8 = new XYSeriesRenderer();
          renderer8.setColor(Color.parseColor("#000000"));
          renderer8.setDisplayChartValues(true);
          renderer8.setChartValuesSpacing((float) 0.5);
  
  
          mRenderer.addSeriesRenderer(renderer);
          mRenderer.addSeriesRenderer(renderer2);
          mRenderer.addSeriesRenderer(renderer3);
          mRenderer.addSeriesRenderer(renderer4);
          mRenderer.addSeriesRenderer(renderer5);
          mRenderer.addSeriesRenderer(renderer6);
          mRenderer.addSeriesRenderer(renderer7);
          mRenderer.addSeriesRenderer(renderer8);
  
          return ChartFactory.getBarChartView(context, dataset,mRenderer, Type.DEFAULT);
      }
  
  }
  </code></pre>