Guides/Window Driver/ChildClasses/Isigrid

From J Wiki
Jump to: navigation, search
Grid.png

Isigrid

Isigrid is a grid control for J that complements the table control. This was added in J803 as a beta release that is still incomplete.

Compared to the table control

For most requirements, the table control is best and is recommended. It uses the QTableWidget which provides standard table display and edit facilities for typical applications.

Isigrid provides some features that are not in the table control, but are useful with multi-layered and/or very large data sets. These features were in the J6 grid control and are now ported to J8. Specifically:

  • multi-row and merged column headers and row labels, as in the example shown at top of page
  • display of multi-dimensional numeric arrays. Each axis may appear in the rows, or columns, or as a slice through the data. The display may be rearranged by drag and drop, or by selecting a new slice.
  • very fast loading for large data sets. For example, the Showcase|isigrid demo has a 1 million cell spreadsheet that loads in a fraction of a second, compared to about 10 seconds for the table control.

Additional facilities that are planned:

  • a hierarchical grid that displays a numeric matrix where rows and/or columns are in a hierarchy. For example, columns may represent cities. and these may in turn be grouped by country and by region. Data is subtotalled as needed for each group.
  • a virtual grid, where values are passed from J to the grid display as required
  • a triangular grid, useful for displaying information in cohorts

The isigrid control is drawn directly and does not use the QTableWidget. Thus many features of the table control are missing from isigrid, for example, editable cells.

See menu Help|Studio|Showcase|isigrd for examples.

wd commands

Create: wd 'cc id isigrid [type]' creates an isigrid. Type is optional, and the only value available now is cube for a multi-dimensional grid.

Set commands (except for cube):

shape - wd'set id shape rows cols ' specifies the number of rows and columns in the table body. This should be given before any other set command.

data - wd'set id data datalist ' specifies the contents of cells as a text string that is a ravelled list of cell contents.

align - wd'set id align alignlist ' sets data alignment as left, center, right (default) (0,1,2) for each cell.

hdr - wd'set id hdr listofcolheaders ' specifies the column headers

hdralign - wd'set id hdralign hdralignlist ' sets header alignment as left, center (default), right (0,1,2) for each column header.

hdrmerge - wd'set id hdrmerge hdrmergelist ' sets header merge list as integer repetitions of the corresponding header

lab - wd'set id lab listofrowlabels ' specifies the row labels

labalign - wd'set id labalign labalignlist ' sets label alignment as left, center (default), right (0,1,2) for each row label.

labmerge - wd'set id labmerge labmergelist ' sets label merge list as integer repetitions of the corresponding label

Set commands for cube:

shape - wd'set id shape rows cols ' specifies the number of rows and columns in the data. This should be given before any other set command.

data - wd'set id data datalist ' specifies the contents of cells as a text string that is a ravelled list of cell contents

names - wd'set id names listofnames ' specifies the axis names (one for each dimension)

labels - wd'set id labels labelslist ' sets labels list, one label for the length of each axis, in order of axes

order - wd'set id order order ' sets the initial display order as a list of 4 elements (the last two may be empty):

   rws;cls;sel;selindex

where rws is the row axes, cls is the column axes, sel is the sliced axes, and selindex is the corresponding indices for sel.