MCPcopy Create free account
hub / github.com/idank/explainshell / d3_scale_pow

Function d3_scale_pow

explainshell/web/static/js/d3.v3.js:6570–6603  ·  view source on GitHub ↗
(linear, exponent)

Source from the content-addressed store, hash-verified

6568 return d3_scale_pow(d3.scale.linear(), 1);
6569 };
6570 function d3_scale_pow(linear, exponent) {
6571 var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
6572 function scale(x) {
6573 return linear(powp(x));
6574 }
6575 scale.invert = function(x) {
6576 return powb(linear.invert(x));
6577 };
6578 scale.domain = function(x) {
6579 if (!arguments.length) return linear.domain().map(powb);
6580 linear.domain(x.map(powp));
6581 return scale;
6582 };
6583 scale.ticks = function(m) {
6584 return d3_scale_linearTicks(scale.domain(), m);
6585 };
6586 scale.tickFormat = function(m, format) {
6587 return d3_scale_linearTickFormat(scale.domain(), m, format);
6588 };
6589 scale.nice = function() {
6590 return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
6591 };
6592 scale.exponent = function(x) {
6593 if (!arguments.length) return exponent;
6594 var domain = scale.domain();
6595 powp = d3_scale_powPow(exponent = x);
6596 powb = d3_scale_powPow(1 / exponent);
6597 return scale.domain(domain);
6598 };
6599 scale.copy = function() {
6600 return d3_scale_pow(linear.copy(), exponent);
6601 };
6602 return d3_scale_linearRebind(scale, linear);
6603 }
6604 function d3_scale_powPow(e) {
6605 return function(x) {
6606 return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);

Callers 1

d3.v3.jsFile · 0.85

Calls 5

d3_scale_powPowFunction · 0.85
d3_scale_linearTicksFunction · 0.85
d3_scale_niceFunction · 0.85
d3_scale_linearRebindFunction · 0.85

Tested by

no test coverage detected