How can I set chart's inner border before text/plot begins?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
alsw-2000
Posts: 16
Joined: Thu May 22, 2003 12:53 pm

How can I set chart's inner border before text/plot begins?

Post by alsw-2000 » Wed May 11, 2005 12:29 pm

Dear all,

I am using JFreeChart 0.9.14.
How can I set 10 pixels padding display on the inner border before text/plot begins?
I have tried the JFreeChart's setBorder function
But it just add a border on the top of the text/plot.

Code: Select all

		chart.setBorderVisible(true);
		chart.setBorderStroke(new BasicStroke(10));
		chart.setBorderPaint(java.awt.Color.green);
I also tried the following code

Code: Select all

//Insets(int top, int left, int bottom, int right)
chart.getPlot().setInsets(new Insets(0, 0, 0, 10));
plot.getRangeAxis().setLabelInsets(new Insets(10, 0, 0, 0));
//Spacer(int type, double left, double top, double right, double bottom)
chart.getTitle().setSpacer(new Spacer(Spacer.ABSOLUTE, 0, 10, 0, 0));
chart.getSubtitle(0).setSpacer(new Spacer(Spacer.ABSOLUTE, 10, 0, 0, 10));
chart.getSubtitle(1).setSpacer(new Spacer(Spacer.ABSOLUTE, 10, 0, 0, 0));
chart.getSubtitle(2).setSpacer(new Spacer(Spacer.ABSOLUTE, 10, 0, 0, 0));
But I can't found any function to set the Legend's margin
and this code is very tedious for future code maintenance.
Is there any better function/method to do it?

Thanks

Locked