MCPcopy
hub / github.com/microsoft/SandDance / trellisLayout

Function trellisLayout

docs/tests/v2/es6/js/sanddance.js:104037–104096  ·  view source on GitHub ↗
(view, group, opt)

Source from the content-addressed store, hash-verified

104035}
104036
104037function trellisLayout(view, group, opt) {
104038 var views = gridLayoutGroups(group),
104039 groups = views.marks,
104040 bbox = opt.bounds === _constants.Flush ? boundFlush : boundFull,
104041 off = opt.offset,
104042 ncols = opt.columns || groups.length,
104043 nrows = ncols < 0 ? 1 : Math.ceil(groups.length / ncols),
104044 cells = nrows * ncols,
104045 x,
104046 y,
104047 x2,
104048 y2,
104049 anchor,
104050 band,
104051 offset; // -- initial grid layout
104052
104053 const bounds = gridLayout(view, groups, opt); // -- layout grid headers and footers --
104054 // perform row header layout
104055
104056 if (views.rowheaders) {
104057 band = get(opt.headerBand, _constants.Row, null);
104058 x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get(off, 'rowHeader'), min, 0, bbox, 'x1', 0, ncols, 1, band);
104059 } // perform column header layout
104060
104061
104062 if (views.colheaders) {
104063 band = get(opt.headerBand, _constants.Column, null);
104064 y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get(off, 'columnHeader'), min, 1, bbox, 'y1', 0, 1, ncols, band);
104065 } // perform row footer layout
104066
104067
104068 if (views.rowfooters) {
104069 band = get(opt.footerBand, _constants.Row, null);
104070 x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols - 1, ncols, 1, band);
104071 } // perform column footer layout
104072
104073
104074 if (views.colfooters) {
104075 band = get(opt.footerBand, _constants.Column, null);
104076 y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells - ncols, 1, ncols, band);
104077 } // perform row title layout
104078
104079
104080 if (views.rowtitle) {
104081 anchor = get(opt.titleAnchor, _constants.Row);
104082 offset = get(off, 'rowTitle');
104083 offset = anchor === _constants.End ? x2 + offset : x - offset;
104084 band = get(opt.titleBand, _constants.Row, 0.5);
104085 layoutTitle(view, views.rowtitle, offset, 0, bounds, band);
104086 } // perform column title layout
104087
104088
104089 if (views.coltitle) {
104090 anchor = get(opt.titleAnchor, _constants.Column);
104091 offset = get(off, 'columnTitle');
104092 offset = anchor === _constants.End ? y2 + offset : y - offset;
104093 band = get(opt.titleBand, _constants.Column, 0.5);
104094 layoutTitle(view, views.coltitle, offset, 1, bounds, band);

Callers

nothing calls this directly

Calls 5

gridLayoutGroupsFunction · 0.70
gridLayoutFunction · 0.70
getFunction · 0.70
layoutHeadersFunction · 0.70
layoutTitleFunction · 0.70

Tested by

no test coverage detected