public class DataSet extends Object
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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. we do not recommend the duplicated legends, but practically, some
ODF editors allow users to do that.
|
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.
|
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.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 seriespublic Double[][] getLocalTableData()
public String[] getLocalTableFirstRow()
public String[] getLocalTableFirstColumn()
public int getLengthOfDataSeries(int index)
index
- index of the data series in the data setpublic int getLengthOfDataSeries(String legend, int beginindex)
legend
- the legend of the data seriespublic 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.Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.