Example #1
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();
      }
    }
  }
Example #2
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());
    }
  }
Example #3
0
  /**
   * actually recalculates the first average (necessary when we change the average settings)
   *
   * @param d
   */
  public void recalculateAverage1() {

    // average1=new TimeSeries("av1", FixedMillisecond.class);
    average1.delete(0, average1.getItemCount() - 1);

    for (int z = 0; z < x1.getItemCount(); z++) {
      try {
        double v = 0;

        // List l1=x1.getItems();

        for (int i = z; i < z + av1; i++) {
          v += x1.getValue(x1.getItemCount() - (av1 - i)).doubleValue();
        }
        average1.add(x1.getTimePeriod(z), v / av1);

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