Customize the layout of a report in code representation (Beta)
Customize the layout of a report in code representation (Beta)
This documentation describes one or more public beta features that are in development. Beta features are subject to quick, iterative changes; therefore the current user experience in the Sigma service can differ from the information provided in this page.
This page should not be considered official published documentation until Sigma removes this notice and the beta flag on the corresponding feature(s) in the Sigma service. For the full beta feature disclaimer, see Beta features.
You can customize the layout of a report in the code representation using the contents.layout and contents.config fields. The layout field is an XML string that controls which page or panel each element belongs to, and the size and position of each element there. The config field controls page-level configurations, including the page size and margins.
To control how elements are arranged on a page when you create or update a report using the API, specify the layout in the representation. When you retrieve the representation of an existing report using the Get a report endpoint with includeContents=true, the layout and config fields populate automatically based on the published version of the report.
The layout field is required. Every element in contents.elements must be placed in the layout, because the layout is what assigns an element to a page or panel. A representation with an element the layout never references is rejected with an error naming that element, such as elements[0]: element 'Vg934XlZ_4' is not placed in layout.
Example representation with layout
The following example shows a YAML representation of a report with a table and a line chart. Both elements span the full width of the page (excluding the margins) and are stacked vertically, with the line chart directly below the table.
YAML representation with layout
Report layouts use a pixel system, instead of a grid system like workbooks. Instead of using gridColumn and gridRow attributes to position elements, report layouts use x and y coordinates. For more information on workbook layout, see Customize the layout of a workbook in code representation.
Representing page layout
In this example representation, the element layout is defined in the layout field, and margin and page size are defined in the config field.
Layout and config representation
The layout field contains one <Page> element per report page. The id attribute of <Page> must match the id of the corresponding page in the contents.pages array. Inside <Page>, each <Element> entry places one element on that page — the elementId attribute must match the id of the corresponding element in the contents.elements array.
Each <Element> entry contains information about the element’s position and size on the page:
-
Position:
xandypixel values set the position of the element’s top-left corner. Thexandypositions are relative to the top-left corner of the page (0,0), excluding the margins. -
Size:
widthandheightattributes set the element’s size.
Representing page size and margins
The config field defines report-level page setup. It contains the following values, all measured in pixels:

