Code coverage report for src/compiler/subfacet.js

Statements: 100% (12 / 12)      Branches: 100% (6 / 6)      Functions: 100% (1 / 1)      Lines: 100% (12 / 12)      Ignored: none     

All files » src/compiler/ » subfacet.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35    1   1   1 4 4                         4 4     4 4     4 4 1      
'use strict';
 
require('../globals');
 
module.exports = subfaceting;
 
function subfaceting(group, mdef, details, encoding) {
  var m = group.marks;
  var g = {
    name: 'subfacet',
    type: 'group',
    from: mdef.from,
    properties: {
      enter: {
        width: {field: {group: 'width'}},
        height: {field: {group: 'height'}}
      }
    },
    marks: m
  };
 
  group.marks = [g];
  delete mdef.from; // (move to the new g)
 
  //TODO test LOD -- we should support stack / line without color (LOD) field
  var trans = (g.from.transform || (g.from.transform = []));
  trans.push({type: 'facet', groupby: details});
 
  // TODO: understand why we need this sort transform and write comment
  var stack = encoding.stack();
  if (stack && encoding.has(COLOR)) {
    trans.unshift({type: 'sort', by: encoding.fieldRef(COLOR)});
  }
}