Jump to content
  • Advertisement
Sign in to follow this  
CraZeE

Graph scale formula

This topic is 5460 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi ppl. This may seem trivial to some but bear with me. I need to come up with a formula that will generate the scale values for a graph. for example's sake, lets say i can have 5 number on the graph scale. Now at runtime, the actual graph may have a highest value of, say, 9900... so ideally my scale ranges from 0 to 10000, with a step of 2000. still with me? i currently use this formula (pseudocode): Round( Log( Abs(value) ) / LN10 ) Log being log10 and LN10 being the natural-log constant. Wat this returns me is the power of the (highest) value. However, this number is useful only if all the other data are relatively near to the highest. However that value on its own cannot be used universally as the data set has higher variance and the power difference between data start to generate scales which are too huge for me. is there a general formula that can work universally to limit the scale as near as possible to the highest value without sacrificing detail. also, how is it possible to round the scale of to the nearest multiple of a power-of-10? Not sure if i phrased this well, but here's to hoping :) thanx in advance.

Share this post


Link to post
Share on other sites
Advertisement
when imean nearest, i dun mean literally the nearest.. btu a sensible one. like if the highest is 9000, then the scale shud be in steps of 2000 reaching the highest of 10000.
but if the value is 10000, then the scale shud be 11000 or 12000. I think it makes more sense for it to be perfectly divisible by 4.

i'm limiting the scale to a minimum of 3 digits and up to 8 digits. just cant figure out a formula that works across this entire range.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!