Chart
Inheritance: java.lang.Object
public class Chart
Encapsulates the object that represents a single Excel chart.
Example
The following codes show how to create a chart with .Net codes.
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);
Cells cells = sheet.getCells();
cells.get(0,1).putValue("Income");
cells.get(1,0).putValue("Company A");
cells.get(2,0).putValue("Company B");
cells.get(3,0).putValue("Company C");
cells.get(1,1).putValue(10000);
cells.get(2,1).putValue(20000);
cells.get(3,1).putValue(30000);
int chartIndex = sheet.getCharts().add(ChartType.COLUMN, 9, 9, 21, 15);
Chart chart = sheet.getCharts().get(chartIndex);
chart.setChartDataRange("A1:B4", true);
chart.setShowLegend(true);
chart.getTitle().setText("Income Analysis");
Methods
Method | Description |
---|---|
calculate() | Calculates the custom position of plot area, axes if the position of them are auto assigned. |
calculate(ChartCalculateOptions calculateOptions) | Calculates the custom position of plot area, axes if the position of them are auto assigned, with Chart Calculate Options. |
changeTemplate(byte[] data) | Change chart type with preset template. |
equals(Object arg0) | |
getActualChartSize() | Gets actual size of chart in unit of pixels. |
getActualSize() | Gets actual size of chart in unit of pixels. |
getAutoScaling() | True if Microsoft Excel scales a 3-D chart so that it’s closer in size to the equivalent 2-D chart. |
getBackWall() | Returns a getWalls() object that represents the back wall of a 3-D chart. |
getCategoryAxis() | Gets the chart’s X axis. |
getChartArea() | Gets the chart area in the worksheet. |
getChartDataRange() | Gets the data source range of the chart. |
getChartDataTable() | Represents the chart data table. |
getChartObject() | Represents the chartShape; |
getChartShape() | Represents the chartShape; |
getClass() | |
getDepthPercent() | Represents the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). |
getDisplayNaAsBlank() | Indicates whether displaying #N/A as blank value. |
getElevation() | Represents the elevation of the 3-D chart view, in degrees. |
getFilteredNSeries() | Gets a SeriesCollection collection representing the data series that are filtered in the chart. |
getFirstSliceAngle() | Gets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). |
getFloor() | Returns a getFloor() object that represents the walls of a 3-D chart. |
getGapDepth() | Gets the distance between the data series in a 3-D chart, as a percentage of the marker width. |
getGapWidth() | Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. |
getHeightPercent() | Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent). |
getHidePivotFieldButtons() | Indicates whether hide the pivot chart field buttons only when the chart is PivotChart. |
getIs3D() | Indicates whether the chart is a 3d chart. |
getLegend() | Gets the chart legend. |
getLine() | Gets the line. |
getNSeries() | Gets a SeriesCollection collection representing the data series in the chart. |
getName() | Gets the name of the chart. |
getPageSetup() | Represents the page setup description in this chart. |
getPerspective() | Returns or sets the perspective for the 3-D chart view. |
getPivotOptions() | Specifies the pivot controls that appear on the chart |
getPivotSource() | The source is the data of the pivotTable. |
getPlacement() | Represents the way the chart is attached to the cells below it. |
getPlotArea() | Gets the chart’s plot area which includes axis tick labels. |
getPlotBy() | Gets whether plot by row or column. |
getPlotEmptyCellsType() | Gets how to plot the empty cells. |
getPlotVisibleCells() | Indicates whether only plot visible cells. |
getPlotVisibleCellsOnly() | Indicates whether plot visible cells only. |
getPrintSize() | Gets the printed chart size. |
getRightAngleAxes() | True if the chart axes are at right angles. |
getRotationAngle() | Represents the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees). |
getSecondCategoryAxis() | Gets the chart’s second X axis. |
getSecondValueAxis() | Gets the chart’s second Y axis. |
getSeriesAxis() | Gets the chart’s series axis. |
getShapes() | Returns all drawing shapes in this chart. |
getShowDataTable() | Gets a value indicating whether the chart displays a data table. |
getShowLegend() | Gets a value indicating whether the chart legend will be displayed. |
getSideWall() | Returns a getWalls() object that represents the side wall of a 3-D chart. |
getSizeWithWindow() | True if Microsoft Excel resizes the chart to match the size of the chart sheet window. |
getStyle() | Gets the builtin style. |
getSubTitle() | Gets the chart’s sub-title. |
getTitle() | Gets the chart’s title. |
getType() | Gets a chart’s type. |
getValueAxis() | Gets the chart’s Y axis. |
getWalls() | Returns a getWalls() object that represents the walls of a 3-D chart. |
getWallsAndGridlines2D() | True if gridlines are drawn two-dimensionally on a 3-D chart. |
getWorksheet() | Gets the worksheet which contains this chart. |
hasAxis(int aixsType, boolean isPrimary) | Returns which axes exist on the chart. |
hashCode() | |
isCellReferedByChart(int sheetIndex, int rowIndex, int columnIndex) | Returns whether the cell refered by the chart. |
isChartDataChanged() | Detects if a chart’s data source has changed. |
isRectangularCornered() | Gets a value indicating whether the chart area is rectangular cornered. |
isReferedByChart(int rowIndex, int columnIndex) | Returns whether the cell refered by the chart. |
move(int upperLeftRow, int upperLeftColumn, int lowerRightRow, int lowerRightColumn) | Moves the chart to a specified location. |
notify() | |
notifyAll() | |
refreshPivotData() | Refreshes chart’s data from pivot table. |
setAutoScaling(boolean value) | True if Microsoft Excel scales a 3-D chart so that it’s closer in size to the equivalent 2-D chart. |
setChartDataRange(String area, boolean isVertical) | Specifies data range for a chart. |
setDepthPercent(int value) | Represents the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). |
setDisplayNaAsBlank(boolean value) | Indicates whether displaying #N/A as blank value. |
setElevation(int value) | Represents the elevation of the 3-D chart view, in degrees. |
setFirstSliceAngle(int value) | Sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). |
setGapDepth(int value) | Sets the distance between the data series in a 3-D chart, as a percentage of the marker width. |
setGapWidth(int value) | Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. |
setHeightPercent(int value) | Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent). |
setHidePivotFieldButtons(boolean value) | Indicates whether hide the pivot chart field buttons only when the chart is PivotChart. |
setName(String value) | Sets the name of the chart. |
setPerspective(short value) | Returns or sets the perspective for the 3-D chart view. |
setPivotSource(String value) | The source is the data of the pivotTable. |
setPlacement(int value) | Represents the way the chart is attached to the cells below it. |
setPlotEmptyCellsType(int value) | Sets how to plot the empty cells. |
setPlotVisibleCells(boolean value) | Indicates whether only plot visible cells. |
setPlotVisibleCellsOnly(boolean value) | Indicates whether plot visible cells only. |
setPrintSize(int value) | Sets the printed chart size. |
setRectangularCornered(boolean value) | Sets a value indicating whether the chart area is rectangular cornered. |
setRightAngleAxes(boolean value) | True if the chart axes are at right angles. |
setRotationAngle(int value) | Represents the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees). |
setShowDataTable(boolean value) | Sets a value indicating whether the chart displays a data table. |
setShowLegend(boolean value) | Sets a value indicating whether the chart legend will be displayed. |
setSizeWithWindow(boolean value) | True if Microsoft Excel resizes the chart to match the size of the chart sheet window. |
setStyle(int value) | Sets the builtin style. |
setType(int value) | Sets a chart’s type. |
setWallsAndGridlines2D(boolean value) | True if gridlines are drawn two-dimensionally on a 3-D chart. |
switchRowColumn() | Switches row/column. |
toImage(OutputStream stream, ImageOrPrintOptions options) | Creates the chart image and saves it to a stream in the specified format. |
toImage(String imageFile) | Creates the chart image and saves it to a file. |
toImage(String imageFile, ImageFormat imageFormat) | Creates the chart image and saves it to a file in the specified format. |
toImage(String imageFile, ImageOrPrintOptions options) | Creates the chart image and saves it to a file. |
toImage(String imageFile, int imageType) | Creates the chart image and saves it to a file in the specified image type. |
toImage(String imageFile, long jpegQuality) | Creates the chart image and saves it to a file in the Jpeg format. |
toPdf(OutputStream stream) | Creates the chart pdf and saves it to a stream. |
toPdf(OutputStream stream, float desiredPageWidth, float desiredPageHeight, int hAlignmentType, int vAlignmentType) | Creates the chart pdf and saves it to a stream. |
toPdf(String fileName) | Saves the chart to a pdf file. |
toPdf(String fileName, float desiredPageWidth, float desiredPageHeight, int hAlignmentType, int vAlignmentType) | Saves the chart to a pdf file. |
toString() | |
wait() | |
wait(long arg0) | |
wait(long arg0, int arg1) |
calculate()
public void calculate()
Calculates the custom position of plot area, axes if the position of them are auto assigned.
calculate(ChartCalculateOptions calculateOptions)
public void calculate(ChartCalculateOptions calculateOptions)
Calculates the custom position of plot area, axes if the position of them are auto assigned, with Chart Calculate Options.
Parameters:
Parameter | Type | Description |
---|---|---|
calculateOptions | ChartCalculateOptions |
changeTemplate(byte[] data)
public void changeTemplate(byte[] data)
Change chart type with preset template.
Parameters:
Parameter | Type | Description |
---|---|---|
data | byte[] | The data of chart template file(.crtx). |
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | java.lang.Object |
Returns: boolean
getActualChartSize()
public int[] getActualChartSize()
Gets actual size of chart in unit of pixels.
Remarks
NOTE: This member is now obsolete. Instead, please use Chart.getActualSize() method. This property will be removed 12 months later since July 2022. Aspose apologizes for any inconvenience you may have experienced.
Returns: int[] - Actual size in an array(width and height). [0] is width; [1] is height.
getActualSize()
public int[] getActualSize()
Gets actual size of chart in unit of pixels.
Returns: int[] - Actual size in an array(width and height). [0] is width; [1] is height.
getAutoScaling()
public boolean getAutoScaling()
True if Microsoft Excel scales a 3-D chart so that it’s closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True.
Returns: boolean
getBackWall()
public Walls getBackWall()
Returns a getWalls() object that represents the back wall of a 3-D chart.
Returns: Walls
getCategoryAxis()
public Axis getCategoryAxis()
Gets the chart’s X axis.
Returns: Axis
getChartArea()
public ChartArea getChartArea()
Gets the chart area in the worksheet.
Returns: ChartArea
getChartDataRange()
public String getChartDataRange()
Gets the data source range of the chart.
Remarks
Only supports range.
Returns: java.lang.String - The data source.
getChartDataTable()
public ChartDataTable getChartDataTable()
Represents the chart data table.
Returns: ChartDataTable
getChartObject()
public ChartShape getChartObject()
Represents the chartShape;
Returns: ChartShape
getChartShape()
public ChartShape getChartShape()
Represents the chartShape;
Remarks
NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Charts.Chart.ChartObject property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.
Returns: ChartShape
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
getDepthPercent()
public int getDepthPercent()
Represents the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent).
Returns: int
getDisplayNaAsBlank()
public boolean getDisplayNaAsBlank()
Indicates whether displaying #N/A as blank value.
Returns: boolean
getElevation()
public int getElevation()
Represents the elevation of the 3-D chart view, in degrees.
Remarks
The chart elevation is the height at which you view the chart, in degrees. The default is 15 for most chart types. The value of this property must be between -90 and 90, except for 3-D bar charts, where it must be between 0 and 44.
Returns: int
getFilteredNSeries()
public SeriesCollection getFilteredNSeries()
Gets a SeriesCollection collection representing the data series that are filtered in the chart.
Returns: SeriesCollection
getFirstSliceAngle()
public int getFirstSliceAngle()
Gets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts, 0 to 360.
Returns: int
getFloor()
public Floor getFloor()
Returns a getFloor() object that represents the walls of a 3-D chart.
Remarks
This property doesn’t apply to 3-D pie charts.
Returns: Floor
getGapDepth()
public int getGapDepth()
Gets the distance between the data series in a 3-D chart, as a percentage of the marker width. The value of this property must be between 0 and 500.
Returns: int
getGapWidth()
public int getGapWidth()
Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. The value of this property must be between 0 and 500.
Returns: int
getHeightPercent()
public int getHeightPercent()
Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent).
Returns: int
getHidePivotFieldButtons()
public boolean getHidePivotFieldButtons()
Indicates whether hide the pivot chart field buttons only when the chart is PivotChart.
Returns: boolean
getIs3D()
public boolean getIs3D()
Indicates whether the chart is a 3d chart.
Returns: boolean
getLegend()
public Legend getLegend()
Gets the chart legend.
Returns: Legend
getLine()
public Line getLine()
Gets the line.
Returns: Line
getNSeries()
public SeriesCollection getNSeries()
Gets a SeriesCollection collection representing the data series in the chart.
Returns: SeriesCollection
getName()
public String getName()
Gets the name of the chart.
Returns: java.lang.String
getPageSetup()
public PageSetup getPageSetup()
Represents the page setup description in this chart.
Returns: PageSetup
getPerspective()
public short getPerspective()
Returns or sets the perspective for the 3-D chart view. Must be between 0 and 100. This property is ignored if the RightAngleAxes property is True.
Returns: short
getPivotOptions()
public PivotOptions getPivotOptions()
Specifies the pivot controls that appear on the chart
Returns: PivotOptions
getPivotSource()
public String getPivotSource()
The source is the data of the pivotTable. If PivotSource is not empty ,the chart is PivotChart.
Remarks
If the pivot table “PivotTable1” in the Worksheet “Sheet1” in the file “Book1.xls”. The pivotSource could be “[Book1.xls]Sheet1!PivotTable1” if the chart and the PivotTable is not in the same workbook. If you set this property ,the previous data source setting will be lost.
Returns: java.lang.String
getPlacement()
public int getPlacement()
Represents the way the chart is attached to the cells below it.
See PlacementType.
Returns: int
getPlotArea()
public PlotArea getPlotArea()
Gets the chart’s plot area which includes axis tick labels.
Remarks
Returns: PlotArea
getPlotBy()
public int getPlotBy()
Gets whether plot by row or column.
See PlotDataByType.
Returns: int
getPlotEmptyCellsType()
public int getPlotEmptyCellsType()
Gets how to plot the empty cells.
See PlotEmptyCellsType.
Returns: int
getPlotVisibleCells()
public boolean getPlotVisibleCells()
Indicates whether only plot visible cells.
Remarks
NOTE: This member is now obsolete. Instead, please use PlotVisibleCellsOnly property. This method will be removed 12 months later since December 2022. Aspose apologizes for any inconvenience you may have experienced.
Returns: boolean
getPlotVisibleCellsOnly()
public boolean getPlotVisibleCellsOnly()
Indicates whether plot visible cells only.
Returns: boolean
getPrintSize()
public int getPrintSize()
Gets the printed chart size.
See PrintSizeType.
Returns: int
getRightAngleAxes()
public boolean getRightAngleAxes()
True if the chart axes are at right angles. Applies only for 3-D charts(except Column3D and 3-D Pie Charts).
Remarks
If this property is True, the Perspective property is ignored.
Returns: boolean
getRotationAngle()
public int getRotationAngle()
Represents the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees).
Remarks
The value of this property must be from 0 to 360, except for 3-D bar charts, where the value must be from 0 to 44. The default value is 20. Applies only to 3-D charts.
Returns: int
getSecondCategoryAxis()
public Axis getSecondCategoryAxis()
Gets the chart’s second X axis.
Returns: Axis
getSecondValueAxis()
public Axis getSecondValueAxis()
Gets the chart’s second Y axis.
Returns: Axis
getSeriesAxis()
public Axis getSeriesAxis()
Gets the chart’s series axis.
Returns: Axis
getShapes()
public ShapeCollection getShapes()
Returns all drawing shapes in this chart.
Returns: ShapeCollection
getShowDataTable()
public boolean getShowDataTable()
Gets a value indicating whether the chart displays a data table.
Returns: boolean
getShowLegend()
public boolean getShowLegend()
Gets a value indicating whether the chart legend will be displayed. Default is true.
Returns: boolean
getSideWall()
public Walls getSideWall()
Returns a getWalls() object that represents the side wall of a 3-D chart.
Returns: Walls
getSizeWithWindow()
public boolean getSizeWithWindow()
True if Microsoft Excel resizes the chart to match the size of the chart sheet window.
Returns: boolean
getStyle()
public int getStyle()
Gets the builtin style.
Remarks
It should be between 1 and 48. Return -1 if it’s not be set.
Returns: int
getSubTitle()
public Title getSubTitle()
Gets the chart’s sub-title. Only for ODS format file.
Returns: Title
getTitle()
public Title getTitle()
Gets the chart’s title.
Returns: Title
getType()
public int getType()
Gets a chart’s type.
See ChartType.
Returns: int
getValueAxis()
public Axis getValueAxis()
Gets the chart’s Y axis.
Returns: Axis
getWalls()
public Walls getWalls()
Returns a getWalls() object that represents the walls of a 3-D chart.
Remarks
This property doesn’t apply to 3-D pie charts.
Returns: Walls
getWallsAndGridlines2D()
public boolean getWallsAndGridlines2D()
True if gridlines are drawn two-dimensionally on a 3-D chart.
Returns: boolean
getWorksheet()
public Worksheet getWorksheet()
Gets the worksheet which contains this chart.
Returns: Worksheet
hasAxis(int aixsType, boolean isPrimary)
public boolean hasAxis(int aixsType, boolean isPrimary)
Returns which axes exist on the chart.
Remarks
Normally, Pie, PieExploded, PiePie,PieBar, Pie3D, Pie3DExploded,Doughnut, DoughnutExploded is no axis.
Parameters:
Parameter | Type | Description |
---|---|---|
aixsType | int | |
isPrimary | boolean |
Returns: boolean
hashCode()
public native int hashCode()
Returns: int
isCellReferedByChart(int sheetIndex, int rowIndex, int columnIndex)
public boolean isCellReferedByChart(int sheetIndex, int rowIndex, int columnIndex)
Returns whether the cell refered by the chart.
Parameters:
Parameter | Type | Description |
---|---|---|
sheetIndex | int | The sheet Index.-1 means the worksheet which contains current chart. |
rowIndex | int | The row index |
columnIndex | int | The column index |
Returns: boolean -
isChartDataChanged()
public boolean isChartDataChanged()
Detects if a chart’s data source has changed.
Remarks
The method detects the changes in the chart’s data source before rendering the chart to image format. At first Chart.toImage call, the chart source data (e.g. XValuesParseData, ValuesParseData) will be recorded. Before calling the Chart.toImage method again, call IsChartDataChanged method to check if Chart needs re-rendering.
Returns: boolean - Returns true if the chart has changed otherwise returns false
isRectangularCornered()
public boolean isRectangularCornered()
Gets a value indicating whether the chart area is rectangular cornered. Default is true.
Returns: boolean
isReferedByChart(int rowIndex, int columnIndex)
public boolean isReferedByChart(int rowIndex, int columnIndex)
Returns whether the cell refered by the chart.
Remarks
NOTE: This method is now obsolete. Instead, please use IsCellReferedByChart(int,int,int) method. This method will be removed 12 months later since April 2023. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | The row index |
columnIndex | int | The column index |
Returns: boolean -
move(int upperLeftRow, int upperLeftColumn, int lowerRightRow, int lowerRightColumn)
public void move(int upperLeftRow, int upperLeftColumn, int lowerRightRow, int lowerRightColumn)
Moves the chart to a specified location.
Parameters:
Parameter | Type | Description |
---|---|---|
upperLeftRow | int | Upper left row index. |
upperLeftColumn | int | Upper left column index. |
lowerRightRow | int | Lower right row index |
lowerRightColumn | int | Lower right column index |
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
refreshPivotData()
public void refreshPivotData()
Refreshes chart’s data from pivot table.
Remarks
We will gather data from pivot data source to the pivot table report. This method is only used to gather all data to a pivot chart.
setAutoScaling(boolean value)
public void setAutoScaling(boolean value)
True if Microsoft Excel scales a 3-D chart so that it’s closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setChartDataRange(String area, boolean isVertical)
public void setChartDataRange(String area, boolean isVertical)
Specifies data range for a chart.
Parameters:
Parameter | Type | Description |
---|---|---|
area | java.lang.String | Specifies values from which to plot the data series |
isVertical | boolean | Specifies whether to plot the series from a range of cell values by row or by column. |
setDepthPercent(int value)
public void setDepthPercent(int value)
Represents the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent).
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setDisplayNaAsBlank(boolean value)
public void setDisplayNaAsBlank(boolean value)
Indicates whether displaying #N/A as blank value.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setElevation(int value)
public void setElevation(int value)
Represents the elevation of the 3-D chart view, in degrees.
Remarks
The chart elevation is the height at which you view the chart, in degrees. The default is 15 for most chart types. The value of this property must be between -90 and 90, except for 3-D bar charts, where it must be between 0 and 44.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setFirstSliceAngle(int value)
public void setFirstSliceAngle(int value)
Sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts, 0 to 360.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setGapDepth(int value)
public void setGapDepth(int value)
Sets the distance between the data series in a 3-D chart, as a percentage of the marker width. The value of this property must be between 0 and 500.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setGapWidth(int value)
public void setGapWidth(int value)
Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. The value of this property must be between 0 and 500.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setHeightPercent(int value)
public void setHeightPercent(int value)
Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent).
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setHidePivotFieldButtons(boolean value)
public void setHidePivotFieldButtons(boolean value)
Indicates whether hide the pivot chart field buttons only when the chart is PivotChart.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setName(String value)
public void setName(String value)
Sets the name of the chart.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setPerspective(short value)
public void setPerspective(short value)
Returns or sets the perspective for the 3-D chart view. Must be between 0 and 100. This property is ignored if the RightAngleAxes property is True.
Parameters:
Parameter | Type | Description |
---|---|---|
value | short |
setPivotSource(String value)
public void setPivotSource(String value)
The source is the data of the pivotTable. If PivotSource is not empty ,the chart is PivotChart.
Remarks
If the pivot table “PivotTable1” in the Worksheet “Sheet1” in the file “Book1.xls”. The pivotSource could be “[Book1.xls]Sheet1!PivotTable1” if the chart and the PivotTable is not in the same workbook. If you set this property ,the previous data source setting will be lost.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setPlacement(int value)
public void setPlacement(int value)
Represents the way the chart is attached to the cells below it.
See PlacementType.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setPlotEmptyCellsType(int value)
public void setPlotEmptyCellsType(int value)
Sets how to plot the empty cells.
See PlotEmptyCellsType.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setPlotVisibleCells(boolean value)
public void setPlotVisibleCells(boolean value)
Indicates whether only plot visible cells.
Remarks
NOTE: This member is now obsolete. Instead, please use PlotVisibleCellsOnly property. This method will be removed 12 months later since December 2022. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setPlotVisibleCellsOnly(boolean value)
public void setPlotVisibleCellsOnly(boolean value)
Indicates whether plot visible cells only.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setPrintSize(int value)
public void setPrintSize(int value)
Sets the printed chart size.
See PrintSizeType.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setRectangularCornered(boolean value)
public void setRectangularCornered(boolean value)
Sets a value indicating whether the chart area is rectangular cornered. Default is true.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setRightAngleAxes(boolean value)
public void setRightAngleAxes(boolean value)
True if the chart axes are at right angles. Applies only for 3-D charts(except Column3D and 3-D Pie Charts).
Remarks
If this property is True, the Perspective property is ignored.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setRotationAngle(int value)
public void setRotationAngle(int value)
Represents the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees).
Remarks
The value of this property must be from 0 to 360, except for 3-D bar charts, where the value must be from 0 to 44. The default value is 20. Applies only to 3-D charts.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setShowDataTable(boolean value)
public void setShowDataTable(boolean value)
Sets a value indicating whether the chart displays a data table.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setShowLegend(boolean value)
public void setShowLegend(boolean value)
Sets a value indicating whether the chart legend will be displayed. Default is true.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setSizeWithWindow(boolean value)
public void setSizeWithWindow(boolean value)
True if Microsoft Excel resizes the chart to match the size of the chart sheet window.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setStyle(int value)
public void setStyle(int value)
Sets the builtin style.
Remarks
It should be between 1 and 48. Return -1 if it’s not be set.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setType(int value)
public void setType(int value)
Sets a chart’s type.
See ChartType.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setWallsAndGridlines2D(boolean value)
public void setWallsAndGridlines2D(boolean value)
True if gridlines are drawn two-dimensionally on a 3-D chart.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
switchRowColumn()
public boolean switchRowColumn()
Switches row/column.
Returns: boolean - False means switching row/column fails.
toImage(OutputStream stream, ImageOrPrintOptions options)
public void toImage(OutputStream stream, ImageOrPrintOptions options)
Creates the chart image and saves it to a stream in the specified format.
Remarks
The format of the image is specified by using options.ImageFormat
. The following formats are supported: ImageFormat.Bmp, ImageFormat.Gif, ImageFormat.Png, ImageFormat.Jpeg, ImageFormat.Tiff, ImageFormat.Emf.
If the width or height is zero or the chart is not supported according to Supported Charts List, this method will do nothing. Please refer to Supported Charts List for more details.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | The output stream. |
options | ImageOrPrintOptions | Additional image creation options |
toImage(String imageFile)
public void toImage(String imageFile)
Creates the chart image and saves it to a file. The extension of the file name determines the format of the image.
Remarks
The format of the image is specified by using the extension of the file name. For example, if you specify “myfile.png”, then the image will be saved in the PNG format. The following file extensions are recognized: .bmp, .gif, .png, .jpg, .jpeg, .tiff, .tif, .emf.
If the width or height is zero or the chart is not supported according to Supported Charts List, this method will do nothing.
Parameters:
Parameter | Type | Description |
---|---|---|
imageFile | java.lang.String | The image file name with full path. |
toImage(String imageFile, ImageFormat imageFormat)
public void toImage(String imageFile, ImageFormat imageFormat)
Creates the chart image and saves it to a file in the specified format.
Remarks
NOTE: This member is now obsolete. Instead, please use Chart.ToImage(string, ImageType) method. This property will be removed 12 months later since July 2022. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
imageFile | java.lang.String | The image file name with full path. |
imageFormat | ImageFormat | The format in which to save the image. |
toImage(String imageFile, ImageOrPrintOptions options)
public void toImage(String imageFile, ImageOrPrintOptions options)
Creates the chart image and saves it to a file. The extension of the file name determines the format of the image.
Remarks
The format of the image is specified by using the extension of the file name. For example, if you specify “myfile.png”, then the image will be saved in the PNG format. The following file extensions are recognized: .bmp, .gif, .png, .jpg, .jpeg, .tiff, .tif, .emf.
If the width or height is zero or the chart is not supported according to Supported Charts List, this method will do nothing. Please refer to Supported Charts List for more details.
Example
Saves to Tiff with 300 dpi and CCITT4 compression.
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setHorizontalResolution(300);
options.setVerticalResolution(300);
options.setTiffCompression(TiffCompression.COMPRESSION_CCITT_4);
Workbook book = new Workbook("test.xls");
book.getWorksheets().get(0).getCharts().get(0).toImage("chart.Tiff", options);
Parameters:
Parameter | Type | Description |
---|---|---|
imageFile | java.lang.String | The image file name with full path. |
options | ImageOrPrintOptions | Additional image creation options |
toImage(String imageFile, int imageType)
public void toImage(String imageFile, int imageType)
Creates the chart image and saves it to a file in the specified image type.
Remarks
The type of the image is specified by using imageType
. The following types are supported: ImageType.Bmp, ImageType.Gif, ImageType.Png, ImageType.Jpeg, ImageType.Tiff, ImageType.Emf.
If the width or height is zero or the chart is not supported according to Supported Charts List, this method will do nothing.
Parameters:
Parameter | Type | Description |
---|---|---|
imageFile | java.lang.String | The image file name with full path. |
imageType | int | ImageOrPrintOptions.getImageType(). The image type in which to save the image. |
toImage(String imageFile, long jpegQuality)
public void toImage(String imageFile, long jpegQuality)
Creates the chart image and saves it to a file in the Jpeg format.
Remarks
If the width or height is zero or the chart is not supported according to Supported Charts List, this method will do nothing.
Parameters:
Parameter | Type | Description |
---|---|---|
imageFile | java.lang.String | The image file name with full path. |
jpegQuality | long | Jpeg quality. |
toPdf(OutputStream stream)
public void toPdf(OutputStream stream)
Creates the chart pdf and saves it to a stream.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | The output stream. |
toPdf(OutputStream stream, float desiredPageWidth, float desiredPageHeight, int hAlignmentType, int vAlignmentType)
public void toPdf(OutputStream stream, float desiredPageWidth, float desiredPageHeight, int hAlignmentType, int vAlignmentType)
Creates the chart pdf and saves it to a stream.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | The output stream. |
desiredPageWidth | float | The desired page width in inches. |
desiredPageHeight | float | The desired page height in inches. |
hAlignmentType | int | PageLayoutAlignmentType. The chart horizontal alignment type in the output page. |
vAlignmentType | int | PageLayoutAlignmentType. The chart vertical alignment type in the output page. |
toPdf(String fileName)
public void toPdf(String fileName)
Saves the chart to a pdf file.
Parameters:
Parameter | Type | Description |
---|---|---|
fileName | java.lang.String | the pdf file name with full path |
toPdf(String fileName, float desiredPageWidth, float desiredPageHeight, int hAlignmentType, int vAlignmentType)
public void toPdf(String fileName, float desiredPageWidth, float desiredPageHeight, int hAlignmentType, int vAlignmentType)
Saves the chart to a pdf file.
Parameters:
Parameter | Type | Description |
---|---|---|
fileName | java.lang.String | the pdf file name with full path |
desiredPageWidth | float | The desired page width in inches. |
desiredPageHeight | float | The desired page height in inches. |
hAlignmentType | int | PageLayoutAlignmentType. The chart horizontal alignment type in the output page. |
vAlignmentType | int | PageLayoutAlignmentType. The chart vertical alignment type in the output page. |
toString()
public String toString()
Returns: java.lang.String
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |