title: Android - why I see only one data when create graph
body: <p>I'm trying to display the data taken from the database and create a pie chart. there are no errors but I see only one data and not all of those stored. 
  I hope someone tells me where I'm wrong.</p>
  
  <pre><code>private void pie(){
  
          SQLiteDatabase db = new MydbHelper(getActivity()).getReadableDatabase();
  
      String sql = "SELECT field1, SUM(field2), color FROM Table";
      Cursor c = db.rawQuery(sql, null);
      int count = c.getCount();
  
      double[] values = new double[count];
      String[] categoryNames = new String[count];
      int[] colori = new int [count];
  
      for(int i=0; i&lt;count; i++) {
          c.moveToNext();     
          categoryNames[i] = c.getString(0);
          values[i] = c.getDouble(1);
          colori[i] = c.getInt(2);
      }
      // Instantiating CategorySeries to plot Pie Chart       
      CategorySeries distributionSeries = new CategorySeries(" Android version distribution as on October 1, 2012");
      for(int i=0 ;i &lt; categoryNames.length;i++){
          // Adding a slice with its values and name to the Pie Chart
          distributionSeries.add(categoryNames[i], values[i]);
      }   
      // Instantiating a renderer for the Pie Chart
      DefaultRenderer defaultRenderer  = new DefaultRenderer();       
      for(int i = 0 ;i&lt;categoryNames.length;i++){         
          SimpleSeriesRenderer seriesRenderer = new SimpleSeriesRenderer();       
  
          defaultRenderer.addSeriesRenderer(seriesRenderer);
      }
      defaultRenderer.setChartTitle("Android version distribution as on October 1, 2012 ");
      defaultRenderer.setChartTitleTextSize(20);
      defaultRenderer.setZoomButtonsVisible(true);        
  
      Intent intent = ChartFactory.getPieChartIntent(getActivity(), distributionSeries , defaultRenderer, "AChartEnginePieChartDemo");        
  
      // Start Activity
      startActivity(intent);
  
              c.close();
              db.close();
              }
  </code></pre>