java - Scaling graph with swing -


I would like to know how to scale the graph properly I am using the axis right now, I have time for the x axis To represent who vary from 0 to 120. The width of my component is 400. I would like to know how to position the scale to give a position, and how to find out the situation from the vice pixel? Thanks for the help.

If I understand your question correctly, then you have the value of 0 to 120, And you want to represent it in 400 pixels.

Driving 400 to 120 gives you 3 and 1/3 pixels per value. To get the pixel value, you multiply the properties 3 and 1/3.

  • Therefore, the value of 30 will give a pixel value of 100.

  • The value of 60 will give a pixel value of 200.

  • The value of 15 will give a pixel value of 50. Similarly, there is a pixel value of 100, similarly, you will divide the pixel value by 3 and 1/3.

    • A pixel value of 200 will give value of 60.

    • A pixel value of 50 will be given 15 values.

Comments