public class ChartSample
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
label
The label of the sample.
|
java.lang.Double |
value
The value of the sample.
|
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected java.lang.String label
public java.lang.Double value
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.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