Legend and jfreechart rc1

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mskjeret
Posts: 27
Joined: Sun May 23, 2004 8:58 am

Legend and jfreechart rc1

Post by mskjeret » Mon Aug 29, 2005 11:03 pm

Hi

I must have missed something here, and suspect that this is something I should know.
I upgraded to rc1, and when I try to compile it wont, because of the Legend class.
Earlier I used jfreechart.getLegend() and placed the legend where I wanted it.
Now that method returns a LegendTitle instance, and I cant seem to find a way to place it in the view.

The pdf still say that I should use:
From page 156 section 21.14

Legend legend = myChart.getLegend();
legend.setAnchor(Legend.WEST);

But since the Legend class does not exsist, I can't do that.

Very confused now

Magne

dhchou
Posts: 138
Joined: Tue Jul 05, 2005 11:01 pm

Post by dhchou » Tue Aug 30, 2005 3:00 pm

You can try this:

LegendTitle legendtitle = (LegendTitle) chart.getLegend(0);
legendtitle.setPosition(RectangleEdge.LEFT);

That worked for me and hopefully will work for you too.

Daniel

mskjeret
Posts: 27
Joined: Sun May 23, 2004 8:58 am

Post by mskjeret » Tue Aug 30, 2005 4:14 pm

Ouch.
I read the javadoc many times.
What could be more obvious than setPosition()

Thanks a lot
Magne

Locked