A
A
Andrew2019-03-24 17:06:11
JavaScript
Andrew, 2019-03-24 17:06:11

How to find the position of a point on a graph?

There is such a problem.
A segment 300 pixels high, pixels are counted from top to bottom.
How to find the coordinates of a point, say 75, if the minimum value is 50 and the maximum is 150?
The whole brain is broken. In the variant without a minimum value, everything was simpler. There I found the coefficient by dividing the maximum point by the number of pixels, then subtracting the required value from the height of the segment, multiplied by the coefficient. Now I have no idea what to do.
5c978de3be5c7670192062.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timokins, 2019-03-24
@AndrewRusinas

everything is the same, just subtract the minimum value,
0px = 150
300px = 50
segment in 1px = x = 300px/(150-50)
dot 75 is:
300px - ((75 - 50) * x) = 225px
dot 50 is:
300px - ((50 - 50) * x) = 300px
point 150 is:
300px - ((150 - 50) * x) = 0px

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question