How to use the vega-util.accessorName function in vega-util

To help you get started, we’ve selected a few vega-util 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 / vega / packages / vega-transforms / src / Impute.js View on Github external
prototype.transform = function(_, pulse) {
  var out = pulse.fork(pulse.ALL),
      impute = getValue(_),
      field = getField(_),
      fName = accessorName(_.field),
      kName = accessorName(_.key),
      gNames = (_.groupby || []).map(accessorName),
      groups = partition(pulse.source, _.groupby, _.key, _.keyvals),
      curr = [],
      prev = this.value,
      m = groups.domain.length,
      group, value, gVals, kVal, g, i, j, l, n, t;

  for (g=0, l=groups.length; g
github vega / vega-dataflow / src / transforms / Impute.js View on Github external
prototype.transform = function(_, pulse) {
  var out = pulse.fork(pulse.ALL),
      impute = getValue(_),
      field = getField(_),
      fName = accessorName(_.field),
      kName = accessorName(_.key),
      gNames = (_.groupby || []).map(accessorName),
      groups = partition(pulse.source, _.groupby, _.key, _.keyvals),
      curr = [],
      prev = this.value,
      m = groups.domain.length,
      group, value, gVals, kVal, g, i, j, l, n, t;

  for (g=0, l=groups.length; g
github vega / vega / packages / vega-transforms / src / util / WindowState.js View on Github external
ops.forEach(function(op, i) {
    let field = fields[i],
        mname = accessorName(field),
        name = measureName(op, mname, as[i]);

    visitInputs(field);
    outputs.push(name);

    // Window operation
    if (hasOwnProperty(WindowOps, op)) {
      windows.push(WindowOp(op, fields[i], params[i], name));
    }

    // Aggregate operation
    else {
      if (field == null && op !== 'count') {
        error('Null aggregate field specified.');
      }
      if (op === 'count') {
github vega / vega / packages / vega-transforms / src / Aggregate.js View on Github external
this._dnames = this._dims.map(function(d) {
    var dname = accessorName(d);
    inputVisit(d);
    outputs.push(dname);
    return dname;
  });
  this.cellkey = _.key ? _.key : groupkey(this._dims);
github vega / vega-dataflow / src / transforms / aggregate / Aggregate.js View on Github external
this._dnames = this._dims.map(function(d) {
    var dname = accessorName(d);
    inputVisit(d);
    outputs.push(dname);
    return dname;
  });
  this.cellkey = _.key ? _.key : groupkey(this._dims);
github vega / vega-dataflow / src / transforms / aggregate / Aggregate.js View on Github external
n = fields.length,
      map = {},
      field, op, m, mname, outname, i;

  if (n !== ops.length) {
    error('Unmatched number of fields and aggregate ops.');
  }

  for (i=0; i
github vega / vega / packages / vega-regression / src / Regression.js View on Github external
prototype.transform = function(_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);

  if (!this.value || pulse.changed() || _.modified()) {
    const source = pulse.materialize(pulse.SOURCE).source,
          groups = partition(source, _.groupby),
          names = (_.groupby || []).map(accessorName),
          method = _.method || 'linear',
          order = _.order || 3,
          dof = degreesOfFreedom(method, order),
          as = _.as || [accessorName(_.x), accessorName(_.y)],
          fit = Methods[method],
          values = [];

    let domain = _.extent;

    if (!hasOwnProperty(Methods, method)) {
      error('Invalid regression method: ' + method);
    }

    if (domain != null) {
      if (method === 'log' && domain[0] <= 0) {
        pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.');
        domain = null;
      }
    }
github vega / vega-dataflow / src / transforms / Bin.js View on Github external
if (v == null) {
      return null;
    } else {
      v = Math.max(start, Math.min(+v, stop - step));
      return start + step * Math.floor((v - start) / step);
    }
  };

  f.start = start;
  f.stop = stop;
  f.step = step;

  return this.value = accessor(
    f,
    accessorFields(field),
    _.name || 'bin_' + accessorName(field)
  );
};
github vega / vega / packages / vega-transforms / src / util / util.js View on Github external
return fields.map(function(f, i) {
    return as[i] || accessorName(f);
  });
}