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

Function ordinalMultipleDomain

docs/app/js/sanddance-app.js:147369–147404  ·  view source on GitHub ↗
(domain, scope, fields)

Source from the content-addressed store, hash-verified

147367 };
147368}
147369function ordinalMultipleDomain(domain, scope, fields) {
147370 const sort = parseSort(domain.sort, true);
147371 let a, v; // get value counts for each domain field
147372 const counts = fields.map((f)=>{
147373 const data = scope.getData(f.data);
147374 if (!data) dataLookupError(f.data);
147375 return data.countsRef(scope, f.field, sort);
147376 }); // aggregate the results from each domain field
147377 const p = {
147378 groupby: keyFieldRef,
147379 pulse: counts
147380 };
147381 if (sort) {
147382 a = sort.op || "count";
147383 v = sort.field ? aggrField(a, sort.field) : "count";
147384 p.ops = [
147385 MULTIDOMAIN_SORT_OPS[a]
147386 ];
147387 p.fields = [
147388 scope.fieldRef(v)
147389 ];
147390 p.as = [
147391 v
147392 ];
147393 }
147394 a = scope.add(Aggregate(p)); // collect aggregate output
147395 const c = scope.add(Collect({
147396 pulse: ref(a)
147397 })); // extract values for combined domain
147398 v = scope.add(Values({
147399 field: keyFieldRef,
147400 sort: scope.sortRef(sort),
147401 pulse: ref(c)
147402 }));
147403 return ref(v);
147404}
147405function parseSort(sort, multidomain) {
147406 if (sort) {
147407 if (!sort.field && !sort.op) {

Callers

nothing calls this directly

Calls 8

parseSortFunction · 0.70
dataLookupErrorFunction · 0.70
aggrFieldFunction · 0.70
AggregateFunction · 0.70
CollectFunction · 0.70
refFunction · 0.70
ValuesFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected