J6/Grid/MultiDimensional

From J Wiki
Jump to navigation Jump to search
J6/Grid | Data Options Types | Actions Events Methods | Class DerivedClass | Hierarchical MultiDimensional MultiLine Virtual | Examples


A multidimensional grid displays multidimensional 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.

Display

In the grid display, the rows and columns are shown at bottom left and top right. At top left are any slices through the data.

Mgrid1.png

Drag and drop an axis tile to rearrange the cube, or click a slice to select a new value.

Mgrid2.png

New Options

A new option group AXIS defines a multidimensional grid.

AXISLABELS axis labels
AXISNAMES axis names
AXISORDER axis order

AXISLABELS - A list of lists, one for each axis. The length of the labels must match the data.

AXISNAMES - A list of names, one for for each axis.

AXISORDER - The axis ordering for the initial display, as a list of 3 or 4 elements:

  rws;cls;sel;selindex

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

Other Options

CELLDATA should be a numeric array, with shape matching AXISNAMES and AXISLABELS.

CELLFMT may only be a single format, i.e. same for each cell.

Options GRIDBORDER, GRIDFLIP, GRIDROWMODE, GRIDSORT are not supported.

Example

The following example is shown above, and also in demo Studio|Demos|Grid|Multi-Dimensional.

a0=. ;: 'Ford GM Honda Toyota Total'
a1=. '2006';'2007'
a2=. ;: 'Hire Lease Sale'
a3=. ;: 'CA KS MN NY TX'
a4=. <;._1 '/Compact/Standard/Full Size/Luxury/MiniVan/SUV/Total'
AXISLABELS=: a0;a1;a2;a3;<a4
AXISNAMES=: ;: 'Model Year Finance State Group'
AXISORDER=: 0;1 2;3 4;0 2
d=. 3 + ?. 17 $~ _1 0 0 0 _1 + # &> AXISLABELS
CELLDATA=: d,"1 0 +/"1 d=. d,"5 4 +/"5 d