Example usage for org.jfree.data.time TimeSeries add

List of usage examples for org.jfree.data.time TimeSeries add

Introduction

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

Prototype

public void add(RegularTimePeriod period, Number value) 

Source Link

Document

Adds a new data item to the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.

Usage

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

private static IntervalXYDataset createDataset() {
    TimeSeries timeseries = new TimeSeries("Executions", "Year", "Count");
    try {// w  ww .  ja va 2s  .  co  m
        timeseries.add(new Year(1976), new Integer(0));
        timeseries.add(new Year(1977), new Integer(1));
        timeseries.add(new Year(1978), new Integer(0));
        timeseries.add(new Year(1979), new Integer(2));
        timeseries.add(new Year(1980), new Integer(0));
        timeseries.add(new Year(1981), new Integer(1));
        timeseries.add(new Year(1982), new Integer(2));
        timeseries.add(new Year(1983), new Integer(5));
        timeseries.add(new Year(1984), new Integer(21));
        timeseries.add(new Year(1985), new Integer(18));
        timeseries.add(new Year(1986), new Integer(18));
        timeseries.add(new Year(1987), new Integer(25));
        timeseries.add(new Year(1988), new Integer(11));
        timeseries.add(new Year(1989), new Integer(16));
        timeseries.add(new Year(1990), new Integer(23));
        timeseries.add(new Year(1991), new Integer(14));
        timeseries.add(new Year(1992), new Integer(31));
        timeseries.add(new Year(1993), new Integer(38));
        timeseries.add(new Year(1994), new Integer(31));
        timeseries.add(new Year(1995), new Integer(56));
        timeseries.add(new Year(1996), new Integer(45));
        timeseries.add(new Year(1997), new Integer(74));
        timeseries.add(new Year(1998), new Integer(68));
        timeseries.add(new Year(1999), new Integer(98));
        timeseries.add(new Year(2000), new Integer(85));
        timeseries.add(new Year(2001), new Integer(66));
        timeseries.add(new Year(2002), new Integer(71));
        timeseries.add(new Year(2003), new Integer(65));
        timeseries.add(new Year(2004), new Integer(59));
        timeseries.add(new Year(2005), new Integer(60));
    } catch (Exception exception) {
        System.err.println(exception.getMessage());
    }
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries);
    return timeseriescollection;
}

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

private static XYDataset createDataset() {
    TimeSeries timeseries = new TimeSeries("L&G European Index Trust");
    timeseries.add(new Month(2, 2001), 181.80000000000001D);
    timeseries.add(new Month(3, 2001), 167.30000000000001D);
    timeseries.add(new Month(4, 2001), 153.80000000000001D);
    timeseries.add(new Month(5, 2001), 167.59999999999999D);
    timeseries.add(new Month(6, 2001), 158.80000000000001D);
    timeseries.add(new Month(7, 2001), 148.30000000000001D);
    timeseries.add(new Month(8, 2001), 153.90000000000001D);
    timeseries.add(new Month(9, 2001), 142.69999999999999D);
    timeseries.add(new Month(10, 2001), 123.2D);
    timeseries.add(new Month(11, 2001), 131.80000000000001D);
    timeseries.add(new Month(12, 2001), 139.59999999999999D);
    timeseries.add(new Month(1, 2002), 142.90000000000001D);
    timeseries.add(new Month(2, 2002), 138.69999999999999D);
    timeseries.add(new Month(3, 2002), 137.30000000000001D);
    timeseries.add(new Month(4, 2002), 143.90000000000001D);
    timeseries.add(new Month(5, 2002), 139.80000000000001D);
    timeseries.add(new Month(6, 2002), 137D);
    timeseries.add(new Month(7, 2002), 132.80000000000001D);
    TimeSeries timeseries1 = new TimeSeries("L&G UK Index Trust");
    timeseries1.add(new Month(2, 2001), 129.59999999999999D);
    timeseries1.add(new Month(3, 2001), 123.2D);
    timeseries1.add(new Month(4, 2001), 117.2D);
    timeseries1.add(new Month(5, 2001), 124.09999999999999D);
    timeseries1.add(new Month(6, 2001), 122.59999999999999D);
    timeseries1.add(new Month(7, 2001), 119.2D);
    timeseries1.add(new Month(8, 2001), 116.5D);
    timeseries1.add(new Month(9, 2001), 112.7D);
    timeseries1.add(new Month(10, 2001), 101.5D);
    timeseries1.add(new Month(11, 2001), 106.09999999999999D);
    timeseries1.add(new Month(12, 2001), 110.3D);
    timeseries1.add(new Month(1, 2002), 111.7D);
    timeseries1.add(new Month(2, 2002), 111D);
    timeseries1.add(new Month(3, 2002), 109.59999999999999D);
    timeseries1.add(new Month(4, 2002), 113.2D);
    timeseries1.add(new Month(5, 2002), 111.59999999999999D);
    timeseries1.add(new Month(6, 2002), 108.8D);
    timeseries1.add(new Month(7, 2002), 101.59999999999999D);
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    timeseriescollection.addSeries(timeseries);
    timeseriescollection.addSeries(timeseries1);
    timeseriescollection.setXPosition(TimePeriodAnchor.MIDDLE);
    return timeseriescollection;
}

From source file:org.jfree.graphics2d.demo.SVGChartWithAnnotationsDemo1.java

/**
 * Creates a sample dataset.//from  w ww  .  j av  a2s.c o  m
 *
 * @return A dataset.
 */
private static XYDataset createDataset() {
    TimeSeries series1 = new TimeSeries("Division A");
    series1.add(new Year(2005), 1520);
    series1.add(new Year(2006), 1132);
    series1.add(new Year(2007), 450);
    series1.add(new Year(2008), 620);
    TimeSeries series2 = new TimeSeries("Division B");
    series2.add(new Year(2005), 1200);
    series2.add(new Year(2006), 1300);
    series2.add(new Year(2007), 640);
    series2.add(new Year(2008), 520);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series1);
    dataset.addSeries(series2);
    return dataset;
}

From source file:org.n52.oxf.render.sos.TimeCategoryPlot.java

/**
 * Creates a dataset, consisting of two series of monthly data.
 *
 * @return The dataset.//w ww . ja v  a  2 s.  c o  m
 */
private static XYDataset createDataset() {

    TimeSeries s1 = new TimeSeries("L&G European Index Trust", Month.class);
    s1.add(new Month(2, 2001), 0);
    s1.add(new Month(3, 2001), 4);
    s1.add(new Month(4, 2001), 3);
    s1.add(new Month(5, 2001), 167.6);
    s1.add(new Month(6, 2001), 158.8);
    s1.add(new Month(7, 2001), 148.3);
    s1.add(new Month(8, 2001), 153.9);
    s1.add(new Month(9, 2001), 142.7);
    s1.add(new Month(10, 2001), 123.2);
    s1.add(new Month(11, 2001), 131.8);
    s1.add(new Month(12, 2001), 139.6);
    s1.add(new Month(1, 2002), 142.9);
    s1.add(new Month(2, 2002), 138.7);
    s1.add(new Month(3, 2002), 137.3);
    s1.add(new Month(4, 2002), 143.9);
    s1.add(new Month(5, 2002), 139.8);
    s1.add(new Month(6, 2002), 137.0);
    s1.add(new Month(7, 2002), 132.8);

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(s1);

    dataset.setDomainIsPointsInTime(true);

    return dataset;

}

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

private static XYDataset createForceDataset(int i) {
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    TimeSeries timeseries = new TimeSeries("Wind Force");
    Object obj = new Minute();
    double d = 3D;
    for (int j = 0; j < i; j++) {
        timeseries.add(((RegularTimePeriod) (obj)), d);
        obj = ((RegularTimePeriod) (obj)).next();
        d = Math.max(0.5D, d + (Math.random() - 0.5D) * 0.5D);
    }/* w  w  w.j  a v  a  2  s.c  om*/

    timeseriescollection.addSeries(timeseries);
    return timeseriescollection;
}

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

private static XYDataset createDataset(String s, double d, RegularTimePeriod regulartimeperiod, int i) {
    TimeSeries timeseries = new TimeSeries(s);
    RegularTimePeriod regulartimeperiod1 = regulartimeperiod;
    double d1 = d;
    for (int j = 0; j < i; j++) {
        timeseries.add(regulartimeperiod1, d1);
        regulartimeperiod1 = regulartimeperiod1.next();
        d1 *= 1.0D + (Math.random() - 0.495D) / 10D;
    }/*from w w w  .j ava 2s  .com*/

    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    timeseriescollection.addSeries(timeseries);
    return timeseriescollection;
}

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

private static XYDataset createDirectionDataset(int i) {
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    TimeSeries timeseries = new TimeSeries("Wind Direction");
    Object obj = new Minute();
    double d = 180D;
    for (int j = 0; j < i; j++) {
        timeseries.add(((RegularTimePeriod) (obj)), d);
        obj = ((RegularTimePeriod) (obj)).next();
        d += (Math.random() - 0.5D) * 15D;
        if (d < 0.0D) {
            d += 360D;/*from w  w w .  j a  v  a2 s .c  o  m*/
            continue;
        }
        if (d > 360D)
            d -= 360D;
    }

    timeseriescollection.addSeries(timeseries);
    return timeseriescollection;
}

From source file:cit.workflow.engine.manager.test.SWTTimeSeriesDemo.java

/**
 * Creates a dataset, consisting of two series of monthly data.
 *
 * @return The dataset.//from   ww  w  .  j  av a 2  s.  c o m
 */
private static XYDataset createDataset() {

    TimeSeries s1 = new TimeSeries("L&G European Index Trust");
    s1.add(new Month(2, 2001), 181.8);
    s1.add(new Month(3, 2001), 167.3);
    s1.add(new Month(4, 2001), 153.8);
    s1.add(new Month(5, 2001), 167.6);
    s1.add(new Month(6, 2001), 158.8);
    s1.add(new Month(7, 2001), 148.3);
    s1.add(new Month(8, 2001), 153.9);
    s1.add(new Month(9, 2001), 142.7);
    s1.add(new Month(10, 2001), 123.2);
    s1.add(new Month(11, 2001), 131.8);
    s1.add(new Month(12, 2001), 139.6);
    s1.add(new Month(1, 2002), 142.9);
    s1.add(new Month(2, 2002), 138.7);
    s1.add(new Month(3, 2002), 137.3);
    s1.add(new Month(4, 2002), 143.9);
    s1.add(new Month(5, 2002), 139.8);
    s1.add(new Month(6, 2002), 137.0);
    s1.add(new Month(7, 2002), 132.8);

    TimeSeries s2 = new TimeSeries("L&G UK Index Trust");
    s2.add(new Month(2, 2001), 129.6);
    s2.add(new Month(3, 2001), 123.2);
    s2.add(new Month(4, 2001), 117.2);
    s2.add(new Month(5, 2001), 124.1);
    s2.add(new Month(6, 2001), 122.6);
    s2.add(new Month(7, 2001), 119.2);
    s2.add(new Month(8, 2001), 116.5);
    s2.add(new Month(9, 2001), 112.7);
    s2.add(new Month(10, 2001), 101.5);
    s2.add(new Month(11, 2001), 106.1);
    s2.add(new Month(12, 2001), 110.3);
    s2.add(new Month(1, 2002), 111.7);
    s2.add(new Month(2, 2002), 111.0);
    s2.add(new Month(3, 2002), 109.6);
    s2.add(new Month(4, 2002), 113.2);
    s2.add(new Month(5, 2002), 111.6);
    s2.add(new Month(6, 2002), 108.8);
    s2.add(new Month(7, 2002), 101.6);

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(s1);
    dataset.addSeries(s2);

    return dataset;
}

From source file:grafici.PazientiTimeSeriesChart.java

/**
 * Creates a dataset, consisting of two series of monthly data.
 *
 * @return The dataset./*from w  w w  . j a  v a  2 s  . c om*/
 */
private static XYDataset createDataset(int tipo) {

    TimeSeries s1 = new TimeSeries(titolo);
    s1.add(new Month(2, 2001), 181.8);

    TimeSeries s2 = new TimeSeries("aaa");
    s2.add(new Month(2, 2001), 129.6);

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(s1);
    dataset.addSeries(s2);

    return dataset;

}

From source file:org.gaixie.micrite.crm.action.CustomerChartAction.java

/**
 * ?/*from   w  w w .ja  v  a2 s  . c  o  m*/
 * @return
 */
private static XYDataset createDataset() {
    TimeSeries timeseries = new TimeSeries("Per Minute Data", org.jfree.data.time.Minute.class);
    Hour hour = new Hour();
    timeseries.add(new Minute(1, hour), 10.199999999999999D);
    timeseries.add(new Minute(3, hour), 17.300000000000001D);
    timeseries.add(new Minute(9, hour), 14.6D);
    timeseries.add(new Minute(11, hour), 11.9D);
    timeseries.add(new Minute(15, hour), 13.5D);
    timeseries.add(new Minute(19, hour), 10.9D);
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries);
    return timeseriescollection;
}