source: Dev/trunk/d3/src/scale/polylinear.js @ 76

Last change on this file since 76 was 76, checked in by fpvanagthoven, 14 years ago

d3

File size: 384 bytes
Line 
1function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
2  var u = [],
3      i = [],
4      j = 0,
5      n = domain.length;
6
7  while (++j < n) {
8    u.push(uninterpolate(domain[j - 1], domain[j]));
9    i.push(interpolate(range[j - 1], range[j]));
10  }
11
12  return function(x) {
13    var j = d3.bisect(domain, x, 1, domain.length - 1) - 1;
14    return i[j](u[j](x));
15  };
16}
Note: See TracBrowser for help on using the repository browser.