Example:
$workbook = new cells\Workbook(); $sheet = $workbook->getWorksheets()->get(0); $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); $chartIndex = $sheet->getCharts()->add(cells\ChartType::COLUMN, 9, 9, 21, 15); $chart = $sheet->getCharts()->get($chartIndex); $chart->getNSeries()->add("B2:B4", true); $chart->getNSeries()->setCategoryData("A2:A4"); $aSeries = $chart->getNSeries()->get(0); $aSeries->setName("=B1"); $chart->setShowLegend(true); $chart->getTitle()->setText("Income Analysis");
Property Getters/Setters Summary | ||
---|---|---|
function | getActualChartSize() | |
Gets actual size of chart
|
||
function | getAutoScaling() | |
function | setAutoScaling(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. | ||
function | getBackWall() | |
Returns a |
||
function | getCategoryAxis() | |
Gets the chart's X axis.
|
||
function | getChartArea() | |
Gets the chart area in the worksheet
|
||
function | getChartDataTable() | |
Represents the chart data table.
|
||
function | getChartObject() | |
Represents the chartShape;
|
||
function | getChartShape() | |
Represents the chartShape;
|
||
function | getDepthPercent() | |
function | setDepthPercent(value) | |
Represents the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). | ||
function | getDisplayNaAsBlank() | |
function | setDisplayNaAsBlank(value) | |
Indicates whether displaying #N/A as blank value. | ||
function | getElevation() | |
function | setElevation(value) | |
Represents the elevation of the 3-D chart view, in degrees. | ||
function | getFirstSliceAngle() | |
function | setFirstSliceAngle(value) | |
Gets or 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. | ||
function | getFloor() | |
Returns a |
||
function | getGapDepth() | |
function | setGapDepth(value) | |
Gets or 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. | ||
function | getGapWidth() | |
function | setGapWidth(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. | ||
function | getHeightPercent() | |
function | setHeightPercent(value) | |
Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent). | ||
function | getHidePivotFieldButtons() | |
function | setHidePivotFieldButtons(value) | |
Indicates whether hide the pivot chart field buttons only when the chart is PivotChart | ||
function | getIs3D() | |
Indicates whether the chart is a 3d chart.
|
||
function | isRectangularCornered() | |
function | setRectangularCornered(value) | |
Gets or sets a value indicating whether the chart area is rectangular cornered. Default is true. | ||
function | getLegend() | |
Gets the chart legend.
|
||
function | getLine() | |
Gets the line.
|
||
function | getName() | |
function | setName(value) | |
Gets and sets the name of the chart. | ||
function | getNSeries() | |
Gets a |
||
function | getPageSetup() | |
Represents the page setup description in this chart.
|
||
function | getPerspective() | |
function | setPerspective(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. | ||
function | getPivotOptions() | |
Specifies the pivot controls that appear on the chart
|
||
function | getPivotSource() | |
function | setPivotSource(value) | |
The source is the data of the pivotTable. If PivotSource is not empty ,the chart is PivotChart. | ||
function | getPlacement() | |
function | setPlacement(value) | |
Represents the way the chart is attached to the cells below it. The value of the property is PlacementType integer constant. | ||
function | getPlotArea() | |
Gets the chart's plot area which includes axis tick labels.
|
||
function | getPlotBy() | |
Gets and sets whether plot by row or column.
The value of the property is PlotDataByType integer constant. |
||
function | getPlotEmptyCellsType() | |
function | setPlotEmptyCellsType(value) | |
Gets and sets how to plot the empty cells. The value of the property is PlotEmptyCellsType integer constant. | ||
function | getPlotVisibleCells() | |
function | setPlotVisibleCells(value) | |
Indicates whether only plot visible cells. | ||
function | getPrintSize() | |
function | setPrintSize(value) | |
Gets and sets the printed chart size. The value of the property is PrintSizeType integer constant. | ||
function | getRightAngleAxes() | |
function | setRightAngleAxes(value) | |
True if the chart axes are at right angles. Applies only for 3-D charts(except Column3D and 3-D Pie Charts). | ||
function | getRotationAngle() | |
function | setRotationAngle(value) | |
Represents the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees). | ||
function | getSecondCategoryAxis() | |
Gets the chart's second X axis.
|
||
function | getSecondValueAxis() | |
Gets the chart's second Y axis.
|
||
function | getSeriesAxis() | |
Gets the chart's series axis.
|
||
function | getShapes() | |
Returns all drawing shapes in this chart.
|
||
function | getShowDataTable() | |
function | setShowDataTable(value) | |
Gets or sets a value indicating whether the chart displays a data table. | ||
function | getShowLegend() | |
function | setShowLegend(value) | |
Gets or sets a value indicating whether the chart legend will be displayed. Default is true. | ||
function | getSideWall() | |
Returns a |
||
function | getSizeWithWindow() | |
function | setSizeWithWindow(value) | |
True if Microsoft Excel resizes the chart to match the size of the chart sheet window. | ||
function | getStyle() | |
function | setStyle(value) | |
Gets and sets the builtin style. | ||
function | getSubTitle() | |
Gets the chart's sub-title.
Only for ODS format file.
|
||
function | getTitle() | |
Gets the chart's title.
|
||
function | getType() | |
function | setType(value) | |
Gets or sets a chart's type. The value of the property is ChartType integer constant. | ||
function | getValueAxis() | |
Gets the chart's Y axis.
|
||
function | getWalls() | |
Returns a |
||
function | getWallsAndGridlines2D() | |
function | setWallsAndGridlines2D(value) | |
True if gridlines are drawn two-dimensionally on a 3-D chart. | ||
function | getWorksheet() | |
Gets the worksheet which contains this chart.
|
Method Summary | ||
---|---|---|
function | calculate() | |
Calculates the custom position of plot area, axes if the position of them are auto assigned.
|
||
function | getChartDataRange() | |
Gets the data source range of the chart .
|
||
function | hasAxis(aixsType, isPrimary) | |
Returns which axes exist on the chart.
|
||
function | isChartDataChanged() | |
Detects if a chart's data source has changed.
|
||
function | move(upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn) | |
Moves the chart to a specified location.
|
||
function | refreshPivotData() | |
Refreshes pivot chart's data from it's pivot data source.
|
||
function | setChartDataRange(area, isVertical) | |
Specifies data range for a chart.
|
||
function | switchRowColumn() | |
Switches row/column.
|
||
function | toImage(imageFile) | |
Creates the chart image and saves it to a file.
The extension of the file name determines the format of the image.
|
||
function | toImage(imageFile, imageFormat) | |
Creates the chart image and saves it to a file in the specified format.
|
||
function | toImage(imageFile, options) | |
Creates the chart image and saves it to a file.
The extension of the file name determines the format of the image.
|
||
function | toImage(imageFile, jpegQuality) | |
Creates the chart image and saves it to a file in the Jpeg format.
|
||
function | toPdf(fileName) | |
Saves the chart to a pdf file.
|
||
function | toPdf(fileName, desiredPageWidth, desiredPageHeight, hAlignmentType, vAlignmentType) | |
Saves the chart to a pdf file.
|
function getStyle() / function setStyle(value)
function getChartObject()
function getHidePivotFieldButtons() / function setHidePivotFieldButtons(value)
function getPivotOptions()
function getPivotSource() / function setPivotSource(value)
function getPlotBy()
function getPlotEmptyCellsType() / function setPlotEmptyCellsType(value)
function getPlotVisibleCells() / function setPlotVisibleCells(value)
function getDisplayNaAsBlank() / function setDisplayNaAsBlank(value)
function getName() / function setName(value)
function getSizeWithWindow() / function setSizeWithWindow(value)
function getWorksheet()
function getShapes()
function getPrintSize() / function setPrintSize(value)
function getType() / function setType(value)
function getNSeries()
function getTitle()
function getSubTitle()
function getPlotArea()
function getChartArea()
function getCategoryAxis()
function getValueAxis()
function getSecondValueAxis()
function getSecondCategoryAxis()
function getSeriesAxis()
function getLegend()
function getChartDataTable()
function getShowLegend() / function setShowLegend(value)
function isRectangularCornered() / function setRectangularCornered(value)
function getShowDataTable() / function setShowDataTable(value)
function getFirstSliceAngle() / function setFirstSliceAngle(value)
function getGapWidth() / function setGapWidth(value)
function getGapDepth() / function setGapDepth(value)
function getFloor()
function getWalls()
function getBackWall()
function getSideWall()
function getWallsAndGridlines2D() / function setWallsAndGridlines2D(value)
function getRotationAngle() / function setRotationAngle(value)
function getElevation() / function setElevation(value)
function getRightAngleAxes() / function setRightAngleAxes(value)
function getAutoScaling() / function setAutoScaling(value)
function getHeightPercent() / function setHeightPercent(value)
function getPerspective() / function setPerspective(value)
function getIs3D()
function getDepthPercent() / function setDepthPercent(value)
function getActualChartSize()
function getPlacement() / function setPlacement(value)
function getPageSetup()
function getChartShape()
function getLine()
function toImage(imageFile)
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.imageFile: String
- The image file name with full path.function toImage(imageFile, imageFormat)
The format of the image is specified by using imageFormat
.
The following formats are supported:
ImageFormat.Bmp, ImageFormat.Gif, ImageFormat.Png, ImageFormat.Jpeg, ImageFormat.Tiff, ImageFormat.Emf.
imageFile: String
- The image file name with full path.imageFormat: ImageFormat
- The format in which to save the image.function toImage(imageFile, jpegQuality)
imageFile: String
- The image file name with full path.jpegQuality: long
- Jpeg quality.function toPdf(fileName)
fileName: String
- the pdf file name with full pathfunction toPdf(fileName, desiredPageWidth, desiredPageHeight, hAlignmentType, vAlignmentType)
fileName: String
- the pdf file name with full pathdesiredPageWidth: Number
- The desired page width in inches.desiredPageHeight: Number
- The desired page height in inches.hAlignmentType: Number
- A vAlignmentType: Number
- A function toImage(imageFile, options)
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.imageFile: String
- The image file name with full path.options: ImageOrPrintOptions
- Additional image creation optionsfunction hasAxis(aixsType, isPrimary)
aixsType
- A AxisType value.function switchRowColumn()
function getChartDataRange()
function setChartDataRange(area, isVertical)
area: String
- Specifies values from which to plot the data seriesisVertical: boolean
- Specifies whether to plot the series from a range of cell values by row or by column.function isChartDataChanged()
function refreshPivotData()
function move(upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn)
upperLeftColumn: Number
- Upper left column index.upperLeftRow: Number
- Upper left row index.lowerRightColumn: Number
- Lower right column indexlowerRightRow: Number
- Lower right row indexfunction calculate()