Can any one help me to know how to draw a rotated ellipse using Ellipse.2D
shape annotation with a given angle in JFreeChart
?
Asked
Active
Viewed 472 times
1
-
Are you having trouble rotating or changing the shape? – Catalina Island Nov 30 '15 at 16:15
-
I have a problem drawing the ellipse over XY PLOT CHART – M.Kassim Nov 30 '15 at 16:26
1 Answers
1
Given an XYPlot
in jfreechart, you can
Add an
XYShapeAnnotation
to the plot, as shown here and here.Invoke
setBaseShape()
on the plot's renderer, as shown here, to change the shape for a whole series.Override
getItemShape()
in the plot's renderer, as shown here, to change an individual shape.
In any case, you can rotate the Shape
using the createTransformedShape()
method of AffineTransform
, as shown here.
-
Thank you for your cooperation My code is perfectly generating x,y parallel ellipse as follows: XYShapeAnnotation unitCircle1 = new XYShapeAnnotation( new Ellipse2D.Double((x,y,m.h), new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER,10.2f), Color.black); xyPlot.addAnnotation(unitCircle1); My problem is how to rotate this ellipse by an angle (tita)???? Thank you – M.Kassim Dec 01 '15 at 11:54
-
I'd use `createTransformedShape()`; because code in comments is hard to read, please edit your question to include a [mcve] that shows your current approach. – trashgod Dec 01 '15 at 12:15