/** Some checks for the removeAgedItems() method. */
  @Test
  public void testRemoveAgedItems() {
    TimeSeries series = new TimeSeries("Test Series", Year.class);
    series.addChangeListener(this);
    assertEquals(Long.MAX_VALUE, series.getMaximumItemAge());
    assertEquals(Integer.MAX_VALUE, series.getMaximumItemCount());
    this.gotSeriesChangeEvent = false;

    // test empty series
    series.removeAgedItems(true);
    assertEquals(0, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);

    // test series with one item
    series.add(new Year(1999), 1.0);
    series.setMaximumItemAge(0);
    this.gotSeriesChangeEvent = false;
    series.removeAgedItems(true);
    assertEquals(1, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);

    // test series with two items
    series.setMaximumItemAge(10);
    series.add(new Year(2001), 2.0);
    this.gotSeriesChangeEvent = false;
    series.setMaximumItemAge(2);
    assertEquals(2, series.getItemCount());
    assertEquals(0, series.getIndex(new Year(1999)));
    assertFalse(this.gotSeriesChangeEvent);
    series.setMaximumItemAge(1);
    assertEquals(1, series.getItemCount());
    assertEquals(0, series.getIndex(new Year(2001)));
    assertTrue(this.gotSeriesChangeEvent);
  }
  /** Basic tests for the delete() method. */
  @Test
  public void testDelete2() {
    TimeSeries s1 = new TimeSeries("Series", Year.class);
    s1.add(new Year(2000), 13.75);
    s1.add(new Year(2001), 11.90);
    s1.add(new Year(2002), null);
    s1.addChangeListener(this);
    this.gotSeriesChangeEvent = false;
    s1.delete(new Year(2001));
    assertTrue(this.gotSeriesChangeEvent);
    assertEquals(2, s1.getItemCount());
    assertEquals(null, s1.getValue(new Year(2001)));

    // try deleting a time period that doesn't exist...
    this.gotSeriesChangeEvent = false;
    s1.delete(new Year(2006));
    assertFalse(this.gotSeriesChangeEvent);

    // try deleting null
    try {
      s1.delete(null);
      fail("Expected IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
      // expected
    }
  }
Esempio n. 3
0
  public Chart(String filename) {
    try {
      // Get Stock Symbol
      this.stockSymbol = filename.substring(0, filename.indexOf('.'));

      // Create time series
      TimeSeries open = new TimeSeries("Open Price", Day.class);
      TimeSeries close = new TimeSeries("Close Price", Day.class);
      TimeSeries high = new TimeSeries("High", Day.class);
      TimeSeries low = new TimeSeries("Low", Day.class);
      TimeSeries volume = new TimeSeries("Volume", Day.class);

      BufferedReader br = new BufferedReader(new FileReader(filename));
      String key = br.readLine();
      String line = br.readLine();
      while (line != null && !line.startsWith("<!--")) {
        StringTokenizer st = new StringTokenizer(line, ",", false);
        Day day = getDay(st.nextToken());
        double openValue = Double.parseDouble(st.nextToken());
        double highValue = Double.parseDouble(st.nextToken());
        double lowValue = Double.parseDouble(st.nextToken());
        double closeValue = Double.parseDouble(st.nextToken());
        long volumeValue = Long.parseLong(st.nextToken());

        // Add this value to our series'
        open.add(day, openValue);
        close.add(day, closeValue);
        high.add(day, highValue);
        low.add(day, lowValue);

        // Read the next day
        line = br.readLine();
      }

      // Build the datasets
      dataset.addSeries(open);
      dataset.addSeries(close);
      dataset.addSeries(low);
      dataset.addSeries(high);
      datasetOpenClose.addSeries(open);
      datasetOpenClose.addSeries(close);
      datasetHighLow.addSeries(high);
      datasetHighLow.addSeries(low);

      JFreeChart summaryChart = buildChart(dataset, "Summary", true);
      JFreeChart openCloseChart = buildChart(datasetOpenClose, "Open/Close Data", false);
      JFreeChart highLowChart = buildChart(datasetHighLow, "High/Low Data", true);
      JFreeChart highLowDifChart =
          buildDifferenceChart(datasetHighLow, "High/Low Difference Chart");

      // Create this panel
      this.setLayout(new GridLayout(2, 2));
      this.add(new ChartPanel(summaryChart));
      this.add(new ChartPanel(openCloseChart));
      this.add(new ChartPanel(highLowChart));
      this.add(new ChartPanel(highLowDifChart));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 /** Serialize an instance, restore it, and check for equality. */
 @Test
 public void testSerialization() {
   TimeSeries s1 = new TimeSeries("A test");
   s1.add(new Year(2000), 13.75);
   s1.add(new Year(2001), 11.90);
   s1.add(new Year(2002), null);
   s1.add(new Year(2005), 19.32);
   s1.add(new Year(2007), 16.89);
   TimeSeries s2 = (TimeSeries) TestUtilities.serialised(s1);
   assertTrue(s1.equals(s2));
 }
 /**
  * Check that the item bounds are determined correctly when there is a maximum item count and a
  * new value is added.
  */
 @Test
 public void testAdd() {
   TimeSeries s1 = new TimeSeries("S1");
   s1.setMaximumItemCount(2);
   s1.add(new Year(2010), 1.1);
   s1.add(new Year(2011), 2.2);
   s1.add(new Year(2012), 3.3);
   assertEquals(2, s1.getItemCount());
   assertEquals(2.2, s1.getMinY(), EPSILON);
   assertEquals(3.3, s1.getMaxY(), EPSILON);
 }
 /**
  * Check that the item bounds are determined correctly when there is a maximum item count and a
  * new value is added.
  */
 @Test
 public void testDelete_RegularTimePeriod() {
   TimeSeries s1 = new TimeSeries("S1");
   s1.add(new Year(2010), 1.1);
   s1.add(new Year(2011), 2.2);
   s1.add(new Year(2012), 3.3);
   s1.add(new Year(2013), 4.4);
   s1.delete(new Year(2010));
   s1.delete(new Year(2013));
   assertEquals(2.2, s1.getMinY(), EPSILON);
   assertEquals(3.3, s1.getMaxY(), EPSILON);
 }
 /** A test for the bug report 1075255. */
 @Test
 public void testBug1075255() {
   TimeSeries ts = new TimeSeries("dummy");
   ts.add(new FixedMillisecond(0L), 0.0);
   TimeSeries ts2 = new TimeSeries("dummy2");
   ts2.add(new FixedMillisecond(0L), 1.0);
   try {
     ts.addAndOrUpdate(ts2);
   } catch (Exception e) {
     fail("No exceptions should be thrown.");
   }
   assertEquals(1, ts.getItemCount());
 }
 /** Check that the item bounds are determined correctly after a call to removeAgedItems(). */
 @Test
 public void testRemoveAgedItems5() {
   TimeSeries s1 = new TimeSeries("S1");
   s1.setMaximumItemAge(4);
   s1.add(new Year(2010), 1.1);
   s1.add(new Year(2011), 2.2);
   s1.add(new Year(2012), 3.3);
   s1.add(new Year(2013), 2.5);
   s1.removeAgedItems(new Year(2015).getMiddleMillisecond(), true);
   assertEquals(3, s1.getItemCount());
   assertEquals(2.2, s1.getMinY(), EPSILON);
   assertEquals(3.3, s1.getMaxY(), EPSILON);
 }
  /** Some simple checks for the hashCode() method. */
  @Test
  public void testHashCode() {
    TimeSeries s1 = new TimeSeries("Test");
    TimeSeries s2 = new TimeSeries("Test");
    assertEquals(s1, s2);
    assertEquals(s1.hashCode(), s2.hashCode());

    s1.add(new Day(1, 1, 2007), 500.0);
    s2.add(new Day(1, 1, 2007), 500.0);
    assertEquals(s1, s2);
    assertEquals(s1.hashCode(), s2.hashCode());

    s1.add(new Day(2, 1, 2007), null);
    s2.add(new Day(2, 1, 2007), null);
    assertEquals(s1, s2);
    assertEquals(s1.hashCode(), s2.hashCode());

    s1.add(new Day(5, 1, 2007), 111.0);
    s2.add(new Day(5, 1, 2007), 111.0);
    assertEquals(s1, s2);
    assertEquals(s1.hashCode(), s2.hashCode());

    s1.add(new Day(9, 1, 2007), 1.0);
    s2.add(new Day(9, 1, 2007), 1.0);
    assertEquals(s1, s2);
    assertEquals(s1.hashCode(), s2.hashCode());
  }
 /** Some checks for the update(RegularTimePeriod...method). */
 @Test
 public void testUpdate_RegularTimePeriod() {
   TimeSeries s1 = new TimeSeries("S1");
   s1.add(new Year(2010), 1.1);
   s1.add(new Year(2011), 2.2);
   s1.add(new Year(2012), 3.3);
   s1.update(new Year(2012), 4.4);
   assertEquals(4.4, s1.getMaxY(), EPSILON);
   s1.update(new Year(2010), 0.5);
   assertEquals(0.5, s1.getMinY(), EPSILON);
   s1.update(new Year(2012), null);
   assertEquals(2.2, s1.getMaxY(), EPSILON);
   s1.update(new Year(2010), null);
   assertEquals(2.2, s1.getMinY(), EPSILON);
 }
  /** Another test of the clone() method. */
  @Test
  public void testClone2() throws CloneNotSupportedException {
    TimeSeries s1 = new TimeSeries("S1", Year.class);
    s1.add(new Year(2007), 100.0);
    s1.add(new Year(2008), null);
    s1.add(new Year(2009), 200.0);
    TimeSeries s2 = (TimeSeries) s1.clone();
    assertTrue(s1.equals(s2));

    // check independence
    s2.addOrUpdate(new Year(2009), 300.0);
    assertFalse(s1.equals(s2));
    s1.addOrUpdate(new Year(2009), 300.0);
    assertTrue(s1.equals(s2));
  }
  /** Some checks for the getDataItem(int) method. */
  @Test
  public void testGetDataItem1() {
    TimeSeries series = new TimeSeries("S", Year.class);

    // can't get anything yet...just an exception
    boolean pass = false;
    try {
      /*TimeSeriesDataItem item =*/ series.getDataItem(0);
    } catch (IndexOutOfBoundsException e) {
      pass = true;
    }
    assertTrue(pass);

    series.add(new Year(2006), 100.0);
    TimeSeriesDataItem item = series.getDataItem(0);
    assertEquals(new Year(2006), item.getPeriod());
    pass = false;
    try {
      /*item = */ series.getDataItem(-1);
    } catch (IndexOutOfBoundsException e) {
      pass = true;
    }
    assertTrue(pass);

    pass = false;
    try {
      /*item = */ series.getDataItem(1);
    } catch (IndexOutOfBoundsException e) {
      pass = true;
    }
    assertTrue(pass);
  }
 /** Some checks for the delete(int, int) method. */
 @Test
 public void testDelete3() {
   TimeSeries s1 = new TimeSeries("S1");
   s1.add(new Year(2011), 1.1);
   s1.add(new Year(2012), 2.2);
   s1.add(new Year(2013), 3.3);
   s1.add(new Year(2014), 4.4);
   s1.add(new Year(2015), 5.5);
   s1.add(new Year(2016), 6.6);
   s1.delete(2, 5);
   assertEquals(2, s1.getItemCount());
   assertEquals(new Year(2011), s1.getTimePeriod(0));
   assertEquals(new Year(2012), s1.getTimePeriod(1));
   assertEquals(1.1, s1.getMinY(), EPSILON);
   assertEquals(2.2, s1.getMaxY(), EPSILON);
 }
  /**
   * Test the setMaximumItemCount() method to ensure that it removes items from the series if
   * necessary.
   */
  @Test
  public void testSetMaximumItemCount() {
    TimeSeries s1 = new TimeSeries("S1", Year.class);
    s1.add(new Year(2000), 13.75);
    s1.add(new Year(2001), 11.90);
    s1.add(new Year(2002), null);
    s1.add(new Year(2005), 19.32);
    s1.add(new Year(2007), 16.89);
    assertTrue(s1.getItemCount() == 5);

    s1.setMaximumItemCount(3);
    assertTrue(s1.getItemCount() == 3);
    TimeSeriesDataItem item = s1.getDataItem(0);
    assertTrue(item.getPeriod().equals(new Year(2002)));
    assertEquals(16.89, s1.getMinY(), EPSILON);
    assertEquals(19.32, s1.getMaxY(), EPSILON);
  }
  // Updates the average if it's past time to measure.
  private void tick(long time) {
    long oldOffset = tickOffset.get();
    long newOffset = time / tick;
    long offsetDiff = newOffset - oldOffset;

    if (offsetDiff > 0L && tickOffset.compareAndSet(oldOffset, newOffset)) {
      double oldAverage = total.getAndSet(0.0) / tick;

      for (long i = 0L, size = offsetDiff - 1L; i < size; ++i) {
        currentAverage += alpha * (0L - currentAverage);
        averages.add(currentAverage * 1e9);
      }

      currentAverage += alpha * (oldAverage - currentAverage);
      averages.add(currentAverage * 1e9);
    }
  }
  /** Some checks for the getIndex() method. */
  @Test
  public void testGetIndex() {
    TimeSeries series = new TimeSeries("Series", Month.class);
    assertEquals(-1, series.getIndex(new Month(1, 2003)));

    series.add(new Month(1, 2003), 45.0);
    assertEquals(0, series.getIndex(new Month(1, 2003)));
    assertEquals(-1, series.getIndex(new Month(12, 2002)));
    assertEquals(-2, series.getIndex(new Month(2, 2003)));

    series.add(new Month(3, 2003), 55.0);
    assertEquals(-1, series.getIndex(new Month(12, 2002)));
    assertEquals(0, series.getIndex(new Month(1, 2003)));
    assertEquals(-2, series.getIndex(new Month(2, 2003)));
    assertEquals(1, series.getIndex(new Month(3, 2003)));
    assertEquals(-3, series.getIndex(new Month(4, 2003)));
  }
  /**
   * Checks that the min and max y values are updated correctly when copying a subset.
   *
   * @throws java.lang.CloneNotSupportedException
   */
  @Test
  public void testCreateCopy3() throws CloneNotSupportedException {
    TimeSeries s1 = new TimeSeries("S1");
    s1.add(new Year(2009), 100.0);
    s1.add(new Year(2010), 101.0);
    s1.add(new Year(2011), 102.0);
    assertEquals(100.0, s1.getMinY(), EPSILON);
    assertEquals(102.0, s1.getMaxY(), EPSILON);

    TimeSeries s2 = s1.createCopy(0, 1);
    assertEquals(100.0, s2.getMinY(), EPSILON);
    assertEquals(101.0, s2.getMaxY(), EPSILON);

    TimeSeries s3 = s1.createCopy(1, 2);
    assertEquals(101.0, s3.getMinY(), EPSILON);
    assertEquals(102.0, s3.getMaxY(), EPSILON);
  }
Esempio n. 18
0
 public void actionPerformed(ActionEvent actionevent) {
   if (actionevent.getActionCommand().equals("ADD_DATA")) {
     double d = 0.90000000000000002D + 0.20000000000000001D * Math.random();
     lastValue = lastValue * d;
     Millisecond millisecond = new Millisecond();
     System.out.println("Now = " + millisecond.toString());
     series.add(new Millisecond(), lastValue);
   }
 }
 /**
  * Create a TimeSeriesDataItem, add it to a TimeSeries. Now, modifying the original
  * TimeSeriesDataItem should NOT affect the TimeSeries.
  */
 @Test
 public void testAdd_TimeSeriesDataItem() {
   TimeSeriesDataItem item = new TimeSeriesDataItem(new Year(2009), 1.0);
   TimeSeries series = new TimeSeries("S1");
   series.add(item);
   assertTrue(item.equals(series.getDataItem(0)));
   item.setValue(new Double(99.9));
   assertFalse(item.equals(series.getDataItem(0)));
 }
  /** A test for bug 1832432. */
  @Test
  public void testBug1832432() throws CloneNotSupportedException {
    TimeSeries s1 = new TimeSeries("Series");
    TimeSeries s2 = (TimeSeries) s1.clone();
    assertTrue(s1 != s2);
    assertTrue(s1.getClass() == s2.getClass());
    assertTrue(s1.equals(s2));

    // test independence
    s1.add(new Day(1, 1, 2007), 100.0);
    assertFalse(s1.equals(s2));
  }
  /** Some checks for the removeAgedItems(long, boolean) method. */
  @Test
  public void testRemoveAgedItems2() {
    long y2006 = 1157087372534L; // milliseconds somewhere in 2006
    TimeSeries series = new TimeSeries("Test Series", Year.class);
    series.addChangeListener(this);
    assertEquals(Long.MAX_VALUE, series.getMaximumItemAge());
    assertEquals(Integer.MAX_VALUE, series.getMaximumItemCount());
    this.gotSeriesChangeEvent = false;

    // test empty series
    series.removeAgedItems(y2006, true);
    assertEquals(0, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);

    // test a series with 1 item
    series.add(new Year(2004), 1.0);
    series.setMaximumItemAge(1);
    this.gotSeriesChangeEvent = false;
    series.removeAgedItems(new Year(2005).getMiddleMillisecond(), true);
    assertEquals(1, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);
    series.removeAgedItems(y2006, true);
    assertEquals(0, series.getItemCount());
    assertTrue(this.gotSeriesChangeEvent);

    // test a series with two items
    series.setMaximumItemAge(2);
    series.add(new Year(2003), 1.0);
    series.add(new Year(2005), 2.0);
    assertEquals(2, series.getItemCount());
    this.gotSeriesChangeEvent = false;
    assertEquals(2, series.getItemCount());

    series.removeAgedItems(new Year(2005).getMiddleMillisecond(), true);
    assertEquals(2, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);
    series.removeAgedItems(y2006, true);
    assertEquals(1, series.getItemCount());
    assertTrue(this.gotSeriesChangeEvent);
  }
 /** Test for bug report 1864222. */
 @Test
 public void testBug1864222() {
   TimeSeries s = new TimeSeries("S");
   s.add(new Day(19, 8, 2005), 1);
   s.add(new Day(31, 1, 2006), 1);
   boolean pass = true;
   try {
     s.createCopy(new Day(1, 12, 2005), new Day(18, 1, 2006));
   } catch (CloneNotSupportedException e) {
     pass = false;
   }
   assertTrue(pass);
 }
  /** Tests the equals method. */
  @Test
  public void testEquals() {
    TimeSeries s1 = new TimeSeries("Time Series 1");
    TimeSeries s2 = new TimeSeries("Time Series 2");
    boolean b1 = s1.equals(s2);
    assertFalse("b1", b1);

    s2.setKey("Time Series 1");
    boolean b2 = s1.equals(s2);
    assertTrue("b2", b2);

    RegularTimePeriod p1 = new Day();
    RegularTimePeriod p2 = p1.next();
    s1.add(p1, 100.0);
    s1.add(p2, 200.0);
    boolean b3 = s1.equals(s2);
    assertFalse("b3", b3);

    s2.add(p1, 100.0);
    s2.add(p2, 200.0);
    boolean b4 = s1.equals(s2);
    assertTrue("b4", b4);

    s1.setMaximumItemCount(100);
    boolean b5 = s1.equals(s2);
    assertFalse("b5", b5);

    s2.setMaximumItemCount(100);
    boolean b6 = s1.equals(s2);
    assertTrue("b6", b6);

    s1.setMaximumItemAge(100);
    boolean b7 = s1.equals(s2);
    assertFalse("b7", b7);

    s2.setMaximumItemAge(100);
    boolean b8 = s1.equals(s2);
    assertTrue("b8", b8);
  }
  /** A test for the clear method. */
  @Test
  public void testClear() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.add(new Year(2009), 1.1);
    s1.add(new Year(2010), 2.2);

    assertEquals(2, s1.getItemCount());

    s1.clear();
    assertEquals(0, s1.getItemCount());
    assertTrue(Double.isNaN(s1.getMinY()));
    assertTrue(Double.isNaN(s1.getMaxY()));
  }
Esempio n. 25
0
  public void draw(double[] v) {
    TimeSeries data = new TimeSeries("symbol", FixedMillisecond.class);
    dataset1.addSeries(data);

    for (int i = 0; i < v.length; i++) {
      try {
        data.add(new FixedMillisecond(i), v[i]);
      } catch (Exception e) {
        System.out.println("Unresolved error");
        // e.printStackTrace();
      }
    }
  }
  private static XYDataset createForceDataset(int i) {
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    TimeSeries timeseries = new TimeSeries("Wind Force", org.jfree.data.time.Minute.class);
    Object obj = new Minute();
    double d = 3D;
    for (int j = 0; j < i; j++) {
      timeseries.add(((RegularTimePeriod) (obj)), d);
      obj = ((RegularTimePeriod) (obj)).next();
      d = Math.max(0.5D, d + (Math.random() - 0.5D) * 0.5D);
    }

    timeseriescollection.addSeries(timeseries);
    return timeseriescollection;
  }
  /** Some checks for the getMaxY() method. */
  @Test
  public void testGetMaxY() {
    TimeSeries s1 = new TimeSeries("S1");
    assertTrue(Double.isNaN(s1.getMaxY()));

    s1.add(new Year(2008), 1.1);
    assertEquals(1.1, s1.getMaxY(), EPSILON);

    s1.add(new Year(2009), 2.2);
    assertEquals(2.2, s1.getMaxY(), EPSILON);

    s1.add(new Year(2000), 99.9);
    assertEquals(99.9, s1.getMaxY(), EPSILON);

    s1.add(new Year(2002), -1.1);
    assertEquals(99.9, s1.getMaxY(), EPSILON);

    s1.add(new Year(2003), null);
    assertEquals(99.9, s1.getMaxY(), EPSILON);

    s1.addOrUpdate(new Year(2000), null);
    assertEquals(2.2, s1.getMaxY(), EPSILON);
  }
 private static XYDataset createDataset2B() {
   TimeSeries timeseries = new TimeSeries("Series 2B");
   timeseries.add(new Day(3, 3, 2002), 43.899999999999999D);
   timeseries.add(new Day(4, 3, 2002), 72.599999999999994D);
   timeseries.add(new Day(5, 3, 2002), 89.400000000000006D);
   timeseries.add(new Day(6, 3, 2002), 23.800000000000001D);
   timeseries.add(new Day(7, 3, 2002), 45D);
   timeseries.add(new Day(8, 3, 2002), 65.799999999999997D);
   timeseries.add(new Day(9, 3, 2002), 92.099999999999994D);
   timeseries.add(new Day(10, 3, 2002), 84.700000000000003D);
   timeseries.add(new Day(11, 3, 2002), 77.200000000000003D);
   timeseries.add(new Day(12, 3, 2002), 65.099999999999994D);
   timeseries.add(new Day(13, 3, 2002), 78.5D);
   timeseries.add(new Day(14, 3, 2002), 75.299999999999997D);
   timeseries.add(new Day(15, 3, 2002), 69.900000000000006D);
   timeseries.add(new Day(20, 3, 2002), 56.600000000000001D);
   TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries);
   timeseriescollection.setXPosition(TimePeriodAnchor.MIDDLE);
   return timeseriescollection;
 }
 private static XYDataset createDataset2A() {
   TimeSeries timeseries = new TimeSeries("Series 2");
   timeseries.add(new Day(3, 3, 2002), 16853.200000000001D);
   timeseries.add(new Day(4, 3, 2002), 19642.299999999999D);
   timeseries.add(new Day(5, 3, 2002), 18253.5D);
   timeseries.add(new Day(6, 3, 2002), 15352.299999999999D);
   timeseries.add(new Day(7, 3, 2002), 13532D);
   timeseries.add(new Day(8, 3, 2002), 12635.299999999999D);
   timeseries.add(new Day(9, 3, 2002), 13998.200000000001D);
   timeseries.add(new Day(10, 3, 2002), 11943.200000000001D);
   timeseries.add(new Day(11, 3, 2002), 16943.900000000001D);
   timeseries.add(new Day(12, 3, 2002), 17843.200000000001D);
   timeseries.add(new Day(13, 3, 2002), 16495.299999999999D);
   timeseries.add(new Day(14, 3, 2002), 17943.599999999999D);
   timeseries.add(new Day(15, 3, 2002), 18500.700000000001D);
   timeseries.add(new Day(16, 3, 2002), 19595.900000000001D);
   TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries);
   timeseriescollection.setXPosition(TimePeriodAnchor.MIDDLE);
   return timeseriescollection;
 }
Esempio n. 30
0
  public void calcAverage1(int d, Date timestamp) {
    try {
      double v = 0;

      // List l1=x1.getItems();

      for (int i = d; i < d + av1; i++) {
        v += x1.getValue(x1.getItemCount() - (av1 - i)).doubleValue();
      }
      average1.add(new FixedMillisecond(timestamp), v / av1);

    } catch (Exception e) {
      // e.printStackTrace();
      // System.out.println(timestamp.toString());
    }
  }