legend.setPosition()

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
magher
Posts: 3
Joined: Thu Feb 20, 2014 11:38 am
antibot: No, of course not.

legend.setPosition()

Post by magher » Wed Dec 06, 2017 8:49 am

Hi,

I upgraded from 1.0.19 to 1.5.0 and legend.setPosition seems to be deprecated. I tried some variations from the API, but I cannot get the hang of it.

Code in jfreechart 1.0.19...

Code: Select all

// Set legends on right side
LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.RIGHT); 
I tried legend.setLegendItemGraphicLocation(RectangleEdge.RIGHT) and legend.setLegendItemGraphicAnchor(RectangleAnchor.RIGHT) but no luck. I cannot understand the usage from the API so I'm a bit lost.

david.gilbert
JFreeChart Project Leader
Posts: 11666
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: legend.setPosition()

Post by david.gilbert » Wed Dec 06, 2017 4:41 pm

The setPosition() method is still there, it is just that the class used for the argument (RectangleEdge) has moved to a new package *within* JFreeChart (so the JCommon dependency could be dropped). So make sure you are not importing the old RectangleEdge class from JCommon.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited

magher
Posts: 3
Joined: Thu Feb 20, 2014 11:38 am
antibot: No, of course not.

Re: legend.setPosition()

Post by magher » Thu Dec 07, 2017 9:14 am

It works :D Thank you.

//Magnus

Post Reply