org.progeeks.jfreechart
Class TimeSeriesDatasetProducer

java.lang.Object
  extended by org.progeeks.jfreechart.MetaDatasetProducer
      extended by org.progeeks.jfreechart.XYDatasetProducer
          extended by org.progeeks.jfreechart.TimeSeriesDatasetProducer
All Implemented Interfaces:
de.laures.cewolf.DatasetProducer, java.io.Serializable

public class TimeSeriesDatasetProducer
extends XYDatasetProducer

A MetaDatasetProducer for TimeSeries collections. Collections can be generated from a list of any object that has public accessors for the (time, value) coordinates of a TimeSeriesDataItem. If no value property is set, the producer will simply count the number of data items for a series in each time slice (assuming that addValues has not been set to false. The object class should also have a property that can be used to identify the name of the series that a particular data object belongs to. If no such value is set, then a single series will be generated with a default name.

Last, make sure to read the notes in MetaDatasetProducer that explain how to use the property of a property in a field.

Version:
$Revision: 1.16 $
Author:
esword
See Also:
Serialized Form

Field Summary
protected  boolean domainIsPointsInTime
           
protected  boolean fillHoles
           
protected  long historyCount
           
protected static Log log
           
protected  org.jfree.data.time.TimePeriodAnchor timePeriodAnchor
           
protected  java.lang.String timeUnit
           
protected  java.lang.Class timeUnitClass
           
protected static java.util.Map timeUnitClasses
           
protected  java.lang.reflect.Constructor timeUnitConstructor
           
 
Fields inherited from class org.progeeks.jfreechart.MetaDatasetProducer
addValues, dataClassIsMetaClass, dataMetaClass, dataObjectClass, defaultSeriesName, filteredSeries, PARAM_DATA, PARAM_EXISTING_DATASET, producerId, seriesNameProperty, storeOriginalData
 
Fields inherited from interface de.laures.cewolf.DatasetProducer
PRODUCER_ATTRIBUTE_NAME
 
Constructor Summary
TimeSeriesDatasetProducer()
           
 
Method Summary
 boolean getFillHoles()
          If true, once all data has been processed, the producer will iterate through each series and insert an item with a 0 value for any TimePeriod that doesn't have data.
 long getHistoryCount()
           
 java.lang.Object getOriginalData(org.jfree.chart.entity.ChartEntity entity)
          Return the linked original data (if we have it)
 org.jfree.data.time.TimePeriodAnchor getTimePeriodAnchor()
           
 java.lang.String getTimeProperty()
           
 java.lang.String getTimeUnit()
           
 java.lang.String getValueProperty()
           
protected  void init()
          Validates input settings, sets up dynamic time unit classes
 boolean isDomainIsPointsInTime()
          This controls how the last period in a time series is displayed - either as the full size of the time period or only up until the current time.
 java.lang.Object produceDataset(java.util.Map params)
           
 void setDomainIsPointsInTime(boolean domainIsPointsInTime)
           
 void setFillHoles(boolean fillHoles)
           
 void setHistoryCount(long historyCount)
          Used to set the TimeSeries.setMaximumItemAge property.
 void setTimePeriodAnchor(org.jfree.data.time.TimePeriodAnchor timePeriodAnchor)
           
 void setTimeProperty(java.lang.String timeProperty)
          Sets the underlying xProperty.
 void setTimeUnit(java.lang.String timeUnit)
          Must be one of "Millisecond", "Second", "Minute", "Hour", "Day", "Week", "Month", "Quarter", "Year".
 void setValueProperty(java.lang.String seriesValueProperty)
          Sets the underlying yProperty.
 
Methods inherited from class org.progeeks.jfreechart.XYDatasetProducer
getItemYValue, getXProperty, getYProperty, setXProperty, setYProperty
 
Methods inherited from class org.progeeks.jfreechart.MetaDatasetProducer
createMetaObject, findOrCreateMetaClass, getDataObjectClass, getDefaultSeriesName, getFilteredSeries, getMetaObject, getProducerId, getPropertyValue, getSeriesNameProperty, getStoreOriginalData, hasExpired, isAddValues, produceDataset, produceDataset, setAddValues, setDataObjectClass, setDefaultSeriesName, setFilteredSeries, setProducerId, setSeriesNameProperty, setStoreOriginalData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final Log log

timeUnit

protected java.lang.String timeUnit

historyCount

protected long historyCount

fillHoles

protected boolean fillHoles

timePeriodAnchor

protected org.jfree.data.time.TimePeriodAnchor timePeriodAnchor

domainIsPointsInTime

protected boolean domainIsPointsInTime

timeUnitClass

protected java.lang.Class timeUnitClass

timeUnitConstructor

protected java.lang.reflect.Constructor timeUnitConstructor

timeUnitClasses

protected static final java.util.Map timeUnitClasses
Constructor Detail

TimeSeriesDatasetProducer

public TimeSeriesDatasetProducer()
Method Detail

init

protected void init()
             throws java.lang.Exception
Validates input settings, sets up dynamic time unit classes

Overrides:
init in class XYDatasetProducer
Throws:
java.lang.Exception

produceDataset

public java.lang.Object produceDataset(java.util.Map params)
                                throws de.laures.cewolf.DatasetProduceException
Specified by:
produceDataset in interface de.laures.cewolf.DatasetProducer
Overrides:
produceDataset in class XYDatasetProducer
Throws:
de.laures.cewolf.DatasetProduceException
See Also:
DatasetProducer.produceDataset(java.util.Map)

getOriginalData

public java.lang.Object getOriginalData(org.jfree.chart.entity.ChartEntity entity)
Return the linked original data (if we have it)

Overrides:
getOriginalData in class MetaDatasetProducer
Parameters:
entity - Normally, an item indicating where a user clicked in the chart accorsing to series, X/Y value or category value. A "non-data" entity (like a LegendItemEntity) could also be passed in, but in that case the routine will return a null.
Returns:
The corresponding data object or null if a match can't be made.

getTimeProperty

public java.lang.String getTimeProperty()
Returns:
Returns the underlying xProperty

getValueProperty

public java.lang.String getValueProperty()
Returns:
Returns the underlying yProperty.

getTimeUnit

public java.lang.String getTimeUnit()
Returns:
Returns the timeUnit.

getHistoryCount

public long getHistoryCount()
Returns:
Returns the historyCount.

getFillHoles

public boolean getFillHoles()
If true, once all data has been processed, the producer will iterate through each series and insert an item with a 0 value for any TimePeriod that doesn't have data. This keeps charts from looking like there is a gradual change from one period to the next when, in fact, the data goes to 0 in between.

Returns:
Returns the fillHoles.

setTimeProperty

public void setTimeProperty(java.lang.String timeProperty)
Sets the underlying xProperty.

Parameters:
timeProperty - The timeProperty to set.

setValueProperty

public void setValueProperty(java.lang.String seriesValueProperty)
Sets the underlying yProperty.

Parameters:
seriesValueProperty - The seriesValueProperty to set.

setTimeUnit

public void setTimeUnit(java.lang.String timeUnit)
Must be one of "Millisecond", "Second", "Minute", "Hour", "Day", "Week", "Month", "Quarter", "Year".

Parameters:
timeUnit - The timeUnit to set.

setHistoryCount

public void setHistoryCount(long historyCount)
Used to set the TimeSeries.setMaximumItemAge property.

Parameters:
historyCount - The historyCount to set.

setFillHoles

public void setFillHoles(boolean fillHoles)
Parameters:
fillHoles - The fillHoles to set.

getTimePeriodAnchor

public org.jfree.data.time.TimePeriodAnchor getTimePeriodAnchor()
Returns:
Returns the timePeriodAnchor.

setTimePeriodAnchor

public void setTimePeriodAnchor(org.jfree.data.time.TimePeriodAnchor timePeriodAnchor)
Parameters:
timePeriodAnchor - The timePeriodAnchor to set.

isDomainIsPointsInTime

public boolean isDomainIsPointsInTime()
This controls how the last period in a time series is displayed - either as the full size of the time period or only up until the current time. Usually, set this to true for line charts and false for bar charts for the best display. Default is true.

Returns:
Returns the domainIsPointsInTime.

setDomainIsPointsInTime

public void setDomainIsPointsInTime(boolean domainIsPointsInTime)
Parameters:
domainIsPointsInTime - The domainIsPointsInTime to set.


Copyright © 2002-2003 Paul Speed. All Rights Reserved.