DOCUMENTS 5 - PortalScripting API
|
The XLSXChart class allows creating an Excel chart. More...
Public Member Functions | |
XLSXChartSeries | addSeries (String categories="", String values="") |
Add a data series to the current chart. More... | |
XLSXChartAxis | getAxis (String axisType) |
Get an axis from the chart. More... | |
String | getLastError () |
Function to get the description of the last error that occurred. More... | |
boolean | setStyle (number styleId=2) |
Set the chart style type. More... | |
boolean | setTable () |
Add a data table below the horizontal axis with the data used to plot the chart. More... | |
boolean | setTitle (String title) |
Set the title of the chart. More... | |
boolean | setTitleRange (String sheetname, number row, number col) |
Set a chart title formula using row and column values. More... | |
The XLSXChart class allows creating an Excel chart.
An XLSXChart object represents an Excel chart. It provides functions for adding data series to the chart and for configuring the chart. An XLSXChart object isn't created directly. Instead it is created by calling the XLSXWriter.addChart(number type) function from an XLSXWriter object.
The basic procedure for adding a chart to a worksheet is:
XLSXWriter.addChart()
.XLSXChart.addSeries()
.XLSXWorksheet.insertChart()
.XLSXChartSeries XLSXChart::addSeries | ( | String | categories = "" , |
String | values = "" |
||
) |
Add a data series to the current chart.
The series numbering and order in the Excel chart will be the same as the order in which they are added with this function.
categories | Optional range of categories in the data series being a string formula like "=Worksheet1!$A$1:$A$6" . The category is more or less the same as the X axis. In most Excel chart types the categories property is optional and the chart will just assume a sequential series from 1..n . |
values | Optional range of values in the data series being a string formula like "=Worksheet1!$A$1:$A$6" . This parameter links the chart with the worksheet data that it displays. |
null
in case of any error. XLSXChartAxis XLSXChart::getAxis | ( | String | axisType | ) |
Get an axis from the chart.
axisType | The axis type: x or y . |
null
in case of any error. String XLSXChart::getLastError | ( | ) |
Function to get the description of the last error that occurred.
boolean XLSXChart::setStyle | ( | number | styleId = 2 | ) |
Set the chart style type.
This function is used to set the style of the chart to one of the 48 built-in styles available on the "Design" tab in Excel 2007.
styleId | Optional index representing the chart style, 1 - 48. The style index number is counted from 1 on the top left in the Excel dialog. The default style is 2. |
true
if successful, false
in case of any error boolean XLSXChart::setTable | ( | ) |
Add a data table below the horizontal axis with the data used to plot the chart.
true
if successful, false
in case of any error boolean XLSXChart::setTitle | ( | String | title | ) |
Set the title of the chart.
title | The chart title displayed above the chart. This parameter can also be a formula such as "=Worksheet1!$A$1" to point to a cell in the Excel file that contains the title. The Excel default is to have no chart title. |
true
if successful, false
in case of any error boolean XLSXChart::setTitleRange | ( | String | sheetname, |
number | row, | ||
number | col | ||
) |
Set a chart title formula using row and column values.
This function can be used to set a chart title range and is an alternative to using XLSXChart.setTitle(String title) and a string formula.
sheetname | The name of the worksheet that contains the cell range. |
row | The zero indexed row number of the range. |
col | The zero indexed column number of the range. |
true
if successful, false
in case of any error