How to use the vega-lite.enc function in vega-lite

To help you get started, we’ve selected a few vega-lite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vega / compass / src / gen / encs.js View on Github external
if (enc.row || enc.col) { //have facet(s)

      // don't use facets before filling up x,y
      if (!enc.x || !enc.y) return false;

      if (opt.omitNonTextAggrWithAllDimsOnFacets) {
        // remove all aggregated charts with all dims on facets (row, col)
        if (genEncs.isAggrWithAllDimOnFacets(enc)) return false;
      }
    }

    if (enc.x && enc.y) {
      var isDimX = !!isDimension(enc.x),
        isDimY = !!isDimension(enc.y);

      if (isDimX && isDimY && !vl.enc.isAggregate(enc)) {
        // FIXME actually check if there would be occlusion #90
        return false;
      }

      if (opt.omitTranpose) {
        if (isDimX ^ isDimY) { // dim x mea
          if (!dimMeaTransposeRule(enc)) return false;
        } else if (enc.y.type===T || enc.x.type === T) {
          if (enc.y.type===T && enc.x.type !== T) return false;
        } else { // show only one OxO, QxQ
          if (enc.x.name > enc.y.name) return false;
        }
      }
      return true;
    }
github vega / compass / test / gen / marktypes.spec.js View on Github external
it('should be generated', function () {
      var shorthand = 'row=1,O|text=avg_2,Q',
        enc = vl.enc.fromShorthand(shorthand),
        marktypes = getMarkTypes(enc, {}, opt);
      expect(marktypes.indexOf('text')).to.gt(-1);
    });
github vega / compass / test / gen / encs.spec.js View on Github external
beforeEach(function() {
      f = fixture['QxT'];
      encs = genEncs([], f.fields, f.stats, opt);
      encShorthands = encs.map(vl.enc.shorthand);
    });
    it('should show only vertical bar/plots', function() {
github vega / compass / test / gen / marktypes.spec.js View on Github external
it('should be generated', function () {
      var shorthand = 'row=1,O|text=mean_2,Q',
        encoding = vl.enc.fromShorthand(shorthand),
        marktypes = getMarkTypes(encoding, {}, opt);
      expect(marktypes.indexOf('text')).to.gt(-1);
    });
github vega / compass / test / gen / encodings.spec.js View on Github external
beforeEach(function() {
      f = fixture['#xB(Q)'];
      encodings = genEncodings([], f.fields, f.stats, opt);
      encShorthands = encodings.map(vl.enc.shorthand);
    });
github vega / compass / test / gen / encs.spec.js View on Github external
beforeEach(function() {
      f = fixture['#xB(Q)'];
      encs = genEncs([], f.fields, f.stats, opt);
      encShorthands = encs.map(vl.enc.shorthand);
    });
github vega / compass / test / gen / encodings.spec.js View on Github external
beforeEach(function() {
      f = fixture['#xT'];
      encodings = genEncodings([], f.fields, f.stats, opt);
      encShorthands = encodings.map(vl.enc.shorthand);
    });