Class Chart
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
详细文档
getAs(contentType)
将此对象内的数据作为转换为指定内容类型的 blob 返回。此方法会向文件名添加相应的扩展名,例如“myfile.pdf”。不过,它假定文件名最后一个英文句点(如果有)后面的部分是应替换的现有扩展名。因此,“ShoppingList.12.25.2014”会变为“ShoppingList.12.25.pdf”。
如需查看转化每日配额,请参阅 Google 服务的配额。新创建的 Google Workspace 网域可能会暂时受到更严格的配额限制。
参数
名称 | 类型 | 说明 |
contentType | String | 要转换到的 MIME 类型。对于大多数 blob,'application/pdf' 是唯一有效的选项。对于 BMP、GIF、JPEG 或 PNG 格式的图片,'image/bmp' 、'image/gif' 、'image/jpeg' 或 'image/png' 中的任何一种也有效。对于 Google 文档,'text/markdown' 也有效。 |
返回
Blob
- 数据(以 blob 的形式)。
getBlob()
以 blob 的形式返回此对象内的数据。
返回
Blob
- 数据(以 blob 的形式)。
getOptions()
返回此图表的选项,例如高度、颜色和轴。
返回的选项是不可变的。
返回
ChartOptions
- 此图表的选项,例如高度、颜色和轴。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eA Chart object can be converted into a static image and offers methods to manipulate its data and appearance.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetAs()\u003c/code\u003e method allows for data export in various formats like PDF, BMP, GIF, JPEG, or PNG, applying appropriate filename extensions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetBlob()\u003c/code\u003e method returns the chart's data as a blob, providing a general way to access its raw content.\u003c/p\u003e\n"],["\u003cp\u003eChart customization is enabled through the \u003ccode\u003egetOptions()\u003c/code\u003e method, which gives access to properties such as height, colors, and axes but in an immutable format.\u003c/p\u003e\n"]]],[],null,["# Class Chart\n\nChart\n\nA Chart object, which can be converted to a static image. For charts embedded in spreadsheets,\nsee [EmbeddedChart](../spreadsheet/embedded-chart.html). \n\n### Methods\n\n| Method | Return type | Brief description |\n|--------------------------------------|-------------------------------------------------------------|---------------------------------------------------------------------------------------|\n| [getAs(contentType)](#getAs(String)) | [Blob](../base/blob.html) | Return the data inside this object as a blob converted to the specified content type. |\n| [getBlob()](#getBlob()) | [Blob](../base/blob.html) | Return the data inside this object as a blob. |\n| [getOptions()](#getOptions()) | [ChartOptions](/apps-script/reference/charts/chart-options) | Returns the options for this chart, such as height, colors, and axes. |\n\nDetailed documentation\n----------------------\n\n### `get``As(contentType)`\n\nReturn the data inside this object as a blob converted to the specified content type. This\nmethod adds the appropriate extension to the filename---for example, \"myfile.pdf\". However, it\nassumes that the part of the filename that follows the last period (if any) is an existing\nextension that should be replaced. Consequently, \"ShoppingList.12.25.2014\" becomes\n\"ShoppingList.12.25.pdf\".\n\nTo view the daily quotas for conversions, see [Quotas for Google\nServices](https://developers.google.com/apps-script/guides/services/quotas). Newly created Google Workspace domains might be temporarily subject to stricter\nquotas.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `content``Type` | `String` | 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. |\n\n#### Return\n\n\n[Blob](../base/blob.html) --- The data as a blob.\n\n*** ** * ** ***\n\n### `get``Blob()`\n\nReturn the data inside this object as a blob.\n\n#### Return\n\n\n[Blob](../base/blob.html) --- The data as a blob.\n\n*** ** * ** ***\n\n### `get``Options()`\n\nReturns the options for this chart, such as height, colors, and axes.\n\nThe returned options are immutable.\n\n#### Return\n\n\n[ChartOptions](/apps-script/reference/charts/chart-options) --- The options for this chart, such as height, colors, and axes."]]