CSPL.js is a library for interpolating between discrete values using Cubic Splines.
The same method is used in Adobe Photoshop and Gimp for Curves tool to interpolate between points.
Read more about algorithm at http://blog.ivank.net/interpolation-with-cubic-splines.html .