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.YieldCurveDemo.java

private static XYDataset createDataset() {
    TimeSeries timeseries = new TimeSeries("US$ Treasury Yields");
    Day day = new Day(1, 12, 2005);
    Day day1 = new Day(1, 2, 2006);
    Day day2 = new Day(1, 5, 2006);
    Day day3 = new Day(1, 12, 2006);
    Day day4 = new Day(1, 12, 2007);
    Day day5 = new Day(1, 12, 2008);
    Day day6 = new Day(1, 12, 2010);
    Day day7 = new Day(1, 12, 2012);
    Day day8 = new Day(1, 12, 2015);
    Day day9 = new Day(1, 12, 2025);
    timeseries.add(day, 3.79D);
    timeseries.add(day1, 3.9950000000000001D);
    timeseries.add(day2, 4.2599999999999998D);
    timeseries.add(day3, 4.3224999999999998D);
    timeseries.add(day4, 4.4474999999999998D);
    timeseries.add(day5, 4.4749999999999996D);
    timeseries.add(day6, 4.5199999999999996D);
    timeseries.add(day7, 4.5599999999999996D);
    timeseries.add(day8, 4.625D);/*from  ww  w  .  ja v a2 s . c o m*/
    timeseries.add(day9, 4.9050000000000002D);
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    timeseriescollection.addSeries(timeseries);
    return timeseriescollection;
}

From source file:Perfil_Deportivo.TimeSeriesChartDemo1.java

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

    TimeSeries s1 = new TimeSeries("L&G European Index Trust");

    SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
    String strFecha = "1/01/2000";
    Date fechaDate = null;
    try {
        fechaDate = formato.parse(strFecha);
        // s1.add(new ,2);
    } catch (ParseException ex) {

    }

    //s1.add(new Week(1, 1), null);
    s1.add(new Month(fechaDate), 167.3);
    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);

    TimeSeries s3 = new TimeSeries("andres2255");
    s3.add(new Month(2, 2001), 129.6);

    s3.add(new Month(10, 2001), 106.1);
    s3.add(new Month(1, 2002), 111.7);
    s3.add(new Month(2, 2002), 111.0);

    // ******************************************************************
    //  More than 150 demo applications are included with the JFreeChart
    //  Developer Guide...for more information, see:
    //
    //  >   http://www.object-refinery.com/jfreechart/guide.html
    //
    // ******************************************************************

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

    return dataset;

}

From source file:com.alibaba.dubbo.monitor.simple.SimpleMonitorService.java

private static void createChart(String key, String service, String method, String date, String[] types,
        Map<String, long[]> data, double[] summary, String path) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmm");
    DecimalFormat numberFormat = new DecimalFormat("###,##0.##");
    TimeSeriesCollection xydataset = new TimeSeriesCollection();
    for (int i = 0; i < types.length; i++) {
        String type = types[i];//  w ww .  j  a v  a2  s.  com
        TimeSeries timeseries = new TimeSeries(type);
        for (Map.Entry<String, long[]> entry : data.entrySet()) {
            try {
                timeseries.add(new Minute(dateFormat.parse(date + entry.getKey())), entry.getValue()[i]);
            } catch (ParseException e) {
                logger.error(e.getMessage(), e);
            }
        }
        xydataset.addSeries(timeseries);
    }
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(
            "max: " + numberFormat.format(summary[0])
                    + (summary[1] >= 0 ? " min: " + numberFormat.format(summary[1]) : "") + " avg: "
                    + numberFormat.format(summary[2])
                    + (summary[3] >= 0 ? " sum: " + numberFormat.format(summary[3]) : ""),
            toDisplayService(service) + "  " + method + "  " + toDisplayDate(date), key, xydataset, true, true,
            false);
    jfreechart.setBackgroundPaint(Color.WHITE);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.WHITE);
    xyplot.setDomainGridlinePaint(Color.GRAY);
    xyplot.setRangeGridlinePaint(Color.GRAY);
    xyplot.setDomainGridlinesVisible(true);
    xyplot.setRangeGridlinesVisible(true);
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setDateFormatOverride(new SimpleDateFormat("HH:mm"));
    BufferedImage image = jfreechart.createBufferedImage(600, 300);
    try {
        if (logger.isInfoEnabled()) {
            logger.info("write chart: " + path);
        }
        File methodChartFile = new File(path);
        File methodChartDir = methodChartFile.getParentFile();
        if (methodChartDir != null && !methodChartDir.exists()) {
            methodChartDir.mkdirs();
        }
        FileOutputStream output = new FileOutputStream(methodChartFile);
        try {
            ImageIO.write(image, "png", output);
            output.flush();
        } finally {
            output.close();
        }
    } catch (IOException e) {
        logger.warn(e.getMessage(), e);
    }
}

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

private static XYDataset createPriceDataset() {
    TimeSeries timeseries = new TimeSeries("Price");
    timeseries.add(new Day(2, 1, 2002), 95.564999999999998D);
    timeseries.add(new Day(3, 1, 2002), 95.640000000000001D);
    timeseries.add(new Day(4, 1, 2002), 95.709999999999994D);
    timeseries.add(new Day(7, 1, 2002), 95.930000000000007D);
    timeseries.add(new Day(8, 1, 2002), 95.930000000000007D);
    timeseries.add(new Day(9, 1, 2002), 95.959999999999994D);
    timeseries.add(new Day(10, 1, 2002), 96.055000000000007D);
    timeseries.add(new Day(11, 1, 2002), 96.334999999999994D);
    timeseries.add(new Day(14, 1, 2002), 96.290000000000006D);
    timeseries.add(new Day(15, 1, 2002), 96.275000000000006D);
    timeseries.add(new Day(16, 1, 2002), 96.239999999999995D);
    timeseries.add(new Day(17, 1, 2002), 96.079999999999998D);
    timeseries.add(new Day(18, 1, 2002), 96.144999999999996D);
    timeseries.add(new Day(22, 1, 2002), 96.120000000000005D);
    timeseries.add(new Day(23, 1, 2002), 96.015000000000001D);
    timeseries.add(new Day(24, 1, 2002), 95.890000000000001D);
    timeseries.add(new Day(25, 1, 2002), 95.864999999999995D);
    timeseries.add(new Day(28, 1, 2002), 95.879999999999995D);
    timeseries.add(new Day(29, 1, 2002), 96.049999999999997D);
    timeseries.add(new Day(30, 1, 2002), 96.064999999999998D);
    timeseries.add(new Day(31, 1, 2002), 95.909999999999997D);
    timeseries.add(new Day(1, 2, 2002), 96.015000000000001D);
    timeseries.add(new Day(4, 2, 2002), 96.140000000000001D);
    timeseries.add(new Day(5, 2, 2002), 96.194999999999993D);
    timeseries.add(new Day(6, 2, 2002), 96.245000000000005D);
    timeseries.add(new Day(7, 2, 2002), 96.219999999999999D);
    timeseries.add(new Day(8, 2, 2002), 96.280000000000001D);
    timeseries.add(new Day(11, 2, 2002), 96.265000000000001D);
    timeseries.add(new Day(12, 2, 2002), 96.159999999999997D);
    timeseries.add(new Day(13, 2, 2002), 96.120000000000005D);
    timeseries.add(new Day(14, 2, 2002), 96.125D);
    timeseries.add(new Day(15, 2, 2002), 96.265000000000001D);
    timeseries.add(new Day(19, 2, 2002), 96.290000000000006D);
    timeseries.add(new Day(20, 2, 2002), 96.275000000000006D);
    timeseries.add(new Day(21, 2, 2002), 96.280000000000001D);
    timeseries.add(new Day(22, 2, 2002), 96.305000000000007D);
    timeseries.add(new Day(25, 2, 2002), 96.265000000000001D);
    timeseries.add(new Day(26, 2, 2002), 96.185000000000002D);
    timeseries.add(new Day(27, 2, 2002), 96.305000000000007D);
    timeseries.add(new Day(28, 2, 2002), 96.215000000000003D);
    timeseries.add(new Day(1, 3, 2002), 96.015000000000001D);
    timeseries.add(new Day(4, 3, 2002), 95.969999999999999D);
    timeseries.add(new Day(5, 3, 2002), 95.935000000000002D);
    timeseries.add(new Day(6, 3, 2002), 95.935000000000002D);
    timeseries.add(new Day(7, 3, 2002), 95.704999999999998D);
    timeseries.add(new Day(8, 3, 2002), 95.484999999999999D);
    timeseries.add(new Day(11, 3, 2002), 95.504999999999995D);
    timeseries.add(new Day(12, 3, 2002), 95.540000000000006D);
    timeseries.add(new Day(13, 3, 2002), 95.674999999999997D);
    timeseries.add(new Day(14, 3, 2002), 95.510000000000005D);
    timeseries.add(new Day(15, 3, 2002), 95.5D);
    timeseries.add(new Day(18, 3, 2002), 95.5D);
    timeseries.add(new Day(19, 3, 2002), 95.534999999999997D);
    timeseries.add(new Day(20, 3, 2002), 95.420000000000002D);
    timeseries.add(new Day(21, 3, 2002), 95.400000000000006D);
    timeseries.add(new Day(22, 3, 2002), 95.375D);
    timeseries.add(new Day(25, 3, 2002), 95.349999999999994D);
    timeseries.add(new Day(26, 3, 2002), 95.504999999999995D);
    timeseries.add(new Day(27, 3, 2002), 95.549999999999997D);
    timeseries.add(new Day(28, 3, 2002), 95.484999999999999D);
    timeseries.add(new Day(1, 4, 2002), 95.484999999999999D);
    timeseries.add(new Day(2, 4, 2002), 95.629999999999995D);
    timeseries.add(new Day(3, 4, 2002), 95.734999999999999D);
    timeseries.add(new Day(4, 4, 2002), 95.694999999999993D);
    timeseries.add(new Day(5, 4, 2002), 95.810000000000002D);
    timeseries.add(new Day(8, 4, 2002), 95.810000000000002D);
    timeseries.add(new Day(9, 4, 2002), 95.864999999999995D);
    timeseries.add(new Day(10, 4, 2002), 95.885000000000005D);
    timeseries.add(new Day(11, 4, 2002), 95.900000000000006D);
    timeseries.add(new Day(12, 4, 2002), 95.980000000000004D);
    timeseries.add(new Day(15, 4, 2002), 96.034999999999997D);
    timeseries.add(new Day(16, 4, 2002), 96D);
    timeseries.add(new Day(17, 4, 2002), 96.034999999999997D);
    timeseries.add(new Day(18, 4, 2002), 96.084999999999994D);
    timeseries.add(new Day(19, 4, 2002), 96.075000000000003D);
    timeseries.add(new Day(22, 4, 2002), 96.105000000000004D);
    timeseries.add(new Day(23, 4, 2002), 96.075000000000003D);
    timeseries.add(new Day(24, 4, 2002), 96.209999999999994D);
    timeseries.add(new Day(25, 4, 2002), 96.254999999999995D);
    timeseries.add(new Day(26, 4, 2002), 96.310000000000002D);
    timeseries.add(new Day(29, 4, 2002), 96.310000000000002D);
    timeseries.add(new Day(30, 4, 2002), 96.325000000000003D);
    timeseries.add(new Day(1, 5, 2002), 96.344999999999999D);
    timeseries.add(new Day(2, 5, 2002), 96.284999999999997D);
    timeseries.add(new Day(3, 5, 2002), 96.385000000000005D);
    timeseries.add(new Day(6, 5, 2002), 96.379999999999995D);
    timeseries.add(new Day(7, 5, 2002), 96.484999999999999D);
    timeseries.add(new Day(8, 5, 2002), 96.230000000000004D);
    timeseries.add(new Day(9, 5, 2002), 96.310000000000002D);
    timeseries.add(new Day(10, 5, 2002), 96.444999999999993D);
    timeseries.add(new Day(13, 5, 2002), 96.355000000000004D);
    timeseries.add(new Day(14, 5, 2002), 96.180000000000007D);
    timeseries.add(new Day(15, 5, 2002), 96.239999999999995D);
    timeseries.add(new Day(16, 5, 2002), 96.325000000000003D);
    timeseries.add(new Day(17, 5, 2002), 96.200000000000003D);
    timeseries.add(new Day(20, 5, 2002), 96.305000000000007D);
    timeseries.add(new Day(21, 5, 2002), 96.385000000000005D);
    timeseries.add(new Day(22, 5, 2002), 96.444999999999993D);
    timeseries.add(new Day(23, 5, 2002), 96.385000000000005D);
    timeseries.add(new Day(24, 5, 2002), 96.390000000000001D);
    timeseries.add(new Day(28, 5, 2002), 96.390000000000001D);
    timeseries.add(new Day(29, 5, 2002), 96.474999999999994D);
    timeseries.add(new Day(30, 5, 2002), 96.555000000000007D);
    timeseries.add(new Day(31, 5, 2002), 96.5D);
    timeseries.add(new Day(3, 6, 2002), 96.540000000000006D);
    timeseries.add(new Day(4, 6, 2002), 96.605000000000004D);
    timeseries.add(new Day(5, 6, 2002), 96.579999999999998D);
    timeseries.add(new Day(6, 6, 2002), 96.609999999999999D);
    timeseries.add(new Day(7, 6, 2002), 96.599999999999994D);
    timeseries.add(new Day(10, 6, 2002), 96.614999999999995D);
    timeseries.add(new Day(11, 6, 2002), 96.704999999999998D);
    timeseries.add(new Day(12, 6, 2002), 96.75D);
    timeseries.add(new Day(13, 6, 2002), 96.829999999999998D);
    timeseries.add(new Day(14, 6, 2002), 96.965000000000003D);
    timeseries.add(new Day(17, 6, 2002), 96.944999999999993D);
    timeseries.add(new Day(18, 6, 2002), 96.989999999999995D);
    timeseries.add(new Day(19, 6, 2002), 97.165000000000006D);
    timeseries.add(new Day(20, 6, 2002), 97.030000000000001D);
    timeseries.add(new Day(21, 6, 2002), 97.144999999999996D);
    timeseries.add(new Day(24, 6, 2002), 97.120000000000005D);
    timeseries.add(new Day(25, 6, 2002), 97.174999999999997D);
    timeseries.add(new Day(26, 6, 2002), 97.364999999999995D);
    timeseries.add(new Day(27, 6, 2002), 97.245000000000005D);
    timeseries.add(new Day(28, 6, 2002), 97.245000000000005D);
    timeseries.add(new Day(1, 7, 2002), 97.290000000000006D);
    timeseries.add(new Day(2, 7, 2002), 97.379999999999995D);
    timeseries.add(new Day(3, 7, 2002), 97.379999999999995D);
    timeseries.add(new Day(5, 7, 2002), 97.219999999999999D);
    timeseries.add(new Day(8, 7, 2002), 97.325000000000003D);
    timeseries.add(new Day(9, 7, 2002), 97.454999999999998D);
    timeseries.add(new Day(10, 7, 2002), 97.579999999999998D);
    timeseries.add(new Day(11, 7, 2002), 97.605000000000004D);
    timeseries.add(new Day(12, 7, 2002), 97.689999999999998D);
    timeseries.add(new Day(15, 7, 2002), 97.730000000000004D);
    timeseries.add(new Day(16, 7, 2002), 97.579999999999998D);
    timeseries.add(new Day(17, 7, 2002), 97.640000000000001D);
    timeseries.add(new Day(18, 7, 2002), 97.680000000000007D);
    timeseries.add(new Day(19, 7, 2002), 97.715000000000003D);
    timeseries.add(new Day(22, 7, 2002), 97.814999999999998D);
    timeseries.add(new Day(23, 7, 2002), 97.875D);
    timeseries.add(new Day(24, 7, 2002), 97.834999999999994D);
    timeseries.add(new Day(25, 7, 2002), 97.924999999999997D);
    timeseries.add(new Day(26, 7, 2002), 97.959999999999994D);
    timeseries.add(new Day(29, 7, 2002), 97.745000000000005D);
    timeseries.add(new Day(30, 7, 2002), 97.709999999999994D);
    timeseries.add(new Day(31, 7, 2002), 97.930000000000007D);
    timeseries.add(new Day(1, 8, 2002), 98D);
    timeseries.add(new Day(2, 8, 2002), 98.170000000000002D);
    timeseries.add(new Day(5, 8, 2002), 98.224999999999994D);
    timeseries.add(new Day(6, 8, 2002), 98.114999999999995D);
    timeseries.add(new Day(7, 8, 2002), 98.265000000000001D);
    timeseries.add(new Day(8, 8, 2002), 98.180000000000007D);
    timeseries.add(new Day(9, 8, 2002), 98.185000000000002D);
    timeseries.add(new Day(12, 8, 2002), 98.150000000000006D);
    timeseries.add(new Day(13, 8, 2002), 98.290000000000006D);
    timeseries.add(new Day(14, 8, 2002), 98.155000000000001D);
    timeseries.add(new Day(15, 8, 2002), 98.075000000000003D);
    timeseries.add(new Day(16, 8, 2002), 98D);
    timeseries.add(new Day(19, 8, 2002), 98.040000000000006D);
    timeseries.add(new Day(20, 8, 2002), 98.135000000000005D);
    timeseries.add(new Day(21, 8, 2002), 98.109999999999999D);
    timeseries.add(new Day(22, 8, 2002), 98.004999999999995D);
    timeseries.add(new Day(23, 8, 2002), 98.055000000000007D);
    timeseries.add(new Day(26, 8, 2002), 98.064999999999998D);
    timeseries.add(new Day(27, 8, 2002), 97.980000000000004D);
    timeseries.add(new Day(28, 8, 2002), 98.034999999999997D);
    timeseries.add(new Day(29, 8, 2002), 98.094999999999999D);
    timeseries.add(new Day(30, 8, 2002), 98.060000000000002D);
    timeseries.add(new Day(3, 9, 2002), 98.25D);
    timeseries.add(new Day(4, 9, 2002), 98.245000000000005D);
    timeseries.add(new Day(5, 9, 2002), 98.314999999999998D);
    timeseries.add(new Day(6, 9, 2002), 98.170000000000002D);
    timeseries.add(new Day(9, 9, 2002), 98.079999999999998D);
    timeseries.add(new Day(10, 9, 2002), 98.090000000000003D);
    timeseries.add(new Day(11, 9, 2002), 98.030000000000001D);
    timeseries.add(new Day(12, 9, 2002), 98.105000000000004D);
    timeseries.add(new Day(13, 9, 2002), 98.135000000000005D);
    timeseries.add(new Day(16, 9, 2002), 98.114999999999995D);
    timeseries.add(new Day(17, 9, 2002), 98.125D);
    timeseries.add(new Day(18, 9, 2002), 98.129999999999995D);
    timeseries.add(new Day(19, 9, 2002), 98.254999999999995D);
    timeseries.add(new Day(20, 9, 2002), 98.254999999999995D);
    timeseries.add(new Day(23, 9, 2002), 98.280000000000001D);
    timeseries.add(new Day(24, 9, 2002), 98.310000000000002D);
    timeseries.add(new Day(25, 9, 2002), 98.25D);
    timeseries.add(new Day(26, 9, 2002), 98.299999999999997D);
    timeseries.add(new Day(27, 9, 2002), 98.409999999999997D);
    timeseries.add(new Day(30, 9, 2002), 98.495000000000005D);
    timeseries.add(new Day(1, 10, 2002), 98.439999999999998D);
    timeseries.add(new Day(2, 10, 2002), 98.439999999999998D);
    timeseries.add(new Day(3, 10, 2002), 98.439999999999998D);
    timeseries.add(new Day(4, 10, 2002), 98.379999999999995D);
    timeseries.add(new Day(7, 10, 2002), 98.385000000000005D);
    timeseries.add(new Day(8, 10, 2002), 98.340000000000003D);
    timeseries.add(new Day(9, 10, 2002), 98.420000000000002D);
    timeseries.add(new Day(10, 10, 2002), 98.375D);
    timeseries.add(new Day(11, 10, 2002), 98.275000000000006D);
    timeseries.add(new Day(14, 10, 2002), 98.275000000000006D);
    timeseries.add(new Day(15, 10, 2002), 98.135000000000005D);
    timeseries.add(new Day(16, 10, 2002), 98.165000000000006D);
    timeseries.add(new Day(17, 10, 2002), 98.170000000000002D);
    timeseries.add(new Day(18, 10, 2002), 98.165000000000006D);
    timeseries.add(new Day(21, 10, 2002), 98.105000000000004D);
    timeseries.add(new Day(22, 10, 2002), 98.125D);
    timeseries.add(new Day(23, 10, 2002), 98.185000000000002D);
    timeseries.add(new Day(24, 10, 2002), 98.245000000000005D);
    timeseries.add(new Day(25, 10, 2002), 98.319999999999993D);
    timeseries.add(new Day(28, 10, 2002), 98.420000000000002D);
    timeseries.add(new Day(29, 10, 2002), 98.540000000000006D);
    timeseries.add(new Day(30, 10, 2002), 98.545000000000002D);
    timeseries.add(new Day(31, 10, 2002), 98.560000000000002D);
    return new TimeSeriesCollection(timeseries);
}

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

private static IntervalXYDataset createVolumeDataset() {
    TimeSeries timeseries = new TimeSeries("Volume");
    timeseries.add(new Day(2, 1, 2002), 41020D);
    timeseries.add(new Day(3, 1, 2002), 45586D);
    timeseries.add(new Day(4, 1, 2002), 81672D);
    timeseries.add(new Day(7, 1, 2002), 81975D);
    timeseries.add(new Day(8, 1, 2002), 79692D);
    timeseries.add(new Day(9, 1, 2002), 53187D);
    timeseries.add(new Day(10, 1, 2002), 87929D);
    timeseries.add(new Day(11, 1, 2002), 107047D);
    timeseries.add(new Day(14, 1, 2002), 86276D);
    timeseries.add(new Day(15, 1, 2002), 79005D);
    timeseries.add(new Day(16, 1, 2002), 80632D);
    timeseries.add(new Day(17, 1, 2002), 88797D);
    timeseries.add(new Day(18, 1, 2002), 57179D);
    timeseries.add(new Day(22, 1, 2002), 36611D);
    timeseries.add(new Day(23, 1, 2002), 57063D);
    timeseries.add(new Day(24, 1, 2002), 101938D);
    timeseries.add(new Day(25, 1, 2002), 87177D);
    timeseries.add(new Day(28, 1, 2002), 39831D);
    timeseries.add(new Day(29, 1, 2002), 67654D);
    timeseries.add(new Day(30, 1, 2002), 81162D);
    timeseries.add(new Day(31, 1, 2002), 64923D);
    timeseries.add(new Day(1, 2, 2002), 73481D);
    timeseries.add(new Day(4, 2, 2002), 54723D);
    timeseries.add(new Day(5, 2, 2002), 76708D);
    timeseries.add(new Day(6, 2, 2002), 81281D);
    timeseries.add(new Day(7, 2, 2002), 66553D);
    timeseries.add(new Day(8, 2, 2002), 53592D);
    timeseries.add(new Day(11, 2, 2002), 29410D);
    timeseries.add(new Day(12, 2, 2002), 60345D);
    timeseries.add(new Day(13, 2, 2002), 67339D);
    timeseries.add(new Day(14, 2, 2002), 40057D);
    timeseries.add(new Day(15, 2, 2002), 67865D);
    timeseries.add(new Day(19, 2, 2002), 58628D);
    timeseries.add(new Day(20, 2, 2002), 52109D);
    timeseries.add(new Day(21, 2, 2002), 50195D);
    timeseries.add(new Day(22, 2, 2002), 47806D);
    timeseries.add(new Day(25, 2, 2002), 31711D);
    timeseries.add(new Day(26, 2, 2002), 88328D);
    timeseries.add(new Day(27, 2, 2002), 95805D);
    timeseries.add(new Day(28, 2, 2002), 84035D);
    timeseries.add(new Day(1, 3, 2002), 113584D);
    timeseries.add(new Day(4, 3, 2002), 71872D);
    timeseries.add(new Day(5, 3, 2002), 83016D);
    timeseries.add(new Day(6, 3, 2002), 62273D);
    timeseries.add(new Day(7, 3, 2002), 138508D);
    timeseries.add(new Day(8, 3, 2002), 139428D);
    timeseries.add(new Day(11, 3, 2002), 80232D);
    timeseries.add(new Day(12, 3, 2002), 75693D);
    timeseries.add(new Day(13, 3, 2002), 104068D);
    timeseries.add(new Day(14, 3, 2002), 72171D);
    timeseries.add(new Day(15, 3, 2002), 117262D);
    timeseries.add(new Day(18, 3, 2002), 66048D);
    timeseries.add(new Day(19, 3, 2002), 87079D);
    timeseries.add(new Day(20, 3, 2002), 116084D);
    timeseries.add(new Day(21, 3, 2002), 113206D);
    timeseries.add(new Day(22, 3, 2002), 68326D);
    timeseries.add(new Day(25, 3, 2002), 34340D);
    timeseries.add(new Day(26, 3, 2002), 104413D);
    timeseries.add(new Day(27, 3, 2002), 57277D);
    timeseries.add(new Day(28, 3, 2002), 69936D);
    timeseries.add(new Day(1, 4, 2002), 57282D);
    timeseries.add(new Day(2, 4, 2002), 74686D);
    timeseries.add(new Day(3, 4, 2002), 108601D);
    timeseries.add(new Day(4, 4, 2002), 123381D);
    timeseries.add(new Day(5, 4, 2002), 106691D);
    timeseries.add(new Day(8, 4, 2002), 118535D);
    timeseries.add(new Day(9, 4, 2002), 85577D);
    timeseries.add(new Day(10, 4, 2002), 75441D);
    timeseries.add(new Day(11, 4, 2002), 88845D);
    timeseries.add(new Day(12, 4, 2002), 137141D);
    timeseries.add(new Day(15, 4, 2002), 72518D);
    timeseries.add(new Day(16, 4, 2002), 122100D);
    timeseries.add(new Day(17, 4, 2002), 136419D);
    timeseries.add(new Day(18, 4, 2002), 141338D);
    timeseries.add(new Day(19, 4, 2002), 80274D);
    timeseries.add(new Day(22, 4, 2002), 40449D);
    timeseries.add(new Day(23, 4, 2002), 72292D);
    timeseries.add(new Day(24, 4, 2002), 110644D);
    timeseries.add(new Day(25, 4, 2002), 145142D);
    timeseries.add(new Day(26, 4, 2002), 139573D);
    timeseries.add(new Day(29, 4, 2002), 51509D);
    timeseries.add(new Day(30, 4, 2002), 105782D);
    timeseries.add(new Day(1, 5, 2002), 170680D);
    timeseries.add(new Day(2, 5, 2002), 140800D);
    timeseries.add(new Day(3, 5, 2002), 170411D);
    timeseries.add(new Day(6, 5, 2002), 46172D);
    timeseries.add(new Day(7, 5, 2002), 137251D);
    timeseries.add(new Day(8, 5, 2002), 220626D);
    timeseries.add(new Day(9, 5, 2002), 175902D);
    timeseries.add(new Day(10, 5, 2002), 128807D);
    timeseries.add(new Day(13, 5, 2002), 78208D);
    timeseries.add(new Day(14, 5, 2002), 212048D);
    timeseries.add(new Day(15, 5, 2002), 145643D);
    timeseries.add(new Day(16, 5, 2002), 121520D);
    timeseries.add(new Day(17, 5, 2002), 147820D);
    timeseries.add(new Day(20, 5, 2002), 75969D);
    timeseries.add(new Day(21, 5, 2002), 118970D);
    timeseries.add(new Day(22, 5, 2002), 131013D);
    timeseries.add(new Day(23, 5, 2002), 141100D);
    timeseries.add(new Day(24, 5, 2002), 63606D);
    timeseries.add(new Day(28, 5, 2002), 78687D);
    timeseries.add(new Day(29, 5, 2002), 86743D);
    timeseries.add(new Day(30, 5, 2002), 164376D);
    timeseries.add(new Day(31, 5, 2002), 150108D);
    timeseries.add(new Day(3, 6, 2002), 132363D);
    timeseries.add(new Day(4, 6, 2002), 144902D);
    timeseries.add(new Day(5, 6, 2002), 123834D);
    timeseries.add(new Day(6, 6, 2002), 125004D);
    timeseries.add(new Day(7, 6, 2002), 165049D);
    timeseries.add(new Day(10, 6, 2002), 88069D);
    timeseries.add(new Day(11, 6, 2002), 114146D);
    timeseries.add(new Day(12, 6, 2002), 149992D);
    timeseries.add(new Day(13, 6, 2002), 191261D);
    timeseries.add(new Day(14, 6, 2002), 207444D);
    timeseries.add(new Day(17, 6, 2002), 117081D);
    timeseries.add(new Day(18, 6, 2002), 135924D);
    timeseries.add(new Day(19, 6, 2002), 179654D);
    timeseries.add(new Day(20, 6, 2002), 260936D);
    timeseries.add(new Day(21, 6, 2002), 140283D);
    timeseries.add(new Day(24, 6, 2002), 199052D);
    timeseries.add(new Day(25, 6, 2002), 191804D);
    timeseries.add(new Day(26, 6, 2002), 384936D);
    timeseries.add(new Day(27, 6, 2002), 313065D);
    timeseries.add(new Day(28, 6, 2002), 169963D);
    timeseries.add(new Day(1, 7, 2002), 109906D);
    timeseries.add(new Day(2, 7, 2002), 140644D);
    timeseries.add(new Day(3, 7, 2002), 150898D);
    timeseries.add(new Day(5, 7, 2002), 181355D);
    timeseries.add(new Day(8, 7, 2002), 155042D);
    timeseries.add(new Day(9, 7, 2002), 204305D);
    timeseries.add(new Day(10, 7, 2002), 300113D);
    timeseries.add(new Day(11, 7, 2002), 338948D);
    timeseries.add(new Day(12, 7, 2002), 281325D);
    timeseries.add(new Day(15, 7, 2002), 256101D);
    timeseries.add(new Day(16, 7, 2002), 348164D);
    timeseries.add(new Day(17, 7, 2002), 242995D);
    timeseries.add(new Day(18, 7, 2002), 200744D);
    timeseries.add(new Day(19, 7, 2002), 181071D);
    timeseries.add(new Day(22, 7, 2002), 163266D);
    timeseries.add(new Day(23, 7, 2002), 188508D);
    timeseries.add(new Day(24, 7, 2002), 308070D);
    timeseries.add(new Day(25, 7, 2002), 230901D);
    timeseries.add(new Day(26, 7, 2002), 162577D);
    timeseries.add(new Day(29, 7, 2002), 216318D);
    timeseries.add(new Day(30, 7, 2002), 280677D);
    timeseries.add(new Day(31, 7, 2002), 260236D);
    timeseries.add(new Day(1, 8, 2002), 242803D);
    timeseries.add(new Day(2, 8, 2002), 298490D);
    timeseries.add(new Day(5, 8, 2002), 182890D);
    timeseries.add(new Day(6, 8, 2002), 232273D);
    timeseries.add(new Day(7, 8, 2002), 253552D);
    timeseries.add(new Day(8, 8, 2002), 165365D);
    timeseries.add(new Day(9, 8, 2002), 160382D);
    timeseries.add(new Day(12, 8, 2002), 118030D);
    timeseries.add(new Day(13, 8, 2002), 208807D);
    timeseries.add(new Day(14, 8, 2002), 231599D);
    timeseries.add(new Day(15, 8, 2002), 343482D);
    timeseries.add(new Day(16, 8, 2002), 186116D);
    timeseries.add(new Day(19, 8, 2002), 96437D);
    timeseries.add(new Day(20, 8, 2002), 151735D);
    timeseries.add(new Day(21, 8, 2002), 167390D);
    timeseries.add(new Day(22, 8, 2002), 127184D);
    timeseries.add(new Day(23, 8, 2002), 80205D);
    timeseries.add(new Day(26, 8, 2002), 79893D);
    timeseries.add(new Day(27, 8, 2002), 201723D);
    timeseries.add(new Day(28, 8, 2002), 114001D);
    timeseries.add(new Day(29, 8, 2002), 188389D);
    timeseries.add(new Day(30, 8, 2002), 162801D);
    timeseries.add(new Day(3, 9, 2002), 200951D);
    timeseries.add(new Day(4, 9, 2002), 129229D);
    timeseries.add(new Day(5, 9, 2002), 183348D);
    timeseries.add(new Day(6, 9, 2002), 216722D);
    timeseries.add(new Day(9, 9, 2002), 128575D);
    timeseries.add(new Day(10, 9, 2002), 224714D);
    timeseries.add(new Day(11, 9, 2002), 144224D);
    timeseries.add(new Day(12, 9, 2002), 195721D);
    timeseries.add(new Day(13, 9, 2002), 160724D);
    timeseries.add(new Day(16, 9, 2002), 65473D);
    timeseries.add(new Day(17, 9, 2002), 141274D);
    timeseries.add(new Day(18, 9, 2002), 115084D);
    timeseries.add(new Day(19, 9, 2002), 242106D);
    timeseries.add(new Day(20, 9, 2002), 130034D);
    timeseries.add(new Day(23, 9, 2002), 95215D);
    timeseries.add(new Day(24, 9, 2002), 229288D);
    timeseries.add(new Day(25, 9, 2002), 163672D);
    timeseries.add(new Day(26, 9, 2002), 193573D);
    timeseries.add(new Day(27, 9, 2002), 170741D);
    timeseries.add(new Day(30, 9, 2002), 199615D);
    timeseries.add(new Day(1, 10, 2002), 170771D);
    timeseries.add(new Day(2, 10, 2002), 138498D);
    timeseries.add(new Day(3, 10, 2002), 154774D);
    timeseries.add(new Day(4, 10, 2002), 287154D);
    timeseries.add(new Day(7, 10, 2002), 111762D);
    timeseries.add(new Day(8, 10, 2002), 172535D);
    timeseries.add(new Day(9, 10, 2002), 148339D);
    timeseries.add(new Day(10, 10, 2002), 178796D);
    timeseries.add(new Day(11, 10, 2002), 153499D);
    timeseries.add(new Day(14, 10, 2002), 4589D);
    timeseries.add(new Day(15, 10, 2002), 172088D);
    timeseries.add(new Day(16, 10, 2002), 151267D);
    timeseries.add(new Day(17, 10, 2002), 222680D);
    timeseries.add(new Day(18, 10, 2002), 127019D);
    timeseries.add(new Day(21, 10, 2002), 118226D);
    timeseries.add(new Day(22, 10, 2002), 183031D);
    timeseries.add(new Day(23, 10, 2002), 221005D);
    timeseries.add(new Day(24, 10, 2002), 121333D);
    timeseries.add(new Day(25, 10, 2002), 138179D);
    timeseries.add(new Day(28, 10, 2002), 162012D);
    timeseries.add(new Day(29, 10, 2002), 237355D);
    timeseries.add(new Day(30, 10, 2002), 161650D);
    timeseries.add(new Day(31, 10, 2002), 207569D);
    return new TimeSeriesCollection(timeseries);
}

From source file:com.orsonpdf.demo.PDFTimeSeriesChartDemo1.java

/**
 * Creates a dataset, consisting of two series of monthly data.
 *
 * @return the dataset.//from   w  w  w .  j ava2  s .  co  m
 */
private static XYDataset createDataset() {
    TimeSeries s1 = new TimeSeries("Indicator Price");
    s1.add(new Month(1, 2010), 126.80);
    s1.add(new Month(2, 2010), 123.37);
    s1.add(new Month(3, 2010), 125.30);
    s1.add(new Month(4, 2010), 126.89);
    s1.add(new Month(5, 2010), 128.10);
    s1.add(new Month(6, 2010), 142.20);
    s1.add(new Month(7, 2010), 153.41);
    s1.add(new Month(8, 2010), 157.46);
    s1.add(new Month(9, 2010), 163.61);
    s1.add(new Month(10, 2010), 161.56);
    s1.add(new Month(11, 2010), 173.90);
    s1.add(new Month(12, 2010), 184.26);
    s1.add(new Month(1, 2011), 197.35);
    s1.add(new Month(2, 2011), 216.03);
    s1.add(new Month(3, 2011), 224.33);
    s1.add(new Month(4, 2011), 231.24);
    s1.add(new Month(5, 2011), 227.97);
    s1.add(new Month(6, 2011), 215.58);
    s1.add(new Month(7, 2011), 210.36);
    s1.add(new Month(8, 2011), 212.19);
    s1.add(new Month(9, 2011), 213.04);
    s1.add(new Month(10, 2011), 193.90);
    s1.add(new Month(11, 2011), 193.66);
    s1.add(new Month(12, 2011), 189.02);
    s1.add(new Month(1, 2012), 188.90);
    s1.add(new Month(2, 2012), 182.29);
    s1.add(new Month(3, 2012), 167.77);
    s1.add(new Month(4, 2012), 160.46);
    s1.add(new Month(5, 2012), 157.68);
    s1.add(new Month(6, 2012), 145.31);
    s1.add(new Month(7, 2012), 159.07);
    s1.add(new Month(8, 2012), 148.50);
    s1.add(new Month(9, 2012), 151.28);
    s1.add(new Month(10, 2012), 147.12);
    s1.add(new Month(11, 2012), 136.35);
    s1.add(new Month(12, 2012), 131.31);
    s1.add(new Month(1, 2013), 135.38);
    s1.add(new Month(2, 2013), 131.51);
    s1.add(new Month(3, 2013), 131.38);

    TimeSeries s2 = new TimeSeries("Columbian Milds");
    s2.add(new Month(1, 2010), 207.51);
    s2.add(new Month(2, 2010), 204.71);
    s2.add(new Month(3, 2010), 205.71);
    s2.add(new Month(4, 2010), 200.00);
    s2.add(new Month(5, 2010), 200.54);
    s2.add(new Month(6, 2010), 224.49);
    s2.add(new Month(7, 2010), 235.52);
    s2.add(new Month(8, 2010), 243.98);
    s2.add(new Month(9, 2010), 247.77);
    s2.add(new Month(10, 2010), 230.02);
    s2.add(new Month(11, 2010), 244.02);
    s2.add(new Month(12, 2010), 261.97);
    s2.add(new Month(1, 2011), 279.88);
    s2.add(new Month(2, 2011), 296.44);
    s2.add(new Month(3, 2011), 300.68);
    s2.add(new Month(4, 2011), 312.95);
    s2.add(new Month(5, 2011), 302.17);
    s2.add(new Month(6, 2011), 287.95);
    s2.add(new Month(7, 2011), 285.21);
    s2.add(new Month(8, 2011), 286.97);
    s2.add(new Month(9, 2011), 287.54);
    s2.add(new Month(10, 2011), 257.66);
    s2.add(new Month(11, 2011), 256.99);
    s2.add(new Month(12, 2011), 251.60);
    s2.add(new Month(1, 2012), 255.91);
    s2.add(new Month(2, 2012), 244.14);
    s2.add(new Month(3, 2012), 222.84);
    s2.add(new Month(4, 2012), 214.46);
    s2.add(new Month(5, 2012), 207.32);
    s2.add(new Month(6, 2012), 184.67);
    s2.add(new Month(7, 2012), 202.56);
    s2.add(new Month(8, 2012), 187.14);
    s2.add(new Month(9, 2012), 190.10);
    s2.add(new Month(10, 2012), 181.39);
    s2.add(new Month(11, 2012), 170.08);
    s2.add(new Month(12, 2012), 164.40);
    s2.add(new Month(1, 2013), 169.19);
    s2.add(new Month(2, 2013), 161.70);
    s2.add(new Month(3, 2013), 161.53);

    TimeSeries s3 = new TimeSeries("Other Milds");
    s3.add(new Month(1, 2010), 158.90);
    s3.add(new Month(2, 2010), 157.86);
    s3.add(new Month(3, 2010), 164.50);
    s3.add(new Month(4, 2010), 169.55);
    s3.add(new Month(5, 2010), 173.38);
    s3.add(new Month(6, 2010), 190.90);
    s3.add(new Month(7, 2010), 203.21);
    s3.add(new Month(8, 2010), 211.59);
    s3.add(new Month(9, 2010), 222.71);
    s3.add(new Month(10, 2010), 217.64);
    s3.add(new Month(11, 2010), 233.48);
    s3.add(new Month(12, 2010), 248.17);
    s3.add(new Month(1, 2011), 263.77);
    s3.add(new Month(2, 2011), 287.89);
    s3.add(new Month(3, 2011), 292.07);
    s3.add(new Month(4, 2011), 300.12);
    s3.add(new Month(5, 2011), 291.09);
    s3.add(new Month(6, 2011), 274.98);
    s3.add(new Month(7, 2011), 268.02);
    s3.add(new Month(8, 2011), 270.44);
    s3.add(new Month(9, 2011), 274.88);
    s3.add(new Month(10, 2011), 247.82);
    s3.add(new Month(11, 2011), 245.09);
    s3.add(new Month(12, 2011), 236.71);
    s3.add(new Month(1, 2012), 237.21);
    s3.add(new Month(2, 2012), 224.16);
    s3.add(new Month(3, 2012), 201.26);
    s3.add(new Month(4, 2012), 191.45);
    s3.add(new Month(5, 2012), 184.65);
    s3.add(new Month(6, 2012), 168.69);
    s3.add(new Month(7, 2012), 190.45);
    s3.add(new Month(8, 2012), 174.82);
    s3.add(new Month(9, 2012), 178.98);
    s3.add(new Month(10, 2012), 173.32);
    s3.add(new Month(11, 2012), 159.91);
    s3.add(new Month(12, 2012), 152.74);
    s3.add(new Month(1, 2013), 157.29);
    s3.add(new Month(2, 2013), 149.46);
    s3.add(new Month(3, 2013), 149.78);

    TimeSeries s4 = new TimeSeries("Brazilian Naturals");
    s4.add(new Month(1, 2010), 131.67);
    s4.add(new Month(2, 2010), 124.57);
    s4.add(new Month(3, 2010), 126.21);
    s4.add(new Month(4, 2010), 126.07);
    s4.add(new Month(5, 2010), 127.45);
    s4.add(new Month(6, 2010), 143.20);
    s4.add(new Month(7, 2010), 156.87);
    s4.add(new Month(8, 2010), 163.21);
    s4.add(new Month(9, 2010), 175.15);
    s4.add(new Month(10, 2010), 175.38);
    s4.add(new Month(11, 2010), 190.62);
    s4.add(new Month(12, 2010), 204.25);
    s4.add(new Month(1, 2011), 219.77);
    s4.add(new Month(2, 2011), 247.00);
    s4.add(new Month(3, 2011), 260.98);
    s4.add(new Month(4, 2011), 273.40);
    s4.add(new Month(5, 2011), 268.66);
    s4.add(new Month(6, 2011), 250.59);
    s4.add(new Month(7, 2011), 245.69);
    s4.add(new Month(8, 2011), 249.83);
    s4.add(new Month(9, 2011), 255.64);
    s4.add(new Month(10, 2011), 234.28);
    s4.add(new Month(11, 2011), 236.75);
    s4.add(new Month(12, 2011), 228.79);
    s4.add(new Month(1, 2012), 228.21);
    s4.add(new Month(2, 2012), 215.40);
    s4.add(new Month(3, 2012), 192.03);
    s4.add(new Month(4, 2012), 180.90);
    s4.add(new Month(5, 2012), 174.17);
    s4.add(new Month(6, 2012), 156.17);
    s4.add(new Month(7, 2012), 175.98);
    s4.add(new Month(8, 2012), 160.05);
    s4.add(new Month(9, 2012), 166.53);
    s4.add(new Month(10, 2012), 161.20);
    s4.add(new Month(11, 2012), 148.25);
    s4.add(new Month(12, 2012), 140.69);
    s4.add(new Month(1, 2013), 145.17);
    s4.add(new Month(2, 2013), 136.63);
    s4.add(new Month(3, 2013), 133.61);

    TimeSeries s5 = new TimeSeries("Robustas");
    s5.add(new Month(1, 2010), 69.92);
    s5.add(new Month(2, 2010), 67.88);
    s5.add(new Month(3, 2010), 67.25);
    s5.add(new Month(4, 2010), 71.59);
    s5.add(new Month(5, 2010), 70.70);
    s5.add(new Month(6, 2010), 76.92);
    s5.add(new Month(7, 2010), 85.27);
    s5.add(new Month(8, 2010), 82.68);
    s5.add(new Month(9, 2010), 81.28);
    s5.add(new Month(10, 2010), 85.27);
    s5.add(new Month(11, 2010), 92.04);
    s5.add(new Month(12, 2010), 94.09);
    s5.add(new Month(1, 2011), 101.09);
    s5.add(new Month(2, 2011), 109.35);
    s5.add(new Month(3, 2011), 118.13);
    s5.add(new Month(4, 2011), 117.37);
    s5.add(new Month(5, 2011), 121.98);
    s5.add(new Month(6, 2011), 117.95);
    s5.add(new Month(7, 2011), 112.73);
    s5.add(new Month(8, 2011), 112.07);
    s5.add(new Month(9, 2011), 106.06);
    s5.add(new Month(10, 2011), 98.10);
    s5.add(new Month(11, 2011), 97.24);
    s5.add(new Month(12, 2011), 98.41);
    s5.add(new Month(1, 2012), 96.72);
    s5.add(new Month(2, 2012), 101.93);
    s5.add(new Month(3, 2012), 103.57);
    s5.add(new Month(4, 2012), 101.80);
    s5.add(new Month(5, 2012), 106.88);
    s5.add(new Month(6, 2012), 105.70);
    s5.add(new Month(7, 2012), 107.06);
    s5.add(new Month(8, 2012), 106.52);
    s5.add(new Month(9, 2012), 104.95);
    s5.add(new Month(10, 2012), 104.47);
    s5.add(new Month(11, 2012), 97.67);
    s5.add(new Month(12, 2012), 96.59);
    s5.add(new Month(1, 2013), 99.69);
    s5.add(new Month(2, 2013), 104.03);
    s5.add(new Month(3, 2013), 106.26);

    TimeSeries s6 = new TimeSeries("Futures (London)");
    s6.add(new Month(1, 2010), 62.66);
    s6.add(new Month(2, 2010), 60.37);
    s6.add(new Month(3, 2010), 58.64);
    s6.add(new Month(4, 2010), 62.21);
    s6.add(new Month(5, 2010), 62.46);
    s6.add(new Month(6, 2010), 69.72);
    s6.add(new Month(7, 2010), 78.17);
    s6.add(new Month(8, 2010), 78.42);
    s6.add(new Month(9, 2010), 75.87);
    s6.add(new Month(10, 2010), 80.08);
    s6.add(new Month(11, 2010), 86.40);
    s6.add(new Month(12, 2010), 88.70);
    s6.add(new Month(1, 2011), 96.02);
    s6.add(new Month(2, 2011), 104.53);
    s6.add(new Month(3, 2011), 111.36);
    s6.add(new Month(4, 2011), 111.34);
    s6.add(new Month(5, 2011), 116.76);
    s6.add(new Month(6, 2011), 110.51);
    s6.add(new Month(7, 2011), 103.36);
    s6.add(new Month(8, 2011), 102.71);
    s6.add(new Month(9, 2011), 96.10);
    s6.add(new Month(10, 2011), 88.64);
    s6.add(new Month(11, 2011), 85.78);
    s6.add(new Month(12, 2011), 87.65);
    s6.add(new Month(1, 2012), 84.19);
    s6.add(new Month(2, 2012), 88.69);
    s6.add(new Month(3, 2012), 91.37);
    s6.add(new Month(4, 2012), 91.81);
    s6.add(new Month(5, 2012), 96.82);
    s6.add(new Month(6, 2012), 94.75);
    s6.add(new Month(7, 2012), 96.14);
    s6.add(new Month(8, 2012), 96.12);
    s6.add(new Month(9, 2012), 94.65);
    s6.add(new Month(10, 2012), 94.66);
    s6.add(new Month(11, 2012), 87.32);
    s6.add(new Month(12, 2012), 85.94);
    s6.add(new Month(1, 2013), 88.85);
    s6.add(new Month(2, 2013), 94.41);
    s6.add(new Month(3, 2013), 97.22);

    TimeSeries s7 = new TimeSeries("Futures (New York)");
    s7.add(new Month(1, 2010), 142.76);
    s7.add(new Month(2, 2010), 134.35);
    s7.add(new Month(3, 2010), 134.97);
    s7.add(new Month(4, 2010), 135.12);
    s7.add(new Month(5, 2010), 135.81);
    s7.add(new Month(6, 2010), 152.36);
    s7.add(new Month(7, 2010), 165.23);
    s7.add(new Month(8, 2010), 175.10);
    s7.add(new Month(9, 2010), 187.80);
    s7.add(new Month(10, 2010), 190.43);
    s7.add(new Month(11, 2010), 206.92);
    s7.add(new Month(12, 2010), 221.51);
    s7.add(new Month(1, 2011), 238.05);
    s7.add(new Month(2, 2011), 261.41);
    s7.add(new Month(3, 2011), 274.10);
    s7.add(new Month(4, 2011), 285.58);
    s7.add(new Month(5, 2011), 277.72);
    s7.add(new Month(6, 2011), 262.52);
    s7.add(new Month(7, 2011), 255.90);
    s7.add(new Month(8, 2011), 260.39);
    s7.add(new Month(9, 2011), 261.39);
    s7.add(new Month(10, 2011), 236.74);
    s7.add(new Month(11, 2011), 235.25);
    s7.add(new Month(12, 2011), 227.23);
    s7.add(new Month(1, 2012), 227.50);
    s7.add(new Month(2, 2012), 212.09);
    s7.add(new Month(3, 2012), 188.78);
    s7.add(new Month(4, 2012), 181.75);
    s7.add(new Month(5, 2012), 176.50);
    s7.add(new Month(6, 2012), 159.93);
    s7.add(new Month(7, 2012), 183.20);
    s7.add(new Month(8, 2012), 169.77);
    s7.add(new Month(9, 2012), 175.36);
    s7.add(new Month(10, 2012), 170.43);
    s7.add(new Month(11, 2012), 155.72);
    s7.add(new Month(12, 2012), 149.58);
    s7.add(new Month(1, 2013), 154.28);
    s7.add(new Month(2, 2013), 144.89);
    s7.add(new Month(3, 2013), 141.43);

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(s1);
    dataset.addSeries(s2);
    dataset.addSeries(s3);
    dataset.addSeries(s4);
    dataset.addSeries(s5);
    dataset.addSeries(s6);
    dataset.addSeries(s7);
    return dataset;
}

From source file:tools.descartes.bungee.chart.ChartGenerator.java

public static XYPlot createIntensityPlot(final List<ArrivalRateTuple> intensities) {
    final TimeSeriesCollection dataset = new TimeSeriesCollection();
    final TimeSeries series = new TimeSeries("load intensity");
    for (ArrivalRateTuple intensity : intensities) {
        long milliseconds = (referenceDate.getTime() / 1000 + (long) Math.floor(intensity.getTimeStamp()))
                * 1000;/*from  w w  w.ja va2 s. com*/
        series.add(new FixedMillisecond(milliseconds), intensity.getArrivalRate());
    }
    dataset.addSeries(series);

    XYStepRenderer renderer = new XYStepRenderer();
    //renderer.setSeriesStroke(0, (new BasicStroke(2.0F)));   
    renderer.setSeriesPaint(0, Color.GRAY);
    final NumberAxis rangeAxis = new NumberAxis("Arrival Rate [1/s]");
    //rangeAxis.setRange(0, 220);
    final XYPlot intensityPlot = new XYPlot(dataset, null, rangeAxis, renderer);
    return intensityPlot;
}

From source file:tools.descartes.bungee.chart.ChartGenerator.java

public static XYPlot createDemandPlot(final List<ArrivalRateTuple> intensities,
        final IntensityDemandMapping mapping) {
    final TimeSeriesCollection dataset = new TimeSeriesCollection();
    final TimeSeries series = new TimeSeries("resource demand");
    for (ArrivalRateTuple intensity : intensities) {
        long milliseconds = (referenceDate.getTime() / 1000 + (long) Math.floor(intensity.getTimeStamp()))
                * 1000;/*from   w w  w. ja va  2 s.  c o m*/
        series.add(new FixedMillisecond(milliseconds), mapping.getResourceDemand(intensity.getArrivalRate()));
    }
    dataset.addSeries(series);

    XYStepRenderer renderer = new XYStepRenderer();
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesStroke(0, new BasicStroke(STROKE_WIDTH));
    final NumberAxis rangeAxis = new NumberAxis("Resource Amount");
    rangeAxis.setAutoRangeIncludesZero(true);
    //rangeAxis.setRange(0,2.2);
    rangeAxis.setTickUnit(new NumberTickUnit(2));
    final XYPlot amountPlot = new XYPlot(dataset, null, rangeAxis, renderer);
    return amountPlot;
}

From source file:org.jfree.fx.demo.FXGraphics2DDemo1.java

/**
 * Creates a dataset, consisting of two series of monthly data.
 *
 * @return the dataset.//from w ww  .  j av  a2 s. com
 */
private static XYDataset createDataset() {

    TimeSeries s1 = new TimeSeries("Indicator Price");
    s1.add(new Month(1, 2010), 126.80);
    s1.add(new Month(2, 2010), 123.37);
    s1.add(new Month(3, 2010), 125.30);
    s1.add(new Month(4, 2010), 126.89);
    s1.add(new Month(5, 2010), 128.10);
    s1.add(new Month(6, 2010), 142.20);
    s1.add(new Month(7, 2010), 153.41);
    s1.add(new Month(8, 2010), 157.46);
    s1.add(new Month(9, 2010), 163.61);
    s1.add(new Month(10, 2010), 161.56);
    s1.add(new Month(11, 2010), 173.90);
    s1.add(new Month(12, 2010), 184.26);
    s1.add(new Month(1, 2011), 197.35);
    s1.add(new Month(2, 2011), 216.03);
    s1.add(new Month(3, 2011), 224.33);
    s1.add(new Month(4, 2011), 231.24);
    s1.add(new Month(5, 2011), 227.97);
    s1.add(new Month(6, 2011), 215.58);
    s1.add(new Month(7, 2011), 210.36);
    s1.add(new Month(8, 2011), 212.19);
    s1.add(new Month(9, 2011), 213.04);
    s1.add(new Month(10, 2011), 193.90);
    s1.add(new Month(11, 2011), 193.66);
    s1.add(new Month(12, 2011), 189.02);
    s1.add(new Month(1, 2012), 188.90);
    s1.add(new Month(2, 2012), 182.29);
    s1.add(new Month(3, 2012), 167.77);
    s1.add(new Month(4, 2012), 160.46);
    s1.add(new Month(5, 2012), 157.68);
    s1.add(new Month(6, 2012), 145.31);
    s1.add(new Month(7, 2012), 159.07);
    s1.add(new Month(8, 2012), 148.50);
    s1.add(new Month(9, 2012), 151.28);
    s1.add(new Month(10, 2012), 147.12);
    s1.add(new Month(11, 2012), 136.35);
    s1.add(new Month(12, 2012), 131.31);
    s1.add(new Month(1, 2013), 135.38);
    s1.add(new Month(2, 2013), 131.51);
    s1.add(new Month(3, 2013), 131.38);

    TimeSeries s2 = new TimeSeries("Columbian Milds");
    s2.add(new Month(1, 2010), 207.51);
    s2.add(new Month(2, 2010), 204.71);
    s2.add(new Month(3, 2010), 205.71);
    s2.add(new Month(4, 2010), 200.00);
    s2.add(new Month(5, 2010), 200.54);
    s2.add(new Month(6, 2010), 224.49);
    s2.add(new Month(7, 2010), 235.52);
    s2.add(new Month(8, 2010), 243.98);
    s2.add(new Month(9, 2010), 247.77);
    s2.add(new Month(10, 2010), 230.02);
    s2.add(new Month(11, 2010), 244.02);
    s2.add(new Month(12, 2010), 261.97);
    s2.add(new Month(1, 2011), 279.88);
    s2.add(new Month(2, 2011), 296.44);
    s2.add(new Month(3, 2011), 300.68);
    s2.add(new Month(4, 2011), 312.95);
    s2.add(new Month(5, 2011), 302.17);
    s2.add(new Month(6, 2011), 287.95);
    s2.add(new Month(7, 2011), 285.21);
    s2.add(new Month(8, 2011), 286.97);
    s2.add(new Month(9, 2011), 287.54);
    s2.add(new Month(10, 2011), 257.66);
    s2.add(new Month(11, 2011), 256.99);
    s2.add(new Month(12, 2011), 251.60);
    s2.add(new Month(1, 2012), 255.91);
    s2.add(new Month(2, 2012), 244.14);
    s2.add(new Month(3, 2012), 222.84);
    s2.add(new Month(4, 2012), 214.46);
    s2.add(new Month(5, 2012), 207.32);
    s2.add(new Month(6, 2012), 184.67);
    s2.add(new Month(7, 2012), 202.56);
    s2.add(new Month(8, 2012), 187.14);
    s2.add(new Month(9, 2012), 190.10);
    s2.add(new Month(10, 2012), 181.39);
    s2.add(new Month(11, 2012), 170.08);
    s2.add(new Month(12, 2012), 164.40);
    s2.add(new Month(1, 2013), 169.19);
    s2.add(new Month(2, 2013), 161.70);
    s2.add(new Month(3, 2013), 161.53);

    TimeSeries s3 = new TimeSeries("Other Milds");
    s3.add(new Month(1, 2010), 158.90);
    s3.add(new Month(2, 2010), 157.86);
    s3.add(new Month(3, 2010), 164.50);
    s3.add(new Month(4, 2010), 169.55);
    s3.add(new Month(5, 2010), 173.38);
    s3.add(new Month(6, 2010), 190.90);
    s3.add(new Month(7, 2010), 203.21);
    s3.add(new Month(8, 2010), 211.59);
    s3.add(new Month(9, 2010), 222.71);
    s3.add(new Month(10, 2010), 217.64);
    s3.add(new Month(11, 2010), 233.48);
    s3.add(new Month(12, 2010), 248.17);
    s3.add(new Month(1, 2011), 263.77);
    s3.add(new Month(2, 2011), 287.89);
    s3.add(new Month(3, 2011), 292.07);
    s3.add(new Month(4, 2011), 300.12);
    s3.add(new Month(5, 2011), 291.09);
    s3.add(new Month(6, 2011), 274.98);
    s3.add(new Month(7, 2011), 268.02);
    s3.add(new Month(8, 2011), 270.44);
    s3.add(new Month(9, 2011), 274.88);
    s3.add(new Month(10, 2011), 247.82);
    s3.add(new Month(11, 2011), 245.09);
    s3.add(new Month(12, 2011), 236.71);
    s3.add(new Month(1, 2012), 237.21);
    s3.add(new Month(2, 2012), 224.16);
    s3.add(new Month(3, 2012), 201.26);
    s3.add(new Month(4, 2012), 191.45);
    s3.add(new Month(5, 2012), 184.65);
    s3.add(new Month(6, 2012), 168.69);
    s3.add(new Month(7, 2012), 190.45);
    s3.add(new Month(8, 2012), 174.82);
    s3.add(new Month(9, 2012), 178.98);
    s3.add(new Month(10, 2012), 173.32);
    s3.add(new Month(11, 2012), 159.91);
    s3.add(new Month(12, 2012), 152.74);
    s3.add(new Month(1, 2013), 157.29);
    s3.add(new Month(2, 2013), 149.46);
    s3.add(new Month(3, 2013), 149.78);

    TimeSeries s4 = new TimeSeries("Brazilian Naturals");
    s4.add(new Month(1, 2010), 131.67);
    s4.add(new Month(2, 2010), 124.57);
    s4.add(new Month(3, 2010), 126.21);
    s4.add(new Month(4, 2010), 126.07);
    s4.add(new Month(5, 2010), 127.45);
    s4.add(new Month(6, 2010), 143.20);
    s4.add(new Month(7, 2010), 156.87);
    s4.add(new Month(8, 2010), 163.21);
    s4.add(new Month(9, 2010), 175.15);
    s4.add(new Month(10, 2010), 175.38);
    s4.add(new Month(11, 2010), 190.62);
    s4.add(new Month(12, 2010), 204.25);
    s4.add(new Month(1, 2011), 219.77);
    s4.add(new Month(2, 2011), 247.00);
    s4.add(new Month(3, 2011), 260.98);
    s4.add(new Month(4, 2011), 273.40);
    s4.add(new Month(5, 2011), 268.66);
    s4.add(new Month(6, 2011), 250.59);
    s4.add(new Month(7, 2011), 245.69);
    s4.add(new Month(8, 2011), 249.83);
    s4.add(new Month(9, 2011), 255.64);
    s4.add(new Month(10, 2011), 234.28);
    s4.add(new Month(11, 2011), 236.75);
    s4.add(new Month(12, 2011), 228.79);
    s4.add(new Month(1, 2012), 228.21);
    s4.add(new Month(2, 2012), 215.40);
    s4.add(new Month(3, 2012), 192.03);
    s4.add(new Month(4, 2012), 180.90);
    s4.add(new Month(5, 2012), 174.17);
    s4.add(new Month(6, 2012), 156.17);
    s4.add(new Month(7, 2012), 175.98);
    s4.add(new Month(8, 2012), 160.05);
    s4.add(new Month(9, 2012), 166.53);
    s4.add(new Month(10, 2012), 161.20);
    s4.add(new Month(11, 2012), 148.25);
    s4.add(new Month(12, 2012), 140.69);
    s4.add(new Month(1, 2013), 145.17);
    s4.add(new Month(2, 2013), 136.63);
    s4.add(new Month(3, 2013), 133.61);

    TimeSeries s5 = new TimeSeries("Robustas");
    s5.add(new Month(1, 2010), 69.92);
    s5.add(new Month(2, 2010), 67.88);
    s5.add(new Month(3, 2010), 67.25);
    s5.add(new Month(4, 2010), 71.59);
    s5.add(new Month(5, 2010), 70.70);
    s5.add(new Month(6, 2010), 76.92);
    s5.add(new Month(7, 2010), 85.27);
    s5.add(new Month(8, 2010), 82.68);
    s5.add(new Month(9, 2010), 81.28);
    s5.add(new Month(10, 2010), 85.27);
    s5.add(new Month(11, 2010), 92.04);
    s5.add(new Month(12, 2010), 94.09);
    s5.add(new Month(1, 2011), 101.09);
    s5.add(new Month(2, 2011), 109.35);
    s5.add(new Month(3, 2011), 118.13);
    s5.add(new Month(4, 2011), 117.37);
    s5.add(new Month(5, 2011), 121.98);
    s5.add(new Month(6, 2011), 117.95);
    s5.add(new Month(7, 2011), 112.73);
    s5.add(new Month(8, 2011), 112.07);
    s5.add(new Month(9, 2011), 106.06);
    s5.add(new Month(10, 2011), 98.10);
    s5.add(new Month(11, 2011), 97.24);
    s5.add(new Month(12, 2011), 98.41);
    s5.add(new Month(1, 2012), 96.72);
    s5.add(new Month(2, 2012), 101.93);
    s5.add(new Month(3, 2012), 103.57);
    s5.add(new Month(4, 2012), 101.80);
    s5.add(new Month(5, 2012), 106.88);
    s5.add(new Month(6, 2012), 105.70);
    s5.add(new Month(7, 2012), 107.06);
    s5.add(new Month(8, 2012), 106.52);
    s5.add(new Month(9, 2012), 104.95);
    s5.add(new Month(10, 2012), 104.47);
    s5.add(new Month(11, 2012), 97.67);
    s5.add(new Month(12, 2012), 96.59);
    s5.add(new Month(1, 2013), 99.69);
    s5.add(new Month(2, 2013), 104.03);
    s5.add(new Month(3, 2013), 106.26);

    TimeSeries s6 = new TimeSeries("Futures (London)");
    s6.add(new Month(1, 2010), 62.66);
    s6.add(new Month(2, 2010), 60.37);
    s6.add(new Month(3, 2010), 58.64);
    s6.add(new Month(4, 2010), 62.21);
    s6.add(new Month(5, 2010), 62.46);
    s6.add(new Month(6, 2010), 69.72);
    s6.add(new Month(7, 2010), 78.17);
    s6.add(new Month(8, 2010), 78.42);
    s6.add(new Month(9, 2010), 75.87);
    s6.add(new Month(10, 2010), 80.08);
    s6.add(new Month(11, 2010), 86.40);
    s6.add(new Month(12, 2010), 88.70);
    s6.add(new Month(1, 2011), 96.02);
    s6.add(new Month(2, 2011), 104.53);
    s6.add(new Month(3, 2011), 111.36);
    s6.add(new Month(4, 2011), 111.34);
    s6.add(new Month(5, 2011), 116.76);
    s6.add(new Month(6, 2011), 110.51);
    s6.add(new Month(7, 2011), 103.36);
    s6.add(new Month(8, 2011), 102.71);
    s6.add(new Month(9, 2011), 96.10);
    s6.add(new Month(10, 2011), 88.64);
    s6.add(new Month(11, 2011), 85.78);
    s6.add(new Month(12, 2011), 87.65);
    s6.add(new Month(1, 2012), 84.19);
    s6.add(new Month(2, 2012), 88.69);
    s6.add(new Month(3, 2012), 91.37);
    s6.add(new Month(4, 2012), 91.81);
    s6.add(new Month(5, 2012), 96.82);
    s6.add(new Month(6, 2012), 94.75);
    s6.add(new Month(7, 2012), 96.14);
    s6.add(new Month(8, 2012), 96.12);
    s6.add(new Month(9, 2012), 94.65);
    s6.add(new Month(10, 2012), 94.66);
    s6.add(new Month(11, 2012), 87.32);
    s6.add(new Month(12, 2012), 85.94);
    s6.add(new Month(1, 2013), 88.85);
    s6.add(new Month(2, 2013), 94.41);
    s6.add(new Month(3, 2013), 97.22);

    TimeSeries s7 = new TimeSeries("Futures (New York)");
    s7.add(new Month(1, 2010), 142.76);
    s7.add(new Month(2, 2010), 134.35);
    s7.add(new Month(3, 2010), 134.97);
    s7.add(new Month(4, 2010), 135.12);
    s7.add(new Month(5, 2010), 135.81);
    s7.add(new Month(6, 2010), 152.36);
    s7.add(new Month(7, 2010), 165.23);
    s7.add(new Month(8, 2010), 175.10);
    s7.add(new Month(9, 2010), 187.80);
    s7.add(new Month(10, 2010), 190.43);
    s7.add(new Month(11, 2010), 206.92);
    s7.add(new Month(12, 2010), 221.51);
    s7.add(new Month(1, 2011), 238.05);
    s7.add(new Month(2, 2011), 261.41);
    s7.add(new Month(3, 2011), 274.10);
    s7.add(new Month(4, 2011), 285.58);
    s7.add(new Month(5, 2011), 277.72);
    s7.add(new Month(6, 2011), 262.52);
    s7.add(new Month(7, 2011), 255.90);
    s7.add(new Month(8, 2011), 260.39);
    s7.add(new Month(9, 2011), 261.39);
    s7.add(new Month(10, 2011), 236.74);
    s7.add(new Month(11, 2011), 235.25);
    s7.add(new Month(12, 2011), 227.23);
    s7.add(new Month(1, 2012), 227.50);
    s7.add(new Month(2, 2012), 212.09);
    s7.add(new Month(3, 2012), 188.78);
    s7.add(new Month(4, 2012), 181.75);
    s7.add(new Month(5, 2012), 176.50);
    s7.add(new Month(6, 2012), 159.93);
    s7.add(new Month(7, 2012), 183.20);
    s7.add(new Month(8, 2012), 169.77);
    s7.add(new Month(9, 2012), 175.36);
    s7.add(new Month(10, 2012), 170.43);
    s7.add(new Month(11, 2012), 155.72);
    s7.add(new Month(12, 2012), 149.58);
    s7.add(new Month(1, 2013), 154.28);
    s7.add(new Month(2, 2013), 144.89);
    s7.add(new Month(3, 2013), 141.43);

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(s1);
    dataset.addSeries(s2);
    dataset.addSeries(s3);
    dataset.addSeries(s4);
    dataset.addSeries(s5);
    dataset.addSeries(s6);
    dataset.addSeries(s7);
    return dataset;
}

From source file:org.efs.openreports.engine.ChartReportEngine.java

private static XYDataset createTimeDataset(ChartValue[] values) {
    TimeSeries series = null;
    TimeSeriesCollection seriesCollection = new TimeSeriesCollection();

    for (int i = 0; i < values.length; i++) {
        TimeChartValue value = (TimeChartValue) values[i];

        if (series == null || !series.getKey().equals(value.getSeries())) {
            if (series != null) {
                seriesCollection.addSeries(series);
            }//from w  w  w . j a va2 s  . co m

            series = new TimeSeries(value.getSeries(), Second.class);
        }

        series.add(new Second(value.getTime()), value.getValue());
    }

    seriesCollection.addSeries(series);

    return seriesCollection;
}