math - exponential gauge calculation in JavaScript -
i have little javascript ajax script gets speed on progress in kbps or whatever - let's mb/s. , want add gauge shows speed graphically. i have image containing gauge design , pointer. pointer default points @ top - lowest value -120deg , highest 120deg. wouldn't nice if has 1mb connection, need add exponential calculation. here values... 0-1mb: -120deg -> -90deg 1-5mb: -90deg -> -60deg 5-10mb: -60deg -> -30deg 10-20mb: -30deg -> 0deg 20-30mb: 0deg -> 30deg 30-50mb: 30deg -> 60deg 50-75mb: 60deg -> 90deg 75-100mb: 90deg -> 120deg i totally don't know how start calculation. the animation done css -webkit-transform:rotate(xdeg) and update on xhr.onprogress the calculation speed is: kb/s=((e.loaded/((new date()-start)/1000))/1024).tofixed(2), mb/s=(d/1024*8).tofixed(2) when have mb/s want set gauge deg. how can achieve these values? here not-completely-working variant. wrote while think it's not proper way. &