📄 demodatasetfactory.java
字号:
*/ public static TimeSeriesCollection createTimeSeriesCollection2() { final TimeSeriesCollection data = new TimeSeriesCollection(); data.addSeries(createJPYTimeSeries()); return data; } /** * Creates a time series collection containing USD/GBP and EUR/GBP exchange rates. * * @return a sample time series collection. */ public static TimeSeriesCollection createTimeSeriesCollection3() { final TimeSeriesCollection collection = new TimeSeriesCollection(); collection.addSeries(createUSDTimeSeries()); collection.addSeries(createEURTimeSeries()); return collection; } /** * Returns a time series dataset using millisecond data. * * @return a sample time series collection. */ public static TimeSeriesCollection createTimeSeriesCollection4() { final TimeSeries t4 = new TimeSeries("Test", "Millisecond", "Value", FixedMillisecond.class); final Date now = new Date(); try { t4.add(new FixedMillisecond(now.getTime() + 0), new Double(50.1)); t4.add(new FixedMillisecond(now.getTime() + 1), new Double(12.3)); t4.add(new FixedMillisecond(now.getTime() + 2), new Double(23.9)); t4.add(new FixedMillisecond(now.getTime() + 3), new Double(83.4)); t4.add(new FixedMillisecond(now.getTime() + 4), new Double(34.7)); t4.add(new FixedMillisecond(now.getTime() + 5), new Double(76.5)); t4.add(new FixedMillisecond(now.getTime() + 6), new Double(150.0)); t4.add(new FixedMillisecond(now.getTime() + 7), new Double(414.7)); t4.add(new FixedMillisecond(now.getTime() + 8), new Double(1500.9)); t4.add(new FixedMillisecond(now.getTime() + 9), new Double(4530.6)); t4.add(new FixedMillisecond(now.getTime() + 10), new Double(7337.2)); t4.add(new FixedMillisecond(now.getTime() + 11), new Double(9117.1)); } catch (Exception e) { System.err.println(e.getMessage()); } return new TimeSeriesCollection(t4); } /** * Returns a time series of the daily USD/GBP exchange rates in 2001 (to date), for use in * the JFreeChart demonstration application. * <P> * You wouldn't normally create a time series in this way. Typically, values would * be read from a database. * * @return a time series. * */ public static TimeSeries createUSDTimeSeries() { final TimeSeries t1 = new TimeSeries("USD/GBP"); try { t1.add(new Day(2, MonthConstants.JANUARY, 2001), 1.4956); t1.add(new Day(3, MonthConstants.JANUARY, 2001), new Double(1.5047)); t1.add(new Day(4, MonthConstants.JANUARY, 2001), new Double(1.4931)); t1.add(new Day(5, MonthConstants.JANUARY, 2001), new Double(1.4955)); t1.add(new Day(8, MonthConstants.JANUARY, 2001), new Double(1.4994)); t1.add(new Day(9, MonthConstants.JANUARY, 2001), new Double(1.4911)); t1.add(new Day(10, MonthConstants.JANUARY, 2001), new Double(1.4903)); t1.add(new Day(11, MonthConstants.JANUARY, 2001), new Double(1.4947)); t1.add(new Day(12, MonthConstants.JANUARY, 2001), new Double(1.4784)); t1.add(new Day(15, MonthConstants.JANUARY, 2001), new Double(1.4787)); t1.add(new Day(16, MonthConstants.JANUARY, 2001), new Double(1.4702)); t1.add(new Day(17, MonthConstants.JANUARY, 2001), new Double(1.4729)); t1.add(new Day(18, MonthConstants.JANUARY, 2001), new Double(1.4760)); t1.add(new Day(19, MonthConstants.JANUARY, 2001), new Double(1.4685)); t1.add(new Day(22, MonthConstants.JANUARY, 2001), new Double(1.4609)); t1.add(new Day(23, MonthConstants.JANUARY, 2001), new Double(1.4709)); t1.add(new Day(24, MonthConstants.JANUARY, 2001), new Double(1.4576)); t1.add(new Day(25, MonthConstants.JANUARY, 2001), new Double(1.4589)); t1.add(new Day(26, MonthConstants.JANUARY, 2001), new Double(1.4568)); t1.add(new Day(29, MonthConstants.JANUARY, 2001), new Double(1.4566)); t1.add(new Day(30, MonthConstants.JANUARY, 2001), new Double(1.4604)); t1.add(new Day(31, MonthConstants.JANUARY, 2001), new Double(1.4616)); t1.add(new Day(1, MonthConstants.FEBRUARY, 2001), new Double(1.4777)); t1.add(new Day(2, MonthConstants.FEBRUARY, 2001), new Double(1.4687)); t1.add(new Day(5, MonthConstants.FEBRUARY, 2001), new Double(1.4753)); t1.add(new Day(6, MonthConstants.FEBRUARY, 2001), new Double(1.4605)); t1.add(new Day(7, MonthConstants.FEBRUARY, 2001), new Double(1.4619)); t1.add(new Day(8, MonthConstants.FEBRUARY, 2001), new Double(1.4453)); t1.add(new Day(9, MonthConstants.FEBRUARY, 2001), new Double(1.4463)); t1.add(new Day(12, MonthConstants.FEBRUARY, 2001), new Double(1.4521)); t1.add(new Day(13, MonthConstants.FEBRUARY, 2001), new Double(1.4517)); t1.add(new Day(14, MonthConstants.FEBRUARY, 2001), new Double(1.4601)); t1.add(new Day(15, MonthConstants.FEBRUARY, 2001), new Double(1.4500)); t1.add(new Day(16, MonthConstants.FEBRUARY, 2001), new Double(1.4517)); t1.add(new Day(19, MonthConstants.FEBRUARY, 2001), new Double(1.4459)); t1.add(new Day(20, MonthConstants.FEBRUARY, 2001), new Double(1.4449)); t1.add(new Day(21, MonthConstants.FEBRUARY, 2001), new Double(1.4447)); t1.add(new Day(22, MonthConstants.FEBRUARY, 2001), new Double(1.4465)); t1.add(new Day(23, MonthConstants.FEBRUARY, 2001), new Double(1.4487)); t1.add(new Day(26, MonthConstants.FEBRUARY, 2001), new Double(1.4417)); t1.add(new Day(27, MonthConstants.FEBRUARY, 2001), new Double(1.4420)); t1.add(new Day(28, MonthConstants.FEBRUARY, 2001), new Double(1.4421)); t1.add(new Day(1, MonthConstants.MARCH, 2001), new Double(1.4547)); t1.add(new Day(2, MonthConstants.MARCH, 2001), new Double(1.4741)); t1.add(new Day(5, MonthConstants.MARCH, 2001), new Double(1.4686)); t1.add(new Day(6, MonthConstants.MARCH, 2001), new Double(1.4667)); t1.add(new Day(7, MonthConstants.MARCH, 2001), new Double(1.4618)); t1.add(new Day(8, MonthConstants.MARCH, 2001), new Double(1.4685)); t1.add(new Day(9, MonthConstants.MARCH, 2001), new Double(1.4677)); t1.add(new Day(12, MonthConstants.MARCH, 2001), new Double(1.4660)); t1.add(new Day(13, MonthConstants.MARCH, 2001), new Double(1.4526)); t1.add(new Day(14, MonthConstants.MARCH, 2001), new Double(1.4483)); t1.add(new Day(15, MonthConstants.MARCH, 2001), new Double(1.4441)); t1.add(new Day(16, MonthConstants.MARCH, 2001), new Double(1.4303)); t1.add(new Day(19, MonthConstants.MARCH, 2001), new Double(1.4259)); t1.add(new Day(20, MonthConstants.MARCH, 2001), new Double(1.4283)); t1.add(new Day(21, MonthConstants.MARCH, 2001), new Double(1.4293)); t1.add(new Day(22, MonthConstants.MARCH, 2001), new Double(1.4192)); t1.add(new Day(23, MonthConstants.MARCH, 2001), new Double(1.4293)); t1.add(new Day(26, MonthConstants.MARCH, 2001), new Double(1.4334)); t1.add(new Day(27, MonthConstants.MARCH, 2001), new Double(1.4371)); t1.add(new Day(28, MonthConstants.MARCH, 2001), new Double(1.4347)); t1.add(new Day(29, MonthConstants.MARCH, 2001), new Double(1.4362)); t1.add(new Day(30, MonthConstants.MARCH, 2001), new Double(1.4217)); t1.add(new Day(2, MonthConstants.APRIL, 2001), new Double(1.4205)); t1.add(new Day(3, MonthConstants.APRIL, 2001), new Double(1.4270)); t1.add(new Day(4, MonthConstants.APRIL, 2001), new Double(1.4333)); t1.add(new Day(5, MonthConstants.APRIL, 2001), new Double(1.4287)); t1.add(new Day(6, MonthConstants.APRIL, 2001), new Double(1.4395)); t1.add(new Day(9, MonthConstants.APRIL, 2001), new Double(1.4494)); t1.add(new Day(10, MonthConstants.APRIL, 2001), new Double(1.4385)); t1.add(new Day(11, MonthConstants.APRIL, 2001), new Double(1.4348)); t1.add(new Day(12, MonthConstants.APRIL, 2001), new Double(1.4402)); t1.add(new Day(17, MonthConstants.APRIL, 2001), new Double(1.4314)); t1.add(new Day(18, MonthConstants.APRIL, 2001), new Double(1.4197)); t1.add(new Day(19, MonthConstants.APRIL, 2001), new Double(1.4365)); t1.add(new Day(20, MonthConstants.APRIL, 2001), new Double(1.4416)); t1.add(new Day(23, MonthConstants.APRIL, 2001), new Double(1.4396)); t1.add(new Day(24, MonthConstants.APRIL, 2001), new Double(1.4360)); t1.add(new Day(25, MonthConstants.APRIL, 2001), new Double(1.4397)); t1.add(new Day(26, MonthConstants.APRIL, 2001), new Double(1.4402)); t1.add(new Day(27, MonthConstants.APRIL, 2001), new Double(1.4366)); t1.add(new Day(30, MonthConstants.APRIL, 2001), new Double(1.4309)); t1.add(new Day(1, MonthConstants.MAY, 2001), new Double(1.4324)); t1.add(new Day(2, MonthConstants.MAY, 2001), new Double(1.4336)); t1.add(new Day(3, MonthConstants.MAY, 2001), new Double(1.4329)); t1.add(new Day(4, MonthConstants.MAY, 2001), new Double(1.4375)); t1.add(new Day(8, MonthConstants.MAY, 2001), new Double(1.4321)); t1.add(new Day(9, MonthConstants.MAY, 2001), new Double(1.4219)); t1.add(new Day(10, MonthConstants.MAY, 2001), new Double(1.4226)); t1.add(new Day(11, MonthConstants.MAY, 2001), new Double(1.4199)); t1.add(new Day(14, MonthConstants.MAY, 2001), new Double(1.4183)); t1.add(new Day(15, MonthConstants.MAY, 2001), new Double(1.4218)); t1.add(new Day(16, MonthConstants.MAY, 2001), new Double(1.4295)); t1.add(new Day(17, MonthConstants.MAY, 2001), new Double(1.4296)); t1.add(new Day(18, MonthConstants.MAY, 2001), new Double(1.4296)); t1.add(new Day(21, MonthConstants.MAY, 2001), new Double(1.4366)); t1.add(new Day(22, MonthConstants.MAY, 2001), new Double(1.4283)); t1.add(new Day(23, MonthConstants.MAY, 2001), new Double(1.4244)); t1.add(new Day(24, MonthConstants.MAY, 2001), new Double(1.4102)); t1.add(new Day(25, MonthConstants.MAY, 2001), new Double(1.4205)); t1.add(new Day(29, MonthConstants.MAY, 2001), new Double(1.4183)); t1.add(new Day(30, MonthConstants.MAY, 2001), new Double(1.4230)); t1.add(new Day(31, MonthConstants.MAY, 2001), new Double(1.4201)); t1.add(new Day(1, MonthConstants.JUNE, 2001), new Double(1.4148)); t1.add(new Day(4, MonthConstants.JUNE, 2001), new Double(1.4142)); t1.add(new Day(5, MonthConstants.JUNE, 2001), new Double(1.4095)); t1.add(new Day(6, MonthConstants.JUNE, 2001), new Double(1.3938)); t1.add(new Day(7, MonthConstants.JUNE, 2001), new Double(1.3886)); t1.add(new Day(8, MonthConstants.JUNE, 2001), new Double(1.3798)); t1.add(new Day(11, MonthConstants.JUNE, 2001), new Double(1.3726)); t1.add(new Day(12, MonthConstants.JUNE, 2001), new Double(1.3788)); t1.add(new Day(13, MonthConstants.JUNE, 2001), new Double(1.3878)); t1.add(new Day(14, MonthConstants.JUNE, 2001), new Double(1.4002)); t1.add(new Day(15, MonthConstants.JUNE, 2001), new Double(1.4033)); t1.add(new Day(18, MonthConstants.JUNE, 2001), new Double(1.4038)); t1.add(new Day(19, MonthConstants.JUNE, 2001), new Double(1.4023)); t1.add(new Day(20, MonthConstants.JUNE, 2001), new Double(1.3952)); t1.add(new Day(21, MonthConstants.JUNE, 2001), new Double(1.4142)); t1.add(new Day(22, MonthConstants.JUNE, 2001), new Double(1.4114)); t1.add(new Day(25, MonthConstants.JUNE, 2001), new Double(1.4141)); t1.add(new Day(26, MonthConstants.JUNE, 2001), new Double(1.4157)); t1.add(new Day(27, MonthConstants.JUNE, 2001), new Double(1.4136)); t1.add(new Day(28, MonthConstants.JUNE, 2001), new Double(1.4089)); t1.add(new Day(29, MonthConstants.JUNE, 2001), new Double(1.4066)); t1.add(new Day(2, MonthConstants.JULY, 2001), new Double(1.4154));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -