Page 1 of 1

Legend width

Posted: Fri Jul 16, 2010 12:11 pm
by 10548077
The legend of my graph is too large.
How can I reduce it?
Is there any way to break the line?

Re: Legend width

Posted: Fri Jul 16, 2010 1:43 pm
by yeray
Hi Wheb,

You could change the series titles for something shorter:

Code: Select all

        for (int i=0; i<tChart1.getSeriesCount(); i++)
        {
            tChart1.getSeries(i).setTitle(tChart1.getSeries(i).getTitle().substring(0,10) + "...");
        }
You could also set the legend position manually:

Code: Select all

        tChart1.getLegend().setCustomPosition(true);
        tChart1.getLegend().setTop(100);
        tChart1.getLegend().setLeft(100);
Or you could try other automatic alignment:

Code: Select all

        tChart1.getLegend().setAlignment(LegendAlignment.BOTTOM);