MCPcopy
hub / github.com/microsoft/SandDance / parseMark

Function parseMark

docs/app/js/sanddance-app.js:148352–148444  ·  view source on GitHub ↗
(spec, scope)

Source from the content-addressed store, hash-verified

148350 op.params = expr5.$params;
148351}
148352function parseMark(spec, scope) {
148353 const role = getRole(spec), group = spec.type === GroupMark, facet = spec.from && spec.from.facet, overlap = spec.overlap;
148354 let layout = spec.layout || role === ScopeRole || role === FrameRole, ops, op, store, enc, name, layoutRef, boundRef;
148355 const nested = role === MarkRole || layout || facet; // resolve input data
148356 const input = parseData$1(spec.from, group, scope); // data join to map tuples to visual items
148357 op = scope.add(DataJoin({
148358 key: input.key || (spec.key ? fieldRef$1(spec.key) : undefined),
148359 pulse: input.pulse,
148360 clean: !group
148361 }));
148362 const joinRef = ref(op); // collect visual items
148363 op = store = scope.add(Collect({
148364 pulse: joinRef
148365 })); // connect visual items to scenegraph
148366 op = scope.add(Mark({
148367 markdef: definition(spec),
148368 interactive: interactive(spec.interactive, scope),
148369 clip: clip(spec.clip, scope),
148370 context: {
148371 $context: true
148372 },
148373 groups: scope.lookup(),
148374 parent: scope.signals.parent ? scope.signalRef("parent") : null,
148375 index: scope.markpath(),
148376 pulse: ref(op)
148377 }));
148378 const markRef = ref(op); // add visual encoders
148379 op = enc = scope.add(Encode(parseEncode(spec.encode, spec.type, role, spec.style, scope, {
148380 mod: false,
148381 pulse: markRef
148382 }))); // monitor parent marks to propagate changes
148383 op.params.parent = scope.encode(); // add post-encoding transforms, if defined
148384 if (spec.transform) spec.transform.forEach((_)=>{
148385 const tx = parseTransform(_, scope), md = tx.metadata;
148386 if (md.generates || md.changes) (0, _vegaUtil.error)("Mark transforms should not generate new data.");
148387 if (!md.nomod) enc.params.mod = true; // update encode mod handling
148388 tx.params.pulse = ref(op);
148389 scope.add(op = tx);
148390 });
148391 // if item sort specified, perform post-encoding
148392 if (spec.sort) op = scope.add(SortItems({
148393 sort: scope.compareRef(spec.sort),
148394 pulse: ref(op)
148395 }));
148396 const encodeRef = ref(op); // add view layout operator if needed
148397 if (facet || layout) {
148398 layout = scope.add(ViewLayout({
148399 layout: scope.objectProperty(spec.layout),
148400 legends: scope.legends,
148401 mark: markRef,
148402 pulse: encodeRef
148403 }));
148404 layoutRef = ref(layout);
148405 } // compute bounding boxes
148406 const bound = scope.add(Bound({
148407 mark: markRef,
148408 pulse: layoutRef || encodeRef
148409 }));

Callers 4

parseLegendFunction · 0.70
parseTitleFunction · 0.70
parseAxisFunction · 0.70
parseScopeFunction · 0.70

Calls 15

getRoleFunction · 0.70
parseData$1Function · 0.70
DataJoinFunction · 0.70
fieldRef$1Function · 0.70
refFunction · 0.70
CollectFunction · 0.70
MarkFunction · 0.70
definitionFunction · 0.70
interactiveFunction · 0.70
clipFunction · 0.70
EncodeFunction · 0.70
parseEncodeFunction · 0.70

Tested by

no test coverage detected