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

Function configureRange

docs/tests/v2/es6/js/sanddance.js:111120–111155  ·  view source on GitHub ↗
(scale, _, count)

Source from the content-addressed store, hash-verified

111118}
111119
111120function configureRange(scale, _, count) {
111121 var type = scale.type,
111122 round = _.round || false,
111123 range = _.range; // if range step specified, calculate full range extent
111124
111125 if (_.rangeStep != null) {
111126 range = configureRangeStep(type, _, count);
111127 } // else if a range scheme is defined, use that
111128 else if (_.scheme) {
111129 range = configureScheme(type, _, count);
111130
111131 if ((0, _vegaUtil.isFunction)(range)) {
111132 if (scale.interpolator) {
111133 return scale.interpolator(range);
111134 } else {
111135 (0, _vegaUtil.error)(`Scale type ${type} does not support interpolating color schemes.`);
111136 }
111137 }
111138 } // given a range array for an interpolating scale, convert to interpolator
111139
111140
111141 if (range && (0, _vegaScale.isInterpolating)(type)) {
111142 return scale.interpolator((0, _vegaScale.interpolateColors)(flip(range, _.reverse), _.interpolate, _.interpolateGamma));
111143 } // configure rounding / interpolation
111144
111145
111146 if (range && _.interpolate && scale.interpolate) {
111147 scale.interpolate((0, _vegaScale.interpolate)(_.interpolate, _.interpolateGamma));
111148 } else if ((0, _vegaUtil.isFunction)(scale.round)) {
111149 scale.round(round);
111150 } else if ((0, _vegaUtil.isFunction)(scale.rangeRound)) {
111151 scale.interpolate(round ? _d3Interpolate.interpolateRound : _d3Interpolate.interpolate);
111152 }
111153
111154 if (range) scale.range(flip(range, _.reverse));
111155}
111156
111157function configureRangeStep(type, _, count) {
111158 if (type !== _vegaScale.Band && type !== _vegaScale.Point) {

Callers 1

sanddance.jsFile · 0.70

Calls 3

configureRangeStepFunction · 0.70
configureSchemeFunction · 0.70
flipFunction · 0.70

Tested by

no test coverage detected