List of usage examples for org.jfree.data.time TimeSeries add
public void add(RegularTimePeriod period, Number value)
From source file:org.jfree.chart.demo.ClusteredXYBarRendererDemo1.java
private static IntervalXYDataset createDataset() { TimeSeries timeseries = new TimeSeries("Series 1"); timeseries.add(new Day(1, 1, 2003), 54.299999999999997D); timeseries.add(new Day(2, 1, 2003), 20.300000000000001D); timeseries.add(new Day(3, 1, 2003), 43.399999999999999D); timeseries.add(new Day(4, 1, 2003), -12D); TimeSeries timeseries1 = new TimeSeries("Series 2"); timeseries1.add(new Day(1, 1, 2003), 8D); timeseries1.add(new Day(2, 1, 2003), 16D); timeseries1.add(new Day(3, 1, 2003), 21D); timeseries1.add(new Day(4, 1, 2003), 5D); TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(); timeseriescollection.addSeries(timeseries); timeseriescollection.addSeries(timeseries1); return timeseriescollection; }
From source file:org.jfree.chart.demo.CompareToPreviousYearDemo.java
private static XYDataset createDataset2007() { TimeSeries timeseries = new TimeSeries("Sales 2007"); timeseries.add(new Month(1, 2007), 163.90000000000001D); timeseries.add(new Month(2, 2007), 163.80000000000001D); timeseries.add(new Month(3, 2007), 162D); timeseries.add(new Month(4, 2007), 167.09999999999999D); timeseries.add(new Month(5, 2007), 170D); timeseries.add(new Month(6, 2007), 175.69999999999999D); timeseries.add(new Month(7, 2007), 171.90000000000001D); TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(); timeseriescollection.addSeries(timeseries); timeseriescollection.setXPosition(TimePeriodAnchor.MIDDLE); return timeseriescollection; }
From source file:carbon.plot.PlotTimeSeries.java
public static void PlotTS(int yr, double[] ppm, int years, String chartOutput) { TimeSeries carbon = new TimeSeries("Carbon"); for (int i = 0; i < years; i++) { carbon.add(new Year(yr + i), ppm[i]); }//w ww.j a va 2s. c o m TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(carbon); JFreeChart chart = ChartFactory.createTimeSeriesChart("Atmospheric CO2 concentration", "Year", "CO2 (ppm)", dataset, false, true, true); try { File plot = new File(chartOutput); ChartUtilities.saveChartAsJPEG(plot, chart, 500, 300); new DisplayImage(chartOutput); } catch (IOException e) { System.err.println("Problem creating chart."); } }
From source file:org.jfree.chart.demo.CompareToPreviousYearDemo.java
private static XYDataset createDataset2006() { TimeSeries timeseries = new TimeSeries("Sales 2006"); timeseries.add(new Month(1, 2006), 100D); timeseries.add(new Month(2, 2006), 102.3D); timeseries.add(new Month(3, 2006), 105.7D); timeseries.add(new Month(4, 2006), 104.2D); timeseries.add(new Month(5, 2006), 114.7D); timeseries.add(new Month(6, 2006), 121.7D); timeseries.add(new Month(7, 2006), 155.59999999999999D); timeseries.add(new Month(8, 2006), 143.19999999999999D); timeseries.add(new Month(9, 2006), 131.90000000000001D); timeseries.add(new Month(10, 2006), 120D); timeseries.add(new Month(11, 2006), 109.90000000000001D); timeseries.add(new Month(12, 2006), 99.599999999999994D); TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(); timeseriescollection.addSeries(timeseries); timeseriescollection.setXPosition(TimePeriodAnchor.MIDDLE); return timeseriescollection; }
From source file:org.jfree.chart.demo.PeriodAxisDemo2.java
private static XYDataset createDataset() { TimeSeries timeseries = new TimeSeries("L&G European Index Trust"); timeseries.add(new Day(24, 1, 2004), 181.80000000000001D); timeseries.add(new Day(25, 1, 2004), 167.30000000000001D); timeseries.add(new Day(26, 1, 2004), 153.80000000000001D); timeseries.add(new Day(27, 1, 2004), 167.59999999999999D); timeseries.add(new Day(28, 1, 2004), 158.80000000000001D); timeseries.add(new Day(29, 1, 2004), 148.30000000000001D); timeseries.add(new Day(30, 1, 2004), 153.90000000000001D); timeseries.add(new Day(31, 1, 2004), 142.69999999999999D); timeseries.add(new Day(1, 2, 2004), 123.2D); timeseries.add(new Day(2, 2, 2004), 131.80000000000001D); timeseries.add(new Day(3, 2, 2004), 139.59999999999999D); timeseries.add(new Day(4, 2, 2004), 142.90000000000001D); timeseries.add(new Day(5, 2, 2004), 138.69999999999999D); timeseries.add(new Day(6, 2, 2004), 137.30000000000001D); timeseries.add(new Day(7, 2, 2004), 143.90000000000001D); timeseries.add(new Day(8, 2, 2004), 139.80000000000001D); timeseries.add(new Day(9, 2, 2004), 137D); timeseries.add(new Day(10, 2, 2004), 132.80000000000001D); TimeZone timezone = TimeZone.getTimeZone("Pacific/Auckland"); TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timezone); timeseriescollection.addSeries(timeseries); timeseriescollection.setXPosition(TimePeriodAnchor.MIDDLE); return timeseriescollection; }
From source file:org.jfree.chart.demo.XYTaskDatasetDemo2.java
private static XYDataset createDataset1() { TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(); TimeSeries timeseries = new TimeSeries("Time Series 1"); timeseries.add(new Hour(0, new Day()), 20214.5D); timeseries.add(new Hour(4, new Day()), 73346.5D); timeseries.add(new Hour(8, new Day()), 54643.599999999999D); timeseries.add(new Hour(12, new Day()), 92683.800000000003D); timeseries.add(new Hour(16, new Day()), 110235.39999999999D); timeseries.add(new Hour(20, new Day()), 120742.5D); timeseries.add(new Hour(24, new Day()), 90654.5D); timeseriescollection.addSeries(timeseries); return timeseriescollection; }
From source file:org.jfree.chart.demo.MarkerDemo2.java
private static XYDataset createDataset() { TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(); TimeSeries timeseries = new TimeSeries("Temperature"); timeseries.add(new Hour(0, 30, 6, 2005), 45.299999999999997D); timeseries.add(new Hour(1, 30, 6, 2005), 48.899999999999999D); timeseries.add(new Hour(2, 30, 6, 2005), 52.100000000000001D); timeseries.add(new Hour(3, 30, 6, 2005), 44.799999999999997D); timeseries.add(new Hour(4, 30, 6, 2005), 49.899999999999999D); timeseries.add(new Hour(5, 30, 6, 2005), 55.5D); timeseries.add(new Hour(6, 30, 6, 2005), 58.200000000000003D); timeseries.add(new Hour(7, 30, 6, 2005), 58.100000000000001D); timeseries.add(new Hour(8, 30, 6, 2005), 63.700000000000003D); timeseries.add(new Hour(9, 30, 6, 2005), 66.299999999999997D); timeseries.add(new Hour(10, 30, 6, 2005), 69.799999999999997D); timeseries.add(new Hour(11, 30, 6, 2005), 70.099999999999994D); timeseries.add(new Hour(12, 30, 6, 2005), 72.400000000000006D); timeseries.add(new Hour(13, 30, 6, 2005), 69.700000000000003D); timeseries.add(new Hour(14, 30, 6, 2005), 68.599999999999994D); timeseries.add(new Hour(15, 30, 6, 2005), 70.900000000000006D); timeseries.add(new Hour(16, 30, 6, 2005), 73.400000000000006D); timeseries.add(new Hour(17, 30, 6, 2005), 77.5D); timeseries.add(new Hour(18, 30, 6, 2005), 82.900000000000006D); timeseries.add(new Hour(19, 30, 6, 2005), 62.100000000000001D); timeseries.add(new Hour(20, 30, 6, 2005), 37.299999999999997D); timeseries.add(new Hour(21, 30, 6, 2005), 40.700000000000003D); timeseries.add(new Hour(22, 30, 6, 2005), 44.200000000000003D); timeseries.add(new Hour(23, 30, 6, 2005), 49.799999999999997D); timeseriescollection.addSeries(timeseries); return timeseriescollection; }
From source file:org.jfree.chart.demo.XYDrawableAnnotationDemo1.java
private static XYDataset createDataset() { TimeSeries timeseries = new TimeSeries("Division A"); timeseries.add(new Year(2005), 1520D); timeseries.add(new Year(2006), 1132D); timeseries.add(new Year(2007), 450D); timeseries.add(new Year(2008), 620D); TimeSeries timeseries1 = new TimeSeries("Division B"); timeseries1.add(new Year(2005), 1200D); timeseries1.add(new Year(2006), 1300D); timeseries1.add(new Year(2007), 640D); timeseries1.add(new Year(2008), 520D); TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(); timeseriescollection.addSeries(timeseries); timeseriescollection.addSeries(timeseries1); return timeseriescollection; }
From source file:org.jfree.chart.demo.QuarterDateFormatDemo.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); return timeseriescollection; }
From source file:org.jfree.chart.demo.XYBarChartDemo5.java
private static IntervalXYDataset createDataset() { TimeSeries timeseries = new TimeSeries("Budget", "Year", "$ Million"); try {/*from w w w .j av a 2 s. c o m*/ timeseries.add(new Year(1980), -74D); timeseries.add(new Year(1981), -79D); timeseries.add(new Year(1982), -128D); timeseries.add(new Year(1983), -208D); timeseries.add(new Year(1984), -185D); timeseries.add(new Year(1985), -212D); timeseries.add(new Year(1986), -221D); timeseries.add(new Year(1987), -150D); timeseries.add(new Year(1988), -155D); timeseries.add(new Year(1989), -153D); timeseries.add(new Year(1990), -221D); timeseries.add(new Year(1991), -269D); timeseries.add(new Year(1992), -290D); timeseries.add(new Year(1993), -255D); timeseries.add(new Year(1994), -203D); timeseries.add(new Year(1995), -164D); timeseries.add(new Year(1996), -107D); timeseries.add(new Year(1997), -22D); timeseries.add(new Year(1998), 69D); timeseries.add(new Year(1999), 126D); timeseries.add(new Year(2000), 236D); timeseries.add(new Year(2001), 128D); timeseries.add(new Year(2002), -158D); timeseries.add(new Year(2003), -378D); timeseries.add(new Year(2004), -412D); } catch (Exception exception) { System.err.println(exception.getMessage()); } TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries); return timeseriescollection; }