public interface 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
UseSecondaryCategories (getUseSecondaryCategories() /setUseSecondaryCategories(boolean) ) property is false). |
IChartDataWorkbook |
getChartDataWorkbook()
Gets the cells factory to create cells used for chart series or categories.
|
int |
getDataSourceType()
Represents data source of the chart
|
java.lang.String |
getExternalWorkbookPath()
Represents external workbook path if data source is external, null otherwise
|
IChartCategoryCollection |
getSecondaryCategories()
Gets the secondary categories if
UseSecondaryCategories (getUseSecondaryCategories() /setUseSecondaryCategories(boolean) ) property is true. |
IChartSeriesCollection |
getSeries()
Gets the series.
|
IChartSeriesGroupCollection |
getSeriesGroups()
Gets the groups of series.
|
boolean |
getUseSecondaryCategories()
If false then
SecondaryCategories (getSecondaryCategories() ) property return null and data
in Categories (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
SecondaryCategories (getSecondaryCategories() ) property return null and data
in Categories (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.
|
IChartDataWorkbook getChartDataWorkbook()
Gets the cells factory to create cells used for chart series or categories.
Read-only IChartDataWorkbook
.
IChartSeriesCollection getSeries()
Gets the series.
Read-only IChartSeriesCollection
.
IChartSeriesGroupCollection getSeriesGroups()
Gets the groups of series.
Read-only IChartSeriesGroupCollection
.
IChartCategoryCollection getCategories()
Gets the primary categories (or both primary and secondary categories
if UseSecondaryCategories
(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() }
UseSecondaryCategories
(getUseSecondaryCategories()
/setUseSecondaryCategories(boolean)
) property is false then SecondaryCategories
(getSecondaryCategories()
)
property return null and data in this Categories
(getCategories()
) property is used both for primary
and secondary series.
If UseSecondaryCategories
(getUseSecondaryCategories()
/setUseSecondaryCategories(boolean)
) property is true then data in SecondaryCategories
(getSecondaryCategories()
)
property is used for secondary series and data in this Categories
(getCategories()
) property is used
for primary series.
boolean getUseSecondaryCategories()
If false then SecondaryCategories
(getSecondaryCategories()
) property return null and data
in Categories
(getCategories()
) property is used both for primary and secondary series.
If true then data in SecondaryCategories
(getSecondaryCategories()
) property is used for secondary series and data
in Categories
(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() }
void setUseSecondaryCategories(boolean value)
If false then SecondaryCategories
(getSecondaryCategories()
) property return null and data
in Categories
(getCategories()
) property is used both for primary and secondary series.
If true then data in SecondaryCategories
(getSecondaryCategories()
) property is used for secondary series and data
in Categories
(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() }
IChartCategoryCollection getSecondaryCategories()
Gets the secondary categories if UseSecondaryCategories
(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() }
UseSecondaryCategories
(getUseSecondaryCategories()
/setUseSecondaryCategories(boolean)
) property is false then this SecondaryCategories
(getSecondaryCategories()
)
property return null and data in Categories
(getCategories()
) property is used both for primary
and secondary series.
If UseSecondaryCategories
(getUseSecondaryCategories()
/setUseSecondaryCategories(boolean)
) property is true then data in
this SecondaryCategories
(getSecondaryCategories()
) property is used for secondary series and data
in Categories
(getCategories()
) property is used for primary series.
byte[] readWorkbookStream()
Writes the internally contained Excel workbook it into an in-memory stream.
void writeWorkbookStream(byte[] ms)
Initializes the internally contained Excel workbook with user-specified value.
ms
- The user-supplied stream containing the entire Excel workbook.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.
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.int getDataSourceType()
Represents data source of the chart
java.lang.String getExternalWorkbookPath()
Represents external workbook path if data source is external, null otherwise
void switchRowColumn()
Swap the data over the axis. Data being charted on the X axis will move to the Y axis and vice versa.
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(); }
workbookPath
- Path to the target workbookcom.aspose.ms.System.InvalidOperationException
- External workbook is not available or can't be loaded.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)chartData).setExternalWorkbook("http://path/doesnt/exists", false); } finally { if (pres != null) pres.dispose(); }
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.