I remember using an equation to do this at some point – how do you do this in Javascript?
Plugin two number ranges:
rangeX = 1 (through) 10;
rangeY = 300.77 (through) 559.22;
Input a value in the rangeY scale:
inputY = 328.17;
Convert to proportional value in rangeX scale:
outputX = 1.43;
I turned @Foggzie's answer into a TypeScript function and ES2016 function.
TypeScript:
ES2016:
Use percentages:
Swift 3 With Bool for extended range or not
No guarantees on the math, but I think something like this: