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

Function scaleBinOrdinal

docs/app/js/sanddance-app.js:126819–126843  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126817}
126818const slice = Array.prototype.slice;
126819function scaleBinOrdinal() {
126820 let domain = [], range = [];
126821 function scale5(x) {
126822 return x == null || x !== x ? undefined : range[((0, _d3Array.bisect)(domain, x) - 1) % range.length];
126823 }
126824 scale5.domain = function(_) {
126825 if (arguments.length) {
126826 domain = numbers(_);
126827 return scale5;
126828 } else return domain.slice();
126829 };
126830 scale5.range = function(_) {
126831 if (arguments.length) {
126832 range = slice.call(_);
126833 return scale5;
126834 } else return range.slice();
126835 };
126836 scale5.tickFormat = function(count, specifier) {
126837 return (0, _d3Scale.tickFormat)(domain[0], (0, _vegaUtil.peek)(domain), count == null ? 10 : count, specifier);
126838 };
126839 scale5.copy = function() {
126840 return scaleBinOrdinal().domain(scale5.domain()).range(scale5.range());
126841 };
126842 return scale5;
126843}
126844const scales = {};
126845/**
126846 * Augment scales with their type and needed inverse methods.

Callers

nothing calls this directly

Calls 1

numbersFunction · 0.70

Tested by

no test coverage detected