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
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...%