Пример #1
0
  /** Adds a series to the chart */
  public void addSeries(String varName, String label) {
    XYSeries s = new XYSeries(label, false);
    SeriesInfo info = new SeriesInfo(varName, label, s, null);
    series.add(info);
    dataset.addSeries(s);

    info.register(dataFilter);
  }
Пример #2
0
  /** Adds a series to the chart */
  public void addSeries(UserFunction uf, String label) {
    XYSeries s = new XYSeries(label, false);
    Function f = new Function(uf);

    SeriesInfo info = new SeriesInfo(null, label, s, f);
    series.add(info);
    dataset.addSeries(s);

    info.register(dataFilter);
  }
Пример #3
0
  /** Consumes data */
  public void consume(DataRow row) {
    if (row.getState().isInitialState()) reset();

    long tick = row.getState().getTick();

    for (SeriesInfo info : series) {
      try {
        Double newValue = info.getValue(row);
        if (newValue == null) continue;

        if (pieData != null) {
          pieData.setValue(info.label, newValue);
        } else {
          info.addValue(tick, newValue);
        }
      } catch (Exception e) {
        // e.printStackTrace();
      }
    }
  }
Пример #4
0
 /** Resets all data */
 public synchronized void reset() {
   // dataset.removeAllSeries();
   for (SeriesInfo info : series) {
     info.clear();
   }
 }