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

Function aggregateParams

docs/tests/v2/es6/js/sanddance.js:91453–91476  ·  view source on GitHub ↗
(_, pulse)

Source from the content-addressed store, hash-verified

91451
91452
91453function aggregateParams(_, pulse) {
91454 var key = _.field,
91455 value = _.value,
91456 op = (_.op === 'count' ? '__count__' : _.op) || 'sum',
91457 fields = (0, _vegaUtil.accessorFields)(key).concat((0, _vegaUtil.accessorFields)(value)),
91458 keys = pivotKeys(key, _.limit || 0, pulse); // if data stream content changes, pivot fields may change
91459 // flag parameter modification to ensure re-initialization
91460
91461 if (pulse.changed()) _.set('__pivot__', null, null, true);
91462 return {
91463 key: _.key,
91464 groupby: _.groupby,
91465 ops: keys.map(function () {
91466 return op;
91467 }),
91468 fields: keys.map(function (k) {
91469 return get(k, key, value, fields);
91470 }),
91471 as: keys.map(function (k) {
91472 return k + '';
91473 }),
91474 modified: _.modified.bind(_)
91475 };
91476} // Generate aggregate field accessor.
91477// Output NaN for non-existent values; aggregator will ignore!
91478
91479

Callers 1

sanddance.jsFile · 0.70

Calls 3

pivotKeysFunction · 0.70
getFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected