MCPcopy Create free account
hub / github.com/microsoft/SandDance / legendEntryLayout

Function legendEntryLayout

docs/app/js/sanddance-app.js:120763–120773  ·  view source on GitHub ↗
(entries)

Source from the content-addressed store, hash-verified

120761 view.dirty(item);
120762}
120763function legendEntryLayout(entries) {
120764 // get max widths for each column
120765 const widths = entries.reduce((w, g)=>{
120766 w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0);
120767 return w;
120768 }, {}); // set dimensions of legend entry groups
120769 entries.forEach((g)=>{
120770 g.width = widths[g.column];
120771 g.height = g.bounds.y2 - g.y;
120772 });
120773}
120774function titleLayout(view, mark, width, height, viewBounds) {
120775 var group = mark.items[0], frame = group.frame, orient = group.orient, anchor = group.anchor, offset = group.offset, padding = group.padding, title = group.items[0].items[0], subtitle = group.items[1] && group.items[1].items[0], end = orient === Left || orient === Right ? height : width, start = 0, x = 0, y = 0, sx = 0, sy = 0, pos;
120776 if (frame !== Group) orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2);

Callers 1

legendLayoutFunction · 0.70

Calls 2

maxMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected