How to Control Font(X,Y co-ords),Space between components!

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Kishore

How to Control Font(X,Y co-ords),Space between components!

Post by Kishore » Thu Oct 31, 2002 7:50 am

Hi,
i) How do i control the Font(Size) of X and Y Coordinates.,i have managed to found only font to set for the Title of JKFreeChart.
11) how do to control the Space between the Frame Title to the Titke Of the Chart, Frame Bottom to the Test Data Label., X-axes Co-ordinates to X-axes label.

Thanks,
Kishore.

Dave Gilbert

Re: How to Control Font(X,Y co-ords),Space between component

Post by Dave Gilbert » Thu Oct 31, 2002 10:37 am

Kishore wrote:
> i) How do i control the Font(Size) of X and Y Coordinates.,i
> have managed to found only font to set for the Title of
> JKFreeChart.

Use the setTickLabelFont(...) method in the Axis class:

XYPlot plot = myChart.getXYPlot();
Axis xAxis = plot.getDomainAxis();
Axis yAxis = plot.getRangeAxis();
xAxis.setTickLabelFont(font1);
yAxis.setTickLabelFont(font2);

> 11) how do to control the Space between the Frame Title to
> the Titke Of the Chart, Frame Bottom to the Test Data Label.,
> X-axes Co-ordinates to X-axes label.

You can increase the space around the title using the setSpacer(...) method in the AbstractTitle class:

AbstractTitle title = myChart.getTitle(0);
title.setSpacer(new Spacer(...));

The Legend class has an attribute 'outerGap' that controls the amount of space around the outside of the legend. Unfortunately, this can only be set in the constructor. I'll probably modify this to use a Spacer object, in the same way as AbstractTitle.

The setTickLabelInsets(...) method in the Axis class controls the amount of space around the outside of the tick labels.

Regards,

DG.

Locked