Example usage for org.jfree.data.time TimeSeries getTimePeriod

List of usage examples for org.jfree.data.time TimeSeries getTimePeriod

Introduction

In this page you can find the example usage for org.jfree.data.time TimeSeries getTimePeriod.

Prototype

public RegularTimePeriod getTimePeriod(int index) 

Source Link

Document

Returns the time period at the specified index.

Usage

From source file:utilesChart.util.TimeSeriesCollection.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 value./*from ww  w.ja v a 2  s . c  om*/
 */
public synchronized Number getEndX(int series, int item) {
    TimeSeries ts = (TimeSeries) this.data.get(series);
    return new Long(ts.getTimePeriod(item).getLastMillisecond(this.workingCalendar));
}

From source file:utilesChart.util.TimeSeriesCollection.java

/**
 * Returns the x-value (as a double primitive) for an item within a series.
 *
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The x-value./*  w  ww .  j a v a  2s  .  c om*/
 */
public double getXValue(int series, int item) {
    TimeSeries s = (TimeSeries) this.data.get(series);
    RegularTimePeriod period = s.getTimePeriod(item);
    return getX(period);
}

From source file:utilesChart.util.TimeSeriesCollection.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 value./*from  w  w  w  .j  a  v a  2s.c  o m*/
 */
public Number getX(int series, int item) {
    TimeSeries ts = (TimeSeries) this.data.get(series);
    RegularTimePeriod period = ts.getTimePeriod(item);
    return new Long(getX(period));
}

From source file:edu.dlnu.liuwenpeng.Time.TimeSeriesCollection.java

/**    
* Returns the range of the values in this dataset's domain.    
*    /*from  ww w . j  a  v  a  2  s.  co  m*/
* @param includeInterval  a flag that determines whether or not the    
*                         x-interval is taken into account.    
*     
* @return The range.    
*/
public Range getDomainBounds(boolean includeInterval) {
    Range result = null;
    Iterator iterator = this.data.iterator();
    while (iterator.hasNext()) {
        TimeSeries series = (TimeSeries) iterator.next();
        int count = series.getItemCount();
        if (count > 0) {
            RegularTimePeriod start = series.getTimePeriod(0);
            RegularTimePeriod end = series.getTimePeriod(count - 1);
            Range temp;
            //if (!includeInterval) {    
            temp = new Range(getX(start), getX(end));
            //System.out.println("here");
            // }    
            /*  else {    
               temp = new Range(    
                       start.getFirstMillisecond(this.workingCalendar),    
                       end.getLastMillisecond(this.workingCalendar));    
              }    
            */
            result = Range.combine(result, temp);
        }
    }
    return result;
}

From source file:org.jfree.data.time.TimeSeriesCollection.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 value./*from   w w  w  . ja  v a 2 s .c om*/
 */
@Override
public synchronized Number getStartX(int series, int item) {
    TimeSeries ts = (TimeSeries) this.data.get(series);
    return new Long(ts.getTimePeriod(item).getFirstMillisecond(this.workingCalendar));
}

From source file:org.jfree.data.time.TimeSeriesCollection.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 value./*from   www.  ja  va 2 s . com*/
 */
@Override
public synchronized Number getEndX(int series, int item) {
    TimeSeries ts = (TimeSeries) this.data.get(series);
    return new Long(ts.getTimePeriod(item).getLastMillisecond(this.workingCalendar));
}

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

/**
 * Returns the x-value (as a double primitive) for an item within a series.
 *
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The x-value./*from w w  w.jav a  2  s .c  o  m*/
 */
@Override
public double getXValue(int series, int item) {
    TimeSeries s = (TimeSeries) this.data.get(series);
    RegularTimePeriod period = s.getTimePeriod(item);
    return getX(period);
}

From source file:org.jfree.data.time.TimeSeriesCollection.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 value./* w w w. j  av a2s  .  c  om*/
 */
@Override
public Number getX(int series, int item) {
    TimeSeries ts = (TimeSeries) this.data.get(series);
    RegularTimePeriod period = ts.getTimePeriod(item);
    return new Long(getX(period));
}

From source file:utilesChart.util.TimeSeriesCollection.java

/**
 * Returns the bounds of the domain values for the specified series.
 *
 * @param visibleSeriesKeys  a list of keys for the visible series.
 * @param includeInterval  include the x-interval?
 *
 * @return A range.//w w w. j  av a2s  .c  om
 *
 * @since 1.0.13
 */
public Range getDomainBounds(List visibleSeriesKeys, boolean includeInterval) {
    Range result = null;
    Iterator iterator = visibleSeriesKeys.iterator();
    while (iterator.hasNext()) {
        Comparable seriesKey = (Comparable) iterator.next();
        TimeSeries series = getSeries(seriesKey);
        int count = series.getItemCount();
        if (count > 0) {
            RegularTimePeriod start = series.getTimePeriod(0);
            RegularTimePeriod end = series.getTimePeriod(count - 1);
            Range temp;
            if (!includeInterval) {
                temp = new Range(getX(start), getX(end));
            } else {
                temp = new Range(start.getFirstMillisecond(this.workingCalendar),
                        end.getLastMillisecond(this.workingCalendar));
            }
            result = Range.combine(result, temp);
        }
    }
    return result;
}

From source file:utilesChart.util.TimeSeriesCollection.java

/**
 * Returns the range of the values in this dataset's domain.
 *
 * @param includeInterval  a flag that determines whether or not the
 *                         x-interval is taken into account.
 *
 * @return The range./*from  www  . j a  v a2  s.  c o  m*/
 */
public Range getDomainBounds(boolean includeInterval) {
    Range result = null;
    Iterator iterator = this.data.iterator();
    while (iterator.hasNext()) {
        TimeSeries series = (TimeSeries) iterator.next();
        int count = series.getItemCount();
        if (count > 0) {
            RegularTimePeriod start = series.getTimePeriod(0);
            RegularTimePeriod end = series.getTimePeriod(count - 1);
            Range temp;
            if (!includeInterval) {
                temp = new Range(getX(start), getX(end));
            } else {
                temp = new Range(start.getFirstMillisecond(this.workingCalendar),
                        end.getLastMillisecond(this.workingCalendar));
            }
            result = Range.combine(result, temp);
        }
    }
    return result;
}