How to use the vega-lite/src/vega.schema.isDataRefDomain 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 / lyra / src / js / actions / bindChannel / parseScales.ts View on Github external
function createScale(dispatch: Dispatch, parsed: CompiledBinding, def: RangeScale): ActionType {
  const {domain, ...rest} = def,
    props = isDataRefDomain(domain)
      ? extend({}, rest, {_domain: [{data: parsed.map.data[domain.data], field: domain.field}]})
      : def;

  const action = addScale(Scale(props));
  return (dispatch(action), action);
}
github vega / lyra / src / js / actions / bindChannel / parseScales.ts View on Github external
function equals(state: State, def: RangeScale, scale: ScaleRecord, dsMap): boolean {
  if (scale.type !== def.type) {
    return false;
  }

  if (JSON.stringify(scale.range) !== JSON.stringify(def.range)) {
    return false;
  }

  if(isDataRefDomain(def.domain) && scale._domain) {
    const domain = scale._domain[0];
    if (domain.field !== def.domain.field) {
      return false;
    }

    const pipeline = getInVis(state, `datasets.${domain.data}._parent`);
    if (pipeline !== getInVis(state, `datasets.${dsMap[def.domain.data]}._parent`)) {
      return false;
    }
  }

  return true;
}