|
Post by honkytonk on Mar 31, 2020 9:14:49 GMT
Hello everyone, I am looking for a generic method to adapt scales to sets of values; example: Display: 400 pixels A values: min = 2.4; max = 15.7 B values: min = 3100; max = 7200 Graduations accordingly ... Additional difficulty is to start the scale before 2.4 and finish after 15.7; before 3100 and after 7200 How to have an identical (same) method for all cases? Thank you for.
|
|
|
Post by Rod on Mar 31, 2020 11:16:28 GMT
Just one way.
'Display: 400 pixels 'A values: min = 2.4; max = 15.7 'B values: min = 3100; max = 7200
d=400
a=2.4 aa=15.7 b=3100 bb=7200
a=a-a/100*10 aa=aa+aa/100*10 range=aa-a print "Start ";a print "End ";aa print "Range ";range perPixelInc=range/d print "Per pixel increment "; perPixelInc for n=390 to 10 step -10 print "Scale "; n,n*perPixelInc+a next
b=b-b/100*10 bb=bb+bb/100*10 range=bb-b print "Start ";b print "End ";bb print "Range ";range perPixelInc=range/d print "Per pixel increment "; perPixelInc for n=390 to 10 step -10 print "Scale "; n,n*perPixelInc+b next
Actually I should have applied the 10% margin to the initial range not a and aa separately.
|
|
|
Post by Rod on Mar 31, 2020 11:19:56 GMT
|
|
|
Post by honkytonk on Mar 31, 2020 11:40:15 GMT
Thank you very much, I will implement this. VĂ©ry good links !!
|
|