Repaint in achartengine with new values

200 views Asked by At

I'm trying to use a seekbar that when you move it, a new graph will be shown in achartengine, but the problem is that paints over the old graphic, instead of repaint the chartview with new values. I've tried everything I've read in other questions but nothing has worked for me. Can anyone help me? Thanks. This is my code:

  int length2 = titles.length;
  XYSeries series = new XYSeries(titles[0], 0);
  double[] xV = x.get(0);
  double[] yV = values.get(0);
  int seriesLength = xV.length;
  for (int k = 0; k < seriesLength; k++) {
    series.add(xV[k], yV[k]);
  }
  mDataset.addSeries(series);

  LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
  if (mChartView == null) {

      mChartView = ChartFactory.getLineChartView(this, mDataset, mRenderer);
      layout.addView(mChartView);

    } else {

        layout.removeAllViews();
        layout.addView(mChartView);


    }
1

There are 1 answers

0
Dan D. On

This is the kind of repaint issue that you could fix using:

renderer.setInScroll(true);