Home  Products  Purchase  Downloads  Demos  Forums  Blogs  Ticket  Wiki  API  Corporate


com.aspose.cells
Class Chart

java.lang.Object
  extended by com.aspose.cells.Chart

public class Chart
extends java.lang.Object

Encapsulates the object that represents a single Workbook chart.


Method Summary
 CategoryAxis getCategoryAxis()
          Gets the chart's category axis.
 ChartArea getChartArea()
          Gets the chart area in the worksheet.
 ChartDataTable getChartDataTable()
          Gets chart data table.
 ChartShape getChartShape()
          Gets the Shape object of this Chart.
 short getDepthPercent()
          Represents the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent).
 int getElevation()
          Gets the elevation of the 3-D chart view, in degrees(between -90 and 90).
 int getFirstSliceAngle()
          Gets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical).
 Floor getFloor()
          Gets a Floor object that represents the walls of a 3-D chart.
 short getGapDepth()
          Gets the distance between the data series in a 3-D chart, as a percentage of the marker width.
 int getGapWidth()
          Gets the space between bar or column clusters, as a percentage of the bar or column width.
 short getHeightPercent()
          Gets the height of a 3-D chart as a percentage of the chart width(between 5 and 500 percent).
 Legend getLegend()
          Gets the chart legend.
 NSeries getNSeries()
          Gets a NSeries object representing the data series in the chart.
 int getOverlap()
          Sets the space between bar or column in a cluster, as a percentage of the bar or column width.
 PageSetup getPageSetup()
          Gets the page setup description in this chart.
 int getPerspective()
          Gets the perspective for the 3-D chart view.
 java.lang.String getPivotSource()
          Gets the pivot source.
 PlotArea getPlotArea()
          Gets the chart's plot area.
 byte getPlotEmptyCellsType()
          Gets the type to plot empty cells as.
 byte getPrintSize()
          Gets the printed chart size.
 int getRotation()
          Gets the rotation of the 3-D chart view (the rotation of the plot area around the series axis, in degrees)(between 0 and 360).
 CategoryAxis getSecondCategoryAxis()
          Gets the chart's second category axis.
 ValueAxis getSecondValueAxis()
          Gets the chart's second value axis.
 ValueAxis getSecondValueXAxis()
          Gets the chart's second value x axis.Only applies for Scatter and Bubble chart.
 SeriesAxis getSeriesAxis()
          Gets the chart's series axis.
 Shapes getShapes()
          Gets the Shapes object which this Chart is in.
 TextBoxes getTextBoxes()
          Gets the TextBoxes collection.
 Title getTitle()
          Gets the chart's title.
 int getType()
          Gets a chart's type.
 ValueAxis getValueAxis()
          Gets the chart's value axis.
 ValueAxis getValueXAxis()
          Gets the chart's value x axis.Only applies for Scatter and Bubble chart.
 Walls getWalls()
          Gets a Walls object that represents the walls of a 3-D chart.
 void hidePivotFieldButton(boolean isHidden)
          Indeicates whether the pivot field button is hidden.
 boolean isAutoScaling()
          True if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart.
 boolean isDataTableShown()
          Indicates whether the chart displays a data table.
 boolean isHiddenPivotFieldButton()
          Gets whether the pivot field button is hidden.
 boolean isLegendOverlay()
          Check whether the Legend overlaps chart.
 boolean isLegendShown()
          Indicates whether the chart legend will be displayed.
 boolean isPlotVisibleCells()
          Indicates whether only plot visible cells.
 boolean isRightAngleAxes()
          True if the chart axes are at right angles, independent of chart rotation or elevation.
 boolean isSizeWithWindow()
          Indicates whether Microsoft Excel resizes the chart to match the size of the chart sheet window.
 boolean isTitleOverlay()
          Checks whether the chart title overlaps chart.
 boolean isWallsAndGridlines2D()
          Indicates if gridlines are drawn two-dimensionally on a 3-D chart.
 void setAutoScaling(boolean isAutoScaling)
          True if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart.
 void setDataTableShown(boolean isDataTableShown)
          Indicates whether the chart displays a data table.
 void setDepthPercent(int depthPercent)
          Represents the depth of a 3-D chart view as a percentage of the chart width (between 20 and 2000 percent).
 void setElevation(int elevation)
          Sets the elevation of the 3-D chart view, in degrees(between -90 and 90).
 void setFirstSliceAngle(int firstSliceAngle)
          Sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical).
 void setGapDepth(int gapDepth)
          Sets the distance between the data series in a 3-D chart, as a percentage of the marker width.
 void setGapWidth(int gapWidth)
          Sets the space between bar or column clusters, as a percentage of the bar or column width.
 void setHeightPercent(int heightPercent)
          Sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent).
 void setLegendOverlay(boolean overlay)
          Sets whether the Legend overlaps chart.
 void setLegendShown(boolean isLegendShown)
          Sets whether the chart legend will be displayed.Default is true.
 void setOverlap(int overlap)
          Sets the space between bar or column in a cluster, as a percentage of the bar or column width.
 void setPerspective(int perspective)
          Gets the perspective for the 3-D chart view.
 void setPivotSource(java.lang.String pivotSource)
          Sets the pivot source.It means this chart is a PivotChart.
 void setPlotEmptyCellsType(byte type)
          Sets the type to plot empty cells as.
 void setPlotVisibleCells(boolean val)
          Sets whether only plot visible cells.
 void setPrintSize(byte printSize)
          Sets the printed chart size.
 void setRightAngleAxes(boolean isRightAngleAxes)
          True if the chart axes are at right angles, independent of chart rotation or elevation.
 void setRotation(int rotation)
          Sets the rotation of the 3-D chart view (the rotation of the plot area around the series axis, in degrees)(between 0 and 360).
 void setSizeWithWindow(boolean val)
          Sets whether Microsoft Excel resizes the chart to match the size of the chart sheet window.
 void setTitleOverlay(boolean overlay)
          Sets whether the chart title overlaps chart.
 void setType(int type)
          Sets a chart's type.
 void setWallsAndGridlines2D(boolean val)
          set whether gridlines are drawn two-dimensionally on a 3-D chart.
 void toImage(java.io.OutputStream stream, ImageOptions options)
          Converts this chart to image and save the image to given stream.
 void toImage(java.lang.String file, ImageOptions options)
          Converts this chart to image and save the image to given file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getShapes

public Shapes getShapes()
Gets the Shapes object which this Chart is in.

Returns:
the Shapes object.

getChartShape

public ChartShape getChartShape()
Gets the Shape object of this Chart.

Returns:
the Shape object of this Chart.

getTextBoxes

public TextBoxes getTextBoxes()
Gets the TextBoxes collection.

Returns:
the TextBoxes collection.

getType

public int getType()
Gets a chart's type.

Returns:
a chart's type.

setType

public void setType(int type)
Sets a chart's type.

Parameters:
type - a chart's type.
Throws:
CellsException - if charts has bean removed.

getPrintSize

public byte getPrintSize()
Gets the printed chart size.

Returns:
the printed chart size

setPrintSize

public void setPrintSize(byte printSize)
Sets the printed chart size.

Parameters:
printSize - the printed chart size. Must be one of following: PrintSizeType.FULL, PrintSizeType.FIT, PrintSizeType.CUSTOM

isPlotVisibleCells

public boolean isPlotVisibleCells()
Indicates whether only plot visible cells.

Returns:
whether only plot visible cells.

setPlotVisibleCells

public void setPlotVisibleCells(boolean val)
Sets whether only plot visible cells.

Parameters:
val - whether only plot visible cells.

isSizeWithWindow

public boolean isSizeWithWindow()
Indicates whether Microsoft Excel resizes the chart to match the size of the chart sheet window.

Returns:
true if Microsoft Excel resizes the chart to match the size of the chart sheet window.

setSizeWithWindow

public void setSizeWithWindow(boolean val)
Sets whether Microsoft Excel resizes the chart to match the size of the chart sheet window.

Parameters:
val - True if Microsoft Excel resizes the chart to match the size of the chart sheet window.

getPlotEmptyCellsType

public byte getPlotEmptyCellsType()
Gets the type to plot empty cells as.

Returns:
type to plot empty cells.
See Also:
setPlotEmptyCellsType(byte)

setPlotEmptyCellsType

public void setPlotEmptyCellsType(byte type)
Sets the type to plot empty cells as.

Parameters:
type - type to plot empty cells.
See Also:
PlotEmptyCellsType

getChartArea

public ChartArea getChartArea()
Gets the chart area in the worksheet.

Returns:
the chart area.
Throws:
CellsException - if charts has bean removed.

getPlotArea

public PlotArea getPlotArea()
Gets the chart's plot area.

Returns:
the chart's plot area.
Throws:
CellsException - if charts has bean removed.

getCategoryAxis

public CategoryAxis getCategoryAxis()
Gets the chart's category axis.

Returns:
CategoryAxis the chart's category axis.
Throws:
CellsException - if charts has bean removed.

getValueAxis

public ValueAxis getValueAxis()
Gets the chart's value axis.

Returns:
ValueAxis the chart's value axis.
Throws:
CellsException - if charts has bean removed.

getValueXAxis

public ValueAxis getValueXAxis()
Gets the chart's value x axis.Only applies for Scatter and Bubble chart.

Returns:
ValueAxis the chart's value x axis.
Throws:
CellsException - if charts has bean removed.

getSecondCategoryAxis

public CategoryAxis getSecondCategoryAxis()
Gets the chart's second category axis.

Returns:
CategoryAxis the chart's second category axis.
Throws:
CellsException - if charts has bean removed.

getSecondValueAxis

public ValueAxis getSecondValueAxis()
Gets the chart's second value axis.

Returns:
ValueAxis the chart's second value axis.
Throws:
CellsException - if charts has bean removed.

getSecondValueXAxis

public ValueAxis getSecondValueXAxis()
Gets the chart's second value x axis.Only applies for Scatter and Bubble chart.

Returns:
ValueAxis the chart's value x axis.
Throws:
CellsException - if charts has bean removed.

getSeriesAxis

public SeriesAxis getSeriesAxis()
Gets the chart's series axis.

Returns:
SeriesAxis the chart's series axis.
Throws:
CellsException - if charts has bean removed.

getNSeries

public NSeries getNSeries()
Gets a NSeries object representing the data series in the chart.

Returns:
a NSeries object.
Throws:
CellsException - if charts has bean removed.

getLegend

public Legend getLegend()
Gets the chart legend.

Returns:
the chart legend.
Throws:
CellsException - if charts has bean removed.

isLegendShown

public boolean isLegendShown()
Indicates whether the chart legend will be displayed. Default is true.

Returns:
whether the chart legend will be displayed.
Throws:
CellsException - if charts has bean removed.

setLegendShown

public void setLegendShown(boolean isLegendShown)
Sets whether the chart legend will be displayed.Default is true.

Parameters:
isLegendShown - whether the chart legend will be displayed.
Throws:
CellsException - if charts has bean removed.

isLegendOverlay

public boolean isLegendOverlay()
Check whether the Legend overlaps chart.

Returns:
true if the Legend overlaps chart.

setLegendOverlay

public void setLegendOverlay(boolean overlay)
Sets whether the Legend overlaps chart.

Parameters:
overlay - whether the Legend overlaps chart.

isWallsAndGridlines2D

public boolean isWallsAndGridlines2D()
Indicates if gridlines are drawn two-dimensionally on a 3-D chart.

Returns:
if gridlines are drawn two-dimensionally on a 3-D chart

setWallsAndGridlines2D

public void setWallsAndGridlines2D(boolean val)
set whether gridlines are drawn two-dimensionally on a 3-D chart.

Parameters:
val - if gridlines are drawn two-dimensionally on a 3-D chart

getTitle

public Title getTitle()
Gets the chart's title.

Returns:
the chart's title.
Throws:
CellsException - if charts has bean removed.

isTitleOverlay

public boolean isTitleOverlay()
Checks whether the chart title overlaps chart.

Returns:
true if the chart title overlaps chart.

setTitleOverlay

public void setTitleOverlay(boolean overlay)
Sets whether the chart title overlaps chart.

Parameters:
overlay - whether the chart title overlaps chart.

getFloor

public Floor getFloor()
Gets a Floor object that represents the walls of a 3-D chart.

Returns:
a Floor object.
Throws:
CellsException - if charts has bean removed.

getWalls

public Walls getWalls()
Gets a Walls object that represents the walls of a 3-D chart.

Returns:
a Walls object.
Throws:
CellsException - if charts has bean removed.

isDataTableShown

public boolean isDataTableShown()
Indicates whether the chart displays a data table. Default is false.

Returns:
whether the chart displays a data table.
Throws:
CellsException - if charts has bean removed.

setDataTableShown

public void setDataTableShown(boolean isDataTableShown)
Indicates whether the chart displays a data table. Default is false.

Parameters:
isDataTableShown - whether the chart displays a data table.
Throws:
CellsException - if charts has bean removed.

getChartDataTable

public ChartDataTable getChartDataTable()
Gets chart data table. Please enable data table is shown first,or data table is ignored.

Returns:
chart data table.
Throws:
CellsException - if charts has bean removed.

getDepthPercent

public short getDepthPercent()
Represents the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent).

Returns:
the depth of a 3-D chart as a percentage of the chart width.
Throws:
CellsException - if charts has bean removed.

setDepthPercent

public void setDepthPercent(int depthPercent)
Represents the depth of a 3-D chart view as a percentage of the chart width (between 20 and 2000 percent).

Parameters:
depthPercent - the depth of a 3-D chart as a percentage of the chart width.
Throws:
java.lang.IllegalArgumentException - if depthPercent is not between 20 and 2000.
CellsException - if charts has bean removed.

getHeightPercent

public short getHeightPercent()
Gets the height of a 3-D chart as a percentage of the chart width(between 5 and 500 percent).

Returns:
the height of a 3-D chart as a percentage of the chart width.
Throws:
CellsException - if charts has bean removed.

setHeightPercent

public void setHeightPercent(int heightPercent)
Sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent).

Parameters:
heightPercent - the height of a 3-D chart as a percentage of the chart width.
Throws:
java.lang.IllegalArgumentException - if heightPercent is not between 5 and 500.
CellsException - if charts has bean removed.

getElevation

public int getElevation()
Gets the elevation of the 3-D chart view, in degrees(between -90 and 90).

Returns:
the elevation of the 3-D chart view.
Throws:
CellsException - if charts has bean removed.

setElevation

public void setElevation(int elevation)
Sets the elevation of the 3-D chart view, in degrees(between -90 and 90).

Parameters:
elevation - the elevation of the 3-D chart view.
Throws:
java.lang.IllegalArgumentException - if elevation is not between -90 and 90.
CellsException - if charts has bean removed.

getPerspective

public int getPerspective()
Gets the perspective for the 3-D chart view. Must be between 0 and 100.

Returns:
the perspective for the 3-D chart view
Throws:
CellsException - if charts has bean removed.

setPerspective

public void setPerspective(int perspective)
Gets the perspective for the 3-D chart view. Must be between 0 and 100.

Parameters:
perspective - the perspective for the 3-D chart view
Throws:
CellsException - if charts has bean removed.
java.lang.IllegalArgumentException - if perspective is not between 0 and 100.

getRotation

public int getRotation()
Gets the rotation of the 3-D chart view (the rotation of the plot area around the series axis, in degrees)(between 0 and 360).

Returns:
the rotation of the 3-D chart view.
Throws:
CellsException - if charts has bean removed.

setRotation

public void setRotation(int rotation)
Sets the rotation of the 3-D chart view (the rotation of the plot area around the series axis, in degrees)(between 0 and 360).

Parameters:
rotation - the rotation of the 3-D chart view.
Throws:
java.lang.IllegalArgumentException - if rotation is not between 0 and 360.
CellsException - if charts has bean removed.

isRightAngleAxes

public boolean isRightAngleAxes()
True if the chart axes are at right angles, independent of chart rotation or elevation. Applies only to 3-D line, column, and bar charts.

Returns:
whether the chart axes are at right angles.
Throws:
CellsException - if charts has bean removed.

setRightAngleAxes

public void setRightAngleAxes(boolean isRightAngleAxes)
True if the chart axes are at right angles, independent of chart rotation or elevation. Applies only to 3-D line, column, and bar charts. If this property is True, the Perspective property is ignored.

Parameters:
isRightAngleAxes - whether the chart axes are at right angles.
Throws:
CellsException - if charts has bean removed.

isAutoScaling

public boolean isAutoScaling()
True if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart.

Returns:
whether char auto 3D scales.
Throws:
CellsException - if charts has bean removed.

setAutoScaling

public void setAutoScaling(boolean isAutoScaling)
True if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart. Only effects when isRightAngleAxes is true.

Parameters:
isAutoScaling - whether the chart auto scales.
Throws:
CellsException - if charts has bean removed.

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:
the angle of the first pie-chart or doughnut-chart slice.
Throws:
CellsException - if charts has bean removed.

setFirstSliceAngle

public void setFirstSliceAngle(int firstSliceAngle)
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:
firstSliceAngle - the angle of the first pie-chart or doughnut-chart slice.
Throws:
java.lang.IllegalArgumentException - if firstSliceAngle is not between 0 and 360;
CellsException - if charts has bean removed.

getPageSetup

public PageSetup getPageSetup()
Gets the page setup description in this chart.

Returns:
the page setup description in this chart.
Throws:
CellsException - if charts has bean removed.

getGapWidth

public int getGapWidth()
Gets 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:
the space between bar or column clusters

setGapWidth

public void setGapWidth(int gapWidth)
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:
gapWidth - the space between bar or column clusters
Throws:
java.lang.IllegalArgumentException - if gapWidth is not between 0 and 500;

getGapDepth

public short getGapDepth()
Gets the distance between the data series in a 3-D chart, as a percentage of the marker width.

Returns:
the distance between the data series in a 3-D chart

setGapDepth

public void setGapDepth(int gapDepth)
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:
gapDepth - the distance between the data series in a 3-D chart.

getOverlap

public int getOverlap()
Sets the space between bar or column in a cluster, as a percentage of the bar or column width. The value of this property must be between 0 and 500.

Returns:
the space between bar or column in a cluster.

setOverlap

public void setOverlap(int overlap)
Sets the space between bar or column in a cluster, as a percentage of the bar or column width. The value of this property must be between -100 and 100.

Parameters:
overlap - the space between bar or column in a cluster.

setPivotSource

public void setPivotSource(java.lang.String pivotSource)
Sets the pivot source.It means this chart is a PivotChart.

Parameters:
pivotSource - the pivot table name. The format should be SheetName!PivotTableName.

getPivotSource

public java.lang.String getPivotSource()
Gets the pivot source.

Returns:
the pivot source.

hidePivotFieldButton

public void hidePivotFieldButton(boolean isHidden)
Indeicates whether the pivot field button is hidden.

Parameters:
isHidden - whether the pivot field button is hidden.

isHiddenPivotFieldButton

public boolean isHiddenPivotFieldButton()
Gets whether the pivot field button is hidden.

Returns:
whether the pivot field button is hidden.

toImage

public void toImage(java.lang.String file,
                    ImageOptions options)
Converts this chart to image and save the image to given file.

Parameters:
file - the image file to be generated.
options - settings for generating image.

toImage

public void toImage(java.io.OutputStream stream,
                    ImageOptions options)
Converts this chart to image and save the image to given stream.

Parameters:
stream - the stream to save the generated image.
options - settings for generating image.