Class ContainerInfo
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ข้อมูลคอนเทนเนอร์
เข้าถึงตำแหน่งของแผนภูมิภายในชีต อัปเดตได้โดยใช้ฟังก์ชัน EmbeddedChart.modify()
const sheet = SpreadsheetApp.getActiveSheet();
const chart = sheet.getCharts()[0];
const modifiedChart = chart.modify().setPosition(5, 5, 0, 0).build();
sheet.updateChart(modifiedChart);
เมธอด
วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
getAnchorColumn() | Integer | ด้านซ้ายของแผนภูมิจะยึดตามคอลัมน์นี้ |
getAnchorRow() | Integer | ด้านบนของแผนภูมิจะยึดไว้ในแถวนี้ |
getOffsetX() | Integer | มุมซ้ายบนของแผนภูมิจะออฟเซ็ตจากคอลัมน์ยึดตามจำนวนพิกเซลนี้ |
getOffsetY() | Integer | มุมซ้ายบนของแผนภูมิจะออฟเซ็ตจากแถวยึดตามจำนวนพิกเซลนี้ |
เอกสารโดยละเอียด
getAnchorColumn()
ด้านซ้ายของแผนภูมิจะยึดตามคอลัมน์นี้
รีเทิร์น
Integer
— คอลัมน์ที่มีดัชนีเป็น 1 (เช่น คอลัมน์ C คือ 3)
getAnchorRow()
ด้านบนของแผนภูมิจะยึดไว้ในแถวนี้
รีเทิร์น
Integer
— แถวที่จัดทำดัชนี 1 (เช่น แถว 5 จะแสดงผล 5)
getOffsetX()
มุมซ้ายบนของแผนภูมิจะออฟเซ็ตจากคอลัมน์ยึดตามจำนวนพิกเซลนี้
รีเทิร์น
Integer
— ออฟเซ็ตแนวนอนเป็นพิกเซลสำหรับมุมซ้ายบนของแผนภูมิ
getOffsetY()
มุมซ้ายบนของแผนภูมิจะออฟเซ็ตจากแถวยึดตามจำนวนพิกเซลนี้
รีเทิร์น
Integer
— ออฟเซ็ตแนวตั้งเป็นพิกเซลสำหรับมุมซ้ายบนของแผนภูมิ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-13 UTC
[null,null,["อัปเดตล่าสุด 2025-08-13 UTC"],[[["\u003cp\u003e\u003ccode\u003eContainerInfo\u003c/code\u003e allows you to access and update an embedded chart's position within a Google Sheet.\u003c/p\u003e\n"],["\u003cp\u003eYou can get the chart's anchor column and row, which determine its main positioning.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eOffsetX\u003c/code\u003e and \u003ccode\u003eOffsetY\u003c/code\u003e properties provide pixel-level control over the chart's placement relative to the anchor point.\u003c/p\u003e\n"],["\u003cp\u003eUse the \u003ccode\u003emodify()\u003c/code\u003e and \u003ccode\u003esetPosition()\u003c/code\u003e functions along with \u003ccode\u003eupdateChart()\u003c/code\u003e to change the chart's position programmatically.\u003c/p\u003e\n"]]],[],null,["# Class ContainerInfo\n\nContainerInfo\n\nAccess the chart's position within a sheet. Can be updated using the [EmbeddedChart.modify()](/apps-script/reference/spreadsheet/embedded-chart#modify()) function.\n\n```javascript\nconst sheet = SpreadsheetApp.getActiveSheet();\nconst chart = sheet.getCharts()[0];\nconst modifiedChart = chart.modify().setPosition(5, 5, 0, 0).build();\nsheet.updateChart(modifiedChart);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------|-------------|------------------------------------------------------------------------------------------|\n| [getAnchorColumn()](#getAnchorColumn()) | `Integer` | The chart's left side is anchored in this column. |\n| [getAnchorRow()](#getAnchorRow()) | `Integer` | The chart's top side is anchored in this row. |\n| [getOffsetX()](#getOffsetX()) | `Integer` | The chart's upper left hand corner is offset from the anchor column by this many pixels. |\n| [getOffsetY()](#getOffsetY()) | `Integer` | The chart's upper left hand corner is offset from the anchor row by this many pixels. |\n\nDetailed documentation\n----------------------\n\n### `get``Anchor``Column()`\n\nThe chart's left side is anchored in this column.\n\n#### Return\n\n\n`Integer` --- 1-indexed column (that is, column C is 3).\n\n*** ** * ** ***\n\n### `get``Anchor``Row()`\n\nThe chart's top side is anchored in this row.\n\n#### Return\n\n\n`Integer` --- 1-indexed row (that is, row 5 returns 5).\n\n*** ** * ** ***\n\n### `get``Offset``X()`\n\nThe chart's upper left hand corner is offset from the anchor column by this many pixels.\n\n#### Return\n\n\n`Integer` --- The horizontal offset in pixels for the upper left hand corner of the chart.\n\n*** ** * ** ***\n\n### `get``Offset``Y()`\n\nThe chart's upper left hand corner is offset from the anchor row by this many pixels.\n\n#### Return\n\n\n`Integer` --- The vertical offset in pixels for the upper left hand corner of the chart."]]