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

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

Introduction

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

Prototype

public Millisecond() 

Source Link

Document

Constructs a millisecond based on the current system time.

Usage

From source file:org.jfree.data.time.junit.MillisecondTest.java

/**
 * Serialize an instance, restore it, and check for equality.
 *//*from  ww  w. ja v  a 2s .  co m*/
public void testSerialization() {
    Millisecond m1 = new Millisecond();
    Millisecond m2 = null;
    try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream(buffer);
        out.writeObject(m1);
        out.close();

        ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
        m2 = (Millisecond) in.readObject();
        in.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    assertEquals(m1, m2);
}

From source file:vincent.DynamicDataDemo.java

public void afficherDerniereTemperature(float floatToPrint) {
    this.series.add(new Millisecond(), floatToPrint);
    temperatureCouranteLabel.setText(floatToPrint + "C");
}

From source file:DynamiskDemo2.java

/**
 * Handles a click on the button by adding new (random) data.
 *
 * @param e  the action event.//from   www  .  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:com.joey.software.memoryToolkit.MemoryUsagePanel.java

/**
 * Adds an observation to the otal memory time series.
 * /*w  ww  . j  a  va2  s . co m*/
 * @param y
 *            the total memory used.
 */
private void addTotalObservation(double y) {
    this.total.add(new Millisecond(), y);
}

From source file:temp1.RealTimeChart.java

@Override
public void run() {
    try {//from   ww  w  .ja va  2  s .  c  o  m
        for (i = 0; i <= length1; i++) {
            time1 = JFrame1.getjs();
            c1 = JFrame1.getc1();
            c2 = JFrame1.getc2();
            c3 = JFrame1.getc3();
            c4 = JFrame1.getc4();
            if (pd) {
                lastValue1 = k1[i];
                lastValue2 = k2[i];
                lastValue3 = k3[i];
                lastValue4 = k4[i];

                if (i > 1 && i < length1 - 5)
                    JFrame1.comp(k1, k2, k3, k4, length1, i, eve1, eve2, eve3, jfreechart);
                if (c1)
                    timeseries1.addOrUpdate(new Millisecond(), lastValue1);
                if (c2)
                    timeseries2.addOrUpdate(new Millisecond(), lastValue2);
                if (c3)
                    timeseries3.addOrUpdate(new Millisecond(), lastValue3);
                if (c4)
                    timeseries4.addOrUpdate(new Millisecond(), lastValue4);
                if (pd == false) {
                    i = 0;
                    thread1.interrupt();
                    System.exit(0);
                }
                if (i == (length1 - 1)) {
                    thread1.interrupt();
                    pd = false;
                    break;
                }
                Thread.sleep(time1);
            }
        }
    } catch (InterruptedException ex) {
        Logger.getLogger(RealTimeChart.class.getName()).log(Level.SEVERE, null, ex);
    }
}

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.//from  w  w w  . j  a  v a  2  s.  c om
 */
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:com.joey.software.memoryToolkit.MemoryUsagePanel.java

/**
 * Adds an observation to the free memory time series.
 * //from w w  w. j  a  v  a 2s . c  om
 * @param y
 *            the free memory.
 */
private void addFreeObservation(double y) {
    this.free.add(new Millisecond(), y);
}

From source file:com.joey.software.memoryToolkit.MemoryUsagePanel.java

private void addUsedObservation(double y) {
    this.used.add(new Millisecond(), y);
}

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 ww  w. j  a v a  2  s  . co  m
 */
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.joey.software.memoryToolkit.MemoryUsagePanel.java

private void addMaxObservation(double y) {
    this.max.add(new Millisecond(), y);
}