I'm working over an interface in which the user enter coordinates and each point is linked two by two. The graoh is drawn in a JPanel by overriding the paint method and using drawLine to link one point and the next. However, the origin being at the top left corner of my JPanel, the resulting graph is a "mirror" of what is should be. Is there a way of inverting the axes so that I can draw the lines without manipulating the coordinates entered before drawing it ?
Asked
Active
Viewed 45 times
0
-
what do you mean by inverting axis? – Vighanesh Gursale Feb 10 '15 at 19:18
-
2You can apply transformation to the `Graphcs`. [Here](http://stackoverflow.com/a/9373195/1048330) is an example. – tenorsax Feb 10 '15 at 19:26
-
If you have so much points it'll be far faster to subtract every `y` from `height` instead of transformation. You don't have to store the new `y` value you can calculate it every repaint. – Dima Maligin Feb 10 '15 at 19:35