Legend width

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Wheb
Newbie
Newbie
Posts: 8
Joined: Fri Jan 25, 2008 12:00 am
Location: Brazil

Legend width

Post by Wheb » Fri Jul 16, 2010 12:11 pm

The legend of my graph is too large.
How can I reduce it?
Is there any way to break the line?
Attachments
Chart.JPG
Chart.JPG (49.21 KiB) Viewed 5634 times

Yeray
Site Admin
Site Admin
Posts: 9552
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Legend width

Post by Yeray » Fri Jul 16, 2010 1:43 pm

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);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply