## How can i get a perfect circle with Ellipse2D?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
sirius
Posts: 1
Joined: Wed Aug 07, 2019 12:55 pm
antibot: No, of course not.

### How can i get a perfect circle with Ellipse2D?

Hello folks,

1) I want to make a perfect circle.
Width == Height but it still draws an ellipse:

If you try to rotate this image you'll see what i mean:

How can i get a perfect circle?

2) Image size: 300x300 px. Distances between edges of image and circle are different:

Top: 9 px.
Bottom: 8 px.
Left: 11 px.
Right: 12 px.

I want to get same distances betwen every edge and circle for example:
Top == Bottom == Left == Right == 10 px.

How can i do this?

Here is my code:

public Circle(String title)
{
chart = ChartFactory.createScatterPlot(""/*title*/, "", "", new XYSeriesCollection());

chart.setBorderVisible(false);
chart.removeLegend();

XYPlot plot = ((XYPlot)chart.getPlot());

plot.setBackgroundPaint(Color.WHITE);
plot.setOutlineVisible(false);

double range = 1.45f;

plot.getRangeAxis().setRange(-range, range);
plot.getRangeAxis().setTickLabelsVisible(false);
plot.getRangeAxis().setTickMarksVisible(false);
plot.getRangeAxis().setAxisLineVisible(false);
plot.getRangeAxis().setLowerMargin(0.0f);
plot.getRangeAxis().setUpperMargin(0.0f);

plot.getDomainAxis().setRange(-range, range);
plot.getDomainAxis().setTickLabelsVisible(false);
plot.getDomainAxis().setTickMarksVisible(false);
plot.getDomainAxis().setAxisLineVisible(false);
plot.getDomainAxis().setLowerMargin(0.0f);
plot.getDomainAxis().setUpperMargin(0.0f);

double outRad = range - 0.01f;