How to use the vega-util.field 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-geo / src / GeoShape.js View on Github external
prototype.transform = function(_, pulse) {
  var out = pulse.fork(pulse.ALL),
      shape = this.value,
      as = _.as || 'shape',
      flag = out.ADD;

  if (!shape || _.modified()) {
    // parameters updated, reset and reflow
    this.value = shape = shapeGenerator(
      getProjectionPath(_.projection),
      _.field || field('datum'),
      _.pointRadius
    );
    out.materialize().reflow();
    flag = out.SOURCE;
  }

  out.visit(flag, function(t) { t[as] = shape; });

  return out.modifies(as);
};
github microsoft / chart-parts / packages / util / transform / src / facade / density / kdeDistributionBuilder.ts View on Github external
public build(ds: DatasetManager) {
		// TODO: wire in source
		if (!this.fromValue) {
			throw new Error('kde distribution must define a source table')
		}
		if (!this.fieldValue) {
			throw new Error('kde distribution must define a field value')
		}
		return {
			function: 'kde',
			from: ds.getTable(this.fromValue),
			field: vegaField(this.fieldValue),
			bandwidth: this.bandwidthValue,
		}
	}
}
github vega / dataflow-api / src / parameters.js View on Github external
function toField(value) {
  if (value && isFunction(value.toObject)) {
    value = value.toObject();
  }
  return isString(value) ? field(value)
    : isObject(value) && !isFunction(value)
    ? isFunction(value.accessor)
      ? accessor(value.accessor, value.fields, value.as)
      : field(value.field, value.as)
    : null;
}
github vega / vega / packages / vega-runtime / src / parameters.js View on Github external
function getField(_, ctx) {
  if (!_.$field) return null;
  var k = 'f:' + _.$field + '_' + _.$name;
  return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name));
}
github vega / dataflow-api / src / parameters.js View on Github external
function toField(value) {
  if (value && isFunction(value.toObject)) {
    value = value.toObject();
  }
  return isString(value) ? field(value)
    : isObject(value) && !isFunction(value)
    ? isFunction(value.accessor)
      ? accessor(value.accessor, value.fields, value.as)
      : field(value.field, value.as)
    : null;
}
github vega / vega-dataflow / src / transforms / aggregate / TupleStore.js View on Github external
export default function TupleStore(key) {
  this._key = key ? field(key) : tupleid;
  this.reset();
}
github vega / vega / packages / vega-loader / src / formats / json.js View on Github external
export default function json(data, format) {
  const prop = (format && format.property) ? field(format.property) : identity;
  return isObject(data) && !isBuffer(data)
    ? parseJSON(prop(data))
    : prop(JSON.parse(data));
}
github microsoft / chart-parts / packages / util / transform / src / facade / aggregate.ts View on Github external
			groupby: this.groupByFields.map(c => vegaField(c)),
			fields: this.computeFields.map(c =>