AG Studio: Build dashboards using native components in web apps. Join us for a webinar on 28th July at 2pm UTC+1 Register

JavaScript Embedded AnalyticsModes & Layout

AG Studio has two main modes - view and edit. Edit mode allows for the construction of reports with the drag-and-drop builder, whilst view mode allows the reports to be viewed as read-only.

Changing Mode Copy Link

The mode can be changed via the mode property.

AgStudioMode
default: 'view'
Which mode Studio is in.

Layout Properties Copy Link

The default layout setup can be overridden via the layout property. The example above adjusts the default number of columns and the row height in the layout. This affects the widget moving and resizing behaviour.

const studioProperties = {
    layout: {
        columns: 4,
        rowHeight: 50,
    },

    // other studio properties ...
}
layoutCopy Link
Partial<AgPageLayoutState>
Default layout styling.

Page Dimensions Copy Link

Page Dimensions define the space your report should fit into and how it behaves when the browser window or device size changes. They are configured via the layout property.

const studioProperties = {
    layout: {
        minWidth: 800,
        maxWidth: 1200,
        height: 600,
    },

    // other studio properties ...
}
layoutCopy Link
Partial<AgPageLayoutState>
Default layout styling.

Width Copy Link

Width settings help keep the layout readable and well-proportioned across different screen sizes.

Min Width defaults to 720px. It defines the smallest width the page can shrink to before horizontal scrolling is needed. In the example below, a large minimum width is set, so a horizontal scrollbar appears when the viewport is narrower than the minimum width.

Max Width is optional and can be left as Auto. When left as Auto, the dashboard can continue expanding beyond the minimum width as the viewport grows.

If Max Width is set, the dashboard stops growing once it reaches that width and remains centred on the screen. In the example below, a fixed maximum width is applied, so the dashboard stops expanding and centres within the available space.

This means:

  • A required Min Width sets the minimum readable size.
  • An optional Max Width controls how wide the dashboard is allowed to grow.

Height Copy Link

Auto Height allows the page to grow as Widgets are added. This works well for dashboards that may expand over time, or reports where content scrolls vertically.

Fixed Height locks the page to a specific height, like a slide or poster. This works well when vertical boundaries need to be fixed for a consistent, contained view, especially for dashboards designed to fit on a single screen.

When using Fixed Height, set it to be a multiple of the layout rowHeight plus double the layout pagePadding to avoid additional padding at the top and bottom of the layout. rowHeight defaults to the studioCanvasRowHeight theme variable, which is 16 in the default theme. pagePadding defaults to widgetPadding if not defined, which in turn defaults to the studioWidgetPadding theme variable, which is 4 in the default theme

Panels Copy Link

Studio has four different panels that can be displayed depending on the mode:

  • AI Panel ('ai') - Used for the AI Feature.
  • Filters Panel ('filters') - Contains page filters, widget filters, cross filters, and filters from filter widgets.
  • Edit Panel ('edit') - Changes function based on the UI selection to display editing controls.
  • Data Panel ('data') - Displays the fields available in the data.

Configuring Panels Copy Link

Which panels are displayed, and on which side, can be configured for both view mode and edit mode.

The example above demonstrates displaying the Filters Panel on the left-hand side in edit mode (and collapsed by default via Initial State). In view mode, the Filters Panel is hidden completely.

const studioProperties = {
    panels: {
        edit: {
            left: ['filters'],
            right: ['edit', 'data']
        },
        view: {
            left: [],
        },
    },

    // other studio properties ...
}
panelsCopy Link
AgPanelConfig
Configure which panels are displayed and on which side.

Note that panels controlling editing functionality are only available in edit mode.

Customising Panel Content Copy Link

The content of the edit panel can be customised in multiple ways. The example above demonstrates configuring the Page tab to only show the first item (page background).

AgPageConfig | ((config: AgPageConfig) => AgPageConfig)
Configure page (e.g. page setup form in page tab of edit panel).

It is also possible to Customise the Available Widgets and Change the Configuration for Individual Widgets. See the documentation on these for examples of how to do this.

The page setup form items are set up in a similar way to the widget Form Grouping Items and Form Input Items, but only a subset of input items are supported.