@d3fc/d3fc-discontinuous-scale
Version:
A D3 scale that supports domains that are not continuous, allowing 'breaks' in the scale, for example skipping weekends for a date scale.
23 lines (15 loc) • 436 B
JavaScript
export default function() {
var identity = {};
identity.distance = function(start, end) {
return end - start;
};
identity.offset = function(start, offset) {
return (start instanceof Date)
? new Date(start.getTime() + offset)
: start + offset;
};
identity.clampUp = d => d;
identity.clampDown = d => d;
identity.copy = () => identity;
return identity;
}