I’m trying to basically reverse this algorithm so that I get the time for a given y-Axis.
+ (CGFloat)yAxisForTime:(CGFloat)time
{
CGFloat newTime = (float)(time * ((60 / [DataClass sharedInstance].timeInterval) / 2 ));
return kTopBuffer + (44.0f * newTime);
}
+ (CGFloat)timeForYAxis:(CGFloat)y
{
CGFloat newTime = (float)(y / ((60 * [DataClass sharedInstance].timeInterval) * 2 ));
return kTopBuffer + (44.0f / newTime);
}
I have a brain fart today and can’t seem to get it right. How would I get the time for yAxis? I have yAxisForTime working good, but now just need to get timeForYAxis.
If
Then
and therefore
So: