Created
July 9, 2016 12:26
-
-
Save levvsha/ab00363e31a445d56e47590a4af6604a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data =[64, 62, 63, 59, 60, 57]; | |
var linear = d3.scale.linear() | |
.domain([50, 70]) | |
.range([1, 50]); | |
for(var i=0; i<data.length; i++) | |
console.log(linear(data[i])); //==> 35.3,30.4,32.85,23.05,25.5,18.15 | |
Dmin = 50; | |
Dmax = 70; | |
Rmin = 1; | |
Rmax = 50; | |
Ddiff = Dmax - Dmin = 20; | |
Rdiff = Rmax - Rmin = 49; | |
I = Rdiff / Ddiff = 49 / 20 = 2.45 | |
x = (V - Dmin) * I + Rmin; //(64 - 50) * 2.45 + 1 = 35.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment