Class ChartOptions
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
圖表選項
公開目前為 Chart
設定的選項,例如高度、顏色等。
如要瞭解可用的選項,請參閱視覺化參考資料說明文件。如要查看每個圖表的特定選項,請在圖表庫中按一下特定圖表。
這些選項無法變更。
內容詳盡的說明文件
get(option)
傳回這張圖表的已設定選項。
參數
名稱 | 類型 | 說明 |
option | String | 代表所需選項的字串。 |
回攻員
Object
:目前為指定選項設定的值,如果選項未設定,則為 null
。
getOrDefault(option)
傳回這張圖表的設定選項。如果未設定圖表選項,則會傳回此選項的預設值 (如有),如果沒有預設值,則會傳回 null
。
參數
名稱 | 類型 | 說明 |
option | String | 代表所需選項的字串。 |
回攻員
Object
:目前為指定選項設定的值。如果未設定選項,且有可用的預設值,則會傳回預設值。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003eChartOptions\u003c/code\u003e provides access to the configuration settings of a Chart, such as height and color, and these options cannot be changed once set.\u003c/p\u003e\n"],["\u003cp\u003eTo understand available options, refer to the visualization reference and chart gallery for specific chart details.\u003c/p\u003e\n"],["\u003cp\u003eIt offers two methods: \u003ccode\u003eget(option)\u003c/code\u003e to retrieve a specific option's value, returning \u003ccode\u003enull\u003c/code\u003e if not set, and \u003ccode\u003egetOrDefault(option)\u003c/code\u003e which returns the option's value or its default if available, otherwise \u003ccode\u003enull\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Class ChartOptions\n\nChartOptions\n\nExposes options currently configured for a [Chart](/apps-script/reference/charts/chart), such as height, color, etc.\n\nPlease see the [visualization\nreference](https://developers.google.com/chart/interactive/docs/customizing_charts) documentation for information on what options are available. Specific options for\neach chart can be found by clicking on the specific chart in the [chart gallery](https://developers.google.com/chart/interactive/docs/gallery).\n\nThese options are immutable. \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------|-------------|---------------------------------------------|\n| [get(option)](#get(String)) | `Object` | Returns a configured option for this chart. |\n| [getOrDefault(option)](#getOrDefault(String)) | `Object` | Returns a configured option for this chart. |\n\nDetailed documentation\n----------------------\n\n### `get(option)`\n\nReturns a configured option for this chart.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|----------|---------------------------------------------|\n| `option` | `String` | The string representing the desired option. |\n\n#### Return\n\n\n`Object` --- The value currently set for the specified option or `null` if the option was not\nset.\n\n*** ** * ** ***\n\n### `get``Or``Default(option)`\n\nReturns a configured option for this chart. If the chart option is not set, returns the default\nvalue of this option if available, or returns `null` if the default value is not\navailable.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|----------|---------------------------------------------|\n| `option` | `String` | The string representing the desired option. |\n\n#### Return\n\n\n`Object` --- The value currently set for the specified option. If the option was not set and the\ndefault value is available, returns the default value."]]