|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.objectplanet.chart.ChartSample
public class ChartSample
This class represents a sample in any chart. A chart sample has a value, label, label color, and a key. Each sample also has an index, which is the sample's position in the chart. A sample can also be selected.
Field Summary | |
---|---|
protected java.lang.String |
label
The label of the sample. |
protected java.lang.Double |
value
The value of the sample. |
Constructor Summary | |
---|---|
ChartSample(int index)
Creates a new empty sample with the given index. |
|
ChartSample(int index,
double value)
Creates a new sample with the given index and value. |
|
ChartSample(int index,
double value,
java.lang.String label,
java.lang.Object key)
Creates a new sample with the given values. |
Method Summary | |
---|---|
void |
clearValue()
Clears the value of the sample. |
double |
getFloatValue()
Gets the value as a floating point. |
int |
getIndex()
Gets the index of the sample. |
java.lang.Object |
getKey()
Gets the key of the sample. |
java.lang.String |
getLabel()
Gets the label of the sample. |
int |
getSeries()
Gets the series index of the sample. |
long |
getValue()
Gets the value of the sample. |
boolean |
hasValue()
Returns true if a value has been set for this sample. |
boolean |
isSelected()
Checks if the sample is selected. |
void |
set(double value,
java.lang.String label,
java.lang.Object key)
Sets the chart sample's value, label, and the key. |
void |
setIndex(int index)
Sets the index of the sample. |
void |
setLabel(java.lang.String label)
Sets the label of the sample. |
void |
setLabelColor(java.awt.Color color)
Sets the label color. |
boolean |
setSelection(boolean state)
Selects or de-selects the sample. |
void |
setSeries(int series)
Sets the series index of the sample. |
void |
setValue(double value)
Sets the value of the sample. |
boolean |
toggleSelection()
Toggles the selection of the sample. |
java.lang.String |
toString()
Returns the label and value as a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String label
protected java.lang.Double value
Constructor Detail |
---|
public ChartSample(int index)
index
- The index of the sample (should be position in the chart).public ChartSample(int index, double value)
index
- The index of the sample (should be position in the chart).value
- The value of the sample.public ChartSample(int index, double value, java.lang.String label, java.lang.Object key)
index
- The index of the sample (should be position in the chart).value
- The value of the sample.label
- The label of the sample.key
- The key of the sample.Method Detail |
---|
public void clearValue()
public double getFloatValue()
public int getIndex()
public java.lang.Object getKey()
public java.lang.String getLabel()
public int getSeries()
public long getValue()
public boolean hasValue()
public boolean isSelected()
public void set(double value, java.lang.String label, java.lang.Object key)
value
- The value of the sample.label
- The label of the sample.key
- The key of the sample.public void setIndex(int index)
index
- The index of the sample.public void setLabel(java.lang.String label)
label
- The label to set.public void setLabelColor(java.awt.Color color)
color
- The color to use.public boolean setSelection(boolean state)
state
- True for selected, false otherwise.
public void setSeries(int series)
series
- The index of the series.public void setValue(double value)
value
- The value to set.public boolean toggleSelection()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |