Exemplo n.º 1
0
  /**
   * Called when one of the sliding window size or step values has changed. This attempts to be
   * 'smart' and instead of recalculating everything from scratch,
   */
  private void newWindowSizeAction() {
    if (sgSeriesMap == null) return;

    XYSeries data;
    int windowSize = (Integer) windowSizeSpinner.getValue();
    int windowStep = (Integer) windowStepSpinner.getValue();
    int tot = 0;

    for (AbstractSeries series : chart.getAllSeries()) {
      if (series instanceof BaseCounterSeries) {
        BaseCounterSeries bcSer = (BaseCounterSeries) series;
        BaseCounter bc = bcSer.getCalculator();
        int partitionIndex = bcSer.getPartitionIndex();
        // System.out.println("Replacing series for calc with name : " + bcSer.getName() + " and
        // partition : " + bcSer.getPartitionIndex());
        if (partitionIndex > -1) {
          bcSer.replaceSeries(bc.getWindowPointSeries(windowSize, windowStep, partitionIndex));
        } else bcSer.replaceSeries(bc.getWindowPointSeries(windowSize, windowStep));
      } else {
        // System.err.println("Hmm, one of the series (" + series.getName() + ") is not a
        // basecounter, cannot recalculate it for the new window size.");/
      }
    }

    chart.repaint();
  }
Exemplo n.º 2
0
 /**
  * You guessed it..remove from the chart all series that are a) baseCounters, and b), have the
  * baseCounter name of calcName. This happens when the user toggles off the check box associated
  * with the named calculator.
  *
  * @param calcName
  */
 public void removeSeriesByCalculatorName(String calcName) {
   List<AbstractSeries> activeSeries = chart.getAllSeries();
   for (AbstractSeries series : activeSeries) {
     if (series instanceof BaseCounterSeries) {
       String name = ((BaseCounterSeries) series).getCalculator().getName();
       if (name.equals(calcName)) {
         chart.removeSeries(series);
       }
     }
   }
 }
Exemplo n.º 3
0
 /**
  * Remove all series associated with the class specified
  *
  * @param toRemove
  */
 public void removeSeriesByClass(Class toRemove) {
   List<AbstractSeries> activeSeries = chart.getAllSeries();
   for (AbstractSeries series : activeSeries) {
     if (series instanceof BaseCounterSeries) {
       BaseCounter bc = ((BaseCounterSeries) series).getCalculator();
       if (bc.getClass() == toRemove) {
         chart.removeSeries(series);
       }
     }
   }
 }