/**
  * Returns the x-value for the specified series and item.
  *
  * @param series the series (zero-based index).
  * @param item the item (zero-based index).
  * @return The x-value for the specified series and item.
  */
 @Override
 public Number getX(int series, int item) {
   TimePeriodValues ts = (TimePeriodValues) this.data.get(series);
   TimePeriodValue dp = ts.getDataItem(item);
   TimePeriod period = dp.getPeriod();
   return new Long(getX(period));
 }
 /**
  * Adds a data item to the series and sends a {@link SeriesChangeEvent} to all registered
  * listeners.
  *
  * @param item the item (<code>null</code> not permitted).
  */
 public void add(TimePeriodValue item) {
   if (item == null) {
     throw new IllegalArgumentException("Null item not allowed.");
   }
   this.data.add(item);
   updateBounds(item.getPeriod(), this.data.size() - 1);
   fireSeriesChanged();
 }
 /** Recalculates the bounds for the collection of items. */
 private void recalculateBounds() {
   this.minStartIndex = -1;
   this.minMiddleIndex = -1;
   this.minEndIndex = -1;
   this.maxStartIndex = -1;
   this.maxMiddleIndex = -1;
   this.maxEndIndex = -1;
   for (int i = 0; i < this.data.size(); i++) {
     TimePeriodValue tpv = (TimePeriodValue) this.data.get(i);
     updateBounds(tpv.getPeriod(), i);
   }
 }
 /**
  * Returns the ending X value for the specified series and item.
  *
  * @param series the series (zero-based index).
  * @param item the item (zero-based index).
  * @return The ending X value for the specified series and item.
  */
 @Override
 public Number getEndX(int series, int item) {
   TimePeriodValues ts = (TimePeriodValues) this.data.get(series);
   TimePeriodValue dp = ts.getDataItem(item);
   return new Long(dp.getPeriod().getEnd().getTime());
 }