gas-types-detailed
Version:
Detailed Google Apps Script Type Definitions. Forked from Definitely Typed @types/google-apps-script. Adds full documentation and urls.
1,055 lines (970 loc) • 124 kB
TypeScript
// Type definitions for Google Apps Script 2023-10-28
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
namespace Charts {
/**
* Builder for area charts. For more details, see the Google Charts documentation.
*
* Here is an example that shows how to build an area chart.
*
* // Create a data table with some sample data.
* var sampleData = Charts.newDataTable()
* .addColumn(Charts.ColumnType.STRING, "Month")
* .addColumn(Charts.ColumnType.NUMBER, "Dining")
* .addColumn(Charts.ColumnType.NUMBER, "Total")
* .addRow(["Jan", 60, 520])
* .addRow(["Feb", 50, 430])
* .addRow(["Mar", 53, 440])
* .addRow(["Apr", 70, 410])
* .addRow(["May", 80, 390])
* .addRow(["Jun", 60, 500])
* .addRow(["Jul", 100, 450])
* .addRow(["Aug", 140, 431])
* .addRow(["Sep", 75, 488])
* .addRow(["Oct", 70, 521])
* .addRow(["Nov", 58, 388])
* .addRow(["Dec", 63, 400])
* .build();
*
* var chart = Charts.newAreaChart()
* .setTitle('Yearly Spending')
* .setXAxisTitle('Month')
* .setYAxisTitle('Spending (USD)')
* .setDimensions(600, 500)
* .setStacked()
* .setColors(['red', 'green'])
* .setDataTable(sampleData)
* .build();
*/
interface AreaChartBuilder {
/**
* Builds the chart.
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#build()
*/
build(): Chart;
/**
* Reverses the drawing of series in the domain axis. For vertical-range charts (such as line,
* area or column charts), this means the horizontal axis is drawn from right to left. For
* horizontal-range charts (such as bar charts), this means the vertical axis is drawn from top to
* bottom. For pie charts, this means the slices are drawn counterclockwise.
*
*
* // Creates a pie chart builder and sets drawing of the slices in a counter-clockwise manner.
* var builder = Charts.newPieChart();
* builder.reverseCategories();
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#reverseCategories()
*/
reverseCategories(): AreaChartBuilder;
/**
* Sets the background color for the chart.
*
*
* // Creates a line chart builder and sets the background color to gray
* var builder = Charts.newLineChart();
* builder.setBackgroundColor("gray");
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setBackgroundColor(String)
* @param cssValue The CSS value for the color (such as "blue" or "#00f").
*/
setBackgroundColor(cssValue: string): AreaChartBuilder;
/**
* Sets the colors for the lines in the chart.
*
*
* // Creates a line chart builder and sets the first two lines to be drawn in green and red,
* // respectively.
* var builder = Charts.newLineChart();
* builder.setColors(["green", "red"]);
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setColors(String)
* @param cssValues An array of color CSS values, such as ["red", "#acf"]. The nth element in the array represents the color of the nth line in the chart.
*/
setColors(cssValues: string[]): AreaChartBuilder;
/**
* Sets the data source URL that is used to pull data in from an external source, such as Google
* Sheets. If a data source URL and a DataTable are provided, the data source URL is ignored.
*
*
* For more information about querying data sources, check out the Google Charts documentation.
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setDataSourceUrl(String)
* @param url The data source URL, including any query parameters.
*/
setDataSourceUrl(url: string): AreaChartBuilder;
/**
* Sets the data table to use for the chart using a DataTableBuilder. This is a convenience method
* for setting the data table without needing to call build().
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setDataTable(DataTableBuilder)
* @param tableBuilder A data table builder. A new data table is created instantly as part of this call, so any further updates to the builder won't be reflected in the chart.
*/
setDataTable(tableBuilder: DataTableBuilder): AreaChartBuilder;
/**
* Sets the data table which contains the lines for the chart, as well as the X-axis labels. The
* first column should be a string, and contain the horizontal axis labels. Any number of columns
* can follow, all must be numeric. Each column is displayed as a separate line.
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setDataTable(DataTableSource)
* @param table The data table to use for the chart.
*/
setDataTable(table: DataTableSource): AreaChartBuilder;
/**
* Sets the data view definition to use for the chart.
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setDataViewDefinition(DataViewDefinition)
* @param dataViewDefinition A data view definition object that defines the view that should be derived from the given data source for the chart drawing.
*/
setDataViewDefinition(dataViewDefinition: DataViewDefinition): AreaChartBuilder;
/**
* Sets the dimensions for the chart.
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setDimensions(Integer,Integer)
* @param width The width of the chart, in pixels.
* @param height The height of the chart, in pixels.
*/
setDimensions(width: Integer, height: Integer): AreaChartBuilder;
/**
* Sets the position of the legend with respect to the chart. By default, there is no legend.
*
*
* // Creates a line chart builder and sets the legend position to right.
* var builder = Charts.newLineChart();
* builder.setLegendPosition(Charts.Position.RIGHT);
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setLegendPosition(Position)
* @param position The position of the legend.
*/
setLegendPosition(position: Position): AreaChartBuilder;
/**
* Sets the text style of the chart legend.
*
*
* // Creates a line chart builder and sets it up for a blue, 26-point legend.
* var textStyleBuilder = Charts.newTextStyle().setColor('#0000FF').setFontSize(26);
* var style = textStyleBuilder.build();
* var builder = Charts.newLineChart();
* builder.setLegendTextStyle(style);
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setLegendTextStyle(TextStyle)
* @param textStyle The text style to use for the chart legend.
*/
setLegendTextStyle(textStyle: TextStyle): AreaChartBuilder;
/**
* Sets advanced options for this chart. See the available options for
* this chart. This method has no effect if the given option is invalid.
*
*
* // Build an area chart with a 1-second animation duration.
* var builder = Charts.newAreaChart();
* builder.setOption('animation.duration', 1000);
* var chart = builder.build();
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setOption(String,Object)
* @param option The option to set.
* @param value The value to set.
*/
setOption(option: string, value: any): AreaChartBuilder;
/**
* Sets the style for points in the line. By default, points have no particular styles, and only
* the line is visible.
*
*
* // Creates a line chart builder and sets large point style.
* var builder = Charts.newLineChart();
* builder.setPointStyle(Charts.PointStyle.LARGE);
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setPointStyle(PointStyle)
* @param style The style to use for points in the line.
*/
setPointStyle(style: PointStyle): AreaChartBuilder;
/**
* Sets the range for the chart.
*
*
* If any data points fall outside the range, the range is expanded to include those data
* points.
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setRange(Number,Number)
* @param start The value for the lowest grid line of the range axis.
* @param end The value for the highest grid line of the range axis.
*/
setRange(start: number, end: number): AreaChartBuilder;
/**
* Uses stacked lines, meaning that line and bar values are stacked (accumulated). By default,
* there is no stacking.
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setStacked()
*/
setStacked(): AreaChartBuilder;
/**
* Sets the title of the chart. The title is displayed centered above the chart.
*
*
* // Creates a line chart builder and title to 'My Line Chart'.
* var builder = Charts.newLineChart();
* builder.setTitle('My Line Chart')
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setTitle(String)
* @param chartTitle the chart title.
*/
setTitle(chartTitle: string): AreaChartBuilder;
/**
* Sets the text style of the chart title.
*
*
* // Creates a line chart builder and sets it up for a blue, 26-point title.
* var textStyleBuilder = Charts.newTextStyle().setColor('#0000FF').setFontSize(26);
* var style = textStyleBuilder.build();
* var builder = Charts.newLineChart();
* builder.setTitleTextStyle(style);
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setTitleTextStyle(TextStyle)
* @param textStyle The text style to use for the chart title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setTitleTextStyle(textStyle: TextStyle): AreaChartBuilder;
/**
* Sets the horizontal axis text style.
*
*
* // Creates a line chart builder and sets the X-axis text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setXAxisTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setXAxisTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setXAxisTextStyle(textStyle: TextStyle): AreaChartBuilder;
/**
* Adds a title to the horizontal axis. The title is centered and appears below the axis value
* labels.
*
*
* // Creates a line chart builder and sets the X-axis title.
* var builder = Charts.newLineChart();
* builder.setTitle('X-axis Title')
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setXAxisTitle(String)
* @param title The title for the X-axis.
*/
setXAxisTitle(title: string): AreaChartBuilder;
/**
* Sets the horizontal axis title text style.
*
*
* // Creates a line chart builder and sets the X-axis title text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setXAxisTitleTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setXAxisTitleTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setXAxisTitleTextStyle(textStyle: TextStyle): AreaChartBuilder;
/**
* Sets the vertical axis text style.
*
*
* // Creates a line chart builder and sets the Y-axis text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setYAxisTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setYAxisTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setYAxisTextStyle(textStyle: TextStyle): AreaChartBuilder;
/**
* Adds a title to the vertical axis. The title is centered and appears to the left of the value
* labels.
*
*
* // Creates a line chart builder and sets the Y-axis title.
* var builder = Charts.newLineChart();
* builder.setYAxisTitle('Y-axis Title')
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setYAxisTitle(String)
* @param title The title for the Y-axis.
*/
setYAxisTitle(title: string): AreaChartBuilder;
/**
* Sets the vertical axis title text style.
*
*
* // Creates a line chart builder and sets the Y-axis title text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setYAxisTitleTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#setYAxisTitleTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setYAxisTitleTextStyle(textStyle: TextStyle): AreaChartBuilder;
/**
* Makes the range axis into a logarithmic scale (requires all values to be positive). The range
* axis are the vertical axis for vertical charts (such as line, area, or column) and the
* horizontal axis for horizontal charts (such as bar).
* https://developers.google.com/apps-script/reference/charts/area-chart-builder#useLogScale()
*/
useLogScale(): AreaChartBuilder;
}
/**
* Builder for bar charts. For more details, see the Google Charts documentation.
*
* Here is an example that shows how to build a bar chart. The data is imported from a
* Google spreadsheet.
*
* // Get sample data from a spreadsheet.
* var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=B1%3AC11' +
* '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=0&headers=-1';
*
* var chartBuilder = Charts.newBarChart()
* .setTitle('Top Grossing Films in US and Canada')
* .setXAxisTitle('USD')
* .setYAxisTitle('Film')
* .setDimensions(600, 500)
* .setLegendPosition(Charts.Position.BOTTOM)
* .setDataSourceUrl(dataSourceUrl);
*
* var chart = chartBuilder.build();
*/
interface BarChartBuilder {
/**
* Builds the chart.
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#build()
*/
build(): Chart;
/**
* Reverses the drawing of series in the domain axis. For vertical-range charts (such as line,
* area or column charts), this means the horizontal axis is drawn from right to left. For
* horizontal-range charts (such as bar charts), this means the vertical axis is drawn from top to
* bottom. For pie charts, this means the slices are drawn counterclockwise.
*
*
* // Creates a pie chart builder and sets drawing of the slices in a counter-clockwise manner.
* var builder = Charts.newPieChart();
* builder.reverseCategories();
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#reverseCategories()
*/
reverseCategories(): BarChartBuilder;
/**
* Reverses the direction in which the bars grow along the horizontal axis. By default, values
* grow from left to right. Calling this method causes them to grow from right to left.
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#reverseDirection()
*/
reverseDirection(): BarChartBuilder;
/**
* Sets the background color for the chart.
*
*
* // Creates a line chart builder and sets the background color to gray
* var builder = Charts.newLineChart();
* builder.setBackgroundColor("gray");
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setBackgroundColor(String)
* @param cssValue The CSS value for the color (such as "blue" or "#00f").
*/
setBackgroundColor(cssValue: string): BarChartBuilder;
/**
* Sets the colors for the lines in the chart.
*
*
* // Creates a line chart builder and sets the first two lines to be drawn in green and red,
* // respectively.
* var builder = Charts.newLineChart();
* builder.setColors(["green", "red"]);
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setColors(String)
* @param cssValues An array of color CSS values, such as ["red", "#acf"]. The nth element in the array represents the color of the nth line in the chart.
*/
setColors(cssValues: string[]): BarChartBuilder;
/**
* Sets the data source URL that is used to pull data in from an external source, such as Google
* Sheets. If a data source URL and a DataTable are provided, the data source URL is ignored.
*
*
* For more information about querying data sources, check out the Google Charts documentation.
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setDataSourceUrl(String)
* @param url The data source URL, including any query parameters.
*/
setDataSourceUrl(url: string): BarChartBuilder;
/**
* Sets the data table to use for the chart using a DataTableBuilder. This is a convenience method
* for setting the data table without needing to call build().
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setDataTable(DataTableBuilder)
* @param tableBuilder A data table builder. A new data table is created instantly as part of this call, so any further updates to the builder won't be reflected in the chart.
*/
setDataTable(tableBuilder: DataTableBuilder): BarChartBuilder;
/**
* Sets the data table which contains the lines for the chart, as well as the X-axis labels. The
* first column should be a string, and contain the horizontal axis labels. Any number of columns
* can follow, all must be numeric. Each column is displayed as a separate line.
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setDataTable(DataTableSource)
* @param table The data table to use for the chart.
*/
setDataTable(table: DataTableSource): BarChartBuilder;
/**
* Sets the data view definition to use for the chart.
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setDataViewDefinition(DataViewDefinition)
* @param dataViewDefinition A data view definition object that defines the view that should be derived from the given data source for the chart drawing.
*/
setDataViewDefinition(dataViewDefinition: DataViewDefinition): BarChartBuilder;
/**
* Sets the dimensions for the chart.
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setDimensions(Integer,Integer)
* @param width The width of the chart, in pixels.
* @param height The height of the chart, in pixels.
*/
setDimensions(width: Integer, height: Integer): BarChartBuilder;
/**
* Sets the position of the legend with respect to the chart. By default, there is no legend.
*
*
* // Creates a line chart builder and sets the legend position to right.
* var builder = Charts.newLineChart();
* builder.setLegendPosition(Charts.Position.RIGHT);
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setLegendPosition(Position)
* @param position The position of the legend.
*/
setLegendPosition(position: Position): BarChartBuilder;
/**
* Sets the text style of the chart legend.
*
*
* // Creates a line chart builder and sets it up for a blue, 26-point legend.
* var textStyleBuilder = Charts.newTextStyle().setColor('#0000FF').setFontSize(26);
* var style = textStyleBuilder.build();
* var builder = Charts.newLineChart();
* builder.setLegendTextStyle(style);
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setLegendTextStyle(TextStyle)
* @param textStyle The text style to use for the chart legend.
*/
setLegendTextStyle(textStyle: TextStyle): BarChartBuilder;
/**
* Sets advanced options for this chart. See the available options for
* this chart. This method has no effect if the given option is invalid.
*
*
* // Build a bar chart with a 1-second animation duration.
* var builder = Charts.newBarChart();
* builder.setOption('animation.duration', 1000);
* var chart = builder.build();
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setOption(String,Object)
* @param option The option to set.
* @param value The value to set.
*/
setOption(option: string, value: any): BarChartBuilder;
/**
* Sets the range for the chart.
*
*
* If any data points fall outside the range, the range is expanded to include those data
* points.
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setRange(Number,Number)
* @param start The value for the lowest grid line of the range axis.
* @param end The value for the highest grid line of the range axis.
*/
setRange(start: number, end: number): BarChartBuilder;
/**
* Uses stacked lines, meaning that line and bar values are stacked (accumulated). By default,
* there is no stacking.
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setStacked()
*/
setStacked(): BarChartBuilder;
/**
* Sets the title of the chart. The title is displayed centered above the chart.
*
*
* // Creates a line chart builder and title to 'My Line Chart'.
* var builder = Charts.newLineChart();
* builder.setTitle('My Line Chart')
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setTitle(String)
* @param chartTitle the chart title.
*/
setTitle(chartTitle: string): BarChartBuilder;
/**
* Sets the text style of the chart title.
*
*
* // Creates a line chart builder and sets it up for a blue, 26-point title.
* var textStyleBuilder = Charts.newTextStyle().setColor('#0000FF').setFontSize(26);
* var style = textStyleBuilder.build();
* var builder = Charts.newLineChart();
* builder.setTitleTextStyle(style);
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setTitleTextStyle(TextStyle)
* @param textStyle The text style to use for the chart title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setTitleTextStyle(textStyle: TextStyle): BarChartBuilder;
/**
* Sets the horizontal axis text style.
*
*
* // Creates a line chart builder and sets the X-axis text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setXAxisTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setXAxisTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setXAxisTextStyle(textStyle: TextStyle): BarChartBuilder;
/**
* Adds a title to the horizontal axis. The title is centered and appears below the axis value
* labels.
*
*
* // Creates a line chart builder and sets the X-axis title.
* var builder = Charts.newLineChart();
* builder.setTitle('X-axis Title')
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setXAxisTitle(String)
* @param title The title for the X-axis.
*/
setXAxisTitle(title: string): BarChartBuilder;
/**
* Sets the horizontal axis title text style.
*
*
* // Creates a line chart builder and sets the X-axis title text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setXAxisTitleTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setXAxisTitleTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setXAxisTitleTextStyle(textStyle: TextStyle): BarChartBuilder;
/**
* Sets the vertical axis text style.
*
*
* // Creates a line chart builder and sets the Y-axis text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setYAxisTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setYAxisTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setYAxisTextStyle(textStyle: TextStyle): BarChartBuilder;
/**
* Adds a title to the vertical axis. The title is centered and appears to the left of the value
* labels.
*
*
* // Creates a line chart builder and sets the Y-axis title.
* var builder = Charts.newLineChart();
* builder.setYAxisTitle('Y-axis Title')
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setYAxisTitle(String)
* @param title The title for the Y-axis.
*/
setYAxisTitle(title: string): BarChartBuilder;
/**
* Sets the vertical axis title text style.
*
*
* // Creates a line chart builder and sets the Y-axis title text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setYAxisTitleTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#setYAxisTitleTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setYAxisTitleTextStyle(textStyle: TextStyle): BarChartBuilder;
/**
* Makes the range axis into a logarithmic scale (requires all values to be positive). The range
* axis are the vertical axis for vertical charts (such as line, area, or column) and the
* horizontal axis for horizontal charts (such as bar).
* https://developers.google.com/apps-script/reference/charts/bar-chart-builder#useLogScale()
*/
useLogScale(): BarChartBuilder;
}
/**
* A Chart object, which can be converted to a static image. For charts embedded in spreadsheets,
* see EmbeddedChart.
*/
interface Chart {
/**
* Return the data inside this object as a blob converted to the specified content type. This
* method adds the appropriate extension to the filename—for example, "myfile.pdf". However, it
* assumes that the part of the filename that follows the last period (if any) is an existing
* extension that should be replaced. Consequently, "ShoppingList.12.25.2014" becomes
* "ShoppingList.12.25.pdf".
*
*
* To view the daily quotas for conversions, see Quotas for Google
* Services. Newly created Google Workspace domains might be temporarily subject to stricter
* quotas.
* https://developers.google.com/apps-script/reference/charts/chart#getAs(String)
* @param contentType The MIME type to convert to. For most blobs, 'application/pdf' is the only valid option. For images in BMP, GIF, JPEG, or PNG format, any of 'image/bmp', 'image/gif', 'image/jpeg', or 'image/png' are also valid.
*/
getAs(contentType: string): Base.Blob;
/**
* Return the data inside this object as a blob.
* https://developers.google.com/apps-script/reference/charts/chart#getBlob()
*/
getBlob(): Base.Blob;
/**
* Returns the options for this chart, such as height, colors, and axes.
*
*
* The returned options are immutable.
* https://developers.google.com/apps-script/reference/charts/chart#getOptions()
*/
getOptions(): ChartOptions;
}
/**
* An enumeration of how hidden dimensions in a source are expressed in a chart.
*/
enum ChartHiddenDimensionStrategy { IGNORE_BOTH, IGNORE_ROWS, IGNORE_COLUMNS, SHOW_BOTH }
/**
* An enumeration of how multiple ranges in the source are expressed in a chart.
*/
enum ChartMergeStrategy { MERGE_COLUMNS, MERGE_ROWS }
/**
* Exposes options currently configured for a Chart, such as height, color, etc.
*
* Please see the visualization
* reference documentation for information on what options are available. Specific options for
* each chart can be found by clicking on the specific chart in the chart gallery.
*
* These options are immutable.
*/
interface ChartOptions {
/**
* Returns a configured option for this chart.
* https://developers.google.com/apps-script/reference/charts/chart-options#get(String)
* @param option The string representing the desired option.
*/
get(option: string): any;
/**
* Returns a configured option for this chart. If the chart option is not set, returns the default
* value of this option if available, or returns null if the default value is not
* available.
* https://developers.google.com/apps-script/reference/charts/chart-options#getOrDefault(String)
* @param option The string representing the desired option.
*/
getOrDefault(option: string): any;
}
/**
* Chart types supported by the Charts service.
*/
enum ChartType { TIMELINE, AREA, BAR, BUBBLE, CANDLESTICK, COLUMN, COMBO, GAUGE, GEO, HISTOGRAM, RADAR, LINE, ORG, PIE, SCATTER, SPARKLINE, STEPPED_AREA, TABLE, TREEMAP, WATERFALL }
/**
* Entry point for creating Charts in scripts.
*
* This example creates a basic data table, populates an area chart with the data, and adds it
* into a web page as an image:
*
* function doGet() {
* var data = Charts.newDataTable()
* .addColumn(Charts.ColumnType.STRING, "Month")
* .addColumn(Charts.ColumnType.NUMBER, "In Store")
* .addColumn(Charts.ColumnType.NUMBER, "Online")
* .addRow(["January", 10, 1])
* .addRow(["February", 12, 1])
* .addRow(["March", 20, 2])
* .addRow(["April", 25, 3])
* .addRow(["May", 30, 4])
* .build();
*
* var chart = Charts.newAreaChart()
* .setDataTable(data)
* .setStacked()
* .setRange(0, 40)
* .setTitle("Sales per Month")
* .build();
*
* var htmlOutput = HtmlService.createHtmlOutput().setTitle('My Chart');
* var imageData = Utilities.base64Encode(chart.getAs('image/png').getBytes());
* var imageUrl = "data:image/png;base64," + encodeURI(imageData);
* htmlOutput.append("Render chart server side: <br/>");
* htmlOutput.append("<img border=\"1\" src=\"" + imageUrl + "\">");
* return htmlOutput;
* }
*/
interface Charts {
ChartHiddenDimensionStrategy: typeof ChartHiddenDimensionStrategy;
ChartMergeStrategy: typeof ChartMergeStrategy;
ChartType: typeof ChartType;
ColumnType: typeof ColumnType;
CurveStyle: typeof CurveStyle;
PointStyle: typeof PointStyle;
Position: typeof Position;
/**
* Starts building an area chart, as described in the Google Chart
* Tools documentation.
* https://developers.google.com/apps-script/reference/charts/charts#newAreaChart()
*/
newAreaChart(): AreaChartBuilder;
/**
* Starts building a bar chart, as described in the Google Chart
* Tools documentation.
* https://developers.google.com/apps-script/reference/charts/charts#newBarChart()
*/
newBarChart(): BarChartBuilder;
/**
* Starts building a column chart, as described in the Google Chart
* Tools documentation.
* https://developers.google.com/apps-script/reference/charts/charts#newColumnChart()
*/
newColumnChart(): ColumnChartBuilder;
/**
* Creates an empty data table, which can have its values set manually.
*
*
* Data tables hold the data for all chart types.
* https://developers.google.com/apps-script/reference/charts/charts#newDataTable()
*/
newDataTable(): DataTableBuilder;
/**
* Creates a new data view definition.
*
*
* Use setters to define the different properties of the data view.
* https://developers.google.com/apps-script/reference/charts/charts#newDataViewDefinition()
*/
newDataViewDefinition(): DataViewDefinitionBuilder;
/**
* Starts building a line chart, as described in the Google Chart
* Tools documentation.
* https://developers.google.com/apps-script/reference/charts/charts#newLineChart()
*/
newLineChart(): LineChartBuilder;
/**
* Starts building a pie chart, as described in the Google Chart
* Tools documentation.
* https://developers.google.com/apps-script/reference/charts/charts#newPieChart()
*/
newPieChart(): PieChartBuilder;
/**
* Starts building a scatter chart, as described in the Google Chart
* Tools documentation.
* https://developers.google.com/apps-script/reference/charts/charts#newScatterChart()
*/
newScatterChart(): ScatterChartBuilder;
/**
* Starts building a table chart, as described in the Google Chart
* Tools documentation.
* https://developers.google.com/apps-script/reference/charts/charts#newTableChart()
*/
newTableChart(): TableChartBuilder;
/**
* Creates a new text style builder.
*
*
* To change the default values, use the setter functions.
* https://developers.google.com/apps-script/reference/charts/charts#newTextStyle()
*/
newTextStyle(): TextStyleBuilder;
}
/**
* Builder for column charts. For more details, see the Google Charts documentation.
*
* This example shows how to create a column chart with data from a data table.
*
* var sampleData = Charts.newDataTable()
* .addColumn(Charts.ColumnType.STRING, "Year")
* .addColumn(Charts.ColumnType.NUMBER, "Sales")
* .addColumn(Charts.ColumnType.NUMBER, "Expenses")
* .addRow(["2004", 1000, 400])
* .addRow(["2005", 1170, 460])
* .addRow(["2006", 660, 1120])
* .addRow(["2007", 1030, 540])
* .addRow(["2008", 800, 600])
* .addRow(["2009", 943, 678])
* .addRow(["2010", 1020, 550])
* .addRow(["2011", 910, 700])
* .addRow(["2012", 1230, 840])
* .build();
*
* var chart = Charts.newColumnChart()
* .setTitle('Sales & Expenses')
* .setXAxisTitle('Year')
* .setYAxisTitle('Amount (USD)')
* .setDimensions(600, 500)
* .setDataTable(sampleData)
* .build();
*/
interface ColumnChartBuilder {
/**
* Builds the chart.
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#build()
*/
build(): Chart;
/**
* Reverses the drawing of series in the domain axis. For vertical-range charts (such as line,
* area or column charts), this means the horizontal axis is drawn from right to left. For
* horizontal-range charts (such as bar charts), this means the vertical axis is drawn from top to
* bottom. For pie charts, this means the slices are drawn counterclockwise.
*
*
* // Creates a pie chart builder and sets drawing of the slices in a counter-clockwise manner.
* var builder = Charts.newPieChart();
* builder.reverseCategories();
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#reverseCategories()
*/
reverseCategories(): ColumnChartBuilder;
/**
* Sets the background color for the chart.
*
*
* // Creates a line chart builder and sets the background color to gray
* var builder = Charts.newLineChart();
* builder.setBackgroundColor("gray");
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setBackgroundColor(String)
* @param cssValue The CSS value for the color (such as "blue" or "#00f").
*/
setBackgroundColor(cssValue: string): ColumnChartBuilder;
/**
* Sets the colors for the lines in the chart.
*
*
* // Creates a line chart builder and sets the first two lines to be drawn in green and red,
* // respectively.
* var builder = Charts.newLineChart();
* builder.setColors(["green", "red"]);
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setColors(String)
* @param cssValues An array of color CSS values, such as ["red", "#acf"]. The nth element in the array represents the color of the nth line in the chart.
*/
setColors(cssValues: string[]): ColumnChartBuilder;
/**
* Sets the data source URL that is used to pull data in from an external source, such as Google
* Sheets. If a data source URL and a DataTable are provided, the data source URL is ignored.
*
*
* For more information about querying data sources, check out the Google Charts documentation.
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setDataSourceUrl(String)
* @param url The data source URL, including any query parameters.
*/
setDataSourceUrl(url: string): ColumnChartBuilder;
/**
* Sets the data table to use for the chart using a DataTableBuilder. This is a convenience method
* for setting the data table without needing to call build().
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setDataTable(DataTableBuilder)
* @param tableBuilder A data table builder. A new data table is created instantly as part of this call, so any further updates to the builder won't be reflected in the chart.
*/
setDataTable(tableBuilder: DataTableBuilder): ColumnChartBuilder;
/**
* Sets the data table which contains the lines for the chart, as well as the X-axis labels. The
* first column should be a string, and contain the horizontal axis labels. Any number of columns
* can follow, all must be numeric. Each column is displayed as a separate line.
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setDataTable(DataTableSource)
* @param table The data table to use for the chart.
*/
setDataTable(table: DataTableSource): ColumnChartBuilder;
/**
* Sets the data view definition to use for the chart.
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setDataViewDefinition(DataViewDefinition)
* @param dataViewDefinition A data view definition object that defines the view that should be derived from the given data source for the chart drawing.
*/
setDataViewDefinition(dataViewDefinition: DataViewDefinition): ColumnChartBuilder;
/**
* Sets the dimensions for the chart.
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setDimensions(Integer,Integer)
* @param width The width of the chart, in pixels.
* @param height The height of the chart, in pixels.
*/
setDimensions(width: Integer, height: Integer): ColumnChartBuilder;
/**
* Sets the position of the legend with respect to the chart. By default, there is no legend.
*
*
* // Creates a line chart builder and sets the legend position to right.
* var builder = Charts.newLineChart();
* builder.setLegendPosition(Charts.Position.RIGHT);
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setLegendPosition(Position)
* @param position The position of the legend.
*/
setLegendPosition(position: Position): ColumnChartBuilder;
/**
* Sets the text style of the chart legend.
*
*
* // Creates a line chart builder and sets it up for a blue, 26-point legend.
* var textStyleBuilder = Charts.newTextStyle().setColor('#0000FF').setFontSize(26);
* var style = textStyleBuilder.build();
* var builder = Charts.newLineChart();
* builder.setLegendTextStyle(style);
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setLegendTextStyle(TextStyle)
* @param textStyle The text style to use for the chart legend.
*/
setLegendTextStyle(textStyle: TextStyle): ColumnChartBuilder;
/**
* Sets advanced options for this chart. See the available options for
* this chart. This method has no effect if the given option is invalid.
*
*
* // Build a column chart with a 1-second animation duration.
* var builder = Charts.newColumnChart();
* builder.setOption('animation.duration', 1000);
* var chart = builder.build();
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setOption(String,Object)
* @param option The option to set.
* @param value The value to set.
*/
setOption(option: string, value: any): ColumnChartBuilder;
/**
* Sets the range for the chart.
*
*
* If any data points fall outside the range, the range is expanded to include those data
* points.
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setRange(Number,Number)
* @param start The value for the lowest grid line of the range axis.
* @param end The value for the highest grid line of the range axis.
*/
setRange(start: number, end: number): ColumnChartBuilder;
/**
* Uses stacked lines, meaning that line and bar values are stacked (accumulated). By default,
* there is no stacking.
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setStacked()
*/
setStacked(): ColumnChartBuilder;
/**
* Sets the title of the chart. The title is displayed centered above the chart.
*
*
* // Creates a line chart builder and title to 'My Line Chart'.
* var builder = Charts.newLineChart();
* builder.setTitle('My Line Chart')
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setTitle(String)
* @param chartTitle the chart title.
*/
setTitle(chartTitle: string): ColumnChartBuilder;
/**
* Sets the text style of the chart title.
*
*
* // Creates a line chart builder and sets it up for a blue, 26-point title.
* var textStyleBuilder = Charts.newTextStyle().setColor('#0000FF').setFontSize(26);
* var style = textStyleBuilder.build();
* var builder = Charts.newLineChart();
* builder.setTitleTextStyle(style);
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setTitleTextStyle(TextStyle)
* @param textStyle The text style to use for the chart title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setTitleTextStyle(textStyle: TextStyle): ColumnChartBuilder;
/**
* Sets the horizontal axis text style.
*
*
* // Creates a line chart builder and sets the X-axis text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setXAxisTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setXAxisTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setXAxisTextStyle(textStyle: TextStyle): ColumnChartBuilder;
/**
* Adds a title to the horizontal axis. The title is centered and appears below the axis value
* labels.
*
*
* // Creates a line chart builder and sets the X-axis title.
* var builder = Charts.newLineChart();
* builder.setTitle('X-axis Title')
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setXAxisTitle(String)
* @param title The title for the X-axis.
*/
setXAxisTitle(title: string): ColumnChartBuilder;
/**
* Sets the horizontal axis title text style.
*
*
* // Creates a line chart builder and sets the X-axis title text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setXAxisTitleTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setXAxisTitleTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder object by calling Charts.newTextStyle().
*/
setXAxisTitleTextStyle(textStyle: TextStyle): ColumnChartBuilder;
/**
* Sets the vertical axis text style.
*
*
* // Creates a line chart builder and sets the Y-axis text style to blue, 18-point font.
* var textStyle = Charts.newTextStyle().setColor('blue').setFontSize(18).build();
* var builder = Charts.newLineChart();
* builder.setYAxisTextStyle(textStyle);
* https://developers.google.com/apps-script/reference/charts/column-chart-builder#setYAxisTextStyle(TextStyle)
* @param textStyle The text style to use for the horizontal axis title. You can create a TextStyleBuilder ob