Jump to content
  • Advertisement
Sign in to follow this  
Wizumwalt

how to fit graph to window?

This topic is 4117 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

I'm trying to plot many points on my graph, and it's work, sort of. My screen size is 400x400. And the points that I have, do draw on the graph, but the size is out of proportion to the size of the graph. My max x coord is 100 and my max y is 80, so the graph is drawn really small in the lower left of the screen. How do I scale it to the proper size so that it fills up whatever size the window is?

Share this post


Link to post
Share on other sites
Advertisement
You can scale the graph to the window by dividing the resolution by the max value on each axis. So, you'd have 400/100 = 4 pixels per unit on the X-axis and 400/80 = 5 pixels per unit on the Y-axis. Or, if you don't want to skew the graph, use the smaller ratio for both axes, in this case, 4 pixels per unit on both axes.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!