java.lang.Object
org.jfree.data.general.AbstractDataset
org.jfree.data.general.AbstractSeriesDataset
org.jfree.data.xy.AbstractXYDataset
org.jfree.data.xy.DefaultHighLowDataset
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,EventListener,PublicCloneable,Dataset,SeriesChangeListener,SeriesDataset,OHLCDataset,XYDataset
public class DefaultHighLowDataset
extends AbstractXYDataset
implements OHLCDataset, PublicCloneable
A simple implementation of the
OHLCDataset interface. See also
the DefaultOHLCDataset class, which provides another implementation
that is very similar.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultHighLowDataset(Comparable seriesKey, Date[] date, double[] high, double[] low, double[] open, double[] close, double[] volume) Constructs a new high/low/open/close dataset. -
Method Summary
Modifier and TypeMethodDescriptionstatic Number[]createNumberArray(double[] data) Constructs an array of Number objects from an array of doubles.booleanTests this dataset for equality with an arbitrary instance.getClose(int series, int item) Returns the close-value for one item in a series.doublegetCloseValue(int series, int item) Returns the close-value (as a double primitive) for an item within a series.getHigh(int series, int item) Returns the high-value for one item in a series.doublegetHighValue(int series, int item) Returns the high-value (as a double primitive) for an item within a series.intgetItemCount(int series) Returns the number of items in the specified series.getLow(int series, int item) Returns the low-value for one item in a series.doublegetLowValue(int series, int item) Returns the low-value (as a double primitive) for an item within a series.getOpen(int series, int item) Returns the open-value for one item in a series.doublegetOpenValue(int series, int item) Returns the open-value (as a double primitive) for an item within a series.intReturns the number of series in the dataset.getSeriesKey(int series) Returns the key for the series stored in this dataset.getVolume(int series, int item) Returns the volume-value for one item in a series.doublegetVolumeValue(int series, int item) Returns the volume-value (as a double primitive) for an item within a series.getX(int series, int item) Returns the x-value for one item in a series.getXDate(int series, int item) Returns the x-value for one item in a series, as a Date.getY(int series, int item) Returns the y-value for one item in a series.inthashCode()Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getDomainOrder, getXValue, getYValueMethods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf, seriesChangedMethods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, clone, fireDatasetChanged, getGroup, getNotify, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObjectMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroupMethods inherited from interface org.jfree.chart.util.PublicCloneable
cloneMethods inherited from interface org.jfree.data.general.SeriesDataset
indexOfMethods inherited from interface org.jfree.data.xy.XYDataset
getDomainOrder, getXValue, getYValue
-
Constructor Details
-
DefaultHighLowDataset
public DefaultHighLowDataset(Comparable seriesKey, Date[] date, double[] high, double[] low, double[] open, double[] close, double[] volume) Constructs a new high/low/open/close dataset.The current implementation allows only one series in the dataset. This may be extended in a future version.
- Parameters:
seriesKey- the key for the series (nullnot permitted).date- the dates (nullnot permitted).high- the high values (nullnot permitted).low- the low values (nullnot permitted).open- the open values (nullnot permitted).close- the close values (nullnot permitted).volume- the volume values (nullnot permitted).
-
-
Method Details
-
getSeriesKey
Returns the key for the series stored in this dataset.- Specified by:
getSeriesKeyin interfaceSeriesDataset- Specified by:
getSeriesKeyin classAbstractSeriesDataset- Parameters:
series- the index of the series (ignored, this dataset supports only one series and this method always returns the key for series 0).- Returns:
- The series key (never
null).
-
getX
Returns the x-value for one item in a series. The value returned is aLonginstance generated from the underlyingDateobject. To avoid generating a new object instance, you might prefer to callAbstractXYDataset.getXValue(int, int). -
getXDate
Returns the x-value for one item in a series, as a Date.This method is provided for convenience only.
- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The x-value as a Date.
- See Also:
-
getY
Returns the y-value for one item in a series.This method (from the
XYDatasetinterface) is mapped to thegetCloseValue(int, int)method. -
getHigh
Returns the high-value for one item in a series.- Specified by:
getHighin interfaceOHLCDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The high-value.
- See Also:
-
getHighValue
public double getHighValue(int series, int item) Returns the high-value (as a double primitive) for an item within a series.- Specified by:
getHighValuein interfaceOHLCDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The high-value.
- See Also:
-
getLow
Returns the low-value for one item in a series.- Specified by:
getLowin interfaceOHLCDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The low-value.
- See Also:
-
getLowValue
public double getLowValue(int series, int item) Returns the low-value (as a double primitive) for an item within a series.- Specified by:
getLowValuein interfaceOHLCDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The low-value.
- See Also:
-
getOpen
Returns the open-value for one item in a series.- Specified by:
getOpenin interfaceOHLCDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The open-value.
- See Also:
-
getOpenValue
public double getOpenValue(int series, int item) Returns the open-value (as a double primitive) for an item within a series.- Specified by:
getOpenValuein interfaceOHLCDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The open-value.
- See Also:
-
getClose
Returns the close-value for one item in a series.- Specified by:
getClosein interfaceOHLCDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The close-value.
- See Also:
-
getCloseValue
public double getCloseValue(int series, int item) Returns the close-value (as a double primitive) for an item within a series.- Specified by:
getCloseValuein interfaceOHLCDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The close-value.
- See Also:
-
getVolume
Returns the volume-value for one item in a series.- Specified by:
getVolumein interfaceOHLCDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The volume-value.
- See Also:
-
getVolumeValue
public double getVolumeValue(int series, int item) Returns the volume-value (as a double primitive) for an item within a series.- Specified by:
getVolumeValuein interfaceOHLCDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The volume-value.
- See Also:
-
getSeriesCount
public int getSeriesCount()Returns the number of series in the dataset.This implementation only allows one series.
- Specified by:
getSeriesCountin interfaceSeriesDataset- Specified by:
getSeriesCountin classAbstractSeriesDataset- Returns:
- The number of series.
-
getItemCount
public int getItemCount(int series) Returns the number of items in the specified series.- Specified by:
getItemCountin interfaceXYDataset- Parameters:
series- the index (zero-based) of the series.- Returns:
- The number of items in the specified series.
-
equals
Tests this dataset for equality with an arbitrary instance. -
hashCode
public int hashCode() -
createNumberArray
Constructs an array of Number objects from an array of doubles.- Parameters:
data- the double values to convert (nullnot permitted).- Returns:
- The data as an array of Number objects.
-