In a similar approach to this question , I am looking for a way to build data points on the screen in Android. Preferably, a library that will do this to enter an arbitrary range, and also allows panning and zooming (using a pinch or zoom).
I have now subclassed a view that does the following normalization:
final int width = View.MeasureSpec.getSize(this.widthMeasureSpec);
final int height = View.MeasureSpec.getSize(this.heightMeasureSpec);
final float factorA = width / (maxA - minA);
final float factorS = height / (maxS - minS);
final float constFactorA = factorA * minA;
final float constFactorS = factorS * minS;
final int dataLength = data.length;
for (int i = 0; i < dataLength; ++i) {
if (i % 2 == 0)
_data[i] = _data[i] * factorA - constFactorA;
else
_data[i] = _data[i] * factorS - constFactorS;
}
and calling in onDraw () the drawPoints method for the canvas (I am also updating this.widthMeasureSpec and this.heightMeasureSpec in onMeasure ()).
This is with minA / maxA as the bounds for my independent variable and minS / maxS as the bounds for my dependent variable.
, , - /.
~ 150 000 , , . , JavaScript, JavaScript Google Chart API HTML .
MyTouch 3g (, 3,5 RAM), - . GPLv3, GraphView.
, this, , , , , , .