Package

com.google.appsscript

charts

Permalink

package charts

Visibility
  1. Public
  2. All

Type Members

  1. trait AreaChartBuilder extends Object

    Permalink

    AreaChartBuilder Builder for area charts.

    AreaChartBuilder Builder for area charts. For more details, see the Google Charts documentation. Here is an example that shows how to build an area chart.

    function doGet() { // 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();

    return UiApp.createApplication().add(chart); }

    Annotations
    @RawJSType()
  2. trait BarChartBuilder extends Object

    Permalink

    BarChartBuilder Builder for bar charts.

    BarChartBuilder 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.

    function doGet() { // 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(); return UiApp.createApplication().add(chart); }

    Annotations
    @RawJSType()
  3. trait CategoryFilterBuilder extends Object

    Permalink

    CategoryFilterBuilder A builder for category filter controls.

    CategoryFilterBuilder A builder for category filter controls. A category filter is a picker to choose one or more between a set of defined values. Given a column of type string, this control will filter out the rows that don't match any of the picked values. Here is an example that creates a table chart a binds a category filter to it. This allows the user to filter the data the table displays.

    function doGet() { var app = UiApp.createApplication(); 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.newTableChart() .setDimensions(600, 500) .build();

    var categoryFilter = Charts.newCategoryFilter() .setFilterColumnLabel("Month") .setAllowMultiple(true) .setSortValues(true) .setLabelStacking(Charts.Orientation.VERTICAL) .setCaption('Choose categories...') .build();

    var panel = app.createVerticalPanel().setSpacing(10); panel.add(categoryFilter).add(chart);

    var dashboard = Charts.newDashboardPanel() .setDataTable(sampleData) .bind(categoryFilter, chart) .build();

    dashboard.add(panel); app.add(dashboard); return app; }

    For more details, see the Gviz documentation

    Annotations
    @RawJSType()
  4. trait Chart extends Object

    Permalink

    Chart A Chart object, which can be embedded into documents, UI elements, or used as a static image.

    Chart A Chart object, which can be embedded into documents, UI elements, or used as a static image. For charts embedded in spreadsheets, see EmbeddedChart.

    Annotations
    @RawJSType()
  5. trait ChartOptions extends Object

    Permalink

    ChartOptions Exposes options currently configured for a Chart, such as height, color, etc.

    ChartOptions 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.

    Annotations
    @RawJSType()
  6. trait ChartType extends Object

    Permalink

    ChartType Chart types supported by the Charts service.

    ChartType Chart types supported by the Charts service.

    Annotations
    @RawJSType()
  7. trait Charts extends Object

    Permalink

    Charts Entry point for creating Charts in scripts.

    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; }

    Annotations
    @RawJSType()
  8. trait ColumnChartBuilder extends Object

    Permalink

    ColumnChartBuilder Builder for column charts.

    ColumnChartBuilder 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.

    function doGet() { 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 vs. Expenses') .setXAxisTitle('Year') .setYAxisTitle('Amount (USD)') .setDimensions(600, 500) .setDataTable(sampleData) .build();

    return UiApp.createApplication().add(chart); }

    Annotations
    @RawJSType()
  9. trait ColumnType extends Object

    Permalink

    ColumnType An enumeration of the valid data types for columns in a DataTable.

    ColumnType An enumeration of the valid data types for columns in a DataTable.

    Annotations
    @RawJSType()
  10. trait Control extends Object

    Permalink

    Control A user interface control object, that drives the data displayed by a DashboardPanel.

    Control A user interface control object, that drives the data displayed by a DashboardPanel. A control can be embedded in a UI application. Controls are user interface widgets (category pickers, range sliders, autocompleters, etc.) users interact with in order to drive the data managed by a dashboard and the charts that are part of it. Controls collect user input and use the information to decide which of the data the dashboard is managing should be made available to the charts that are part of it. Given a data table, a control will filter out the data that doesn't comply with the conditions implied by its current state, and will expose the filtered data table as an output. For more details, see the Gviz documentation.

    Annotations
    @RawJSType()
  11. trait CurveStyle extends Object

    Permalink

    CurveStyle An enumeration of the styles for curves in a chart.

    CurveStyle An enumeration of the styles for curves in a chart.

    Annotations
    @RawJSType()
  12. trait DashboardPanel extends Object

    Permalink

    DashboardPanel A dashboard is a visual structure that enables the organization and management of multiple charts that share the same underlying data.

    DashboardPanel A dashboard is a visual structure that enables the organization and management of multiple charts that share the same underlying data. Controls are user interface widgets (category pickers, range sliders, autocompleters, etc.) users interact with in order to drive the data managed by a dashboard and the charts that are part of it. For example, a string filter control is a simple text input field that lets the user filter data via string matching. Given a column and matching options, the control will filter out the rows that don't match the term that's in the input field. The Gviz API defines a dashboard as a set of charts and controls bound together. The bindings between the different components define the data flow, the state of the controls filters views of the data which propagate in the dashboard and are eventually visualized with charts. For more details, see the Gviz documentation. The dashboard panel has two purposes, one is being a container for the charts and controls objects that compose the dashboard, and the other is holding the data and use as an interface for binding controls to charts. Here's an example of creating a dashboard and showing it in a UI app:

    function doGet() { // Create a data table with some sample data. var data = Charts.newDataTable() .addColumn(Charts.ColumnType.STRING, "Name") .addColumn(Charts.ColumnType.NUMBER, "Age") .addRow(["Michael", 18]) .addRow(["Elisa", 12]) .addRow(["John", 20]) .addRow(["Jessica", 25]) .addRow(["Aaron", 14]) .addRow(["Margareth", 19]) .addRow(["Miranda", 22]) .addRow(["May", 20]) .build();

    var chart = Charts.newBarChart() .setTitle("Ages") .build();

    var control = Charts.newStringFilter() .setFilterColumnLabel("Name") .build();

    // Bind the control to the chart in a dashboard panel. var dashboard = Charts.newDashboardPanel() .setDataTable(data) .bind(control, chart) .build();

    var uiApp = UiApp.createApplication().setTitle("My Dashboard");

    var panel = uiApp.createHorizontalPanel() .setVerticalAlignment(UiApp.VerticalAlignment.MIDDLE) .setSpacing(50);

    panel.add(control); panel.add(chart); dashboard.add(panel); uiApp.add(dashboard); return uiApp; }

    Annotations
    @RawJSType()
  13. trait DashboardPanelBuilder extends Object

    Permalink

    DashboardPanelBuilder A builder for a dashboard panel object.

    DashboardPanelBuilder A builder for a dashboard panel object. For an example of how to use DashboardPanelBuilder, refer to DashboardPanel. For more details, see the Gviz documentation.

    Annotations
    @RawJSType()
  14. trait DataTable extends Object

    Permalink

    DataTable A Data Table to be used in charts.

    DataTable A Data Table to be used in charts. A DataTable can come from sources such as Google Sheets or specified data-table URLs, or can be filled in by hand. This class intentionally has no methods: a DataTable can be passed around, but not manipulated directly.

    Annotations
    @RawJSType()
  15. trait DataTableBuilder extends Object

    Permalink

    DataTableBuilder Builder of DataTable objects.

    DataTableBuilder Builder of DataTable objects. Building a data table consists of first specifying its columns, and then adding its rows, one at a time. Example: 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();

    Annotations
    @RawJSType()
  16. trait DataTableSource extends Object

    Permalink

    DataTableSource Interface for objects that can represent their data as a DataTable.

    DataTableSource Interface for objects that can represent their data as a DataTable. Implementing classes Name Brief description DataTable A Data Table to be used in charts. Range Access and modify spreadsheet ranges.

    Annotations
    @RawJSType()
  17. trait DataViewDefinition extends Object

    Permalink

    DataViewDefinition A data view definition for visualizing chart data.

    DataViewDefinition A data view definition for visualizing chart data. Data view definition can be set for charts to visualize a view derived from the given data table and not the data table itself. For example if the view definition of a chart states that the view columns are [0, 3], only the first and the third columns of the data table will be taken into consideration when drawing the chart. See DataViewDefinitionBuilder for an example on how to define and use a DataViewDefinition.

    Annotations
    @RawJSType()
  18. trait DataViewDefinitionBuilder extends Object

    Permalink

    DataViewDefinitionBuilder Builder for DataViewDefinition objects.

    DataViewDefinitionBuilder Builder for DataViewDefinition objects. Here's an example of using the builder. The data is imported from a Google spreadsheet.

    function doGet() { // This example creates two table charts side by side. One uses a data view definition to // restrict the number of displayed columns. var app = UiApp.createApplication(); // Get sample data from a spreadsheet. var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=A1%3AF' + '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=4&headers=-1';

    // Create a chart to display all of the data. var originalChart = Charts.newTableChart() .setDimensions(600, 500) .setDataSourceUrl(dataSourceUrl) .build();

    // Create another chart to display a subset of the data (only columns 1 and 4). var dataViewDefinition = Charts.newDataViewDefinition().setColumns([0, 3]); var limitedChart = Charts.newTableChart() .setDimensions(200, 500) .setDataSourceUrl(dataSourceUrl) .setDataViewDefinition(dataViewDefinition) .build();

    var panel = app.createHorizontalPanel().setSpacing(15); panel.add(originalChart).add(limitedChart); return app.add(panel); }

    Annotations
    @RawJSType()
  19. trait LineChartBuilder extends Object

    Permalink

    LineChartBuilder Builder for line charts.

    LineChartBuilder Builder for line charts. For more details, see the Google Charts documentation. Here is an example that shows how to build a line chart. The data is imported from a Google spreadsheet.

    function doGet() { // Get sample data from a spreadsheet. var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=A1%3AG5' + '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=2&headers=-1';

    var chartBuilder = Charts.newLineChart() .setTitle('Yearly Rainfall') .setXAxisTitle('Month') .setYAxisTitle('Rainfall (in)') .setDimensions(600, 500) .setCurveStyle(Charts.CurveStyle.SMOOTH) .setPointStyle(Charts.PointStyle.MEDIUM) .setDataSourceUrl(dataSourceUrl);

    var chart = chartBuilder.build(); return UiApp.createApplication().add(chart); }

    Annotations
    @RawJSType()
  20. trait MatchType extends Object

    Permalink

    MatchType An enumeration of how a string value should be matched.

    MatchType An enumeration of how a string value should be matched. Matching a string is a boolean operation. Given a string, a match term (string), and a match type, the operation will output true in the following cases: If the match type equals EXACT and the match term equals the string. If the match type equals PREFIX and the match term is a prefix of the string. If the match type equals ANY and the match term is a substring of the string. This enumeration can be used in by a string filter control to decide which rows to filter out of the data table. Given a column to filter on, leave only the rows that match the value entered in the filter input box, using one of the above matching types.

    Annotations
    @RawJSType()
  21. trait NumberRangeFilterBuilder extends Object

    Permalink

    NumberRangeFilterBuilder A builder for number range filter controls.

    NumberRangeFilterBuilder A builder for number range filter controls. A number range filter is a slider with two thumbs that lets the user select ranges of numeric values. Given a column of type number and matching options, this control will filter out the rows that don't match the range that was selected. This example creates a table chart bound to a number range filter:

    function doGet() { var app = UiApp.createApplication(); // Get sample data from a spreadsheet. var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=A1%3AF' + '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=4&headers=-1'; var data = SpreadsheetApp.openByUrl(dataSourceUrl).getSheetByName('US_GDP').getRange("A1:F");

    var chart = Charts.newTableChart() .setDimensions(600, 500) .build();

    var numberRangeFilter = Charts.newNumberRangeFilter() .setFilterColumnLabel("Year") .setShowRangeValues(true) .setLabel("Restrict year range") .build();

    var panel = app.createVerticalPanel().setSpacing(10); panel.add(numberRangeFilter).add(chart);

    // Create a new dashboard panel to bind the filter and chart together. var dashboard = Charts.newDashboardPanel() .setDataTable(data) .bind(numberRangeFilter, chart) .build();

    dashboard.add(panel); app.add(dashboard); return app; }

    For more details, see the Gviz documentation

    Annotations
    @RawJSType()
  22. trait Orientation extends Object

    Permalink

    Orientation An enumeration of the orientation of an object.

    Orientation An enumeration of the orientation of an object.

    Annotations
    @RawJSType()
  23. trait PickerValuesLayout extends Object

    Permalink

    PickerValuesLayout An enumeration of how to display selected values in picker widget.

    PickerValuesLayout An enumeration of how to display selected values in picker widget.

    Annotations
    @RawJSType()
  24. trait PieChartBuilder extends Object

    Permalink

    PieChartBuilder A builder for pie charts.

    PieChartBuilder A builder for pie charts. For more details, see the Google Charts documentation. Here is an example that shows how to build a pie chart. The data is imported from a Google spreadsheet.

    function doGet() { // Get sample data from a spreadsheet. var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=A1%3AB8' + '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=3&headers=-1';

    var chartBuilder = Charts.newPieChart() .setTitle('World Population by Continent') .setDimensions(600, 500) .set3D() .setDataSourceUrl(dataSourceUrl);

    var chart = chartBuilder.build(); return UiApp.createApplication().add(chart); }

    Annotations
    @RawJSType()
  25. trait PointStyle extends Object

    Permalink

    PointStyle An enumeration of the styles of points in a line.

    PointStyle An enumeration of the styles of points in a line.

    Annotations
    @RawJSType()
  26. trait Position extends Object

    Permalink

    Position An enumeration of legend positions within a chart.

    Position An enumeration of legend positions within a chart.

    Annotations
    @RawJSType()
  27. trait ScatterChartBuilder extends Object

    Permalink

    ScatterChartBuilder Builder for scatter charts.

    ScatterChartBuilder Builder for scatter charts. For more details, see the Google Charts documentation. Here is an example that shows how to build a scatter chart. The data is imported from a Google spreadsheet.

    function doGet() { // Get sample data from a spreadsheet. var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=C1%3AD' + '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=4&headers=-1';

    var chartBuilder = Charts.newScatterChart() .setTitle('Adjusted GDP vs. U.S. Population') .setXAxisTitle('U.S. Population (millions)') .setYAxisTitle('Adjusted GDP ($ billions)') .setDimensions(600, 500) .setLegendPosition(Charts.Position.NONE) .setDataSourceUrl(dataSourceUrl);

    var chart = chartBuilder.build(); return UiApp.createApplication().add(chart); }

    Annotations
    @RawJSType()
  28. trait StringFilterBuilder extends Object

    Permalink

    StringFilterBuilder A builder for string filter controls.

    StringFilterBuilder A builder for string filter controls. A string filter is a simple text input field that lets the user filter data via string matching. Given a column of type string and matching options, this control will filter out the rows that don't match the term that's in the input field. This example creates a table chart and binds it to a string filter. Using the filter, it is possible to change the table chart to display a subset of its data.

    function doGet() { var app = UiApp.createApplication(); 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.newTableChart() .setDimensions(600, 500) .build();

    var stringFilter = Charts.newStringFilter() .setFilterColumnLabel("Month") .setRealtimeTrigger(true) .setCaseSensitive(true) .setLabel("Filter months shown") .build();

    var panel = app.createVerticalPanel().setSpacing(10); panel.add(stringFilter).add(chart);

    // Create a dashboard panel to bind the filter and the chart together. var dashboard = Charts.newDashboardPanel() .setDataTable(sampleData) .bind(stringFilter, chart) .build();

    dashboard.add(panel); app.add(dashboard); return app; }

    For more details, see the Gviz documentation.

    Annotations
    @RawJSType()
  29. trait TableChartBuilder extends Object

    Permalink

    TableChartBuilder A builder for table charts.

    TableChartBuilder A builder for table charts. For more details, see the Google Charts documentation. Here is an example that shows how to build a table chart. The data is imported from a Google spreadsheet.

    function doGet() { // Get sample data from a spreadsheet. var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=A1%3AF' + '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=4&headers=-1';

    var chartBuilder = Charts.newTableChart() .setDimensions(600, 500) .enablePaging(20) .setDataSourceUrl(dataSourceUrl);

    var chart = chartBuilder.build(); return UiApp.createApplication().add(chart); }

    Annotations
    @RawJSType()
  30. trait TextStyle extends Object

    Permalink

    TextStyle A text style configuration object.

    TextStyle A text style configuration object. Used in charts options to configure text style for elements that accepts it, such as title, horizontal axis, vertical axis, legend and tooltip.

    // This example creates a chart specifying different text styles for the title and axes. function doGet() { var sampleData = Charts.newDataTable() .addColumn(Charts.ColumnType.STRING, "Seasons") .addColumn(Charts.ColumnType.NUMBER, "Rainy Days") .addRow(["Winter", 5]) .addRow(["Spring", 12]) .addRow(["Summer", 8]) .addRow(["Fall", 8]) .build();

    var titleTextStyleBuilder = Charts.newTextStyle() .setColor('#0000FF').setFontSize(26).setFontName('Ariel'); var axisTextStyleBuilder = Charts.newTextStyle() .setColor('#3A3A3A').setFontSize(20).setFontName('Ariel'); var titleTextStyle = titleTextStyleBuilder.build(); var axisTextStyle = axisTextStyleBuilder.build();

    var chart = Charts.newLineChart() .setTitleTextStyle(titleTextStyle) .setXAxisTitleTextStyle(axisTextStyle) .setYAxisTitleTextStyle(axisTextStyle) .setTitle('Rainy Days Per Season') .setXAxisTitle('Season') .setYAxisTitle('Number of Rainy Days') .setDataTable(sampleData) .build();

    return UiApp.createApplication().add(chart); }

    Annotations
    @RawJSType()
  31. trait TextStyleBuilder extends Object

    Permalink

    TextStyleBuilder A builder used to create TextStyle objects.

    TextStyleBuilder A builder used to create TextStyle objects. It allows configuration of the text's properties such as name, color, and size. The following example shows how to create a text style using the builder. For a more complete example, refer to the documentation for TextStyle.

    // Creates a new text style that uses 26-point, blue, Ariel font. var textStyleBuilder = Charts.newTextStyle() .setColor('#0000FF').setFontName('Ariel').setFontSize(26); var style = textStyleBuilder.build();

    Annotations
    @RawJSType()

Ungrouped