0
$\begingroup$

I have a graph where on my Y axis , I have price and on X axis I have period/time.

My range on Y axis is from 10 (lower limit) to 200 (upper limit), so to draw the point on graph I need the Y position of the value for example if my price is 100.50 then how should I calculate Y position of this price .

Thanks.

1 Answers 1

1

You have $200-10=190$ values on the Y-axis and you start at $10$. So value $y$ should be placed at $\frac{y-10}{190}$ of the way up the axis.

  • 1
    OP may want to worry about truncation details. There are 191 pixels along the y axis if 10 and 200 are both included (though the length is 190), and the result will have to be forced to an integer. The classic way is to round: use $\lfloor \frac {y-10}{190}+0.5\rfloor$, but the idea is the same.2012-07-25