How to use the vega-lite/src/type.Type.NOMINAL 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 / aggregates.ts View on Github external
}

    var f = fieldDefs[i];
    // Otherwise, assign i-th field
    switch (f.type) {
      // TODO: "D", "G"
      case Type.QUANTITATIVE:
        assignQ(i, hasAggr, autoMode);
        break;

      case Type.TEMPORAL:
        assignT(i, hasAggr, autoMode);
        break;
      case Type.ORDINAL:
        /* falls through */
      case Type.NOMINAL:
        /* falls through */
      default:
        tf[i] = f;
        assignField(i + 1, hasAggr, autoMode);
        break;
    }
  }
github vega / compass / src / rank / rankEncodings.ts View on Github external
export let dimensionScore:any = function(fieldDef, channel, mark, stats, opt){
  var cardinality = vlFieldDef.cardinality(fieldDef, stats);
  switch (channel) {
    case vlChannel.X:
      if (fieldDef.type === Type.NOMINAL || fieldDef.type === Type.ORDINAL)  {
        return D.pos - D.minor;
      }
      return D.pos;

    case vlChannel.Y:
      if (fieldDef.type === Type.NOMINAL || fieldDef.type === Type.ORDINAL) {
        return D.pos - D.minor; // prefer ordinal on y
      }
      if (fieldDef.type === Type.TEMPORAL) {
        return D.Y_T; // time should not be on Y
      }
      return D.pos - D.minor;

    case vlChannel.COLUMN:
      if (mark === 'text') return D.facet_text;
      // prefer column over row due to scrolling issues
      return cardinality <= opt.maxGoodCardinalityForFacets ? D.facet_good :
        cardinality <= opt.maxCardinalityForFacets ? D.facet_ok : D.facet_bad;

    case vlChannel.ROW:
      if (mark === 'text') return D.facet_text;
      return (cardinality <= opt.maxGoodCardinalityForFacets ? D.facet_good :