예제 #1
0
 /**
  * This method adds the specified stream elements to the timeSeries of the appropriate plot.
  *
  * @param streamElement
  */
 public synchronized void addData(StreamElement streamElement) {
   for (int i = 0; i < streamElement.getFieldNames().length; i++) {
     TimeSeries timeSeries = dataForTheChart.get(streamElement.getFieldNames()[i]);
     if (timeSeries == null) {
       dataForTheChart.put(
           streamElement.getFieldNames()[i],
           timeSeries =
               new TimeSeries(
                   streamElement.getFieldNames()[i], org.jfree.data.time.FixedMillisecond.class));
       timeSeries.setMaximumItemCount(historySize);
       dataCollectionForTheChart.addSeries(timeSeries);
     }
     try {
       timeSeries.addOrUpdate(
           new FixedMillisecond(new Date(streamElement.getTimeStamp())),
           Double.parseDouble(streamElement.getData()[i].toString()));
     } catch (SeriesException e) {
       logger.warn(e.getMessage(), e);
     }
   }
   changed = true;
 }