Transforming data to screen coordinates
问题 I would like to transform data to screen coordinates in javascript using a function. The function has to look like this: function createTransform(domain, range){ // domain is a two-element array of the domain’s bounds // range is a two-element array of the range’s bounds // implement the actual calculation here var alpha = ...; var beta = ...; return function(x){ return alpha * x + beta; }; } // to use this for instance: var tranform = createTransform([10, 20], [10, 20]); console.log