jfree / jfreechart

A 2D chart library for Java applications (JavaFX, Swing or server-side).
http://www.jfree.org/jfreechart/
GNU Lesser General Public License v2.1
1.22k stars 462 forks source link

Custom Drawing for Chart Customisation #361

Open S-Varunn opened 1 year ago

S-Varunn commented 1 year ago

I have a requirement where I need to give the bars in a Bar Chart rounded corners but only in the upper part of the bar.

I was able to achieve rounded corners but it gets applied to both sides (Top and Bottom). Was able to this by writing a custom renderer that uses RoundRectangle2D.

I have created the drawing logic for the case where Rounded corners are applied to the top part alone using Path2D. Could you provide support for this? Or provide a method signature that accepts custom classes in BarPainter and not just RectangularShape.

trashgod commented 1 year ago

To publish your work stemming from discussion #360, you can fork the project, modify a branch and submit a pull request. See Collaborating with pull requests for details. I'd hoped that the rendering could be confined to the existing RectangularShape; I'm unsure about altering the BarPainter interfcve. Also consider how you might handle alternate PlotOrientation.