(linear, exponent)
| 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); |
no test coverage detected