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

A hierarchical grid 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 subtotaled as needed for each group.



There are three ways to navigate a hierarchy:

1. a drop down selection box at top left selects the top level of the hierarchy

1. click on any higher-level column heading drills down into the hierarchy with values subset to that heading. The heading itself appears in a list of walk tiles at the top of the grid. Click any walk tile to return to that heading

1. up/down arrows at top right select the lowest level of the hierarchy that is displayed



Note: the sorting feature was added with scripts version 6.02.025.

If only one axis is in a hierarchy, that axis can be sorted by Ctrl-click on a label of the other axis. For example, Ctrl-click on a row label to sort the columns. Ctrl-click again to reverse the sort, and Ctrl-click in the top left corner to restore the original order.

Sorting respects groups - the top level is sorted first, then the next level, and so on. The following example is sorted in ascending order for Node 211. China values in total are less than Japan, so this is shown first. Within China, Shanghai values are less than Beijing, so this is shown first, etc.


New Options

A new option group LVL defines a multidimensional grid. LVLCOL names define the columns, and similarly for LVLROW names. The examples below are from the hierarchical grid demo:

LVLCOL column names
LVLCOLTOP topmost level shown
LVLCOLLEN initial last level shown
LVLCOLID hierarchy names
LVLCOLMASK grouping mask
LVLCOLSORTDIR sort direction

LVLCOL - A list of lists of column names, one for each level of the hierarchy. The last list must have length equal to the number of columns in the data. For example:


LVLCOLTOP - The index of the topmost level shown, default 0

LVLCOLLEN - Initial last level shown, default 0

LVLCOLID - A list of hierarchy names, for example:


LVLCOLMASK - A boolean matrix of shape (#hierarchy),#columns. Each row is a mask that partitions the columns into the groups at that level. The last row is identically 1. For example:

1 0 0 0 0 0 1 0 0 0 0 0
1 0 1 0 0 0 1 0 1 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1

LVLCOLSORTDIR - sort direction for columns +/- 1

LVLCOLSORTROW - sort row for columns (empty if none)

Other Options

CELLDATA should be a numeric array, with shape matching the last item of LVLROW and/or LVLCOL, equally the number of columns in LVLROWMASK and/or LVLCOLMASK.

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