Plot Area Clip

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Jens
Posts: 2
Joined: Wed Aug 24, 2016 8:04 am
antibot: No, of course not.

Plot Area Clip

Post by Jens » Wed Aug 24, 2016 8:11 am

Hi,

I know that the Plot clips the dataArea to ensure that the renderers stay within the bounds.
I want to display my item labels next to the bars of a bar chart, that is outside the bars.

How/Where can I specify the required insets such that the renderer draws the item labels within the required bounds, but outside the bars?

Thanks a lot!

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Plot Area Clip

Post by paradoxoff » Fri Aug 26, 2016 8:21 am

The position of the item labels can be defined by using a suitable instance of org.jfree.chart.labels.ItemLabelPosition. In order to allow a rendering of the item labels outside the data area, you will have to override the drawItemLabel-Method, which is defined in both AbstractXYItemRenderer and AbstractCategoryItemRenderer, and manipulate the Clip of the Graphics2D instance.

Jens
Posts: 2
Joined: Wed Aug 24, 2016 8:04 am
antibot: No, of course not.

Re: Plot Area Clip

Post by Jens » Wed Aug 31, 2016 9:35 pm

I feared as much. Many of the required attributes in the draw methods are private, which make a simple override to the clip a little bit more difficult.
Thanks for the reply, I'll try how I can override the method.

Locked