0

I'd like to calculate the position of a vertical axis (so a percentage of the axis), but the initial value of that axis isn't 0. Graph for explanation

For example here I have a graph with initial value of 500 and final value of 15000. I'd like to be able to place a vertical axis at the position (percentage of the width of graph) of a dedicated value between 500 and 15000.

I'd don't know how to "offset" the calculation to take in account that the graph starts at 500 and not 0.

Can someone drive me to an idea? Thanks in advance

Jikai
  • 1
  • Are you saying something like, you want to be able to work out what number is 30% of the way between 500 and 15000 (or any other desired percentage)? – Minus One-Twelfth Oct 29 '21 at 12:03
  • Looks like you're doing something like this: https://math.stackexchange.com/questions/3355027/a-function-or-a-factor-to-scale-a-list-of-real-numbers-from-one-range-to-another/3355071#3355071

    In your case, $a=0$ and $b= 100~%$; $min=500$ and $max=15000$.

    – Matti P. Oct 29 '21 at 12:04
  • @MattiP. exactly what I was looking for thx! – Jikai Oct 29 '21 at 14:02

1 Answers1

0

As @Matti P. said in the comment here is the answer: Assuming: a = 0% b = 100% min = 500 max = 15000 Here is the formula to find the percentage of the "in between" (valP), for example 10000:

valP = ((b*(val-min)) + (a*(max-val))) / (max-min);

-> 65.5172...%

Jikai
  • 1