how to change legend size

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
fno
Posts: 2
Joined: Wed Feb 06, 2008 4:40 pm

how to change legend size

Post by fno » Mon Feb 11, 2008 11:20 am

I would like to change the size of the font in the legend list and also to get bigger color dots so it would be easier to see diffrences of colors.

Any one know how to do this.

/Fredrik

Wetzerk
Posts: 14
Joined: Thu Feb 07, 2008 3:54 pm

Post by Wetzerk » Mon Feb 11, 2008 5:55 pm

Fredrik,
Check out the API for legendTitle.
http://www.jfree.org/jfreechart/api/jav ... Title.html

Depending on how you are making your plot the implementation would change. Say, if you were using one of the factories you would just set legend = false in the constructor, manually build your legend, then use the .addLegend in the JFreeChart object

For example,

Code: Select all

 LegendTitle legend = new LegendTitle('my title');
 legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
 legend.setFrame(new LineBorder());
 legend.setBackgroundPaint(Color.white);
 legend.setPosition(RectangleEdge.BOTTOM);
 // more legend options...
 chart = ChartFactory.createBarChart(null, categoryAxisLabel,
          rangeAxisLabel, dataset, PlotOrientation.HORIZONTAL, false, false, false); 
  chart.addLegend(legend)

Locked