PanelLayout class

This is the abstract base class for all Panel Layouts, which inform the possible Panel types. It is possible to create your own Panel type by creating a subclass of PanelLayout, though this is not common and not recommended for beginners.

By default, GoJS has 12 Panel types, each corresponding to a PanelLayout subclass:

  • 'Position', PanelLayoutPosition
  • 'Horizontal', PanelLayoutHorizontal
  • 'Vertical', PanelLayoutVertical
  • 'Spot', PanelLayoutSpot
  • 'Auto', PanelLayoutAuto
  • 'Table', PanelLayoutTable
  • 'Viewbox', PanelLayoutViewbox
  • 'TableRow', PanelLayoutTableRow
  • 'TableColumn', PanelLayoutTableColumn
  • 'Link', PanelLayoutLink
  • 'Grid', PanelLayoutGrid
  • 'Graduated', PanelLayoutGraduated

None of these predefined panel layout classes have their own documentation pages.

These panel layouts are included by default in builds of go.js and go-module.js and their respective debug versions. When building from source, you can optionally exclude all of them except Position, Vertical, Auto, Link, and Grid. This is demonstrated in minimalSource and maximalSource, in the /projects folder.

Registering a new PanelLayout is done by calling the static function, Panel.definePanelLayout:

Panel.definePanelLayout('Table', new PanelLayoutCustom());

Each PanelLayout must define a #measure and #arrange method. The measure method must call #measureElement with each element of the Panel, which sets each element's GraphObject#measuredBounds. These bounds can be used to determine object layout. The arrange method must call #arrangeElement with each element of the Panel to position the objects relative to the Panel. Remember that each Panel defines its own coordinate system, which is used for sizing and positioning of the panel's elements.

An instance of a PanelLayout is shared by all copies of a Panel that uses it.

There is an example PanelLayout in the PanelLayout sample. There is a Flow PanelLayout extension at #PanelLayoutFlow, demonstrated at Flow PanelLayout sample.

Available Extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

PanelLayout()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited