Skip to main content
Version: 0.17.1

Responsive Visualizations

Gosling visualizations can be responsive or fixed to the screen size.

Responsive size

A Gosling visualization can be made responsive to the screen size by setting the responsiveSize property in the root of the Gosling specification. When the screen size changes, the visualization will automatically adjust its size to fit the screen.

Here is an example of a Gosling specification with responsive size enabled:

{
responsiveSize: { width: true },
// ... rest of the Gosling spec
}

Fixed size

A Gosling visualization can have a fixed size by setting the width and height properties. The tracks will have a fixed size regardless of the screen size.

When the width and height properties are set in the root of the spec, all tracks will have this height and width unless they are overridden in the track specification.

{
width: 800,
height: 200,
// ... rest of the Gosling spec
}