|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.odftoolkit.simple.chart.DataSet
public class DataSet
DataSet is wrapper class for chart data. Generally it is a 2 dimensional data container, a set of chart data series. Each data series has a key, i.e. chart label. The data may be a 2 dimensional double array, or a cell range address of a sheet in Spreadsheet document. DataSet provides some convenient methods for users to manipulate specific data series in the chart data.
Constructor Summary | |
---|---|
DataSet()
Creates a new DataSet without argument. |
|
DataSet(CellRangeAddressList cellRangeAddress,
SpreadsheetDocument spreadsheet,
boolean bFirstRowAsLabel,
boolean bFirstColumnAsLabel,
boolean rowAsDataSeries)
Creates a new DataSet. |
|
DataSet(String[] labels,
String[] legends,
double[][] data)
Creates a new DataSet. |
Method Summary | |
---|---|
void |
appendDataSeries(String legend,
double[] values)
Adds a data series at the end of current data set. |
CellRangeAddressList |
getCellRangeAddress()
Gets the cell range address list. |
double[] |
getDataSeriesByIndex(int index)
Gets the values of a data series by its index in the data set. |
double[] |
getDataSeriesByLegend(String legend,
int beginindex)
Gets the values of a data series by its legend, if multiple data series have duplicated legends, return the values of the first matched data series. |
int |
getDataSeriesCount()
Gets the count of data series in the data set. |
int |
getIndexOfDataSeries(String legend,
int beginindex)
Gets the index of the data series by its legend. |
String |
getLabelByIndex(int index)
Gets the legend of the data series by its index in the data set. |
String[] |
getLabels()
Gets the string array of labels. |
String |
getLegendByIndex(int index)
Gets the legend of the data series by its index in the data set. |
String[] |
getLegends()
Gets the string array of legends. |
int |
getLengthOfDataSeries(int index)
Gets the data item count of the data series given by the index. |
int |
getLengthOfDataSeries(String legend,
int beginindex)
Gets the data item count of the data series given by the label. |
String |
getLocalTableCellRanges(int seriesCount,
int labelLength,
Vector<String> seriesCellRange,
Vector<String> legendCellAddr)
Gets the local table cell range. |
Double[][] |
getLocalTableData()
Gets the values of a data set as a double dimension array. |
String[] |
getLocalTableFirstColumn()
Gets the first column labels of the local table. |
String[] |
getLocalTableFirstRow()
Gets the first row labels of the local table. |
int |
getMaxLengthOfDataSeries()
Gets the maximal data item count |
void |
insertDataSeries(int index,
String legend,
double[] values)
Adds a data series at the index in current data set. |
boolean |
isFirstColumnAsLabel()
Gets whether this data set uses first column as chart label. |
boolean |
isFirstRowAsLabel()
Gets whether this data set uses first row as chart label. |
boolean |
isLocalTable()
Gets whether this data set uses local table. |
boolean |
isRowAsDataSeries()
Gets whether this data set uses row as data series. |
void |
removeDataSeries(int index)
Removes a data series by the index of the data series in the data set. |
void |
removeDataSeries(String legend,
int beginindex)
Remove a data series by the legend of the data series. |
void |
setLabelByIndex(int index,
String label)
Sets or change the legend of the data series by its index in the data set. |
void |
setLegendByIndex(int index,
String legend)
Sets or change the legend of the data series by its index in the data set. |
void |
setLocalTable(boolean isLocalTable)
Sets this data set uses local table or not. |
void |
setValues(CellRangeAddressList cellRangeAddress,
SpreadsheetDocument spreadsheet,
boolean bFirstRowAsLabel,
boolean bFirstColumnAsLabel,
boolean rowAsDataSeries)
Sets data for the data set with cell range address of sheet in spreadsheet document or internal chart table in other chart containers. |
void |
setValues(String[] labels,
String[] legends,
double[][] data)
Sets or updates data for the data set with 2 dimensional double array, the first dimension represents the index of data series, the second dimension represents the index of data item in each data series. |
void |
updateDataSeries(int index,
double[] values)
Updates the data series values according to the index of the data series. |
void |
updateDataSeries(String legend,
int beginindex,
double[] values)
Updates the data series values according to the legend of the data series. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataSet()
public DataSet(String[] labels, String[] legends, double[][] data)
labels
- the label strings of this DataSet.legends
- the legend strings of this DataSet.data
- the data of this DataSet, which stores in 2 dimensional double
array.public DataSet(CellRangeAddressList cellRangeAddress, SpreadsheetDocument spreadsheet, boolean bFirstRowAsLabel, boolean bFirstColumnAsLabel, boolean rowAsDataSeries)
cellRangeAddress
- the cell range address, which is used as the data source.spreadsheet
- the data source SpreadsheetDocument.bFirstRowAsLabel
- whether this data set uses first row as chart label.bFirstColumnAsLabel
- whether this data set uses first column as chart label.rowAsDataSeries
- whether this data set uses row as data series.Method Detail |
---|
public String getLocalTableCellRanges(int seriesCount, int labelLength, Vector<String> seriesCellRange, Vector<String> legendCellAddr)
public CellRangeAddressList getCellRangeAddress()
public void appendDataSeries(String legend, double[] values)
legend
- legend for the data series.values
- data series values corresponding to the legend.public void insertDataSeries(int index, String legend, double[] values)
index
- the index the added data series will be located.legend
- legend for the data series.values
- data series values corresponding to the legend.public void updateDataSeries(int index, double[] values)
index
- the index of the data series in the data set.values
- data series values.public void updateDataSeries(String legend, int beginindex, double[] values)
legend
- the chart legend of the data series.values
- data series values.public void removeDataSeries(int index)
index
- index of the data series in the data set.public void removeDataSeries(String legend, int beginindex)
legend
- the legend of the data series.public int getIndexOfDataSeries(String legend, int beginindex)
legend
- the legend of the data series.
public String getLegendByIndex(int index)
index
- index of the data series in the data set.
public void setLegendByIndex(int index, String legend)
index
- index of the data series in the data set.legend
- the legend of the data series.public String getLabelByIndex(int index)
index
- index of the data series in the data set.
public void setLabelByIndex(int index, String label)
index
- index of the data series in the data set.label
- the label of the data series.public String[] getLabels()
public String[] getLegends()
public boolean isFirstRowAsLabel()
true
, this data set uses first row as
chart label.public boolean isFirstColumnAsLabel()
true
, this data set uses first row as
chart label.public boolean isRowAsDataSeries()
true
, this data set uses row as data
series.public boolean isLocalTable()
true
, this data set uses uses local table.public void setLocalTable(boolean isLocalTable)
isLocalTable
- if the value is true
, this data set uses uses
local table.public double[] getDataSeriesByIndex(int index)
index
- index of the data series in the data set.
public double[] getDataSeriesByLegend(String legend, int beginindex)
legend
- the legend of the data series
public Double[][] getLocalTableData()
public String[] getLocalTableFirstRow()
public String[] getLocalTableFirstColumn()
public int getLengthOfDataSeries(int index)
index
- index of the data series in the data set
public int getLengthOfDataSeries(String legend, int beginindex)
legend
- the legend of the data series
public int getMaxLengthOfDataSeries()
public int getDataSeriesCount()
public void setValues(String[] labels, String[] legends, double[][] data)
labels
- the chart labels, which is corresponding to the first
dimension of data array.data
- a 2 dimensional double array.public void setValues(CellRangeAddressList cellRangeAddress, SpreadsheetDocument spreadsheet, boolean bFirstRowAsLabel, boolean bFirstColumnAsLabel, boolean rowAsDataSeries)
cellRangeAddress
- cell range address of sheet or table.spreadsheet
- the spreadsheet document instance, the cell address is
relative to the spreadsheet document.bFirstRowAsLabel
- whether this data set uses first row as chart label.bFirstColumnAsLabel
- whether this data set uses first column as chart label.rowAsDataSeries
- whether this data set uses row as data series.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |