|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.data.xy.IntervalXYDelegate
A class for delegating xy-interval issues to. Enhances a XYDataset to an XYIntervalDataset. The decorator pattern was not used because of the several possibly implemented interfaces of the decorated instance (e.g. TableXYDataset, RangeInfo, DomainInfo etc.).
This class calculates the minimal interval width between two items. This width influences the width of bars displayed with this dataset.
The width can be set manually or calculated automatically. The switch
autoWidth allows to determine which behavior is used. The behavior is
transparent: The width is always calculated automatically in the background
without affecting the manually set width. The switch simply determines which
value is used.
As default manually set width, 1.0 is used.
If there
is only one item in the series, the auto width calculation fails and falls
back on the manually set interval width (which is itself defaulted to 1.0).
Constructor Summary | |
IntervalXYDelegate(XYDataset dataset)
Creates an XYIntervalDelegate. |
|
IntervalXYDelegate(XYDataset dataset,
boolean autoWidth)
Creates a new delegate for the specified dataset. |
Method Summary | |
java.lang.Object |
clone()
|
boolean |
equals(java.lang.Object obj)
Tests the delegate for equality with an arbitrary object. |
Range |
getDomainBounds(boolean includeInterval)
Returns the range of the values in this dataset's domain. |
double |
getDomainLowerBound(boolean includeInterval)
Returns the minimum x-value in the dataset. |
double |
getDomainUpperBound(boolean includeInterval)
Returns the maximum x-value in the dataset. |
java.lang.Number |
getEndX(int series,
int item)
Returns the end x value based on the intervalWidth and the intervalPositionFactor. |
double |
getIntervalPositionFactor()
Returns the interval position factor. |
double |
getIntervalWidth()
Returns the full interval width. |
java.lang.Number |
getStartX(int series,
int item)
Returns the start x value based on the intervalWidth and the intervalPositionFactor. |
boolean |
isAutoWidth()
Returns whether the interval width is automatically calculated or not. |
void |
itemAdded(int series,
int item)
Updates the interval width if an item is added. |
void |
itemRemoved(double x)
Updates the interval width if an item is removed. |
void |
seriesAdded(int series)
Convenience method for XYSeriesCollection. |
void |
seriesRemoved()
A convenience method for XYSeriesCollection which is called
whenever a series is removed - the interval width is recalculated. |
void |
setAutoWidth(boolean b)
Sets the flag that indicates whether the interval width is automatically calculated or not. |
void |
setIntervalPositionFactor(double d)
Sets the interval position factor. |
void |
setIntervalWidth(double w)
Sets the manual interval width. |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public IntervalXYDelegate(XYDataset dataset)
dataset
- the dataset for which this interval delegate works.public IntervalXYDelegate(XYDataset dataset, boolean autoWidth)
dataset
- the dataset for which this interval delegate works.autoWidth
- a flag that controls whether the interval width is
calculated automatically.Method Detail |
public boolean isAutoWidth()
public void setAutoWidth(boolean b)
b
- a boolean.public double getIntervalPositionFactor()
public void setIntervalPositionFactor(double d)
d
- the new interval position factor (in the range
0.0
to 1.0
inclusive).public void setIntervalWidth(double w)
w
- the width (negative values not permitted).public double getIntervalWidth()
public java.lang.Number getStartX(int series, int item)
series
- the series index.item
- the item index.
public java.lang.Number getEndX(int series, int item)
series
- the series index.item
- the item index.
public double getDomainLowerBound(boolean includeInterval)
getDomainLowerBound
in interface DomainInfo
includeInterval
- a flag that determines whether or not the
x-interval is taken into account.
public double getDomainUpperBound(boolean includeInterval)
getDomainUpperBound
in interface DomainInfo
includeInterval
- a flag that determines whether or not the
x-interval is taken into account.
public Range getDomainBounds(boolean includeInterval)
getDomainBounds
in interface DomainInfo
includeInterval
- a flag that determines whether or not the
x-interval should be taken into account.
public void itemAdded(int series, int item)
item
- the number of the item.series
- the number of the seriespublic void itemRemoved(double x)
x
- the x value of the removed item (that doesn't occur twice)public void seriesAdded(int series)
series
- the series index.public void seriesRemoved()
XYSeriesCollection
which is called
whenever a series is removed - the interval width is recalculated.
public boolean equals(java.lang.Object obj)
obj
- the object (null
permitted).
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
- if the object cannot be cloned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |