アップデート:
今は魅力のように走ります。私を正しい方向に向けてくれたAlexKlimashevskyの助けを借りて。基本的に、forループをメッシュ化しました。これはそれがどうあるべきかです:
for(int a = 1; a < x.length; a++) {
y[(a)]=yprev[a-1];
}
y[0]=value_i/10;
for(int a = 0; a < x.length; a++) {
yprev[a]=y[a];
}
ありがとう!
誰かが何が悪いのか教えてくれるかもしれません。これは本当に基本的なプロットプログラムですが、今のところは十分です。
ビュークラスの先頭でこれを宣言しました。
private int[] x = {50, 60, 70, 80, 90, 100, 110,120,130};
private int[] y= {500,500,500,500,500,500,500,500,500};
private int[] yprev={500,500,500,500,100,500,500,500,500};
そして私はこれをonDraw内に置きます:
for(int a = (x.length-1); a ==0; a--) {
y[(a+1)]=yprev[i]; //Shift everything one place to the right
}
y[0]=value/10; //Fill in the newest value for temperature on the first index
for(int a = (x.length); a ==0; a--) {
yprev[a]=y[a]; //Store the latest array, such it can be re-used in the next cycle**
}
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(2);
paint.setColor(Color.RED);
Path path = new Path();
path.moveTo(x[0], y[0]);
for(int b = 1; b < x.length; b++) {
path.lineTo(x[b], y[b]);
}
canvas.drawPath(path, paint);
プロットは機能しますが、どういうわけかそれは私のプロットをシフトしません。新しい値は毎回最初のインデックスにプロットされ、他のすべての値は500のままです。何かアイデアはありますか?
よろしく、ケビン