Package org.jfree.data
Class OHLCDataset
java.lang.Object
org.jfree.data.AbstractDataset
org.jfree.data.AbstractSeriesDataset
org.jfree.data.AbstractXYDataset
org.jfree.data.OHLCDataset
- All Implemented Interfaces:
ObjectInputValidation
,Serializable
,Cloneable
,EventListener
,Dataset
,HighLowDataset
,SeriesChangeListener
,SeriesDataset
,XYDataset
public class OHLCDataset extends AbstractXYDataset implements HighLowDataset
A simple implementation of the
HighLowDataset
interface. This
implementation supports only one series.- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description OHLCDataset(String name, OHLCDataItem[] data)
Creates a new dataset. -
Method Summary
Modifier and Type Method Description double
getClose(int series, int item)
Returns the close-value (as a double primitive) for an item within a series.Number
getCloseValue(int series, int item)
Returns the close value.double
getHigh(int series, int item)
Returns the high-value (as a double primitive) for an item within a series.Number
getHighValue(int series, int item)
Returns the high value.int
getItemCount(int series)
Returns the item count for the specified series.double
getLow(int series, int item)
Returns the low-value (as a double primitive) for an item within a series.Number
getLowValue(int series, int item)
Returns the low value.double
getOpen(int series, int item)
Returns the open-value (as a double primitive) for an item within a series.Number
getOpenValue(int series, int item)
Returns the open value.int
getSeriesCount()
Returns the series count.String
getSeriesName(int series)
Returns the series name.double
getVolume(int series, int item)
Returns the volume-value (as a double primitive) for an item within a series.Number
getVolumeValue(int series, int item)
Returns the trading volume.Date
getXDate(int series, int item)
Returns the x-value for a data item as a date.Number
getXValue(int series, int item)
Returns the x-value for a data item.Number
getYValue(int series, int item)
Returns the y-value.void
sortDataByDate()
Sorts the data into ascending order by date.Methods inherited from class org.jfree.data.AbstractXYDataset
getX, getY
Methods inherited from class org.jfree.data.AbstractSeriesDataset
seriesChanged
Methods inherited from class org.jfree.data.AbstractDataset
addChangeListener, clone, getGroup, removeChangeListener, setGroup, validateObject
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jfree.data.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
Constructor Details
-
OHLCDataset
Creates a new dataset.- Parameters:
name
- the series name.data
- the data items.
-
-
Method Details
-
getSeriesName
Returns the series name.- Specified by:
getSeriesName
in interfaceSeriesDataset
- Specified by:
getSeriesName
in classAbstractSeriesDataset
- Parameters:
series
- the series index (ignored).- Returns:
- the series name.
-
getXValue
Returns the x-value for a data item. -
getXDate
Returns the x-value for a data item as a date.- Parameters:
series
- the series index (ignored).item
- the item index (zero-based).- Returns:
- the x-value as a date.
-
getYValue
Returns the y-value. -
getHighValue
Returns the high value.- Specified by:
getHighValue
in interfaceHighLowDataset
- Parameters:
series
- the series index (ignored).item
- the item index (zero-based).- Returns:
- the high value.
-
getHigh
public double getHigh(int series, int item)Returns the high-value (as a double primitive) for an item within a series.- Specified by:
getHigh
in interfaceHighLowDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- The high-value.
-
getLowValue
Returns the low value.- Specified by:
getLowValue
in interfaceHighLowDataset
- Parameters:
series
- the series index (ignored).item
- the item index (zero-based).- Returns:
- the low value.
-
getLow
public double getLow(int series, int item)Returns the low-value (as a double primitive) for an item within a series.- Specified by:
getLow
in interfaceHighLowDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- The low-value.
-
getOpenValue
Returns the open value.- Specified by:
getOpenValue
in interfaceHighLowDataset
- Parameters:
series
- the series index (ignored).item
- the item index (zero-based).- Returns:
- the open value.
-
getOpen
public double getOpen(int series, int item)Returns the open-value (as a double primitive) for an item within a series.- Specified by:
getOpen
in interfaceHighLowDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- The open-value.
-
getCloseValue
Returns the close value.- Specified by:
getCloseValue
in interfaceHighLowDataset
- Parameters:
series
- the series index (ignored).item
- the item index (zero-based).- Returns:
- the close value.
-
getClose
public double getClose(int series, int item)Returns the close-value (as a double primitive) for an item within a series.- Specified by:
getClose
in interfaceHighLowDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- The close-value.
-
getVolumeValue
Returns the trading volume.- Specified by:
getVolumeValue
in interfaceHighLowDataset
- Parameters:
series
- the series index (ignored).item
- the item index (zero-based).- Returns:
- the trading volume.
-
getVolume
public double getVolume(int series, int item)Returns the volume-value (as a double primitive) for an item within a series.- Specified by:
getVolume
in interfaceHighLowDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- The volume-value.
-
getSeriesCount
public int getSeriesCount()Returns the series count.- Specified by:
getSeriesCount
in interfaceSeriesDataset
- Specified by:
getSeriesCount
in classAbstractSeriesDataset
- Returns:
- 1.
-
getItemCount
public int getItemCount(int series)Returns the item count for the specified series.- Specified by:
getItemCount
in interfaceXYDataset
- Parameters:
series
- the series index (ignored).- Returns:
- the item count.
-
sortDataByDate
public void sortDataByDate()Sorts the data into ascending order by date.
-