Google Apps Script

Class Charts

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 UiApp:

 
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 uiApp = UiApp.createApplication().setTitle("My Chart");
   uiApp.add(chart);
   return uiApp;
 }
 

Properties

PropertyTypeDescription
ChartTypeChartTypeAn enumeration of chart types supported by the Charts service.
ColumnTypeColumnTypeAn enumeration of the valid data types for columns in a DataTable.
CurveStyleCurveStyleAn enumeration of the styles for curves in a chart.
MatchTypeMatchTypeAn enumeration of how a string value should be matched.
OrientationOrientationAn enumeration of the orientation of an object.
PickerValuesLayoutPickerValuesLayoutAn enumeration of how to display selected values in a picker widget.
PointStylePointStyleAn enumeration of the styles of points in a line.
PositionPositionAn enumeration of legend positions within a chart.

Methods

MethodReturn typeBrief description
newAreaChart()AreaChartBuilderStarts building an area chart, as described in the Google Chart Tools documentation.
newBarChart()BarChartBuilderStarts building a bar chart, as described in the Google Chart Tools documentation.
newCategoryFilter()CategoryFilterBuilderStarts building a category filter control, as described in the Google Chart Tools documentation.
newColumnChart()ColumnChartBuilderStarts building a column chart, as described in the Google Chart Tools documentation.
newDashboardPanel()DashboardPanelBuilderStarts building a dashboard panel, as described in the Google Chart Tools documentation.
newDataTable()DataTableBuilderCreates an empty data table, which can have its values set manually.
newDataViewDefinition()DataViewDefinitionBuilderCreates a new data view definition.
newLineChart()LineChartBuilderStarts building a line chart, as described in the Google Chart Tools documentation.
newNumberRangeFilter()NumberRangeFilterBuilderStarts building a number range filter control, as described in the Google Chart Tools documentation.
newPieChart()PieChartBuilderStarts building a pie chart, as described in the Google Chart Tools documentation.
newScatterChart()ScatterChartBuilderStarts building a scatter chart, as described in the Google Chart Tools documentation.
newStringFilter()StringFilterBuilderStarts building a string filter control, as described in the Google Chart Tools documentation.
newTableChart()TableChartBuilderStarts building a table chart, as described in the Google Chart Tools documentation.
newTextStyle()TextStyleBuilderCreates a new text style builder.

Detailed documentation

newAreaChart()

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


newBarChart()

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


newCategoryFilter()

Starts building a category filter control, as described in the Google Chart Tools documentation.

Return

CategoryFilterBuilder — a CategoryFilterBuilder, which can be used to build a category filter


newColumnChart()

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


newDashboardPanel()

Starts building a dashboard panel, as described in the Google Chart Tools documentation.

Return

DashboardPanelBuilder — a DashboardPanelBuilder, which can be used to build a dashboard panel


newDataTable()

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


newDataViewDefinition()

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


newLineChart()

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


newNumberRangeFilter()

Starts building a number range filter control, as described in the Google Chart Tools documentation.

Return

NumberRangeFilterBuilder — a NumberRangeFilterBuilder, which can be used to build a number range filter


newPieChart()

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


newScatterChart()

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


newStringFilter()

Starts building a string filter control, as described in the Google Chart Tools documentation.

Return

StringFilterBuilder — a StringFilterBuilder, which can be used to build a string filter


newTableChart()

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


newTextStyle()

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

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.