UNPKG

gas-types-detailed

Version:

Enhanced Google Apps Script Type Definitions with detailed documentation. Includes type definitions plus code snippets, return values, required authorization scopes, and other details not found in @types/google-apps-script.

1,095 lines (1,024 loc) 147 kB
// Type definitions for Google Apps Script 2025-11-10 // 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. * const 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(); * * const 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. * * Return: * - Chart — A Chart object, which can be embedded into documents, UI elements, or used as a static image. * * 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. * const builder = Charts.newPieChart(); * builder.reverseCategories(); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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 * const builder = Charts.newLineChart(); * builder.setBackgroundColor('gray'); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newLineChart(); * builder.setColors(['green', 'red']); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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(). * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newLineChart(); * builder.setLegendPosition(Charts.Position.RIGHT); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const textStyleBuilder = * Charts.newTextStyle().setColor('#0000FF').setFontSize(26); * const style = textStyleBuilder.build(); * const builder = Charts.newLineChart(); * builder.setLegendTextStyle(style); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newAreaChart(); * builder.setOption('animation.duration', 1000); * const chart = builder.build(); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newLineChart(); * builder.setPointStyle(Charts.PointStyle.LARGE); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * - PointStyle * * 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. * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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'. * const builder = Charts.newLineChart(); * builder.setTitle('My Line Chart'); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const textStyleBuilder = * Charts.newTextStyle().setColor('#0000FF').setFontSize(26); * const style = textStyleBuilder.build(); * const builder = Charts.newLineChart(); * builder.setTitleTextStyle(style); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const textStyle = * Charts.newTextStyle().setColor('blue').setFontSize(18).build(); * const builder = Charts.newLineChart(); * builder.setXAxisTextStyle(textStyle); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newLineChart(); * builder.setTitle('X-axis Title'); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const textStyle = * Charts.newTextStyle().setColor('blue').setFontSize(18).build(); * const builder = Charts.newLineChart(); * builder.setXAxisTitleTextStyle(textStyle); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const textStyle = * Charts.newTextStyle().setColor('blue').setFontSize(18).build(); * const builder = Charts.newLineChart(); * builder.setYAxisTextStyle(textStyle); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newLineChart(); * builder.setYAxisTitle('Y-axis Title'); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const textStyle = * Charts.newTextStyle().setColor('blue').setFontSize(18).build(); * const builder = Charts.newLineChart(); * builder.setYAxisTitleTextStyle(textStyle); * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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). * * Return: * - AreaChartBuilder — This builder, useful for chaining. * * 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. * const dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=B1%3AC11' + * '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=0&headers=-1'; * * const chartBuilder = Charts.newBarChart() * .setTitle('Top Grossing Films in US and Canada') * .setXAxisTitle('USD') * .setYAxisTitle('Film') * .setDimensions(600, 500) * .setLegendPosition(Charts.Position.BOTTOM) * .setDataSourceUrl(dataSourceUrl); * * const chart = chartBuilder.build(); */ interface BarChartBuilder { /** * Builds the chart. * * Return: * - Chart — A Chart object, which can be embedded into documents, UI elements, or used as a static image. * * 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. * const builder = Charts.newPieChart(); * builder.reverseCategories(); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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 * const builder = Charts.newLineChart(); * builder.setBackgroundColor('gray'); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newLineChart(); * builder.setColors(['green', 'red']); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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(). * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newLineChart(); * builder.setLegendPosition(Charts.Position.RIGHT); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const textStyleBuilder = * Charts.newTextStyle().setColor('#0000FF').setFontSize(26); * const style = textStyleBuilder.build(); * const builder = Charts.newLineChart(); * builder.setLegendTextStyle(style); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newBarChart(); * builder.setOption('animation.duration', 1000); * const chart = builder.build(); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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'. * const builder = Charts.newLineChart(); * builder.setTitle('My Line Chart'); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const textStyleBuilder = * Charts.newTextStyle().setColor('#0000FF').setFontSize(26); * const style = textStyleBuilder.build(); * const builder = Charts.newLineChart(); * builder.setTitleTextStyle(style); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const textStyle = * Charts.newTextStyle().setColor('blue').setFontSize(18).build(); * const builder = Charts.newLineChart(); * builder.setXAxisTextStyle(textStyle); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newLineChart(); * builder.setTitle('X-axis Title'); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const textStyle = * Charts.newTextStyle().setColor('blue').setFontSize(18).build(); * const builder = Charts.newLineChart(); * builder.setXAxisTitleTextStyle(textStyle); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const textStyle = * Charts.newTextStyle().setColor('blue').setFontSize(18).build(); * const builder = Charts.newLineChart(); * builder.setYAxisTextStyle(textStyle); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newLineChart(); * builder.setYAxisTitle('Y-axis Title'); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * const textStyle = * Charts.newTextStyle().setColor('blue').setFontSize(18).build(); * const builder = Charts.newLineChart(); * builder.setYAxisTitleTextStyle(textStyle); * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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). * * Return: * - BarChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - Blob — The data as a blob. * * 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. For a Google Docs document, 'text/markdown' is also valid. */ getAs(contentType: string): Base.Blob; /** * Return the data inside this object as a blob. * * Return: * - Blob — The data 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. * * Return: * - ChartOptions — The options for this chart, such as height, colors, and axes. * * 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. * * To call an enum, you call its parent class, name, and property. For example, * Charts.ChartHiddenDimensionStrategy.IGNORE_ROWS. */ enum ChartHiddenDimensionStrategy { IGNORE_BOTH, IGNORE_ROWS, IGNORE_COLUMNS, SHOW_BOTH } /** * An enumeration of how multiple ranges in the source are expressed in a chart. * * To call an enum, you call its parent class, name, and property. For example, * Charts.ChartMergeStrategy.MERGE_COLUMNS. */ 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. * * Return: * - Object — The value currently set for the specified option or null if the option was not set. * * 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. * * Return: * - Object — The value currently set for the specified option. If the option was not set and the default value is available, returns the default value. * * 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. * * To call an enum, you call its parent class, name, and property. For example, * Charts.ChartType.TIMELINE. */ 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() { * const 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(); * * const chart = Charts.newAreaChart() * .setDataTable(data) * .setStacked() * .setRange(0, 40) * .setTitle('Sales per Month') * .build(); * * const htmlOutput = HtmlService.createHtmlOutput().setTitle('My Chart'); * const imageData = Utilities.base64Encode(chart.getAs('image/png').getBytes()); * const 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. * * Return: * - AreaChartBuilder — An AreaChartBuilder, which can be used to build an area chart. * * 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. * * Return: * - BarChartBuilder — A BarChartBuilder, which can be used to build a bar chart. * * 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. * * Return: * - ColumnChartBuilder — A ColumnChartBuilder, which can be used to build a column chart. * * 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. * * Return: * - DataTableBuilder — A DataTableBuilder, which can hold data for charts. * * 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. * * Return: * - DataViewDefinitionBuilder — A DataViewDefinitionBuilder, which can be used to build a data view definition. * * 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. * * Return: * - LineChartBuilder — A LineChartBuilder, which can be used to build a line chart. * * 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. * * Return: * - PieChartBuilder — A PieChartBuilder, which can be used to build a pie chart. * * 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. * * Return: * - ScatterChartBuilder — A ScatterChartBuilder, which can be used to build a scatter chart. * * 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. * * Return: * - TableChartBuilder — A TableChartBuilder, which can be used to build a table chart. * * 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. * * Return: * - TextStyleBuilder — A TextStyleBuilder, which can be used to build a text style configuration object. * * 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. * * const 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(); * * const chart = Charts.newColumnChart() * .setTitle('Sales & Expenses') * .setXAxisTitle('Year') * .setYAxisTitle('Amount (USD)') * .setDimensions(600, 500) * .setDataTable(sampleData) * .build(); */ interface ColumnChartBuilder { /** * Builds the chart. * * Return: * - Chart — A Chart object, which can be embedded into documents, UI elements, or used as a static image. * * 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. * const builder = Charts.newPieChart(); * builder.reverseCategories(); * * Return: * - ColumnChartBuilder — This builder, useful for chaining. * * 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 * const builder = Charts.newLineChart(); * builder.setBackgroundColor('gray'); * * Return: * - ColumnChartBuilder — This builder, useful for chaining. * * 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. * const builder = Charts.newLineChart(); * builder.setColors(['green', 'red']); * * Return: * - ColumnChartBuilder — This builder, useful for chaining. * * 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. * * Return: * - ColumnChartBuilder — This builder, useful for chaining. * * 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 tab