Class ContainerInfo

  • ContainerInfo is used to access and update a chart's position within a sheet.

  • The position can be modified using the EmbeddedChart.modify() function.

  • Methods are available to get the anchor column and row, and the X and Y offsets in pixels.

ContainerInfo

Access the chart's position within a sheet. Can be updated using the EmbeddedChart.modify() function.

constsheet=SpreadsheetApp.getActiveSheet();
constchart=sheet.getCharts()[0];
constmodifiedChart=chart.modify().setPosition(5,5,0,0).build();
sheet.updateChart(modifiedChart);

Methods

MethodReturn typeBrief description
getAnchorColumn() IntegerThe chart's left side is anchored in this column.
getAnchorRow() IntegerThe chart's top side is anchored in this row.
getOffsetX() IntegerThe chart's upper left hand corner is offset from the anchor column by this many pixels.
getOffsetY() IntegerThe chart's upper left hand corner is offset from the anchor row by this many pixels.

Detailed documentation

getAnchorColumn()

The chart's left side is anchored in this column.

Return

Integer — 1-indexed column (that is, column C is 3).


getAnchorRow()

The chart's top side is anchored in this row.

Return

Integer — 1-indexed row (that is, row 5 returns 5).


getOffsetX()

The chart's upper left hand corner is offset from the anchor column by this many pixels.

Return

Integer — The horizontal offset in pixels for the upper left hand corner of the chart.


getOffsetY()

The chart's upper left hand corner is offset from the anchor row by this many pixels.

Return

Integer — The vertical offset in pixels for the upper left hand corner of the chart.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年08月12日 UTC.