A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
poppins
- Posts: 10
- Joined: Thu Sep 01, 2005 12:17 pm
- Location: India
Post
by poppins » Wed Oct 05, 2005 7:28 am
Q1] How to find (x,y) coordinate of the origin of a plot.
Code: Select all
|
|
|
|
|
|____________________
(x,y)
Q2] How to find the hieght/width of the plot ?
-
poppins
- Posts: 10
- Joined: Thu Sep 01, 2005 12:17 pm
- Location: India
Post
by poppins » Wed Oct 05, 2005 8:10 am
Ok, i found it. It goes as follows..
Code: Select all
//.... find origin
x = plot.getRangeAxisEdge().coordinate(dataArea, RectangleEdge.LEFT);
y = plot.getRangeAxisEdge().coordinate(dataArea, RectangleEdge.BOTTOM);
//..use origin
Or if someone has a better way to do it, plz post it here. Thanx.
-
dhchou
- Posts: 138
- Joined: Tue Jul 05, 2005 11:01 pm
Post
by dhchou » Wed Oct 05, 2005 2:17 pm
You may also want to consider these two methods in ChartPanel:
translateJava2DToScreen(java.awt.geom.Point2D java2DPoint)
translateScreenToJava2D(java.awt.Point screenPoint)
Daniel
-
poppins
- Posts: 10
- Joined: Thu Sep 01, 2005 12:17 pm
- Location: India
Post
by poppins » Thu Oct 06, 2005 5:38 am
Thanx Daniel, but use of these methods requires a 'Point2D' and 'Point' instance, which i don't know how to construct at that point of time. I have a Plot instance, a Rectangle2D instance and ValueAxis and DomainAxis instances.
regards,
nitin