Skip to content
maxkfranz edited this page Dec 16, 2011 · 7 revisions

Grid layout

A layout that positions nodes in a grid of rows and columns.

The viewport is conceptually split into a a grid, containing a number of cells. A node is positioned in the centre of its corresponding cell.

Coordinate system

2D Cartesian (x and y)

Default options

var defaults = {
  name: "grid",
  ready: undefined,
  fit: true,
  rows: undefined,
  columns: undefined
};

Description of options

ready : A callback function that executes when the layout is done.

fit : A boolean indicating whether to adjust the zoom and pan of the graph to fit the graph to the viewport.

rows : An integer indicating how many rows the grid should be made up of. If rows is set but not columns, then columns is set automatically to fit the number of nodes in the graph.

columns : An integer indicating how many columns the grid should be made up of. If columns is set but not rows, then rows is set automatically to fit the number of nodes in the graph.

Note: If neither rows nor columns is set, then both rows and columns are set automatically to best make use of the available viewport space. It is recommended you use this automatic option unless you need a specific grid.

Clone this wiki locally