List of usage examples for org.jfree.data.time TimeSeries add
public void add(RegularTimePeriod period, Number value)
From source file:ChartUsingJava.CombinedXYPlotDemo1.java
/** * Creates a sample dataset. You wouldn't normally hard-code the * population of a dataset in this way (it would be better to read the * values from a file or a database query), but for a self-contained demo * this is the least complicated solution. * * @return The dataset./* w w w . j a v a 2 s. c om*/ */ private static IntervalXYDataset createDataset1() { // create dataset 1... TimeSeries series1 = new TimeSeries("Series 1"); series1.add(new Month(1, 2005), 7627.743); series1.add(new Month(2, 2005), 7713.138); series1.add(new Month(3, 2005), 6776.939); series1.add(new Month(4, 2005), 5764.537); series1.add(new Month(5, 2005), 4777.880); series1.add(new Month(6, 2005), 4836.496); series1.add(new Month(7, 2005), 3887.618); series1.add(new Month(8, 2005), 3926.933); series1.add(new Month(9, 2005), 4932.710); series1.add(new Month(10, 2005), 4027.123); series1.add(new Month(11, 2005), 8092.322); series1.add(new Month(12, 2005), 8170.414); series1.add(new Month(1, 2006), 8196.070); series1.add(new Month(2, 2006), 8269.886); series1.add(new Month(3, 2006), 5371.156); series1.add(new Month(4, 2006), 5355.718); series1.add(new Month(5, 2006), 5356.777); series1.add(new Month(6, 2006), 8420.042); series1.add(new Month(7, 2006), 8444.347); series1.add(new Month(8, 2006), 8515.034); series1.add(new Month(9, 2006), 8506.974); series1.add(new Month(10, 2006), 8584.329); series1.add(new Month(11, 2006), 8633.246); series1.add(new Month(12, 2006), 8680.224); series1.add(new Month(1, 2007), 8707.561); return new TimeSeriesCollection(series1); }
From source file:ChartUsingJava.CombinedXYPlotDemo1.java
/** * Creates a sample dataset. You wouldn't normally hard-code the * population of a dataset in this way (it would be better to read the * values from a file or a database query), but for a self-contained demo * this is the least complicated solution. * * @return A sample dataset./*from ww w . java2 s .c om*/ */ private static IntervalXYDataset createDataset2() { TimeSeriesCollection dataset = new TimeSeriesCollection(); TimeSeries series1 = new TimeSeries("Series 2"); series1.add(new Month(1, 2005), 1200); series1.add(new Month(2, 2005), 1400); series1.add(new Month(3, 2005), 1500); series1.add(new Month(4, 2005), 1700); series1.add(new Month(5, 2005), 1600); series1.add(new Month(6, 2005), 2400); series1.add(new Month(7, 2005), 2100); series1.add(new Month(8, 2005), 2200); series1.add(new Month(9, 2005), 800); series1.add(new Month(10, 2005), 2350); series1.add(new Month(11, 2005), 500); series1.add(new Month(12, 2005), 700); series1.add(new Month(1, 2006), 900); series1.add(new Month(2, 2006), 1500); series1.add(new Month(3, 2006), 2100); series1.add(new Month(4, 2006), 2200); series1.add(new Month(5, 2006), 1900); series1.add(new Month(6, 2006), 3000); series1.add(new Month(7, 2006), 3780); series1.add(new Month(8, 2006), 4000); series1.add(new Month(9, 2006), 4500); series1.add(new Month(10, 2006), 7000); series1.add(new Month(11, 2006), 5500); series1.add(new Month(12, 2006), 6000); series1.add(new Month(1, 2007), 6500); dataset.addSeries(series1); return dataset; }
From source file:com.mxgraph.examples.swing.chart.TimeSeriesChartDemo1.java
/** * Creates a dataset, consisting of two series of monthly data. * * @return The dataset./*ww w . j a v a 2 s.c o m*/ */ public static XYDataset createDataset() { TimeSeries s1 = new TimeSeries("L&G European Index Trust", Second.class); s1.add(new Second(30, new Minute()), 181.8); s1.add(new Second(10, new Minute()), 151.8); s1.add(new Second(20, new Minute()), 167.8); s1.add(new Second(37, new Minute()), 155.8); s1.add(new Second(45, new Minute()), 166.8); s1.add(new Second(24, new Minute()), 144.8); s1.add(new Second(6, new Minute()), 181.8); /* s1.add(new Second(1,1,1,1,3, 2001), 167.3); s1.add(new Second(3,3,3,3,4, 2001), 153.8); s1.add(new Second(5,5,5,5,5, 2001), 167.6); s1.add(new Second(6,6,6,6,6, 2001), 158.8); s1.add(new Second(7,7,7,7,7, 2001), 148.3); s1.add(new Second(8,8,8,8,8, 2001), 153.9); s1.add(new Second(9,9,9,9,9, 2001), 142.7); s1.add(new Second(10,10,8,8,8, 2001), 123.2); s1.add(new Second(1,1,1,1,11, 2001), 131.8); s1.add(new Second(1,2,3,4,12, 2001), 139.6); s1.add(new Second(5,2,4,2,1, 2002), 142.9); s1.add(new Second(5,6,5,6,2, 2002), 138.7);*/ // ****************************************************************** // 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); return dataset; }
From source file:org.jfree.experimental.chart.demo.XYTitleAnnotationDemo1.java
/** * Creates a dataset, consisting of two series of monthly data. * * @return The dataset./*ww w . j a v a 2s .c o m*/ */ private static XYDataset createDataset() { TimeSeries s1 = new TimeSeries("L&G European Index Trust", Month.class); 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", Month.class); 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:org.hxzon.demo.jfreechart.DatasetVisibleDemo.java
private static XYDataset createDataset() { TimeSeries s1 = new TimeSeries(series1Name); s1.add(new Month(1, 2001), 181.8); s1.add(new Month(2, 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(9, 2001), 148.3); s1.add(new Month(10, 2001), 153.9); s1.add(new Month(11, 2001), 142.7); s1.add(new Month(12, 2001), 123.2); s1.add(new Month(1, 2002), 131.8); s1.add(new Month(2, 2002), 139.6); s1.add(new Month(3, 2002), 142.9); s1.add(new Month(4, 2002), 138.7); s1.add(new Month(6, 2002), 137.3); s1.add(new Month(7, 2002), 143.9); s1.add(new Month(8, 2002), 139.8); s1.add(new Month(9, 2002), 137.0); s1.add(new Month(10, 2002), 132.8); TimeSeries s2 = new TimeSeries(series2Name); 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(series3Name); s3.add(new Month(2, 2001), 1129.6); s3.add(new Month(3, 2001), 1123.2); s3.add(new Month(4, 2001), 1117.2); s3.add(new Month(5, 2001), 1124.1); s3.add(new Month(6, 2001), 1122.6); s3.add(new Month(7, 2001), 1119.2); s3.add(new Month(8, 2001), 1116.5); s3.add(new Month(9, 2001), 1112.7); s3.add(new Month(10, 2001), 1101.5); s3.add(new Month(11, 2001), 1106.1); s3.add(new Month(12, 2001), 1110.3); s3.add(new Month(1, 2002), 1111.7); s3.add(new Month(2, 2002), 1111.0); s3.add(new Month(3, 2002), 1109.6); s3.add(new Month(4, 2002), 1113.2); s3.add(new Month(5, 2002), 1111.6); s3.add(new Month(6, 2002), 1108.8); s3.add(new Month(7, 2002), 1101.6); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(s3);/* ww w .java 2 s . c om*/ dataset.addSeries(s2); dataset.addSeries(s1); return dataset; }
From source file:Operacional.Janela2.java
private static IntervalXYDataset createDataset() { TimeSeries timeseries = new TimeSeries("Recebimento", "Year", "Count"); try {// w w w . j a va 2 s. c o m timeseries.add(new Month(12, 1975), new Integer(1)); timeseries.add(new Month(11, 1975), new Integer(1)); timeseries.add(new Month(10, 1975), new Integer(1)); timeseries.add(new Month(9, 1975), new Integer(1)); } catch (Exception exception) { System.err.println(exception.getMessage()); } TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries); //timeseriescollection.setDomainIsPointsInTime(false); return timeseriescollection; }
From source file:cn.edu.thss.iise.bpmdemo.charts.SWTMultipleAxisDemo1.java
/** * Creates a sample dataset./*from w ww .j av a 2 s . c o m*/ * * @param name * the dataset name. * @param base * the starting value. * @param start * the starting period. * @param count * the number of values to generate. * * @return The dataset. */ private static XYDataset createDataset(String name, double base, RegularTimePeriod start, int count) { TimeSeries series = new TimeSeries(name); RegularTimePeriod period = start; double value = base; for (int i = 0; i < count; i++) { series.add(period, value); period = period.next(); value = value * (1 + (Math.random() - 0.495) / 10.0); } TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(series); return dataset; }
From source file:TimeSeriesChartDemo1.java
/** * Creates a dataset, consisting of two series of monthly data. * * @return The dataset./* ww w . ja v a2 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);*/ // ****************************************************************** // 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); return dataset; }
From source file:org.jfree.chart.demo.PriceVolumeDemo2.java
private static IntervalXYDataset createVolumeDataset() { TimeSeries timeseries = new TimeSeries("Volume"); timeseries.add(new Day(12, 4, 2007), 49646800D); timeseries.add(new Day(13, 4, 2007), 67319300D); timeseries.add(new Day(16, 4, 2007), 56840200D); timeseries.add(new Day(17, 4, 2007), 40752300D); timeseries.add(new Day(18, 4, 2007), 42533800D); timeseries.add(new Day(19, 4, 2007), 34232100D); timeseries.add(new Day(20, 4, 2007), 32437600D); timeseries.add(new Day(23, 4, 2007), 28755900D); timeseries.add(new Day(24, 4, 2007), 74503300D); timeseries.add(new Day(25, 4, 2007), 322214000D); timeseries.add(new Day(26, 4, 2007), 96141700D); timeseries.add(new Day(27, 4, 2007), 62326200D); timeseries.add(new Day(30, 4, 2007), 52334400D); timeseries.add(new Day(1, 5, 2007), 133096100D); timeseries.add(new Day(2, 5, 2007), 93874500D); timeseries.add(new Day(3, 5, 2007), 101011400D); timeseries.add(new Day(4, 5, 2007), 56629700D); timeseries.add(new Day(7, 5, 2007), 43302200D); timeseries.add(new Day(8, 5, 2007), 51456500D); timeseries.add(new Day(9, 5, 2007), 48230900D); timeseries.add(new Day(10, 5, 2007), 65536000D); timeseries.add(new Day(11, 5, 2007), 46469700D); timeseries.add(new Day(14, 5, 2007), 118580000D); timeseries.add(new Day(15, 5, 2007), 50774100D); timeseries.add(new Day(16, 5, 2007), 44590200D); timeseries.add(new Day(17, 5, 2007), 125482500D); timeseries.add(new Day(18, 5, 2007), 49987500D); timeseries.add(new Day(21, 5, 2007), 48387400D); timeseries.add(new Day(22, 5, 2007), 67992600D); timeseries.add(new Day(23, 5, 2007), 45629200D); timeseries.add(new Day(24, 5, 2007), 123288600D); timeseries.add(new Day(25, 5, 2007), 47345300D); timeseries.add(new Day(29, 5, 2007), 90454000D); timeseries.add(new Day(30, 5, 2007), 73049200D); timeseries.add(new Day(31, 5, 2007), 60395400D); timeseries.add(new Day(1, 6, 2007), 48792300D); timeseries.add(new Day(4, 6, 2007), 109972800D); timeseries.add(new Day(5, 6, 2007), 198201200D); timeseries.add(new Day(6, 6, 2007), 121415700D); timeseries.add(new Day(7, 6, 2007), 56637400D); timeseries.add(new Day(8, 6, 2007), 64116600D); timeseries.add(new Day(11, 6, 2007), 60274800D); timeseries.add(new Day(12, 6, 2007), 93451300D); timeseries.add(new Day(13, 6, 2007), 103309000D); timeseries.add(new Day(14, 6, 2007), 103135400D); timeseries.add(new Day(15, 6, 2007), 104415900D); timeseries.add(new Day(18, 6, 2007), 51506900D); timeseries.add(new Day(19, 6, 2007), 74592100D); timeseries.add(new Day(20, 6, 2007), 69027600D); timeseries.add(new Day(21, 6, 2007), 97212500D); timeseries.add(new Day(22, 6, 2007), 51612000D); timeseries.add(new Day(25, 6, 2007), 63845400D); timeseries.add(new Day(26, 6, 2007), 84818400D); timeseries.add(new Day(27, 6, 2007), 73512900D); timeseries.add(new Day(28, 6, 2007), 75275100D); timeseries.add(new Day(29, 6, 2007), 104203900D); timeseries.add(new Day(2, 7, 2007), 66540400D); timeseries.add(new Day(3, 7, 2007), 28520800D); timeseries.add(new Day(5, 7, 2007), 47176300D); timeseries.add(new Day(6, 7, 2007), 70084800D); timeseries.add(new Day(9, 7, 2007), 91630800D); timeseries.add(new Day(10, 7, 2007), 114071700D); timeseries.add(new Day(11, 7, 2007), 34217900D); timeseries.add(new Day(12, 7, 2007), 30298000D); timeseries.add(new Day(13, 7, 2007), 40423500D); timeseries.add(new Day(16, 7, 2007), 39238000D); return new TimeSeriesCollection(timeseries); }
From source file:org.jfree.chart.demo.DifferenceChartDemo1.java
private static XYDataset createDataset() { TimeSeries timeseries = new TimeSeries("Random 1"); TimeSeries timeseries1 = new TimeSeries("Random 2"); double d = 0.0D; double d1 = 0.0D; Day day = new Day(); for (int i = 0; i < 200; i++) { d = (d + Math.random()) - 0.5D; d1 = (d1 + Math.random()) - 0.5D; timeseries.add(day, d); timeseries1.add(day, d1);// w w w.jav a2 s . c o m day = (Day) day.next(); } TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(); timeseriescollection.addSeries(timeseries); timeseriescollection.addSeries(timeseries1); return timeseriescollection; }