1

I have an XYLineChart and I want to customize the shape of nodes into rings.

Like this:

shape nodes

Here is the code how I try to done this:

Ellipse2D bigCircle = new Ellipse2D.Double(-4, -4, 8, 8);
Ellipse2D smallCircle = new Ellipse2D.Double(-2,-2,4,4);

Area ring = new Area(bigCircle);
ring.subtract(new Area(smallCircle));

Shape ringShape = (Shape)ring;

renderer.setSeriesShape(0, ringShape);

But the result is like in the left image. It is like this renderer.setSeriesShape(0, bigCircle);

What I am doing wrong?

or

Exist a factory with shapes which include my shape?

KunLun
  • 3,109
  • 3
  • 18
  • 65
  • 1
    It seems that your shape is fine, the green color is due to the line.Take a look on [J. Gatica answer](https://stackoverflow.com/questions/20084543/jfreechart-with-shadow-and-circle-nodes) if you don't mind the inner part of the ring is white instead of transparent – samabcde Oct 04 '18 at 14:32
  • 1
    @samabcde Yes, you are right. My code is fine, but the problem is with line. I changed into bigger ring and this is the real problem : https://i.imgur.com/JM4xG88.png. – KunLun Oct 04 '18 at 14:41

1 Answers1

1

My code is fine, but the problem is from line. How @samabcde said.

I made a bigger ring to see what exactly is.

https://i.imgur.com/JM4xG88.png

KunLun
  • 3,109
  • 3
  • 18
  • 65