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;
  }
Exemplo n.º 2
0
  public static void main(String[] args) {
    ChartWindow cw = new ChartWindow("test");

    double[] c1 = new double[100];
    for (int i = 0; i < c1.length; i++) {
      c1[i] = Math.random();
    }

    cw.draw(c1);

    double[] c2 = new double[100];
    for (int i = 0; i < c2.length; i++) {
      c2[i] = Math.random();
    }

    cw.draw(c2);
  }
Exemplo n.º 3
0
    public void actionPerformed(ActionEvent actionevent) {
      for (int i = 0; i < 3; i++)
        if (actionevent.getActionCommand().endsWith(String.valueOf(i))) {
          Millisecond millisecond1 = new Millisecond();
          System.out.println("Now = " + millisecond1.toString());
          lastValue[i] =
              lastValue[i] * (0.90000000000000002D + 0.20000000000000001D * Math.random());
          datasets[i].getSeries(0).add(new Millisecond(), lastValue[i]);
        }

      if (actionevent.getActionCommand().equals("ADD_ALL")) {
        Millisecond millisecond = new Millisecond();
        System.out.println("Now = " + millisecond.toString());
        for (int j = 0; j < 3; j++) {
          lastValue[j] =
              lastValue[j] * (0.90000000000000002D + 0.20000000000000001D * Math.random());
          datasets[j].getSeries(0).add(new Millisecond(), lastValue[j]);
        }
      }
    }
  private static XYDataset createDirectionDataset(int i) {
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    TimeSeries timeseries = new TimeSeries("Wind Direction", org.jfree.data.time.Minute.class);
    Object obj = new Minute();
    double d = 180D;
    for (int j = 0; j < i; j++) {
      timeseries.add(((RegularTimePeriod) (obj)), d);
      obj = ((RegularTimePeriod) (obj)).next();
      d += (Math.random() - 0.5D) * 15D;
      if (d < 0.0D) {
        d += 360D;
        continue;
      }
      if (d > 360D) d -= 360D;
    }

    timeseriescollection.addSeries(timeseries);
    return timeseriescollection;
  }