All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lightgraph.GraphLight Maven / Gradle / Ivy

The newest version!
package lightgraph;

import javax.swing.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.io.File;
import java.util.ArrayList;
import java.util.TimerTask;
import java.util.Timer;

/**
 * This is the 'test package'
 * User: melkor
 * Date: May 9, 2010
 * Time: 8:56:53 PM
 * To change this template use File | Settings | File Templates.
 */
public class GraphLight {
    int COUNTER=0;
    Graph xy;
    DataSet b;
    GraphLight(Graph xy){
        this.xy = xy;
        b = xy.addData(new double[]{0}, new double[]{0});
    }
    boolean next(){
        b.DATA.get(0).setLocation(COUNTER*0.1, 0);
        switch(COUNTER){
            case 200:
                xy.setXRange(0,500);
                break;
            case 400:
                xy.autoScaleX();
                break;
            case 600:
                xy.setYRange(0,10);
                break;
            case 800:
                xy.setXRange(-100,100);
                xy.setYRange(-5,5);
                xy.resizeGraph(1000,1000);
                break;
        }
        xy.resetGraph();
        xy.repaint();
        COUNTER++;
        return COUNTER>1000;
    }
    public static void main(String[] args){
        double[] x = new double[1000];
        double[] y = new double[1000];
        double[] z = new double[1000];
        for(int i = 0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy