Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
// given a range array for an interpolating scale, convert to interpolator
if (range && isInterpolating(type)) {
return scale.interpolator(
interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma)
);
}
// configure rounding / interpolation
if (range && _.interpolate && scale.interpolate) {
scale.interpolate(getInterpolate(_.interpolate, _.interpolateGamma));
} else if (isFunction(scale.round)) {
scale.round(round);
} else if (isFunction(scale.rangeRound)) {
scale.interpolate(round ? interpolateRound : interpolate);
}
if (range) scale.range(flip(range, _.reverse));
}
return fieldRef(channelDef, scaleName, {binSuffix: 'range'}, {offset});
}
}
return fieldRef(channelDef, scaleName, {}, {offset}); // no need for bin suffix
} else if (isValueDef(channelDef)) {
const value = channelDef.value;
const offsetMixins = offset ? {offset} : {};
return {...vgValueRef(channel, value), ...offsetMixins};
}
// If channelDef is neither field def or value def, it's a condition-only def.
// In such case, we will use default ref.
}
const ref = isFunction(defaultRef) ? {...defaultRef(), ...(offset ? {offset} : {})} : defaultRef;
if (ref) {
// for non-position, ref could be undefined.
return {
...ref,
// only include offset when it is non-zero (zero = no offset)
...(offset ? {offset} : {})
};
}
return ref;
}
function setForceParam(f, v, _) {
f(isFunction(v) ? function(d) { return v(d, _); } : v);
}
function adjustScheme(scheme, extent, reverse) {
return (isFunction(scheme) && (extent || reverse))
? interpolateRange(scheme, flip(extent || [0, 1], reverse))
: scheme;
}
export function getScale(name, ctx) {
let s;
return isFunction(name) ? name
: isString(name) ? (s = ctx.scales[name]) && s.value
: undefined;
}
remove: function(t) {
var a = isFunction(t) ? remp : rem,
d = array(t), i = 0, n = d.length;
for (; i
function onStream(df, stream, target, update, params, options) {
var opt = extend({}, options, SKIP), func, op;
if (!isFunction(target)) target = constant(target);
if (update === undefined) {
func = function(e) {
df.touch(target(e));
};
} else if (isFunction(update)) {
op = new Operator(null, update, params, false);
func = function(e) {
var v, t = target(e);
op.evaluate(e);
isChangeSet(v = op.value) ? df.pulse(t, v, options) : df.update(t, v, opt);
};
} else {
func = function(e) {
df.update(target(e), update, opt);
};
}
stream.apply(func);
}
function dependency(f) {
if (!isFunction(f)) return false;
const set = toSet(accessorFields(f));
return set.$x || set.$y || set.$value || set.$max;
}