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

Method build

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

Source from the content-addressed store, hash-verified

3846 }
3847 }
3848 build() {
3849 const { aggregation , names , props } = this;
3850 const { dock , globalScope , groupings , niceScale , parentScope , showAxes } = props;
3851 (0, _scope.addTransforms)(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, (0, _scope.getGroupBy)(groupings))), {
3852 as: [
3853 names.aggregateField
3854 ]
3855 }), {
3856 type: "extent",
3857 field: (0, _expr.safeFieldName)(names.aggregateField),
3858 signal: names.globalAggregateExtentSignal
3859 });
3860 (0, _scope.addSignals)(globalScope.scope, {
3861 name: props.globalAggregateMaxExtentSignal,
3862 update: `${names.globalAggregateExtentSignal}[1]`
3863 });
3864 const horizontal = dock === "left";
3865 const groupScaled = `scale(${JSON.stringify(names.scale)}, datum[${JSON.stringify(names.aggregateField)}])`;
3866 const offsets = {
3867 x: parentScope.offsets.x,
3868 y: (0, _scope.addOffsets)(parentScope.offsets.y, dock === "bottom" ? groupScaled : ""),
3869 h: horizontal ? parentScope.offsets.h : dock === "top" ? groupScaled : `${parentScope.offsets.h} - ${groupScaled}`,
3870 w: horizontal ? groupScaled : parentScope.offsets.w
3871 };
3872 const scale = {
3873 type: "linear",
3874 name: names.scale,
3875 domain: [
3876 0,
3877 {
3878 signal: props.globalAggregateMaxExtentSignal
3879 }
3880 ],
3881 range: horizontal ? [
3882 0,
3883 {
3884 signal: parentScope.sizeSignals.layoutWidth
3885 }
3886 ] : [
3887 {
3888 signal: parentScope.sizeSignals.layoutHeight
3889 },
3890 0
3891 ],
3892 nice: niceScale,
3893 zero: true,
3894 reverse: dock === "top"
3895 };
3896 const globalAggregateMaxExtentScaledValue = `scale(${JSON.stringify(names.scale)}, ${props.globalAggregateMaxExtentSignal})`;
3897 (0, _scope.addSignals)(globalScope.scope, {
3898 name: props.globalAggregateMaxExtentScaledSignal,
3899 update: dock === "bottom" ? `${parentScope.sizeSignals.layoutHeight} - ${globalAggregateMaxExtentScaledValue}` : globalAggregateMaxExtentScaledValue
3900 });
3901 return {
3902 offsets,
3903 sizeSignals: horizontal ? {
3904 layoutHeight: parentScope.sizeSignals.layoutHeight,
3905 layoutWidth: null

Callers

nothing calls this directly

Calls 1

getTransformsMethod · 0.95

Tested by

no test coverage detected