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

Method build

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

Source from the content-addressed store, hash-verified

4029 };
4030 }
4031 build() {
4032 const { names , props } = this;
4033 const { aggregation , globalScope , groupings , onBuild , parentScope } = props;
4034 const { sizeSignals } = parentScope;
4035 (0, _scope.addTransforms)(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, (0, _scope.getGroupBy)(groupings))), {
4036 as: [
4037 names.aggregateField
4038 ]
4039 }), {
4040 type: "extent",
4041 field: (0, _expr.safeFieldName)(names.aggregateField),
4042 signal: names.globalAggregateExtentSignal
4043 });
4044 const localAggregateMaxExtent = `datum[${JSON.stringify(names.aggregateField)}]`;
4045 const squareMaxSide = `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`;
4046 const squareMaxArea = `(${[
4047 squareMaxSide,
4048 squareMaxSide
4049 ].join(" * ")})`;
4050 const shrinkRatio = `((${localAggregateMaxExtent}) / (${names.globalAggregateExtentSignal}[1]))`;
4051 const squareArea = `(${[
4052 squareMaxArea,
4053 shrinkRatio
4054 ].join(" * ")})`;
4055 const squareSide = `sqrt(${squareArea})`;
4056 const localAggregateMaxExtentScaled = squareSide;
4057 onBuild && onBuild(localAggregateMaxExtent, localAggregateMaxExtentScaled);
4058 const offsets = {
4059 x: (0, _scope.addOffsets)(parentScope.offsets.x, `(${parentScope.offsets.w} - ${squareSide}) / 2`),
4060 y: (0, _scope.addOffsets)(parentScope.offsets.y, `(${parentScope.offsets.h} - ${squareSide}) / 2`),
4061 h: squareSide,
4062 w: squareSide
4063 };
4064 return {
4065 offsets,
4066 sizeSignals: {
4067 layoutHeight: null,
4068 layoutWidth: null
4069 },
4070 encodingRuleMap: {
4071 y: [
4072 {
4073 test: (0, _selection.testForCollapseSelection)(),
4074 signal: offsets.y
4075 }
4076 ],
4077 height: [
4078 {
4079 test: (0, _selection.testForCollapseSelection)(),
4080 value: 0
4081 }
4082 ]
4083 }
4084 };
4085 }
4086 getTransforms(aggregation, groupby) {
4087 const trans = {
4088 type: "joinaggregate",

Callers

nothing calls this directly

Calls 1

getTransformsMethod · 0.95

Tested by

no test coverage detected