php - How to find the % of a value on a Y axis of a LOG graph? -
wow, 1 though!
i'm trying find in php % of value relative y axis. if refer graph : http://en.wikipedia.org/wiki/semi-log_graph (2009 outbreak of influenza a), let's want find % value "256" on chart.
visually, it's easy : it's bit more 1/3 or 33%. if @ 1024 value, it's around 50% of height of y axis. 131072 100%.
so how calculate php?
let's take graph , take x = day 0 , y = 256. 256 % of y ?
thanks lot can compute baby :)
percent = 100 * ( log(y) - log(y1) ) / ( log(y2) - log(y1) )
where
y = value y1 = smallest value in y-axis y2 = largest value in y-axis.
when y1 = 1.0
can simplify other answers given here (since log(1)=0 definition)
percent = 100 * log(y)/log(y2)
note not log charts have 1.0 lowest value.
Comments
Post a Comment