how to increase the width of the legend section ONLY

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
roland
Posts: 5
Joined: Wed Jan 06, 2016 10:09 pm
antibot: No, of course not.

how to increase the width of the legend section ONLY

Post by roland » Mon Apr 25, 2016 10:22 pm

My generated chart is as follows:

Image

To make the legend texts appear in one single line,
I am considering to increase the width of the legend section while keeping the width of the pie chart section the SAME. Do we have an approach to accomplish this?

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: how to increase the width of the legend section ONLY

Post by John Matthews » Tue Apr 26, 2016 4:27 am

Your could iterate though the pie plot's LegendItemCollection and put the item's label in a nearby JLabel, which allows HTML, or JTextField, which can scroll.

roland
Posts: 5
Joined: Wed Jan 06, 2016 10:09 pm
antibot: No, of course not.

Re: how to increase the width of the legend section ONLY

Post by roland » Tue Apr 26, 2016 2:53 pm

John Matthews wrote:Your could iterate though the pie plot's LegendItemCollection and put the item's label in a nearby JLabel, which allows HTML, or JTextField, which can scroll.
Thank you. But do we have a property that controls the widths of the legend section? Or it is hard coded?

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

Re: how to increase the width of the legend section ONLY

Post by paradoxoff » Tue Apr 26, 2016 3:51 pm

I am surprised to see tat you hava managed to get a roughly 50:50 split of the available space between the plot and the legend. What I would have expected to see is that the long text in the legend title is covering the entiren width of the chart area and squeezes the plot area to zero.
Can you show the code that is producing your output?

Locked