Example usage for org.jfree.data.time Millisecond toString

List of usage examples for org.jfree.data.time Millisecond toString

Introduction

In this page you can find the example usage for org.jfree.data.time Millisecond toString.

Prototype

@Override
public String toString() 

Source Link

Document

Returns a string representation of the time period.

Usage

From source file:org.jfree.chart.demo.CloneTest1.java

public void actionPerformed(ActionEvent actionevent) {
    if (actionevent.getActionCommand().equals("ADD_DATA")) {
        double d = 0.90000000000000002D + 0.20000000000000001D * Math.random();
        lastValue = lastValue * d;//from ww w .  j  a  v  a2  s. c  o m
        Millisecond millisecond = new Millisecond();
        System.out.println("Now = " + millisecond.toString());
        series.add(new Millisecond(), lastValue);
    }
}

From source file:org.jfree.chart.demo.Graph.java

/**
 * Handles a click on the button by adding new (random) data.
 *
 * @param e  the action event./*from  w  w  w. j  av  a  2 s . co  m*/
 */
public void actionPerformed(final ActionEvent e) {
    if (e.getActionCommand().equals("ADD_DATA")) {

        final double factor = 0.90 + 0.2 * Math.random();
        this.lastValue = this.lastValue * factor;
        final Millisecond now = new Millisecond();
        System.out.println("Now = " + now.toString());
        this.series.add(new Millisecond(), this.lastValue);
    }
}

From source file:DynamiskDemo2.java

/**
 * Handles a click on the button by adding new (random) data.
 *
 * @param e  the action event.//from ww w.j a v a2s . co  m
 */
public void actionPerformed(final ActionEvent e) {
    if (e.getActionCommand().equals("ADD_DATA")) {
        final double factor = 0.90 + 0.2 * Math.random();
        this.lastValue = this.lastValue * factor;
        final Millisecond now = new Millisecond();
        System.out.println("Now = " + now.toString());
        //this.series.add(new Millisecond(), this.lastValue);
    }
}

From source file:DynamicDataDemo.java

/**
 * Handles a click on the button by adding new (random) data.
 *
 * @param e  the action event.//from  w  w w  .  java  2s  .co m
 */
public void actionPerformed(final ActionEvent e) {
    if (e.getActionCommand().equals("ADD_DATA")) {
        final double factor = 0.90 + 0.2 * Math.random();
        this.lastValue = this.lastValue * factor;
        final Millisecond now = new Millisecond();
        System.out.println("Now = " + now.toString());
        this.series.add(new Millisecond(), this.lastValue);
    }
}

From source file:org.jfree.chart.demo.DynamicDataDemo3.java

/**
 * Handles a click on the button by adding new (random) data.
 *
 * @param e  the action event.//w ww.ja va 2 s .  co  m
 */
public void actionPerformed(final ActionEvent e) {

    for (int i = 0; i < SUBPLOT_COUNT; i++) {
        if (e.getActionCommand().endsWith(String.valueOf(i))) {
            final Millisecond now = new Millisecond();
            System.out.println("Now = " + now.toString());
            this.lastValue[i] = this.lastValue[i] * (0.90 + 0.2 * Math.random());
            this.datasets[i].getSeries(0).add(new Millisecond(), this.lastValue[i]);
        }
    }

    if (e.getActionCommand().equals("ADD_ALL")) {
        final Millisecond now = new Millisecond();
        System.out.println("Now = " + now.toString());
        for (int i = 0; i < SUBPLOT_COUNT; i++) {
            this.lastValue[i] = this.lastValue[i] * (0.90 + 0.2 * Math.random());
            this.datasets[i].getSeries(0).add(new Millisecond(), this.lastValue[i]);
        }
    }

}

From source file:org.jfree.chart.demo.DynamicDataDemo2.java

/**
 * Handles a click on the button by adding new (random) data.
 *
 * @param e  the action event./*from   w ww  .  ja va 2 s. com*/
 */
public void actionPerformed(final ActionEvent e) {
    boolean add1 = false;
    boolean add2 = false;
    if (e.getActionCommand().equals("ADD_DATA_1")) {
        add1 = true;
    } else if (e.getActionCommand().equals("ADD_DATA_2")) {
        add2 = true;
    } else if (e.getActionCommand().equals("ADD_BOTH")) {
        add1 = true;
        add2 = true;
    }
    if (add1) {
        final double factor = 0.90 + 0.2 * Math.random();
        this.lastValue1 = this.lastValue1 * factor;
        final Millisecond now = new Millisecond();
        System.out.println("Now = " + now.toString());
        this.series1.add(new Millisecond(), this.lastValue1);
    }
    if (add2) {
        final double factor = 0.90 + 0.2 * Math.random();
        this.lastValue2 = this.lastValue2 * factor;
        final Millisecond now = new Millisecond();
        System.out.println("Now = " + now.toString());
        this.series2.add(new Millisecond(), this.lastValue2);
    }
}

From source file:com.experiments.DynamicDataDemo.java

/**
 * Handles a click on the button by adding new (random) data.
 * //from  www. j  a  v  a  2s .com
 * @param e
 *            the action event.
 */
public void actionPerformed(final ActionEvent e) {
    if (e.getActionCommand().equals("ADD_DATA")) {
        final double factor = 0.90 + 0.2 * Math.random();
        this.lastValue = this.lastValue * factor;
        final Millisecond now = new Millisecond();
        System.out.println("Now = " + now.toString());
        this.series.add(new Millisecond(), this.lastValue);
    } else if (e.getActionCommand().equals("START_ADDING")) {
        if (timer == null) {
            timer = new Timer(interval, new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    final double factor = 0.90 + 0.2 * Math.random();
                    DynamicDataDemo.this.lastValue = DynamicDataDemo.this.lastValue * factor;
                    final Millisecond now = new Millisecond();
                    System.out.println("Now = " + now.toString());
                    DynamicDataDemo.this.series.add(new Millisecond(), DynamicDataDemo.this.lastValue);
                }

            });
            timer.start();
        }
    } else if (e.getActionCommand().equals("STOP_ADDING")) {
        if (timer != null) {
            timer.stop();
        }
        timer = null;
    }
}