title: achartengine clear renderers in XYMultipleSeriesRenderer
body: <p>My goal is create a graph that will hide and show a series depending on user actions. I thought to do that by first clearing the graph and dataset and renderers and then reinserting the new values. Much like the <code>.clear()</code> method of Arraylists, I was wondering if there was some type of similar functionality built for the XYMultipleSeriesRenderer. I noticed that the XYMultipleSeriesDataset was lacking similar functionality, but i was able to resolve that (i think, i can't be sure yet) by doing </p>
  
  <pre><code>        for(int i = 0; i &lt; dataset.getSeriesCount(); i++) {
              dataset.removeSeries(i);
          }
  </code></pre>
  
  <p>Luckily XYMultipleSeriesRenderer seems to have a getrenderercount type of method, but not a remove method that takes <code>ints</code>. All i see is a remove function that doesn't take <code>ints</code>, just actual series renderer names. </p>
  
  <p>Here is more code if that helps:</p>
  
  <pre><code>private void excecuteGraph() {
      //      add series to the complete dataset
      XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
      XYMultipleSeriesRenderer mrenderer = new XYMultipleSeriesRenderer();
  
      switch (graphCase ){
      case -1:
          dataset.addSeries(series0);
          dataset.addSeries(series1);
          dataset.addSeries(series2);
          dataset.addSeries(series3);     
  
          //          create the individual renderers, customize settings for each
          XYSeriesRenderer renderer1 = new XYSeriesRenderer();
          renderer1.setColor(Color.BLUE);
          renderer1.setLineWidth(3);
          XYSeriesRenderer renderer2 = new XYSeriesRenderer();
          renderer2.setColor(Color.DKGRAY);
          renderer2.setLineWidth(3);
          XYSeriesRenderer renderer3 = new XYSeriesRenderer();
          renderer3.setColor(Color.RED);      
          renderer3.setLineWidth(3);
          XYSeriesRenderer renderer4 = new XYSeriesRenderer();
          renderer4.setColor(Color.WHITE);        
          renderer4.setLineWidth(3);
  
          //          add renderers to the complete multirenderer, customize settings for it
          mrenderer.addSeriesRenderer(renderer1);
          mrenderer.addSeriesRenderer(renderer2);
          mrenderer.addSeriesRenderer(renderer3);
          mrenderer.addSeriesRenderer(renderer4);
          break;
      case 0:
          for(int i = 0; i &lt; dataset.getSeriesCount(); i++) {
              dataset.removeSeries(i);
          }
  
          dataset.addSeries(series0);
          XYSeriesRenderer renderer00 = new XYSeriesRenderer();
          renderer00.setColor(Color.BLUE);
          renderer00.setLineWidth(3);
          mrenderer.addSeriesRenderer(renderer00);
          break;
      case 1:
          for(int i = 0; i &lt; dataset.getSeriesCount(); i++) {
              dataset.removeSeries(i);
              Log.d("testingGraph", dataset.toString());
          }
  
          dataset.addSeries(series1);
          XYSeriesRenderer renderer10 = new XYSeriesRenderer();
          renderer10.setColor(Color.DKGRAY);
          renderer10.setLineWidth(3);
          mrenderer.addSeriesRenderer(renderer10);
          break;
      case 2:
          for(int i = 0; i &lt; dataset.getSeriesCount(); i++) {
              dataset.removeSeries(i);
          }
          dataset.addSeries(series2);
          XYSeriesRenderer renderer20 = new XYSeriesRenderer();
          renderer20.setColor(Color.RED);     
          renderer20.setLineWidth(3);
          mrenderer.addSeriesRenderer(renderer20);
      case 3:
          for(int i = 0; i &lt; dataset.getSeriesCount(); i++) {
              dataset.removeSeries(i);
          }
          dataset.addSeries(series3);
          XYSeriesRenderer renderer30 = new XYSeriesRenderer();
          renderer30.setColor(Color.WHITE);       
          renderer30.setLineWidth(3);
          mrenderer.addSeriesRenderer(renderer30);
      }
  
      mrenderer.setYTitle("Accuracy (%)");
      mrenderer.setYAxisMin(0);
      mrenderer.setYAxisMax(100);
      mrenderer.setApplyBackgroundColor(true);
      mrenderer.setBackgroundColor(Color.TRANSPARENT);
  
      //      Get the chart view result, add it to the linear layout
      GraphicalView mChartView = ChartFactory.getTimeChartView(this, dataset,
              mrenderer, "MM/dd/yyyy");
  
      LinearLayout graphLayout = (LinearLayout) findViewById(R.id.layout_graph);
      graphLayout.addView(mChartView, new LayoutParams(LayoutParams.MATCH_PARENT,
              LayoutParams.MATCH_PARENT));        
  
      if (mChartView !=null) {
          mChartView.repaint();
      }
  
  }
  </code></pre>