The Charts service facilitates server-side chart creation using Google Charts Tools, whereas client-side rendering utilizes the Google Charts API.
An example is provided illustrating the process of creating a data table, populating an area chart, and displaying it as an image.
The documentation details various classes and methods for building different chart types such as Area, Bar, Column, Line, Pie, and Scatter charts, as well as data table and text style objects.
Supported chart types are listed, including Timeline, Area, Bar, Bubble, Candlestick, Column, Combo, Gauge, Geo, Histogram, Radar, Line, Org, Pie, Scatter, Sparkline, Stepped Area, Table, Treemap, and Waterfall charts.
Enums are defined for handling hidden data, merging data ranges, specifying column types, setting curve and point styles, defining legend positions, handling string matching in filters, setting orientation, and specifying picker values layout.
This service allows users to create charts using
Google Charts Tools and render them server side.
If you want to render charts in a web browser, use the
Google Charts API instead.
This example creates a basic data table, populates an area chart with the data,
and adds it to a web page as an image:
functiondoGet(){vardata=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();varchart=Charts.newAreaChart().setDataTable(data).setStacked().setRange(0,40).setTitle('Sales per Month').build();varhtmlOutput=HtmlService.createHtmlOutput().setTitle('My Chart');varimageData=Utilities.base64Encode(chart.getAs('image/png').getBytes());varimageUrl="data:image/png;base64,"+encodeURI(imageData);htmlOutput.append("Render chart server side: <br/>");htmlOutput.append("<img border=\"1\" src=\""+imageUrl+"\">");returnhtmlOutput;}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-12-11 UTC."],[],["This service renders server-side charts using Google Charts Tools. Users create charts through builders like `AreaChartBuilder`, `BarChartBuilder`, etc. Data is structured in `DataTable` objects via `DataTableBuilder`. Charts can be converted to static images using `Chart.getAs()`. Customization includes setting colors, titles, dimensions, legends, axis styles, and data ranges. `ChartOptions` allow for advanced configurations. The `Charts` class provides the creation entry point and enums define chart, data, and styling options.\n"]]