J6/Grid/Sizes

From J Wiki
Jump to navigation Jump to search

Grid/NavigatorDev


Column Widths

The following applies to all columns, including the row label columns.

Column widths are determined in several steps. Here, wid is the column widths to be determined.

1. Option COLWIDTH is defined at outset, and if COLRESIZE is 1, it can be updated by manually resizing the columns.

2. If COLAUTOFIT is 0, then COLWIDTH is the actual column width, and:

wid=. COLWIDTH * GRIDZOOM

Otherwise, If COLAUTOFIT is 1 (default), then column widths are calculated to fit the data, see Column Extents below. In this case, COLWIDTH is the minimum column width, and:

wid=. (COLWIDTH * GRIDZOOM) >. calculated column width

3. If COLSCALE is not empty, then wid is scaled to fit the actual window width available.

4. The minimum column width is then applied:

wid=. wid >. COLMINWIDTH * GRIDZOOM

5. For COLWIDTH and COLSCALE, if there are fewer values than the number of columns, the last value given is used for the remaining columns.

Column Extents

If column sizes are dynamic ( COLAUTOFIT is 1), then column extents are calculated as follows:

1. If the number of columns is unbounded, then the extents are calculated from scratch when CELLDFMT is defined, and recalculated again if a cell is changed.

2. Otherwise:

  • extents are calculated for only the initial formatted data block, which is typically a subset of the total data. As each new block of data is formatted, then these extents are updated as needed. The update can only increase values.
  • if a cell is changed, then the new extent for the cell changes the column extents as follows:
    • if the entire data has been formatted, then the extents for that column are recalculated. This may reduce the extent for that column.
    • otherwise, the extent for the column is increased if required. It will not decrease.

3. The calculation of column extent is the maximum extent in a column, plus the horizontal padding and twice the horizontal margin, see option GRIDMARGIN.

Row Heights

Currently, row heights are always autofit. The calculation is the same as for autofit column widths.