1

Can any one help me to know how to draw a rotated ellipse using Ellipse.2D shape annotation with a given angle in JFreeChart?

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
M.Kassim
  • 33
  • 5

1 Answers1

1

Given an XYPlot in , 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.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • 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