Package org.jfree.chart.demo
Class SampleYSymbolicDataset
java.lang.Object
org.jfree.data.AbstractDataset
org.jfree.data.AbstractSeriesDataset
org.jfree.chart.demo.SampleYSymbolicDataset
- All Implemented Interfaces:
ObjectInputValidation
,Serializable
,Cloneable
,EventListener
,Dataset
,SeriesChangeListener
,SeriesDataset
,XYDataset
,YisSymbolic
public class SampleYSymbolicDataset extends AbstractSeriesDataset implements XYDataset, YisSymbolic
A dataset implementation that provides random data for a symbolic plot demo.
This sample dataset has numerical x-values, and symbolic y-values.
- Author:
- Anthony Boulestreau
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description SampleYSymbolicDataset(String datasetName, int xRange, String[] tabString)
Creates a new sample dataset.SampleYSymbolicDataset(String datasetName, int xRange, String[] tabString, int seriesCount, int itemCount, String[] serieNames)
Creates a new sample dataset.SampleYSymbolicDataset(String datasetName, Double[][] xValues, Integer[][] yValues, String[] ySymbolicValues, int seriesCount, int itemCount, String[] serieNames)
Creates a new sample dataset. -
Method Summary
Modifier and Type Method Description Object
clone()
Clone the SampleYSymbolicDataset objectstatic String[]
combineYSymbolicDataset(YisSymbolic dataset1, YisSymbolic dataset2)
This function modifydataset1
anddataset1
in order that they share the same symbolic value list.int
getItemCount(int series)
Returns the number of items in the specified series.int
getSeriesCount()
Returns the number of series in the dataset.String
getSeriesName(int series)
Returns the name of the series.double
getX(int series, int item)
Returns the x-value (as a double primitive) for an item within a series.Number
getXValue(int series, int item)
Returns the x-value for the specified series and item.double
getY(int series, int item)
Returns the y-value (as a double primitive) for an item within a series.String
getYSymbolicValue(int series, int item)
Returns the symbolic value of the data set specified byseries
anditem
parameters.String
getYSymbolicValue(Integer val)
Returns the symbolic value linked with the specifiedInteger
.String[]
getYSymbolicValues()
Returns the list of symbolic values.Number
getYValue(int series, int item)
Returns the y-value for the specified series and item.void
setYSymbolicValues(String[] sValues)
Sets the list of symbolic values.void
setYValue(int series, int item, Number newValue)
Sets the y-value for the specified series and item with the specified newNumber
value.Methods inherited from class org.jfree.data.AbstractSeriesDataset
seriesChanged
Methods inherited from class org.jfree.data.AbstractDataset
addChangeListener, 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
-
SampleYSymbolicDataset
Creates a new sample dataset.- Parameters:
datasetName
- the dataset name.xRange
- the upper limit of the (random) x-values.tabString
- the symbols for the y-values.
-
SampleYSymbolicDataset
public SampleYSymbolicDataset(String datasetName, int xRange, String[] tabString, int seriesCount, int itemCount, String[] serieNames)Creates a new sample dataset.- Parameters:
datasetName
- the dataset name.xRange
- the upper limit of the (random) x-values.tabString
- the symbolic y-values.seriesCount
- the number of series to create.itemCount
- the number of items to create for each series.serieNames
- the series names.
-
SampleYSymbolicDataset
public SampleYSymbolicDataset(String datasetName, Double[][] xValues, Integer[][] yValues, String[] ySymbolicValues, int seriesCount, int itemCount, String[] serieNames)Creates a new sample dataset.- Parameters:
datasetName
- the dataset name.xValues
- the x values.yValues
- the y values.ySymbolicValues
- the y symbolsseriesCount
- the series count.itemCount
- the item count.serieNames
- the series names.
-
-
Method Details
-
getXValue
Returns the x-value for the specified series and item. Series are numbered 0, 1, ... -
getX
public double getX(int series, int item)Returns the x-value (as a double primitive) for an item within a series. -
getYValue
Returns the y-value for the specified series and item. Series are numbered 0, 1, ... -
getY
public double getY(int series, int item)Returns the y-value (as a double primitive) for an item within a series. -
setYValue
Sets the y-value for the specified series and item with the specified newNumber
value. Series are numbered 0, 1, ...This method is used by combineYSymbolicDataset to modify the reference to the symbolic value ...
- Parameters:
series
- the index (zero-based) of the series.item
- the index (zero-based) of the required item.newValue
- the value to set.
-
getSeriesCount
public int getSeriesCount()Returns the number of series in the dataset.- Specified by:
getSeriesCount
in interfaceSeriesDataset
- Specified by:
getSeriesCount
in classAbstractSeriesDataset
- Returns:
- The number of series in the dataset.
-
getSeriesName
Returns the name of the series.- Specified by:
getSeriesName
in interfaceSeriesDataset
- Specified by:
getSeriesName
in classAbstractSeriesDataset
- Parameters:
series
- the index (zero-based) of the series.- Returns:
- the name of the series.
-
getItemCount
public int getItemCount(int series)Returns the number of items in the specified series.- Specified by:
getItemCount
in interfaceXYDataset
- Parameters:
series
- The index (zero-based) of the series.- Returns:
- the number of items in the specified series.
-
getYSymbolicValues
Returns the list of symbolic values.- Specified by:
getYSymbolicValues
in interfaceYisSymbolic
- Returns:
- array of symbolic value.
-
setYSymbolicValues
Sets the list of symbolic values.- Parameters:
sValues
- the new list of symbolic value.
-
getYSymbolicValue
Returns the symbolic value of the data set specified byseries
anditem
parameters.- Specified by:
getYSymbolicValue
in interfaceYisSymbolic
- Parameters:
series
- value of the serie.item
- value of the item.- Returns:
- the symbolic value.
-
getYSymbolicValue
Returns the symbolic value linked with the specifiedInteger
.- Specified by:
getYSymbolicValue
in interfaceYisSymbolic
- Parameters:
val
- value of the integer linked with the symbolic value.- Returns:
- the symbolic value.
-
combineYSymbolicDataset
This function modifydataset1
anddataset1
in order that they share the same symbolic value list.The sharing symbolic value list is obtained adding the symbolic data list of the fist data set to the symbolic data list of the second data set.
This function is use with the combined plot functions of JFreeChart.
- Parameters:
dataset1
- the first data set to combine.dataset2
- the second data set to combine.- Returns:
- the shared symbolic array.
-
clone
Clone the SampleYSymbolicDataset object- Overrides:
clone
in classAbstractDataset
- Returns:
- the cloned object.
-