Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
outputs = (this._outputs = []),
inputMap = {};
function inputVisit(get) {
var fields = array(accessorFields(get)),
i = 0, n = fields.length, f;
for (; i
function add(fDef: TypedFieldDef | SecondaryFieldDef, channel: Channel) {
const mainChannel = getMainRangeChannel(channel);
const fieldDef: TypedFieldDef = isTypedFieldDef(fDef)
? fDef
: {
...fDef,
type: encoding[mainChannel].type // for secondary field def, copy type from main channel
};
const key = array(title(fieldDef, config, {allowDisabling: false})).join(', ');
let value = text(fieldDef, config, expr).signal;
if (channel === 'x' || channel === 'y') {
const channel2 = channel === 'x' ? 'x2' : 'y2';
const fieldDef2 = getFieldDef(encoding[channel2]);
if (isBinned(fieldDef.bin) && fieldDef2) {
const startField = vgField(fieldDef, {expr});
const endField = vgField(fieldDef2, {expr});
value = binFormatExpression(startField, endField, format(fieldDef), config);
toSkip[channel2] = true;
}
}
tooltipTuples.push({channel, key, value});
function wrapAllFieldsInvalid(model, channel, valueRef) {
const { config, mark } = model;
if (config.invalidValues === 'hide' && valueRef && !isPathMark(mark)) {
// For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains.
// For path marks, we will use "defined" property and skip these values instead.
const test = allFieldsInvalidPredicate(model, { invalid: true, channels: SCALE_CHANNELS });
if (test) {
return {
[channel]: [
// prepend the invalid case
// TODO: support custom value
{ test, value: null },
...array(valueRef)
]
};
}
}
return valueRef ? { [channel]: valueRef } : {};
}
function markDefProperties(mark, ignore) {
} else if (data.url) {
// load data from external source
if (hasSignal(data.url) || hasSignal(data.format)) {
// if either url or format has signal, use dynamic loader
output.push(load(scope, data));
output.push(source = collect());
} else {
// otherwise, request load upon dataflow init
output.push(source = collect({
$request: data.url,
$format: data.format
}));
}
} else if (data.source) {
// derives from one or more other data sets
source = upstream = array(data.source).map(function(d) {
return ref(scope.getData(d).output);
});
output.push(null); // populate later
}
// scan data transforms, add collectors as needed
for (i=0, n=ops.length; i
function setup(sim, _, init) {
var f = array(_.forces), i, n, p;
for (i=0, n=ForceParams.length; i
function addSignals(scope, signals, config) {
// signals defined in the spec take priority
array(signals).forEach(_ => {
if (!defined[_.name]) parseSignal(_, scope)
});
if (!config) return signals;
const out = array(signals).slice();
// add config signals if not already defined
array(config).forEach(_ => {
if (!scope.hasOwnSignal(_.name)) {
parseSignal(_, scope);
out.push(_);
}
});
return out;
}
function filter(opt) {
let p = null;
if (opt) {
const types = array(opt.marktype),
names = array(opt.markname);
p = _ => (!types.length || types.some(t => _.marktype === t))
&& (!names.length || names.some(s => _.name === s));
}
return p;
}
export default function WindowState(_) {
let self = this,
ops = array(_.ops),
fields = array(_.fields),
params = array(_.params),
as = array(_.as),
outputs = self.outputs = [],
windows = self.windows = [],
inputs = {},
map = {},
countOnly = true,
counts = [],
measures = [];
function visitInputs(f) {
array(accessorFields(f)).forEach(_ => inputs[_] = 1);
}
visitInputs(_.sort);