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:application.TrendPlot.java

/**
 * Oppdaterer plottet/*w  w  w.  ja  v a 2 s  .  c om*/
 * @param errorValue
 */

public void updatePlot(double errorValue) {
    //metode i timeseries som oppdaterer plottet
    timeSeries.addOrUpdate(new Millisecond(), errorValue);

}

From source file:monitoring.suhu.DynamicCharts.java

public void setData(double x) {
    this.lastValue = x;
    this.series.add(new Millisecond(), this.lastValue);
}

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

public static void main2(String as[]) {
    PerformanceTest1 performancetest1 = new PerformanceTest1("Performance Test 1");
    performancetest1.pack();/*www  . j a v  a2s  .c om*/
    RefineryUtilities.centerFrameOnScreen(performancetest1);
    performancetest1.setVisible(true);
    TimeSeries timeseries = new TimeSeries("Test");
    timeseries.setMaximumItemAge(200L);
    do {
        Millisecond millisecond = new Millisecond();
        long l = System.currentTimeMillis();
        for (int i = 0; i < 200; i++) {
            millisecond = (Millisecond) millisecond.next();
            timeseries.addOrUpdate(millisecond, 1.0D);
        }

        long l1 = System.currentTimeMillis();
        performancetest1.addObservation(l1 - l);
    } while (true);
}

From source file:mediamatrix.gui.JVMMemoryProfilerPanel.java

public JVMMemoryProfilerPanel() {
    initComponents();/*from   ww  w . j a  v a 2s  . c  om*/
    profiler = new JVMMemoryProfiler(frequency);
    profiler.addListener(new JVMMemoryProfilerListener() {

        @Override
        public void addScore(long t, long f) {
            total.add(new Millisecond(), t);
            free.add(new Millisecond(), f);
        }
    });

    total = new TimeSeries("Total Memory");
    total.setMaximumItemCount(historyCount);
    free = new TimeSeries("Free Memory");
    free.setMaximumItemCount(historyCount);

    final TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(total);
    dataset.addSeries(free);

    final DateAxis domain = new DateAxis("Time");
    final NumberAxis range = new NumberAxis("Memory");
    domain.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    domain.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
    range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    range.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
    range.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    final XYItemRenderer renderer = new DefaultXYItemRenderer();
    renderer.setSeriesPaint(0, Color.red);
    renderer.setSeriesPaint(1, Color.green);
    renderer.setBaseStroke(new BasicStroke(3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));

    final XYPlot plot = new XYPlot(dataset, domain, range, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    domain.setAutoRange(true);
    domain.setLowerMargin(0.0);
    domain.setUpperMargin(0.0);
    domain.setTickLabelsVisible(true);

    final JFreeChart chart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", Font.BOLD, 24), plot,
            true);
    chart.setBackgroundPaint(Color.white);
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(Color.black)));
    chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 12));

    add(chartPanel, BorderLayout.CENTER);
}

From source file:graph.MySensorPanel.java

public DataSetCallB getTempSetCallback() {
    return (new DataSetCallB() {
        @Override/* w ww .j a v  a 2 s .  com*/
        public void setData(double data_d) {
            Millisecond now = new Millisecond();
            //System.out.println("Now1 = " + now.toString());
            series1.add(new Millisecond(), data_d);
        }
    });
}

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   w  ww .j  ava  2 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.PerformanceTest1.java

public void addObservation(long l) {
    timings.addOrUpdate(new Millisecond(), l);
}

From source file:clientv2.GUI.java

/**
 * Updates the roll value//from  www .  j  a  v a 2  s . c  o m
 *
 * @param roll
 */
public void updateRoll(double roll) {
    this.roll.addOrUpdate(new Millisecond(), roll);
}

From source file:netplot.TimeSeriesPlotPanel.java

public void addPlotValue(double plotIndex, double yValue) {
    timeSeriesList.get((int) plotIndex).addOrUpdate(new Millisecond(), yValue);
}

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

/**
 * Check that a {@link Millisecond} instance is equal to itself.
 *
 * SourceForge Bug ID: 558850./*from   ww  w.j  a  v a  2s .c o m*/
 */
@Test
public void testEqualsSelf() {
    Millisecond millisecond = new Millisecond();
    assertTrue(millisecond.equals(millisecond));
}