title: how to update chart in androidplot
body: <p>I made a graph from my database with androidplot, but when i reset the database with by button, the graph dosnt update, how do i update the graph without recreating the activity?</p>
  
  <pre><code>public class Overview extends Activity {
  Number[] seriesOfNumbers;
  private XYPlot mySimpleXYPlot;
  // double totalprofitd;
  private BetsDbAdapter dbHelper;
  TextView NBtext;
  TextView TOtext;
  TextView TPtext;
  TextView ROItext;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.c_overview);
  
      dbHelper = new BetsDbAdapter(this);
      TOtext = (TextView) findViewById(R.id.turnover);
      TPtext = (TextView) findViewById(R.id.totalprofit);
      NBtext = (TextView) findViewById(R.id.numberOfBet);
      ROItext = (TextView) findViewById(R.id.roi);
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.android_tab_layout, menu);
      return true;
  }
  
  public void resetClick(View v) {
      dbHelper.open();
      dbHelper.deleteDatabase();
      dbHelper.close();
      CalculateProfit();
      graph();
  }
  
  @Override
  protected void onResume() {
      // TODO Auto-generated method stub
      super.onResume();
      CalculateProfit();
      graph();
  }
  
  public void CalculateProfit() {
      dbHelper.open();
      List&lt;String&gt; tip = dbHelper.getTip();
      List&lt;String&gt; betamount = dbHelper.getBetAmount();
      ArrayList&lt;String&gt; sbodds = dbHelper.getSBodds();
      dbHelper.close();
  
      int NumberOfBets = tip.size();
      double turnover = 0;
      double ROI = 0;
      double totalprofit = 0;
      double profit = 0;
      seriesOfNumbers = new Number[NumberOfBets];
      for (int i = 0; i &lt; NumberOfBets; i++) {
          String WLV = tip.get(i);
          String arrpct[] = WLV.split(" ", 2);
          String WLV1 = arrpct[0];
  
          if (WLV1.equals("W")) {
              profit = Double.parseDouble(betamount.get(i).replaceAll(",",
                      "."))
                      * (Double.parseDouble(sbodds.get(i)) - 1);
          }
  
          else if (WLV1.equals("L")) {
              profit = -Double.parseDouble(betamount.get(i).replaceAll(",",
                      "."));
          } else {
              profit = 0;
          }
          //Add total turnover
          turnover += Double.parseDouble(betamount.get(i).replaceAll(",", "."));
          //Add total profit
          totalprofit += profit;
          //For the graph
          seriesOfNumbers[i] = totalprofit;
      }
      ROI = ((turnover + totalprofit) / turnover) * 100;
      TPtext.setText(new DecimalFormat("##.##").format(totalprofit));
      TOtext.setText(new DecimalFormat("##.##").format(turnover));
      NBtext.setText(Integer.toString(NumberOfBets));
      ROItext.setText(new DecimalFormat("##.##").format(ROI));
  }
  
  public void graph() {
      dbHelper.open();
      // initialize our XYPlot reference:
      mySimpleXYPlot = (XYPlot) findViewById(R.id.mySimpleXYPlot);
  
      // Turn the above arrays into XYSeries':
      XYSeries series1 = new SimpleXYSeries(Arrays.asList(seriesOfNumbers),
      // SimpleXYSeries takes a List so turn our array into a list
              SimpleXYSeries.ArrayFormat.Y_VALS_ONLY,
              // Y_VALS_ONLY means use the element index as the x value
              "Series1"); // Set the display title of the series
  
      // Create a formatter to use for drawing a series using
      // LineAndPointRenderer:
      LineAndPointFormatter series1Format = new LineAndPointFormatter(
              Color.rgb(0, 200, 0), // line color
              null, // point color
              Color.rgb(0, 200, 0)); // fill color (none)
  
      // add a new series' to the xyplot:
      mySimpleXYPlot.addSeries(series1, series1Format);
  
      // reduce the number of range labels
      mySimpleXYPlot.setTicksPerRangeLabel(3);
  
      // by default, AndroidPlot displays developer guides to aid in laying
      // out your plot.
      // To get rid of them call disableAllMarkup():
      mySimpleXYPlot.disableAllMarkup();
      dbHelper.close();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Dont know if its important, but here is my:</p>
  
  <p>c_overview.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content" &gt;
  
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:orientation="vertical" &gt;
  
              &lt;TextView
                  android:id="@+id/Profit_text"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:ems="6"
                  android:text="Profit:" /&gt;
  
              &lt;TextView
                  android:id="@+id/ROI_text"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:ems="6"
                  android:text="ROI:" /&gt;
  
              &lt;TextView
                  android:id="@+id/Bet_Counter_text"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:ems="6"
                  android:text="No. of Bets:" /&gt;
  
              &lt;TextView
                  android:id="@+id/Turnover_text"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:ems="6"
                  android:text="Turnover:" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="130dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.75"
              android:orientation="vertical" &gt;
  
              &lt;TextView
                  android:id="@+id/totalprofit"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  android:ems="10"
                  android:text="total profit" /&gt;
  
              &lt;TextView
                  android:id="@+id/roi"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  android:ems="10"
                  android:text="Return Of Interest" /&gt;
  
              &lt;TextView
                  android:id="@+id/numberOfBet"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  android:text="number of bets" /&gt;
  
              &lt;TextView
                  android:id="@+id/turnover"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  android:ems="10"
                  android:text="Turnover" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;Button
              android:id="@+id/reset"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:onClick="resetClick"
              android:text="Reset" /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;com.androidplot.xy.XYPlot
              android:id="@+id/mySimpleXYPlot"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:layout_marginTop="10px"
              android:layout_marginLeft="10px"
              android:layout_marginRight="10px"
              title="A Simple XYPlot Example"/&gt;
  
  
  
  &lt;/LinearLayout&gt;
  </code></pre>