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

MethodDescription
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 pivot chart’s data from it’s pivot data source.
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:

ParameterTypeDescription
calculateOptionsChartCalculateOptions

changeTemplate(byte[] data)

public void changeTemplate(byte[] data)

Change chart type with preset template.

Parameters:

ParameterTypeDescription
databyte[]The data of chart template file(.crtx).

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.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:

ParameterTypeDescription
aixsTypeint
isPrimaryboolean

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:

ParameterTypeDescription
sheetIndexintThe sheet Index.-1 means the worksheet which contains current chart.
rowIndexintThe row index
columnIndexintThe 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:

ParameterTypeDescription
rowIndexintThe row index
columnIndexintThe 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:

ParameterTypeDescription
upperLeftRowintUpper left row index.
upperLeftColumnintUpper left column index.
lowerRightRowintLower right row index
lowerRightColumnintLower right column index

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

refreshPivotData()

public void refreshPivotData()

Refreshes pivot chart’s data from it’s pivot data source.

Remarks

We will gather data from pivot data source to the pivot chart cache. 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:

ParameterTypeDescription
valueboolean

setChartDataRange(String area, boolean isVertical)

public void setChartDataRange(String area, boolean isVertical)

Specifies data range for a chart.

Parameters:

ParameterTypeDescription
areajava.lang.StringSpecifies values from which to plot the data series
isVerticalbooleanSpecifies 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:

ParameterTypeDescription
valueint

setDisplayNaAsBlank(boolean value)

public void setDisplayNaAsBlank(boolean value)

Indicates whether displaying #N/A as blank value.

Parameters:

ParameterTypeDescription
valueboolean

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:

ParameterTypeDescription
valueint

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:

ParameterTypeDescription
valueint

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:

ParameterTypeDescription
valueint

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:

ParameterTypeDescription
valueint

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:

ParameterTypeDescription
valueint

setHidePivotFieldButtons(boolean value)

public void setHidePivotFieldButtons(boolean value)

Indicates whether hide the pivot chart field buttons only when the chart is PivotChart.

Parameters:

ParameterTypeDescription
valueboolean

setName(String value)

public void setName(String value)

Sets the name of the chart.

Parameters:

ParameterTypeDescription
valuejava.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:

ParameterTypeDescription
valueshort

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:

ParameterTypeDescription
valuejava.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:

ParameterTypeDescription
valueint

setPlotEmptyCellsType(int value)

public void setPlotEmptyCellsType(int value)

Sets how to plot the empty cells.

See PlotEmptyCellsType.

Parameters:

ParameterTypeDescription
valueint

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:

ParameterTypeDescription
valueboolean

setPlotVisibleCellsOnly(boolean value)

public void setPlotVisibleCellsOnly(boolean value)

Indicates whether plot visible cells only.

Parameters:

ParameterTypeDescription
valueboolean

setPrintSize(int value)

public void setPrintSize(int value)

Sets the printed chart size.

See PrintSizeType.

Parameters:

ParameterTypeDescription
valueint

setRectangularCornered(boolean value)

public void setRectangularCornered(boolean value)

Sets a value indicating whether the chart area is rectangular cornered. Default is true.

Parameters:

ParameterTypeDescription
valueboolean

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:

ParameterTypeDescription
valueboolean

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:

ParameterTypeDescription
valueint

setShowDataTable(boolean value)

public void setShowDataTable(boolean value)

Sets a value indicating whether the chart displays a data table.

Parameters:

ParameterTypeDescription
valueboolean

setShowLegend(boolean value)

public void setShowLegend(boolean value)

Sets a value indicating whether the chart legend will be displayed. Default is true.

Parameters:

ParameterTypeDescription
valueboolean

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:

ParameterTypeDescription
valueboolean

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:

ParameterTypeDescription
valueint

setType(int value)

public void setType(int value)

Sets a chart’s type.

See ChartType.

Parameters:

ParameterTypeDescription
valueint

setWallsAndGridlines2D(boolean value)

public void setWallsAndGridlines2D(boolean value)

True if gridlines are drawn two-dimensionally on a 3-D chart.

Parameters:

ParameterTypeDescription
valueboolean

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:

ParameterTypeDescription
streamjava.io.OutputStreamThe output stream.
optionsImageOrPrintOptionsAdditional 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:

ParameterTypeDescription
imageFilejava.lang.StringThe 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:

ParameterTypeDescription
imageFilejava.lang.StringThe image file name with full path.
imageFormatImageFormatThe 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:

ParameterTypeDescription
imageFilejava.lang.StringThe image file name with full path.
optionsImageOrPrintOptionsAdditional 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:

ParameterTypeDescription
imageFilejava.lang.StringThe image file name with full path.
imageTypeintImageOrPrintOptions.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:

ParameterTypeDescription
imageFilejava.lang.StringThe image file name with full path.
jpegQualitylongJpeg quality.

toPdf(OutputStream stream)

public void toPdf(OutputStream stream)

Creates the chart pdf and saves it to a stream.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe 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:

ParameterTypeDescription
streamjava.io.OutputStreamThe output stream.
desiredPageWidthfloatThe desired page width in inches.
desiredPageHeightfloatThe desired page height in inches.
hAlignmentTypeintPageLayoutAlignmentType. The chart horizontal alignment type in the output page.
vAlignmentTypeintPageLayoutAlignmentType. 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:

ParameterTypeDescription
fileNamejava.lang.Stringthe 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:

ParameterTypeDescription
fileNamejava.lang.Stringthe pdf file name with full path
desiredPageWidthfloatThe desired page width in inches.
desiredPageHeightfloatThe desired page height in inches.
hAlignmentTypeintPageLayoutAlignmentType. The chart horizontal alignment type in the output page.
vAlignmentTypeintPageLayoutAlignmentType. 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:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int