コード例 #1
0
ファイル: ChartDataSet.java プロジェクト: trungpv88/gama
 public void addDataSource(ChartDataSource source) {
   sources.add(source);
   LinkedHashMap<String, ChartDataSeries> newseries = source.getSeries();
   for (Entry<String, ChartDataSeries> entry : newseries.entrySet()) {
     // should do something... raise an exception?
     addNewSerie(entry.getKey(), entry.getValue(), -1);
   }
   //		series.putAll(source.getSeries());
 }
コード例 #2
0
ファイル: ChartDataSet.java プロジェクト: trungpv88/gama
  public void updatedataset(IScope scope, int chartCycle) {
    // TODO Auto-generated method stub

    commonXindex++;
    commonYindex++;
    if (didReload(scope, chartCycle)) {
      BackwardSim(scope, chartCycle);
    }
    updateXValues(scope, chartCycle);
    updateYValues(scope, chartCycle);

    if (commonXindex >= this.getXSeriesValues().size())
      commonXindex = this.getXSeriesValues().size() - 1;
    if (commonYindex >= this.getYSeriesValues().size())
      commonYindex = this.getYSeriesValues().size() - 1;

    for (ChartDataSource source : sources) {
      source.updatevalues(scope, chartCycle);
      source.savehistory(scope, history);
    }
    history.append(Strings.LN);
  }
コード例 #3
0
ファイル: ChartDataSet.java プロジェクト: trungpv88/gama
  public void BackwardSim(IScope scope, int chartCycle) {
    this.setResetAllBefore(chartCycle);
    ArrayList<ChartDataSource> sourcestoremove = new ArrayList<ChartDataSource>();
    ArrayList<ChartDataSource> sourcestoadd = new ArrayList<ChartDataSource>();
    for (ChartDataSource source : sources) {
      if (source.isCumulative || source.isCumulativeY) {

        ChartDataSource newsource = source.getClone(scope, chartCycle);
        newsource.createInitialSeries(scope);
        sourcestoremove.add(source);
        sourcestoadd.add(newsource);
      }
    }
    for (ChartDataSource source : sourcestoremove) {
      sources.remove(source);
    }
    for (ChartDataSource source : sourcestoadd) {
      this.addDataSource(source);
    }
    if (this.getXSeriesValues().size() > 0) {
      ArrayList<Double> ser = this.getXSeriesValues();
      for (int i = 0; i < this.getXSeriesValues().size(); i++) {
        if (ser.get(i) == chartCycle - 1) {
          this.commonXindex = i;
        }
      }
    }
    if (this.getYSeriesValues().size() > 0) {
      ArrayList<Double> sery = this.getYSeriesValues();
      for (int i = 0; i < this.getYSeriesValues().size(); i++) {
        if (sery.get(i) == chartCycle - 1) {
          this.commonYindex = i;
        }
      }
    }
  }