MCPcopy Index your code
hub / github.com/microsoft/SandDance / build

Method build

packages/sanddance-specs/src/layouts/stack.ts:61–259  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 }
60
61 public build(): InnerScope {
62 const { names, props } = this;
63 const { globalScope, groupings, parentScope, sort } = props;
64 const { sizeSignals } = parentScope;
65
66 addTransforms(globalScope.data,
67 {
68 type: 'joinaggregate',
69 groupby: getGroupBy(groupings).map(safeFieldName),
70 ops: ['count'],
71 as: [names.count],
72 },
73 {
74 type: 'extent',
75 field: names.count,
76 signal: names.globalExtent,
77 },
78 {
79 type: 'stack',
80 groupby: getGroupBy(groupings).map(safeFieldName),
81 as: [names.stack0, names.stack1],
82 ...sort && {
83 sort: {
84 field: safeFieldName(sort.name),
85 order: 'ascending',
86 },
87 },
88 },
89 );
90
91 addData(globalScope.scope,
92 {
93 name: names.sequence,
94 transform: [
95 {
96 type: 'sequence',
97 start: 1,
98 stop: {
99 signal: `max(sqrt(${names.globalExtent}[1]),2)`,
100 },
101 },
102 {
103 type: 'formula',
104 expr: 'datum.data * datum.data',
105 as: 'squared',
106 },
107 {
108 type: 'formula',
109 expr: `ceil(${names.globalExtent}[1] / datum.squared)`,
110 as: 'maxlevels',
111 },
112 {
113 type: 'formula',
114 expr: `(${names.size} - (datum.data - 1) * datum.data) / datum.data`,
115 as: 'side',
116 },
117 {
118 type: 'formula',

Callers

nothing calls this directly

Calls 8

addTransformsFunction · 0.90
getGroupByFunction · 0.90
safeFieldNameFunction · 0.90
addDataFunction · 0.90
addSignalsFunction · 0.90
addOffsetsFunction · 0.90
addMarksFunction · 0.90
testForCollapseSelectionFunction · 0.90

Tested by

no test coverage detected