GPL-compatible graphics library for Android

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, , , , , , .

+3
3

sargas, android-misc-widgets. PlotView TestInterPolator.

, .

+2

: Chart and Graph Library Android

GraphView .

GraphView - Android, . , .

. github. GraphView github

() . : Android

: line graph

(. ):

// graph with dynamically genereated horizontal and vertical labels
GraphView graphView = new LineGraphView(
  this // context
  , new GraphViewData[] {
    new GraphViewData(1, 2.0d)
    , new GraphViewData(2, 1.5d)
    , new GraphViewData(2.5, 3.0d) // another frequency
    , new GraphViewData(3, 2.5d)
    , new GraphViewData(4, 1.0d)
    , new GraphViewData(5, 3.0d)
  } // data
  , "GraphViewDemo" // heading
  , null // dynamic labels
  , null // dynamic labels
);
LinearLayout layout = (LinearLayout) findViewById(R.id.graph1);
layout.addView(graphView);
+1

http://www.jfree.org/jfreechart/, , Java-, Android. LGPL.

If you can take the JavaScript route, you can check out ProtoVis http://vis.stanford.edu/protovis/

-1
source

Source: https://habr.com/ru/post/1752369/


All Articles