public class ChartData extends java.lang.Object implements IChartData
Represents data used for a chart plotting.
Modifier and Type | Method and Description |
---|---|
IChartCategoryCollection |
getCategories()
Gets the primary categories (or both primary and secondary categories
if
getUseSecondaryCategories() /setUseSecondaryCategories(boolean) property is false). |
IChartDataWorkbook |
getChartDataWorkbook()
Gets the cells factory to create cells used for chart series or categories.
|
int |
getDataSourceType()
Represents external workbook path if external data source, null otherwise
|
java.lang.String |
getExternalWorkbookPath()
Represents data source of the chart
|
com.aspose.slides.IDOMObject |
getParent_Immediate()
Returns Parent_Immediate object.
|
IChartCategoryCollection |
getSecondaryCategories()
Gets the secondary categories if
getUseSecondaryCategories() /setUseSecondaryCategories(boolean) property is true. |
IChartSeriesCollection |
getSeries()
Gets the series.
|
IChartSeriesGroupCollection |
getSeriesGroups()
Gets the groups of series.
|
boolean |
getUseSecondaryCategories()
If false then
getSecondaryCategories() property return null and data
in getCategories() property is used both for primary and secondary series. |
byte[] |
readWorkbookStream()
Writes the internally contained Excel workbook it into an in-memory stream.
|
void |
setExternalWorkbook(java.lang.String workbookPath)
Sets external workbook as a data source for the chart.
|
void |
setExternalWorkbook(java.lang.String workbookPath,
boolean updateChartData)
Sets external workbook as a data source for the chart.
|
void |
setRange(java.lang.String formula)
Set chart data range.
|
void |
setUseSecondaryCategories(boolean value)
If false then
getSecondaryCategories() property return null and data
in getCategories() property is used both for primary and secondary series. |
void |
switchRowColumn()
Swap the data over the axis.
|
void |
writeWorkbookStream(byte[] ms)
Initializes the internally contained Excel workbook with user-specified value.
|
public final IChartDataWorkbook getChartDataWorkbook()
Gets the cells factory to create cells used for chart series or categories.
Read-only IChartDataWorkbook
.
getChartDataWorkbook
in interface IChartData
public final IChartSeriesCollection getSeries()
Gets the series.
Read-only IChartSeriesCollection
.
getSeries
in interface IChartData
public final IChartSeriesGroupCollection getSeriesGroups()
Gets the groups of series.
Read-only IChartSeriesGroupCollection
.
getSeriesGroups
in interface IChartData
public final IChartCategoryCollection getCategories()
Gets the primary categories (or both primary and secondary categories
if getUseSecondaryCategories()
/setUseSecondaryCategories(boolean)
property is false).
Read-only IChartCategoryCollection
.
Example. What categories are related to series - ChartData.getCategories() or ChartData.getSecondaryCategories()?if (series.getPlotOnSecondAxis() && series.getChart().getChartData().getUseSecondaryCategories()) { // related categories are series.getChart().getChartData().getSecondaryCategories() } else { // related categories are series.getChart().getChartData().getCategories() }
getUseSecondaryCategories()
/setUseSecondaryCategories(boolean)
property is false then SecondaryCategories
(getSecondaryCategories()
)
property return null and data in this getCategories()
property is used both for primary
and secondary series.
If getUseSecondaryCategories()
/setUseSecondaryCategories(boolean)
property is true then data in SecondaryCategories
(getSecondaryCategories()
)
property is used for secondary series and data in this getCategories()
property is used
for primary series.
getCategories
in interface IChartData
public final boolean getUseSecondaryCategories()
If false then getSecondaryCategories()
property return null and data
in getCategories()
property is used both for primary and secondary series.
If true then data in getSecondaryCategories()
property is used for secondary series and data
in getCategories()
property is used for primary series.
Read/write boolean
.
Example. What categories are related to series - ChartData.getCategories() or ChartData.getSecondaryCategories()?if (series.getPlotOnSecondAxis() && series.getChart().getChartData().getUseSecondaryCategories()) { // related categories are series.getChart().getChartData().getSecondaryCategories() } else { // related categories are series.getChart().getChartData().getCategories() }
getUseSecondaryCategories
in interface IChartData
public final void setUseSecondaryCategories(boolean value)
If false then getSecondaryCategories()
property return null and data
in getCategories()
property is used both for primary and secondary series.
If true then data in getSecondaryCategories()
property is used for secondary series and data
in getCategories()
property is used for primary series.
Read/write boolean
.
Example. What categories are related to series - ChartData.getCategories() or ChartData.getSecondaryCategories()?if (series.getPlotOnSecondAxis() && series.getChart().getChartData().getUseSecondaryCategories()) { // related categories are series.getChart().getChartData().getSecondaryCategories() } else { // related categories are series.getChart().getChartData().getCategories() }
setUseSecondaryCategories
in interface IChartData
public final IChartCategoryCollection getSecondaryCategories()
Gets the secondary categories if getUseSecondaryCategories()
/setUseSecondaryCategories(boolean)
property is true.
Read-only IChartCategoryCollection
.
Example. What categories are related to series - ChartData.getCategories() or ChartData.getSecondaryCategories()?if (series.getPlotOnSecondAxis() && series.getChart().getChartData().getUseSecondaryCategories()) { // related categories are series.getChart().getChartData().getSecondaryCategories() } else { // related categories are series.getChart().getChartData().getCategories() }
getUseSecondaryCategories()
/setUseSecondaryCategories(boolean)
property is false then this SecondaryCategories
(getSecondaryCategories()
)
property return null and data in getCategories()
property is used both for primary
and secondary series.
If getUseSecondaryCategories()
/setUseSecondaryCategories(boolean)
property is true then data in
this getSecondaryCategories()
property is used for secondary series and data
in getCategories()
property is used for primary series.
getSecondaryCategories
in interface IChartData
public final byte[] readWorkbookStream()
Writes the internally contained Excel workbook it into an in-memory stream.
readWorkbookStream
in interface IChartData
MemoryStream
containing a copy of the internally contained Excel workbook.public final void writeWorkbookStream(byte[] ms)
Initializes the internally contained Excel workbook with user-specified value.
writeWorkbookStream
in interface IChartData
ms
- The user-supplied stream containing the entire Excel workbook.public final int getDataSourceType()
Represents external workbook path if external data source, null otherwise
getDataSourceType
in interface IChartData
public final java.lang.String getExternalWorkbookPath()
Represents data source of the chart
getExternalWorkbookPath
in interface IChartData
public final void setRange(java.lang.String formula)
Set chart data range. Series and categories will be updated based on new data range. If amount of series in data range greater than count of series in the chart data then additional series with the same type as a last series in the current collection will be added to the end of the collection.
setRange
in interface IChartData
formula
- The cells data range formula. E.g: "Sheet1!$A$1:$C$4" , "SomeSheetName!A1:B100", "Sheet1!$A$1:$B$5;Sheet1!$D$1:$D$5".com.aspose.ms.System.ArgumentNullException
- formula is null.com.aspose.ms.System.ArgumentException
- formula has incorrect format.public final void setExternalWorkbook(java.lang.String workbookPath)
Sets external workbook as a data source for the chart. Chart data will be updated from the target workbook.
Presentation pres = new Presentation(); try { IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Pie, 50, 50, 400, 600, true); IChartData chartData = chart.getChartData(); ((ChartData)chartData).setExternalWorkbook("../../workbook.xlsx"); } finally { if (pres != null) pres.dispose(); }
setExternalWorkbook
in interface IChartData
workbookPath
- Path to the target workbookcom.aspose.ms.System.InvalidOperationException
- External workbook is not available or can't be loaded.public final void setExternalWorkbook(java.lang.String workbookPath, boolean updateChartData)
Sets external workbook as a data source for the chart.
Presentation pres = new Presentation(); try { IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Pie, 50, 50, 400, 600, true); IChartData chartData = chart.getChartData(); ((ChartData).setExternalWorkbook("http://path/doesnt/exists", false); } finally { if (pres != null) pres.dispose(); }
setExternalWorkbook
in interface IChartData
workbookPath
- Path to the target workbookupdateChartData
- If value is false only workbook path will be updated.
Chart data won't be loaded and updated from the target workbook. Can be used when target workbook doesn't exist or it's not available.
If value is true chart data will be updated from the target workbook.com.aspose.ms.System.InvalidOperationException
- External workbook is not available or can't be loaded.public final com.aspose.slides.IDOMObject getParent_Immediate()
Returns Parent_Immediate object.
Read-only IDOMObject
.
public final void switchRowColumn()
Swap the data over the axis. Data being charted on the X axis will move to the Y axis and vice versa.
switchRowColumn
in interface IChartData