Example usage for org.jfree.data.time TimePeriodValue getPeriod

List of usage examples for org.jfree.data.time TimePeriodValue getPeriod

Introduction

In this page you can find the example usage for org.jfree.data.time TimePeriodValue getPeriod.

Prototype

public TimePeriod getPeriod() 

Source Link

Document

Returns the time period.

Usage

From source file:org.jfree.data.time.TimePeriodValuesCollection.java

/**
 * Returns the starting X value for the specified series and item.
 *
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The starting X value for the specified series and item.
 *//*from ww  w. ja v a 2  s  .  c o  m*/
@Override
public Number getStartX(int series, int item) {
    TimePeriodValues ts = (TimePeriodValues) this.data.get(series);
    TimePeriodValue dp = ts.getDataItem(item);
    return new Long(dp.getPeriod().getStart().getTime());
}

From source file:org.jfree.data.time.TimePeriodValuesCollection.java

/**
 * 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.
 *///  w ww.j a va 2s .c  o m
@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());
}

From source file:org.jfree.data.time.TimePeriodValuesCollection.java

/**
 * 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.
 *///w  ww .ja v a  2  s  .c  o  m
@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));
}

From source file:org.jfree.data.time.TimePeriodValues.java

/**
 * Recalculates the bounds for the collection of items.
 *///from  w w w.  j a va 2 s .  com
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);
    }
}

From source file:org.jfree.data.time.TimePeriodValues.java

/**
 * Adds a data item to the series and sends a {@link SeriesChangeEvent} to
 * all registered listeners.// ww  w .ja  v  a 2  s.co  m
 *
 * @param item  the item (<code>null</code> not permitted).
 */
public void add(TimePeriodValue item) {
    ParamChecks.nullNotPermitted(item, "item");
    this.data.add(item);
    updateBounds(item.getPeriod(), this.data.size() - 1);
    fireSeriesChanged();
}

From source file:org.jfree.data.time.TimePeriodValues.java

/**
 * Adds a data item to the series and sends a {@link SeriesChangeEvent} to
 * all registered listeners./*from w  w  w .  ja  v  a 2  s. com*/
 *
 * @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();
}