Class Chart
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Tangga lagu
Objek Diagram, yang dapat dikonversi menjadi gambar statis. Untuk diagram yang disematkan dalam spreadsheet,
lihat EmbeddedChart
.
Metode
Metode | Jenis hasil yang ditampilkan | Deskripsi singkat |
getAs(contentType) | Blob | Menampilkan data di dalam objek ini sebagai blob yang dikonversi ke jenis konten yang ditentukan. |
getBlob() | Blob | Menampilkan data di dalam objek ini sebagai blob. |
getOptions() | ChartOptions | Menampilkan opsi untuk diagram ini, seperti tinggi, warna, dan sumbu. |
Dokumentasi mendetail
getAs(contentType)
Menampilkan data di dalam objek ini sebagai blob yang dikonversi ke jenis konten yang ditentukan. Metode
ini menambahkan ekstensi yang sesuai ke nama file—misalnya, "myfile.pdf". Namun, hal ini
menganggap bahwa bagian nama file yang mengikuti titik terakhir (jika ada) adalah ekstensi
yang ada dan harus diganti. Akibatnya, "ShoppingList.12.25.2014" menjadi
"ShoppingList.12.25.pdf".
Untuk melihat kuota harian konversi, lihat Kuota untuk Layanan Google. Domain Google Workspace yang baru dibuat mungkin akan dikenai kuota yang lebih ketat untuk sementara.
Parameter
Nama | Jenis | Deskripsi |
contentType | String | Jenis MIME yang akan dikonversi. Untuk sebagian besar blob, 'application/pdf' adalah
satu-satunya opsi yang valid. Untuk gambar dalam format BMP, GIF, JPEG, atau PNG, 'image/bmp' , 'image/gif' , 'image/jpeg' , atau 'image/png' juga
valid. Untuk dokumen Google Dokumen, 'text/markdown' juga valid. |
Pulang pergi
Blob
— Data sebagai blob.
getBlob()
Menampilkan data di dalam objek ini sebagai blob.
Pulang pergi
Blob
— Data sebagai blob.
getOptions()
Menampilkan opsi untuk diagram ini, seperti tinggi, warna, dan sumbu.
Opsi yang ditampilkan tidak dapat diubah.
Pulang pergi
ChartOptions
— Opsi untuk diagram ini, seperti tinggi, warna, dan sumbu.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[[["\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."]]