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

Method build

docs/app/js/sanddance-app.js:4129–4206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4127 return this.bin.fields;
4128 }
4129 build() {
4130 const { bin , names , props } = this;
4131 const { globalScope , minBandWidth , orientation , parentScope , showAxes } = props;
4132 const binField = bin.fields[0];
4133 if (bin.native === false) {
4134 (0, _scope.addSignals)(globalScope.scope, ...bin.signals);
4135 (0, _scope.addTransforms)(globalScope.data, ...bin.transforms);
4136 (0, _scope.addData)(globalScope.scope, bin.dataSequence);
4137 }
4138 //TODO don't add this, use existing dataset
4139 (0, _scope.addData)(globalScope.scope, {
4140 name: names.accumulative,
4141 source: bin.fullScaleDataname,
4142 transform: [
4143 {
4144 type: "aggregate",
4145 groupby: this.getGrouping().map((0, _expr.safeFieldName)),
4146 ops: [
4147 "count"
4148 ]
4149 }
4150 ]
4151 });
4152 const horizontal = orientation === "horizontal";
4153 const minCellSignal = horizontal ? globalScope.signals.minCellHeight : globalScope.signals.minCellWidth;
4154 (0, _signals.modifySignal)(minCellSignal, "max", `length(data(${JSON.stringify(names.accumulative)})) * ${minBandWidth}`);
4155 (0, _scope.addSignals)(globalScope.scope, {
4156 name: names.bandWidth,
4157 update: `bandwidth(${JSON.stringify(horizontal ? names.yScale : names.xScale)})`
4158 });
4159 const scales = this.getScales(bin, horizontal);
4160 let encodingRuleMap;
4161 if (!props.excludeEncodingRuleMap) encodingRuleMap = horizontal ? {
4162 x: [
4163 {
4164 test: (0, _selection.testForCollapseSelection)(),
4165 signal: parentScope.offsets.x
4166 }
4167 ],
4168 width: [
4169 {
4170 test: (0, _selection.testForCollapseSelection)(),
4171 value: 0
4172 }
4173 ]
4174 } : {
4175 y: [
4176 {
4177 test: (0, _selection.testForCollapseSelection)(),
4178 signal: (0, _scope.addOffsets)(parentScope.offsets.y, parentScope.offsets.h)
4179 }
4180 ],
4181 height: [
4182 {
4183 test: (0, _selection.testForCollapseSelection)(),
4184 value: 0
4185 }
4186 ]

Callers 2

buildFunction · 0.45
iterateLayoutsMethod · 0.45

Calls 3

getGroupingMethod · 0.95
getScalesMethod · 0.95
getOffsetMethod · 0.95

Tested by

no test coverage detected