Closed Aakash16 closed 10 years ago
It is not plotted dynamically, because you insert and run the loop at the same time. As soon as a new value is added with 'appendData', the graph is refreshed.
If you want a kind of 'animation', you need to do at least a Thread.sleep(time_between_two_points).
thanks MarcDahlem, actually i want to pick a value from array and display it by appending to the series... thats why i thought of using for loop.... is there a way to plot series from array and display dynamically ..... so that it seems like a real time graph plot....
You could simulate this behaviour for example with a timer:
private class MyTimerTask extends TimerTask {
Random random;
int counter;
public MyTimerTask() {
this.counter=0;
this.random=new Random();
}
@Override
public void run() {
appendData...
if (counter++ <=100) {
//setup new timer
int nextTime=MainActivity.MIN_DELAY+random.nextInt(MainActivity.MAX_TIMER_DEVIATION);
MainActivity.this.timer.schedule(this, nextTime);
}
}
}
And in your MainActivity you need to start a single timer with this timertask.
can any one explain me why the plot is not dynamic ... it gets plotted an once... public void plot() {
//eData is having data to be plotted //xView initialised to 10. for (int y =0; y <1000; y++) {