Android Open Source - AndroidGraph sine_scatter






From Project

Back to project page AndroidGraph.

License

The source code is released under:

MIT License

If you think the Android project AndroidGraph listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.nimble.android_graph.Graph;
//from www .  jav a  2 s . com
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;

import com.nimble.android_graph.Graph_Base.Point;

/**
 * Created by Michael Leith on 22/07/2014.
 */
public class sine_scatter extends ScatterGraph {

    double t = 0;

    public sine_scatter(Context context)
    {
        super(context);
        dataAdjusted = true;
        useGrid = false;
        Line line = new Line();
        line.setColour(Color.rgb(44, 84, 179));
        line.setShadow(Color.argb(50, 127, 160, 236));
        line.distBetweenPoints = 2f;
        addLine(line);

    }

    @Override
    public void onDraw(Canvas canvas)
    {
        float y = 100* (float) Math.sin(t) + 400;

        //  if(lines.size() > 0)
        addPointToLine(0, new Point(lines.get(0).getNextX(), y));
        t +=0.1;

        super.onDraw(canvas);
        //invalidate();
        // invalidate(bounds);
    }
}




Java Source Code List

Nimble.com.androidgraph.ApplicationTest.java
com.nimble.android_graph.Activities.FragmentList.java
com.nimble.android_graph.Activities.GraphActivity.java
com.nimble.android_graph.Activities.GraphFragment.java
com.nimble.android_graph.Activities.GroupsFragment.java
com.nimble.android_graph.Graph.CurveGraph.java
com.nimble.android_graph.Graph.LineGraph.java
com.nimble.android_graph.Graph.Line.java
com.nimble.android_graph.Graph.ScatterGraph.java
com.nimble.android_graph.Graph.SineWave.java
com.nimble.android_graph.Graph_Base.Coord2d.java
com.nimble.android_graph.Graph_Base.GraphDataSettings.java
com.nimble.android_graph.Graph_Base.GraphDrawBackground.java
com.nimble.android_graph.Graph_Base.GraphRelateToScreen.java
com.nimble.android_graph.Graph_Base.GraphThreading.java
com.nimble.android_graph.Graph_Base.GraphTouchEvent.java
com.nimble.android_graph.Graph_Base.GraphViewDimensions.java
com.nimble.android_graph.Graph_Base.GraphView.java
com.nimble.android_graph.Graph_Base.Point.java
com.nimble.android_graph.Graph_Base.Range2d.java
com.nimble.android_graph.Graph.sine_scatter.java
com.nimble.android_graph.generics.Methods.java
com.nimble.android_graph.generics.ViewManipulators.java
com.nimble.android_graph.generics.testingSuite.java