MCPcopy Create free account
hub / github.com/microsoft/SandDance / configureScheme

Function configureScheme

docs/app/js/sanddance-app.js:130097–130107  ·  view source on GitHub ↗
(type, _, count)

Source from the content-addressed store, hash-verified

130095 ];
130096}
130097function configureScheme(type, _, count) {
130098 var extent = _.schemeExtent, name, scheme$1;
130099 if ((0, _vegaUtil.isArray)(_.scheme)) scheme$1 = (0, _vegaScale.interpolateColors)(_.scheme, _.interpolate, _.interpolateGamma);
130100 else {
130101 name = _.scheme.toLowerCase();
130102 scheme$1 = (0, _vegaScale.scheme)(name);
130103 if (!scheme$1) (0, _vegaUtil.error)("Unrecognized scheme name: ".concat(_.scheme));
130104 } // determine size for potential discrete range
130105 count = type === (0, _vegaScale.Threshold) ? count + 1 : type === (0, _vegaScale.BinOrdinal) ? count - 1 : type === (0, _vegaScale.Quantile) || type === (0, _vegaScale.Quantize) ? +_.schemeCount || DEFAULT_COUNT : count; // adjust and/or quantize scheme as appropriate
130106 return (0, _vegaScale.isInterpolating)(type) ? adjustScheme(scheme$1, extent, _.reverse) : (0, _vegaUtil.isFunction)(scheme$1) ? (0, _vegaScale.quantizeInterpolator)(adjustScheme(scheme$1, extent), count) : type === (0, _vegaScale.Ordinal) ? scheme$1 : scheme$1.slice(0, count);
130107}
130108function adjustScheme(scheme, extent, reverse) {
130109 return (0, _vegaUtil.isFunction)(scheme) && (extent || reverse) ? (0, _vegaScale.interpolateRange)(scheme, flip(extent || [
130110 0,

Callers 1

configureRangeFunction · 0.70

Calls 1

adjustSchemeFunction · 0.70

Tested by

no test coverage detected